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

False positive "class should override both the equals and hashCode methods" for Enum values #295

Closed
ewirch opened this issue Feb 3, 2021 · 2 comments
Labels
Milestone

Comments

@ewirch
Copy link

ewirch commented Feb 3, 2021

#138 introduced a warning which looks like

The class MyEnum class should override both the equals and hashCode methods based on the JSON object value it represents!

I cannot override hashCode() and equals() for enums, they are final.

@vladmihalcea
Copy link
Owner

@ewirch At this line, try replacing the getDeclaredMethodOrNull check with a hasMethod call and see if it works.

Looking forward to getting your feedback.

@vladmihalcea vladmihalcea added this to the 2.10.3 milestone Feb 3, 2021
@vladmihalcea vladmihalcea changed the title False positive "class should override both the equals and hashCode methods" for enum values False positive "class should override both the equals and hashCode methods" for Enum values Feb 25, 2021
vladmihalcea added a commit that referenced this issue Feb 25, 2021
@vladmihalcea
Copy link
Owner

Fixed.

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

No branches or pull requests

2 participants