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

Support running on Java 17 #692

Open
nielsbasjes opened this issue Aug 22, 2022 · 1 comment
Open

Support running on Java 17 #692

nielsbasjes opened this issue Aug 22, 2022 · 1 comment

Comments

@nielsbasjes
Copy link

Describe the bug
When I try to run an application that uses this library on Java 17 I get exceptions over the fact that in a lot of places this library uses .setAccessible(true);

You'll see exceptions like:

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private long[] java.util.BitSet.words accessible: module java.base does not "opens java.util" to unnamed module @3c679bde

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Object[] java.util.Arrays$ArrayList.a accessible: module java.base does not "opens java.util" to unnamed module @3c679bde

To Reproduce
In Java just do one of these:
new ArraysAsListSerializer();
or
new BitSetSerializer();
or
new PriorityQueueSerializer();
or
... one of the many other classes that call .setAccessible(...) ...

Expected behavior
No errors and exceptions.

Environment
Java 17

Additional context
I ran into this when trying to make Apache Flink run on Java 17.

@regadas
Copy link
Collaborator

regadas commented Sep 7, 2022

Hi @nielsbasjes, this caught my attention, and it's possible to run chill with Java 17 by adding some extra JVM flags.

The following are enough to run our tests but more might be required depending on your use case.

        Seq(
           "--add-opens",
           "java.base/java.util=ALL-UNNAMED",
           "--add-opens",
           "java.base/java.lang.invoke=ALL-UNNAMED"
         )

You can see the usage of these flags in #694

The need for these is also being tracked in kryo EsotericSoftware/kryo#885

Hope this helps.

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

2 participants