Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with JDK 17 #131

Open
lvitaly opened this issue Sep 28, 2021 · 6 comments
Open

Compatibility with JDK 17 #131

lvitaly opened this issue Sep 28, 2021 · 6 comments

Comments

@lvitaly
Copy link

lvitaly commented Sep 28, 2021

No description provided.

@jvdvegt
Copy link

jvdvegt commented Oct 4, 2021

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?

@lvitaly
Copy link
Author

lvitaly commented Oct 4, 2021

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.

@jvdvegt
Copy link

jvdvegt commented Oct 8, 2021

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

@dkroehan
Copy link

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

@tinder-johnbuhanan
Copy link

tinder-johnbuhanan commented Apr 28, 2023

Any updates on ArraysAsListSerializer compatibility with JDK 17?

@theigl
Copy link
Collaborator

theigl commented Apr 29, 2023

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

gengjun-git added a commit to StarRocks/starrocks that referenced this issue Dec 25, 2024
1. Copy UnmodifiableCollectionsSerializer.java to our repository to fix compilable issue:
`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 `
  Refer to magro/kryo-serializers#131
2. Upgrade jacoco to 0.8.8
3. For the arrow flight server, users should add `--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED` to JAVA_OPTS 
  Refer to https://arrow.apache.org/docs/java/install.html
4. Fix some UT

Signed-off-by: gengjun-git <gengjun@starrocks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants