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

Package private and private records cannot be deserialized #849

Closed
theigl opened this issue Jul 30, 2021 · 0 comments
Closed

Package private and private records cannot be deserialized #849

theigl opened this issue Jul 30, 2021 · 0 comments
Assignees
Labels

Comments

@theigl
Copy link
Collaborator

theigl commented Jul 30, 2021

Describe the bug
While testing #847 I noticed that package private records cannot be deserialized.

To Reproduce

    static record PackagePrivateRecord(int i, String s) {}
    
    @Test
    void testNonPublicRecords() {
        kryo.register(PackagePrivateRecord.class);

        roundTrip(4, new PackagePrivateRecord(1, "s1"));
    }

This fails with:

Caused by: java.lang.NoSuchMethodException: com.esotericsoftware.kryo.serializers.RecordSerializerTest$PackagePrivateRecord.<init>(int,java.lang.String)
	at java.base/java.lang.Class.getConstructor0(Class.java:3517)
	at java.base/java.lang.Class.getConstructor(Class.java:2238)
	at com.esotericsoftware.kryo.serializers.RecordSerializer.invokeCanonicalConstructor(RecordSerializer.java:224)
	... 70 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant