-
Notifications
You must be signed in to change notification settings - Fork 828
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 for JDK17 #885
Comments
Your specific case can be solved by using a custom RegexSerializer that doesn't rely on reflection. Alternatively, you can add JVM arguments for opening up the modules in question. See this comment. I think it makes sense to include the |
I cannot reproduce your first issue. I just downloaded and ran my tests on Corretto to make sure it isn't a JVM specific problem. |
Thank you for the quick response. I did set a breakpoint at This is caused by the The Now I'm wondering if this is expected behaviour or a failure with java 17. |
I tried the
It seems to work. FYI: UnmodifiableCollectionsSerializer from kryo-serializers also lacks compatibility. There is already an open issue, which I just updated: |
This is expected behavior and has no effect unless you want to use UnsafeByteBuffers for Input/Output. If you want to use those, you have to open the module up for reflection.
AFAIK it is impossible to write a non-reflective version of a serializer for |
Kryo is currently missing built-in, safe serializers for the following JDK classes:
These serializers are trivial to implement, but cannot be registered in Kryo 5 as default serializers because it would break backwards compatibility. I will add them to |
I'm trying to upgrade from Java 11 to 17 running Kryo 5 with Unsafe I/O, but am getting a weird
I also tested moving away from |
@jdorleans: On JDK 17, you currently need to open up
Otherwise initialization of |
I guess I'm just doing something wrong, but I'm also currently trying the latest final var kryo = new Kryo();
kryo.register(ClassWithList.class);
ClassWithList copy = kryo.copy(classWithList); I get this error messsage: com.esotericsoftware.kryo.KryoException: java.lang.IllegalArgumentException: Class is not registered: java.util.ImmutableCollections$List12
Note: To register this class use: kryo.register(java.util.ImmutableCollections.List12.class); Registering this class doesn't work, since |
@graves501: You can either set kryo.register(List.of(1).getClass());
kryo.register(List.of(1,2,3).getClass()); kryo.register(Class.forName("java.util.ImmutableCollections$List12"));
kryo.register(Class.forName("java.util.ImmutableCollections$ListN")); |
Thanks, that did the job! |
Quick update:
It would be great if anyone could confirm the second change using the current snapshots. |
version: kryo 5.4.0 reproduce code
We need to serialize |
@leonchen83: I would not consider serializing exceptions a typical use-case for Kryo, so I'm against adding exception serializers to Kryo itself. You have two options:
I'd go for the second option. Exceptions should occur very rarely, so speed of serialization and payload size usually doesn't matter that much. Redisson for instance is using this approach. |
Hi @theigl, Version 5.5.0 Here is the code used to reproduce the exception public static void main(String[] args) {
Kryo kryo = new Kryo();
kryo.register(ClosureSerializer.Closure.class, new ClosureSerializer());
} here is the exception
I've already try to set this argument to the JVM
but it solves nothing |
@amodolo: I am using
Maybe the additional |
Oh i see what's going wrong. |
Hi, when will Kryo 6 release? Thanks. |
@endlesstian: You can already register all these serializers yourself. They are available for manual registration since Kryo 5.4.0. As for Kryo 6, I currently do not have a release date. I will have more spare time in December and I'll see if I can create a release candidate by the end of the year. |
Can we expect, that the rkyo library will support modular system ? |
@vyalyh-oleg: Kryo currently only adds an automatic module name. So far, there is no module definition. What is required for add-opens to be restricted to Kryo? |
Describe the bug
It seems that Kryo is currently not compatible with JDK17. When calling the default constructor it fails with:
To Reproduce
Kryo kryo = new Kryo();
Environment:
Additional context
In my case I am also registering some standard classes.
It seems to work for classes like:
But it fails for
java.util.regex.Pattern
due to:What would be the proper way to fix this?
The text was updated successfully, but these errors were encountered: