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

Enums with one value will produce wrong verify result #74

Closed
GoogleCodeExporter opened this issue Mar 29, 2015 · 3 comments
Closed

Enums with one value will produce wrong verify result #74

GoogleCodeExporter opened this issue Mar 29, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create any class with a field of an enum with one element.
2. Run EqualsVerifier on this class:

AssertionError: "java.lang.AssertionError: Enum DeleteReason only has 1 
element(s).", thrown at PrefabValues.putEnumInstances

But: a enum field may be null or be the one enum value. Imo this is unusual but 
no reason to fail equals-validation.

Original issue reported on code.google.com by [email protected] on 6 Feb 2013 at 3:34

@GoogleCodeExporter
Copy link
Author

You're right, EqualsVerifier fails on classes with a single-element enum field, 
even if this field isn't used anywhere in the equals or hashCode methods. Since 
single-element enums are the recommended way to create singletons, this isn't 
even that unusual a scenario.

I'll try to think of something for the next release. Thanks for reporting this!

Original comment by [email protected] on 9 Feb 2013 at 2:19

  • Changed state: Accepted
  • Added labels: Milestone-Next-Minor
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

I've fixed this in version 1.2!

Original comment by [email protected] on 26 Mar 2013 at 6:56

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Hurray, thanks alot!

Original comment by [email protected] on 26 Mar 2013 at 10:28

  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant