...
Violating the general contract when overriding the equals() method can lead to unexpected results.
Rule | Severity | Likelihood | Detectable | RepairableRemediation Cost | Priority | Level |
|---|---|---|---|---|---|---|
MET08-J | Low | Unlikely | No | NoMedium | P2P1 | L3 |
Automated Detection
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| CodeSonar |
| JAVA.COMPARE.CTO.ASSYM | Asymmetric compareTo (Java) | ||||||
| Parasoft Jtest |
| CERT.MET08.EQREFL | Make sure implementation of Object.equals(Object) is reflexive | ||||||
| SonarQube |
| S2162 | "equals" methods should be symmetric and work for subclasses |
...