Open lvitaly opened 3 years ago
Sorry that I opened an issue without comment. @jvdvegt, I guess you are right, but I discovered that kryo added this serializer to the default list in v5.0.0 (see Kryo.java#L225).
I discovered few more serializers that throw errors with JDK 17
Unfortunately, I didn't dig deep enough to find out the root cause, and here is an original thread with these issues in cqengine project (see https://github.com/npgall/cqengine/issues/269). You can find there that almost all cqengine's tests except one (ReflectiveAttributeTest) are passing with JDK17 + kryo v5.2.0 without serializers mentioned above.
The first one seems quite easy to fix, though it is slightly slower than the original version. See attached sourcecode. UnmodifiableCollectionsSerializer.java.txt
Stumbled across the issue with the UnmodifiableCollectionsSerializer
when I was trying JDK 17 with kryo + kryo-serializers.
The stacktrace is:
checkCanSetAccessible:354, AccessibleObject (java.lang.reflect)
checkCanSetAccessible:297, AccessibleObject (java.lang.reflect)
checkCanSetAccessible:178, Field (java.lang.reflect)
setAccessible:172, Field (java.lang.reflect)
<clinit>:55, UnmodifiableCollectionsSerializer (de.javakaffee.kryoserializers)
The error message is:
Unable to make field final java.util.Collection java.util.Collections$UnmodifiableCollection.c accessible: module java.base does not "opens java.util" to unnamed module @61322f9d
Any updates on ArraysAsListSerializer compatibility with JDK 17?
@tinder-johnbuhanan: Can't you simply use the built-in ArraysAsListSerializer from Kryo 5? If you are on Kryo 5, you don't need any custom serializers. If you are on Kryo 4, you can copy the ArraysAsListSerializer
from Kryo 5.
I suppose what @lvitaly means is: ArraysAsListSerializer is currently not compatible with Java 17, as a java.lang.reflect.InaccessibleObjectException is thrown when the class is created. This is no longer allowed:
Are there any plans to fix this?