-
Notifications
You must be signed in to change notification settings - Fork 83
Description
I'm using jackson-module-afterburner 2.15.3. with Java 17.
The following test case shows the issue:
afterburner-test.tgz
The test output is copied below.
While this looks similar to #30, I think that the fix to that older issue was perhaps not general enough. The test case mentioned in the old issue is successful but the test case I attached fails.
I compared the generated bytecode for Cat$Access4JacksonDeserializerXXX from the runtime vs. the same code manually written. I think that the issue may be that the generated bytecode is using invokeinterface:
20: invokeinterface #20, 2 // InterfaceMethod test/Cat.setInfo:(Ljava/lang/String;)V
While the bytecode for the manually written code is using invokevirtual:
22: invokevirtual #22 // Method model/Cat.setInfo:(Ljava/lang/String;)V
Test output
Running test.CatTest
{"name":"Molly","info":""}
{"name":"Molly","info":""}
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.292 sec <<< FAILURE!
test.CatTest.testWithAfterBurner() Time elapsed: 0.051 sec <<< FAILURE!
java.lang.IncompatibleClassChangeError: Found class model.Cat, but interface was expected
at model.Cat$Access4JacksonDeserializerdf4cb562.stringSetter(model/Cat$Access4JacksonDeserializer.java)
at com.fasterxml.jackson.module.afterburner.deser.SettableStringMethodProperty.deserializeAndSet(SettableStringMethodProperty.java:46)
at com.fasterxml.jackson.module.afterburner.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:159)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3740)
at test.CatTest.test(CatTest.java:38)
at test.CatTest.testWithAfterBurner(CatTest.java:28)
Results :
Failed tests: test.CatTest.testWithAfterBurner(): Found class model.Cat, but interface was expected
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0