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

The DataClass rule should also disallow overriding equals or hashcode. #16

Open
Whathecode opened this issue Feb 15, 2021 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@Whathecode
Copy link
Member

The main reason to enable the DataClass rule is to have predictable equals and hashcode implementations for classes extending from a base class, i.e., value comparisons instead of reference equality.

However, even when the rule passes, extending implementations may still override equals and hashcode therefore potentially violating the intended/expected behavior.

Therefore, it would make sense for this rule to also inhibit overriding these methods. We could also consider giving the rule a better name to clarify its intent.

@Whathecode Whathecode added the enhancement New feature or request label Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant