Giter VIP home page Giter VIP logo

Comments (6)

jvdvegt avatar jvdvegt commented on September 17, 2024

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:

public ArraysAsListSerializer() {
        _arrayField = Class.forName( "java.util.Arrays$ArrayList" ).getDeclaredField( "a" );
        _arrayField.setAccessible( true );
}

Are there any plans to fix this?

from kryo-serializers.

lvitaly avatar lvitaly commented on September 17, 2024

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

  • UnmodifiableCollectionsSerializer
  • SynchronizedCollectionsSerializer

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 npgall/cqengine#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.

from kryo-serializers.

jvdvegt avatar jvdvegt commented on September 17, 2024

The first one seems quite easy to fix, though it is slightly slower than the original version. See attached sourcecode.
UnmodifiableCollectionsSerializer.java.txt

from kryo-serializers.

dkroehan avatar dkroehan commented on September 17, 2024

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

from kryo-serializers.

tinder-johnbuhanan avatar tinder-johnbuhanan commented on September 17, 2024

Any updates on ArraysAsListSerializer compatibility with JDK 17?

from kryo-serializers.

theigl avatar theigl commented on September 17, 2024

@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.

from kryo-serializers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.