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

Allow EnumSetSerializer to work with empty EnumSets #91

Closed
ghost opened this issue Nov 11, 2013 · 1 comment
Closed

Allow EnumSetSerializer to work with empty EnumSets #91

ghost opened this issue Nov 11, 2013 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Nov 11, 2013

From [email protected] on September 26, 2012 01:52:57

I was rather surprised by the original error, so I made a minor revision to allow the class of the contained Enum to be determined. As long as the Enum has at least one definition, using the complement of an empty set works.

EnumSet.allOf(Enum) == EnumSet.complementOf(EnumSet.noneOf(Enum))

Unfortunately, I could not get the EnumMap to behave in a similar fashion due to the constructor requiring a class object and EnumSet.copyOf(Collection) doesn't work if the collection is empty :(

I hate Java generics...

Attachment: DefaultSerializers.java.patch

Original issue: http://code.google.com/p/kryo/issues/detail?id=91

@ghost
Copy link
Author

ghost commented Nov 11, 2013

From romixlev on October 02, 2013 13:14:40

Fixed in r414. A dedicated JUnit test was added.

Status: Fixed

@ghost ghost closed this as completed Nov 11, 2013
This issue was closed.
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

0 participants