-
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
Record serialization uses incorrect types #847
Comments
@purpledrazi: Thanks for this bug report! This is quite an obvious bug. It seems nobody has tried serializing non-trivial records so far. I'll look into this as soon as I can and hope I can fix it without breaking serialization compatibility. |
@purpledrazi: I have created a PR for this issue. Unfortunately, it is not possible to solve this in a fully backwards-compatible way. But since this bug makes the record serializer basically unusable in real world applications, I decided to break compatibility and allow existing users to opt-in to the old behavior. The fix will be part of Kryo 5.2.0, which I plan to release in the near future. |
Describe the bug
Record fields are serialized with the wrong type. It appears that Kryo is using the declared type of the field rather than the actual type of the object assigned to the field.
To Reproduce
The code below fails with the error "Class is not registered: java.lang.Number".
Registering java.lang.Number allows the serialization to succeed, but then deserialization fails because it attempts to create an instance of Number.
Environment:
The text was updated successfully, but these errors were encountered: