chill
chill copied to clipboard
Support running on Java 17
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.
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 https://github.com/twitter/chill/pull/694
The need for these is also being tracked in kryo https://github.com/EsotericSoftware/kryo/issues/885
Hope this helps.