FasterXML / jackson-modules-base

Uber-project for foundational modules of Jackson that build directly on core components but nothing else; not including data format or datatype modules
Apache License 2.0
167 stars 77 forks source link

afterburner tests fail for JDK 17 #186

Open pjfanning opened 2 years ago

pjfanning commented 2 years ago

The CI build builds for Java 8 (ok), Java 11 (small group of failures), Java 17 (lots of afterburner fails -- possibly more issues, the build stops after the afterburner fails).

[ERROR] Failures: 
[ERROR]   MyClassLoaderTest.testLoadAndResolveTryParentSameClassTwice:33 first class should be loaded with parent class loader expected:<jdk.internal.loader.ClassLoaders$AppClassLoader@531d72ca> but was:<com.fasterxml.jackson.module.afterburner.util.MyClassLoader@46d59067>
[ERROR]   MyClassLoaderTest.testLoadAndResolveTryParentSameClassTwiceTwoThreads:71 first class should be loaded with parent class loader expected:<jdk.internal.loader.ClassLoaders$AppClassLoader@531d72ca> but was:<com.fasterxml.jackson.module.afterburner.util.MyClassLoader@5276d6ee>
[ERROR] Errors: 
[ERROR]   AfterburnerModuleJDKSerializabilityTest.testMapperWithoutUse:23->_serDeserPointWith:56 » IllegalAccess
[ERROR]   TestAccessFallback.testDeserializeAccess:65 » IllegalAccess failed to access c...
[ERROR]   TestUnwrapped.testUnwrappedDeserialize:51 » IllegalAccess failed to access cla...
[ERROR]   BasicDeserializeTest.testBigNonVoidProperty:300 » IllegalAccess failed to acce...
[ERROR]   BasicDeserializeTest.testBooleans:318 » IllegalAccess failed to access class c...
[ERROR]   BasicDeserializeTest.testEnumField:228 » IllegalAccess failed to access class ...
[ERROR]   BasicDeserializeTest.testFluentMethod:352 » IllegalAccess class com.fasterxml....
[ERROR]   BasicDeserializeTest.testIntMethod:174 » IllegalAccess failed to access class ...
[ERROR]   BasicDeserializeTest.testLongField:214 » IllegalAccess failed to access class ...
[ERROR]   BasicDeserializeTest.testMixed:259 » IllegalAccess failed to access class com....
[ERROR]   BasicDeserializeTest.testMultiIntMethod:179 » IllegalAccess failed to access c...
[ERROR]   BasicDeserializeTest.testNonVoidProperty:285 » IllegalAccess failed to access ...
[ERROR]   BasicDeserializeTest.testProblemWithIndentation:335 » IllegalAccess failed to ...
[ERROR]   BasicDeserializeTest.testStringAsObjectField:234 » IllegalAccess failed to acc...
[ERROR]   BasicDeserializeTest.testStringField:219 » IllegalAccess failed to access clas...
[ERROR]   TestBuilders.testSimpleBuilder:44 » IllegalAccess failed to access class com.f...
[ERROR]   TestCollectionDeser.testIntMethod:34 » IllegalAccess failed to access class co...
[ERROR]   TestCollectionDeser.testUnwrapSingleArray:53 » IllegalAccess failed to access ...
[ERROR]   TestCreators.testNoArgsFactory:296 » IllegalAccess failed to access class com....
[ERROR]   TestCreators2.testSingleStringCreator:329 » IllegalAccess failed to access cla...
[ERROR]   TestFinalFields.testFinalFields:50 » IllegalAccess failed to access class com....
[ERROR]   TestIssue14.testIssue:58 » IllegalAccess failed to access class com.fasterxml....
[ERROR]   TestNonStaticInner.testInnerClass:37 » IllegalAccess failed to access class co...
[ERROR]   TestStdDeserializerOverrides.testFiveMinuteDoc:63 » IllegalAccess failed to ac...
[ERROR]   TestStdDeserializerOverrides.testStringDeserOverideWithAfterburner:112 » IllegalAccess
[ERROR]   CoerceToBooleanTest.testEmptyStringFailForBooleanPrimitive:96 » IllegalAccess ...
[ERROR]   CoerceToBooleanTest.testFailFromInteger:359->_verifyFailFromInteger:425 » IllegalAccess
[ERROR]   CoerceToBooleanTest.testIntToBooleanCoercionFailBytes:257->_verifyBooleanCoerceFail:389 » IllegalAccess
[ERROR]   CoerceToBooleanTest.testIntToBooleanCoercionFailChars:269->_verifyBooleanCoerceFail:391 » IllegalAccess
[ERROR]   CoerceToBooleanTest.testIntToBooleanCoercionSuccessPojo:193 » IllegalAccess fa...
[ERROR]   CoerceToBooleanTest.testIntToEmptyCoercion:322 » IllegalAccess failed to acces...
[ERROR]   CoerceToBooleanTest.testIntToNullCoercion:299 » IllegalAccess failed to access...
[ERROR]   CoerceToBooleanTest.testIntToTryCoercion:345 » IllegalAccess failed to access ...
[ERROR]   TestFailOnPrimitiveFromNullDeserialization.testFailPrimitiveFromNull:51 » IllegalAccess
[ERROR]   TestFailOnPrimitiveFromNullDeserialization.testPassPrimitiveFromNull:38 » IllegalAccess
[ERROR]   IgnorePropertyOnDeser1217Test.testIgnoreOnProperty:33 » IllegalAccess failed t...
[ERROR]   IgnorePropertyOnDeser1217Test.testIgnoreViaConfigOverride:57 » IllegalAccess c...
[ERROR]   NullConversionsForContentTest.testFailOnNullFromDefaults:54 » IllegalAccess fa...
[ERROR]   NullConversionsForContentTest.testFailOnNullWithArrays:117 » IllegalAccess fai...
[ERROR]   NullConversionsForContentTest.testFailOnNullWithCollections:86 » IllegalAccess
[ERROR]   NullConversionsForContentTest.testFailOnNullWithMaps:164 » IllegalAccess faile...
[ERROR]   NullConversionsForContentTest.testFailOnNullWithPrimitiveArrays:138 » IllegalAccess
[ERROR]   NullConversionsForContentTest.testNullsAsEmptyUsingDefaults:215 » IllegalAccess
[ERROR]   NullConversionsForContentTest.testNullsAsEmptyWithArrays:235 » IllegalAccess f...
[ERROR]   NullConversionsForContentTest.testNullsAsEmptyWithCollections:192 » IllegalAccess
[ERROR]   NullConversionsForContentTest.testNullsAsEmptyWithMaps:277 » IllegalAccess fai...
[ERROR]   NullConversionsForContentTest.testNullsAsEmptyWithPrimitiveArrays:248 » IllegalAccess
[ERROR]   NullConversionsForContentTest.testNullsSkipUsingDefaults:307 » IllegalAccess f...
[ERROR]   NullConversionsForContentTest.testNullsSkipWithArrays:366 » IllegalAccess fail...
[ERROR]   NullConversionsForContentTest.testNullsSkipWithCollections:343 » IllegalAccess
[ERROR]   NullConversionsForContentTest.testNullsSkipWithMaps:421 » IllegalAccess failed...
[ERROR]   NullConversionsForContentTest.testNullsSkipWithOverrides:327 » IllegalAccess f...
[ERROR]   NullConversionsForContentTest.testNullsSkipWithPrimitiveArrays:387 » IllegalAccess
[ERROR]   NullConversionsGenericTest.testEmptyStringToNullToEmptyPojo:69 » IllegalAccess
[ERROR]   NullConversionsGenericTest.testNullsToEmptyArrays:102 » IllegalAccess failed t...
[ERROR]   NullConversionsGenericTest.testNullsToEmptyCollection:78 » IllegalAccess faile...
[ERROR]   NullConversionsGenericTest.testNullsToEmptyMap:92 » IllegalAccess failed to ac...
[ERROR]   NullConversionsGenericTest.testNullsToEmptyPojo:47 » IllegalAccess failed to a...
[ERROR]   NullConversionsPojoTest.testFailOnNull:53 » IllegalAccess failed to access cla...
[ERROR]   NullConversionsPojoTest.testFailOnNullWithDefaults:72 » IllegalAccess failed t...
[ERROR]   NullConversionsPojoTest.testNullsToEmptyScalar:88 » IllegalAccess failed to ac...
[ERROR]   NullConversionsSkipTest.testSkipNullField:52 » IllegalAccess failed to access ...
[ERROR]   NullConversionsSkipTest.testSkipNullMethod:66 » IllegalAccess failed to access...
[ERROR]   NullConversionsSkipTest.testSkipNullWithDefaults:86 » IllegalAccess failed to ...
[ERROR]   ProblemHandlerTest.testInstantiationExceptionHandling:329 » IllegalAccess fail...
[ERROR]   ProblemHandlerTest.testInvalidClassAsId:281 » IllegalAccess failed to access c...
[ERROR]   ProblemHandlerTest.testInvalidTypeId:271 » IllegalAccess failed to access clas...
[ERROR]   ProblemHandlerTest.testInvalidTypeIdFail:313 » IllegalAccess failed to access ...
[ERROR]   ProblemHandlerTest.testMissingClassAsId:303 » IllegalAccess failed to access c...
[ERROR]   ProblemHandlerTest.testMissingTypeId:293 » IllegalAccess failed to access clas...
[ERROR]   ProblemHandlerTest.testWeirdKeyHandling:241 » IllegalAccess failed to access c...
[ERROR]   RecursiveIgnorePropertiesTest.testRecursiveForDeser:29 » IllegalAccess failed ...
[ERROR]   TestUnknownPropertyDeserialization.testClassWithIgnoreUnknown:228 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testClassWithUnknownAndIgnore:240 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testIssue987:285 » IllegalAccess failed to ...
[ERROR]   TestUnknownPropertyDeserialization.testPropertyIgnoral:253 » IllegalAccess fai...
[ERROR]   TestUnknownPropertyDeserialization.testPropertyIgnoralForMap:267 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testPropertyIgnoralWithClass:260 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testUnknownHandlingDefault:138 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testUnknownHandlingIgnoreWithFeature:185 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testUnknownHandlingIgnoreWithHandler:153 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testUnknownHandlingIgnoreWithHandlerAndObjectReader:168 » IllegalAccess
[ERROR]   TestUnknownPropertyDeserialization.testWithClassIgnore:197 » IllegalAccess fai...
[ERROR]   TestInjectables.testSimple:106 » IllegalAccess failed to access class com.fast...
[ERROR]   TestInjectables.testTransientField:140 » IllegalAccess failed to access class ...
[ERROR]   DefaultMethodsTest.testDeserializeViaDefault:62 » IllegalAccess failed to acce...
[ERROR]   JDKScalarsDeserTest.testBooleanPrimitive:144 » IllegalAccess failed to access ...
[ERROR]   JDKScalarsDeserTest.testCharacterWrapper:218 » IllegalAccess failed to access ...
[ERROR]   JDKScalarsDeserTest.testDoublePrimitive:317 » IllegalAccess failed to access c...
[ERROR]   JDKScalarsDeserTest.testEmptyStringForBooleanPrimitive:473 » IllegalAccess fai...
[ERROR]   JDKScalarsDeserTest.testEmptyStringForFloatPrimitives:493 » IllegalAccess fail...
[ERROR]   JDKScalarsDeserTest.testEmptyStringForFloatWrappers:465 » IllegalAccess failed...
[ERROR]   JDKScalarsDeserTest.testEmptyStringForIntegerPrimitives:479 » IllegalAccess fa...
[ERROR]   JDKScalarsDeserTest.testEmptyStringForIntegerWrappers:448 » IllegalAccess fail...
[ERROR]   JDKScalarsDeserTest.testIntPrimitive:253 » IllegalAccess failed to access clas...
[ERROR]   JDKScalarsDeserTest.testIntWithOverride:302 » IllegalAccess failed to access c...
[ERROR]   JDKScalarsDeserTest.testLongPrimitive:283 » IllegalAccess failed to access cla...
[ERROR]   JDKScalarsDeserTest.testNullForPrimitivesDefault:508 » IllegalAccess failed to...
[ERROR]   JDKScalarsDeserTest.testNullForPrimitivesNotAllowedFP:569 » IllegalAccess fail...
[ERROR]   JDKScalarsDeserTest.testNullForPrimitivesNotAllowedInts:531 » IllegalAccess fa...
[ERROR]   JDKScalarsDeserTest.testNullForPrimitivesNotAllowedMisc:591 » IllegalAccess fa...
[ERROR]   JDKScalarsDeserTest.testVoidDeser:678 » IllegalAccess failed to access class c...
[ERROR]   CollectionMergeTest.testCollectionMerging:62 » IllegalAccess failed to access ...
[ERROR]   CollectionMergeTest.testEnumSetMerging:96 » IllegalAccess failed to access cla...
[ERROR]   CollectionMergeTest.testListMerging:70 » IllegalAccess failed to access class ...
[ERROR]   MapMergeTest.testMapMerging:36 » IllegalAccess failed to access class com.fast...
[ERROR]   NodeMergeTest.testArrayNodeMerge:104 » IllegalAccess failed to access class co...
[ERROR]   NodeMergeTest.testObjectNodeMerge:55 » IllegalAccess failed to access class co...
[ERROR]   PropertyMergeTest.testBeanMergingViaGlobal:132 » IllegalAccess failed to acces...
[ERROR]   PropertyMergeTest.testBeanMergingViaProp:102 » IllegalAccess failed to access ...
[ERROR]   PropertyMergeTest.testBeanMergingViaType:115 » IllegalAccess failed to access ...
[ERROR]   PropertyMergeTest.testBeanMergingWithoutSetter:149 » IllegalAccess failed to a...
[ERROR]   PropertyMergeTest.testReferenceMerging:205 » IllegalAccess failed to access cl...
[ERROR]   ColletionFormatShapeTest.testListAsObjectRoundtrip:56 » IllegalAccess failed t...
[ERROR]   MapFormatShapeTest.testDeserializeAsPOJOViaClass:201 » IllegalAccess failed to...
[ERROR]   MapFormatShapeTest.testRoundTrip:193 » IllegalAccess failed to access class co...
[ERROR]   JSOGDeserialize622Test.testAlterativePolymorphicRoundTrip669:228 » IllegalAccess
[ERROR]   JSOGDeserialize622Test.testPolymorphicRoundTrip:212 » IllegalAccess class com....
[ERROR]   JSOGDeserialize622Test.testStructJSOGRef:195 » IllegalAccess class com.fasterx...
[ERROR]   AbstractSettersTest.testSimpleConstructor:54 » IllegalAccess failed to access ...
[ERROR]   BiggerDataTest.testReading:85 » IllegalAccess failed to access class com.faste...
[ERROR]   BiggerDataTest.testRoundTrip:114 » IllegalAccess failed to access class com.fa...
[ERROR]   POJOAsArrayTest.testReadSimplePropertyValue:107 » IllegalAccess failed to acce...
[ERROR]   POJOAsArrayTest.testReadSimpleRootValue:121 » IllegalAccess failed to access c...
[ERROR]   MyClassLoaderTest.testLoadAndResolvePrivateSuperclassTryParentSameClassTwice:52 » IllegalArgument
[ERROR]   MyClassLoaderTest.testLoadAndResolvePrivateSuperclassTryParentSameClassTwiceTwoThreads:83->loadSameClassOnTwoThreads:198 Runtime
[INFO] 
[ERROR] Tests run: 344, Failures: 2, Errors: 126, Skipped: 0
pjfanning commented 2 years ago

One full test stack trace:

java.lang.IllegalAccessError: failed to access class com.fasterxml.jackson.module.afterburner.deser.BasicDeserializeTest$BigBeanWithNonVoidPropertySetter from class com.fasterxml.jackson.module.afterburner.deser.BasicDeserializeTest$BigBeanWithNonVoidPropertySetter$Creator4JacksonDeserializer1ede742a (com.fasterxml.jackson.module.afterburner.deser.BasicDeserializeTest$BigBeanWithNonVoidPropertySetter is in unnamed module of loader 'app'; com.fasterxml.jackson.module.afterburner.deser.BasicDeserializeTest$BigBeanWithNonVoidPropertySetter$Creator4JacksonDeserializer1ede742a is in unnamed module of loader com.fasterxml.jackson.module.afterburner.util.MyClassLoader @55040f2f)

    at com.fasterxml.jackson.module.afterburner.deser.BasicDeserializeTest$BigBeanWithNonVoidPropertySetter$Creator4JacksonDeserializer1ede742a.createUsingDefault(com/fasterxml/jackson/module/afterburner/deser/BasicDeserializeTest$BigBeanWithNonVoidPropertySetter$Creator4JacksonDeserializer.java)
    at com.fasterxml.jackson.module.afterburner.deser.SuperSonicBeanDeserializer.deserialize(SuperSonicBeanDeserializer.java:136)
    at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4697)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3652)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3620)
    at com.fasterxml.jackson.module.afterburner.deser.BasicDeserializeTest.testBigNonVoidProperty(BasicDeserializeTest.java:300)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at junit.framework.TestCase.runTest(TestCase.java:177)
    at junit.framework.TestCase.runBare(TestCase.java:142)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:130)
    at junit.framework.TestSuite.runTest(TestSuite.java:241)
    at junit.framework.TestSuite.run(TestSuite.java:236)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

Looks like Java 17 doesn't let inner classes access the non-public state of other inner classes. For instance, this test passes if I make BigBeanWithNonVoidPropertySetter class public instead of package private.

cowtowncoder commented 2 years ago

Yes, I can see the failure on 2.14 branch. Not sure what could be done here; I guess an obvious thing would be to avoid generating accessor methods on JDK 17+ for cases determined inaccessible and revert to using default introspection-based (de)serializer access. I forget if there was a way to mix these -- it is possible it is all-or-nothing (that is, either access to all properties is generated or none).

Looks like Blackbird works better, although there is 1 test failure for it too. But probably easier to resolve.

cowtowncoder commented 2 years ago

Quick note: JDK 11 tests now pass for CI, leaving the big group of issues for JDK 17.