CWE-581—Object Model Violation: Just One of Equals and Hashcode Defined
PUBLISHEDweakness record
released 2006-12-15 · last modified 2025-12-11
Metadata
名称
Object Model Violation: Just One of Equals and Hashcode Defined
描述
The product does not maintain equal hashcodes for equal objects.
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().