Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: REM cost reform

...

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

ToolVersionCheckerDescription
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

JAVA.COMPARE.CTO.ASSYM
JAVA.IDEF.NOEQUALS
JAVA.IDEF.CTONOEQ
JAVA.IDEF.CTOEQ

Asymmetric compareTo (Java)
Missing Equals Override (Java)
compareTo without equals (Java)
compareTo/equals mismatch (Java)

Parasoft Jtest

Include Page
Parasoft_V
Parasoft_V

CERT.MET08.EQREFLMake sure implementation of Object.equals(Object) is reflexive
SonarQube
Include Page
SonarQube_V
SonarQube_V
S2162"equals" methods should be symmetric and work for subclasses

...