This repository was archived by the owner on Nov 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
IllegalStateException: Afterburner internal error: BeanDeserializer for [simple type, class Envelope] has no properties that match expected ordering -- can not create optimized deserializer #43
Copy link
Copy link
Closed
Milestone
Description
Hi,
Encountering the following problem with:
jackson-module-afterburner:jar:2.3.2
And the following code:
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
import org.junit.Test;
import java.io.IOException;
class Envelope {
@JsonTypeInfo(use= JsonTypeInfo.Id.CLASS, include= JsonTypeInfo.As.EXTERNAL_PROPERTY, property="class")
private Object payload;
public Envelope(@JsonProperty("payload") Object payload) {
this.payload = payload;
}
@JsonProperty
public Object getPayload() {
return payload;
}
}
class Payload {
private String something;
public Payload(@JsonProperty("something") String something) {
this.something = something;
}
@JsonProperty
public Object getSomething() {
return something;
}
}
public class AfterBurnerTest {
@Test
public void testAfterburner() throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new AfterburnerModule());
Envelope envelope = new Envelope(new Payload("test"));
String json = mapper.writeValueAsString(envelope);
System.err.println(json);
Envelope envelope1 = mapper.readValue(json, Envelope.class);
System.err.println(mapper.writeValueAsString(envelope1));
}
}
Results in:
{"payload":{"something":"test"},"class":"Payload"}
java.lang.IllegalStateException: Afterburner internal error: BeanDeserializer for [simple type, class Envelope] has no properties that match expected ordering -- can not create optimized deserializer
at com.fasterxml.jackson.module.afterburner.deser.SuperSonicBeanDeserializer.resolve(SuperSonicBeanDeserializer.java:97)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:292)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:241)
at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:381)
at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:3154)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3047)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2146)
at AfterBurnerTest.testAfterburner(AfterBurnerTest.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
...
Only happens with Afterburner, and seems to be due to Envelope only having one property, as adding another property to Envelope seems to fix it.
Metadata
Metadata
Assignees
Labels
No labels