CWE-581: Object Model Violation: Just One of Equals and Hashcode Defined

VariantDraft

The product does not maintain equal hashcodes for equal objects.

View on MITRE
Back to CWE Lookup

Extended Description

Java objects are expected to obey a number of invariants related to equality. One of these invariants is that equal objects must have equal hashcodes. In other words, if a.equals(b) == true then a.hashCode() == b.hashCode().

Technical Details

Structure
Simple

Applicable To

Languages
Java
Platforms

Learn More

CWE-581: Object Model Violation: Just One of Equals and Hashcode Defined | CWE Lookup | Inventive HQ