-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update to Java 17 and Kryo 5 #3994
Conversation
* | ||
* @author <a href="mailto:[email protected]">Martin Grotzke</a> | ||
*/ | ||
public class UnmodifiableCollectionsSerializer extends Serializer<Object> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be remove once we move to Kryo 5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be removed when issue magro/kryo-serializers#131 is fixed. The PR contains an update to Kryo 5
src/main/java/org/opentripplanner/graph_builder/module/geometry/GeometryAndBlockProcessor.java
Show resolved
Hide resolved
This looks great. I only had one question, se above. |
@@ -52,44 +48,28 @@ public static Kryo create() { | |||
kryo.register(TIntIntHashMap.class, new TIntIntHashMapSerializer()); | |||
|
|||
// Add support for the package local java.util.ImmutableCollections. | |||
// Not supported in the current com.conveyal:kryo-tools:1.3.0. | |||
// Not supported properly in the current com.conveyal:kryo-tools:1.4.0. | |||
// This provide support for List.of, Set.of, Map.of and Collectors.toUnmodifiable(Set|List|Map) | |||
kryo.register(List.of().getClass(), new JavaImmutableListSerializer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't Kryo 5 have built-in support for List.of()? https://github.com/EsotericSoftware/kryo/blob/master/src/com/esotericsoftware/kryo/serializers/ImmutableCollectionsSerializers.java
Or are they broken in the same was as the map one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they will return a wrong type when serializing an empty Set/List/Map, thus failing the tests which compare the loaded graph. I'll create an issue in kryo about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for the explanation. Can you cc me when you create the ticket?
Is this intended to be merged into dev-2.x before or after the release? I ask because there's already a 2.1-rc branch and this PR seems like a major change to introduce immediately before a release. Actually I may be misinterpreting the branching strategy because it's different than what we've used in the past. It looks like development is continuing on dev-2.x and changes intended for the release are being cherry-picked over to 2.1-rc. |
This is intended for 2.2, so after the release has been cut |
@abyrd I already updated the version number in |
Hi @hannesj. I'm the maintainer of Kryo and just stumbled across this issue. Are you sure that the immutable collections serializers really return the wrong type at times? I just wrote a a test-case that asserts on the result type of the collection and it passes for all sizes. |
Hi @theigl, Hannes isn't contributing a lot anymore. However, I can try removing our custom serializers and run the test suite again. Maybe these things have been fixed in the meantime. Thanks for chiming in! |
@leonardehrenfried: Thanks, that would be great. I'd really like to know if there is some hidden bug in those serializers that I'm currently not aware of. |
So I just tried it by removing our custom serializers and using the built-in Kyro ones: leonardehrenfried@591a54d (Is this setup correct?) Unfortunately, after this change our test reports that we expect at
Something is amiss here. It could very well be that our setup is wrong. |
I wrote some more tests and I can confirm that with plain Kryo the type is correctly deserialized to Can you spot an error in our |
Everything looks alright in your builder. I'll try to get to the bottom of this next week. Your branch should be enough for me to write a reproducer. Thanks! |
Great. If you want to run the test yourself it's called GraphSerializationTest. |
Summary
Update to Java 17. I needed to update a couple of libraries, in order not to have compering files of some of the dependencies.
Changelog
The changelog file
is generated from the pull-request title, make sure the title describe the feature or issue fixed.
To exclude the PR from the changelog add
[changelog skip]
in the title.