The DataClass
rule should also disallow overriding equals
or hashcode
.
#16
Labels
enhancement
New feature or request
The main reason to enable the
DataClass
rule is to have predictableequals
andhashcode
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
andhashcode
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.
The text was updated successfully, but these errors were encountered: