Object Model Violation: Just One of Equals and Hashcode Defined |
Weakness ID: 581 (Weakness Base) | Status: Draft |
Description Summary
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().
Scope | Effect |
---|---|
Integrity | Failure to uphold this invariant is likely to cause trouble if objects of this class are stored in a collection. If the objects of the class in question are used as a key in a Hashtable or if they are inserted into a Map or Set, it is critical that equal objects have equal hashcodes. |
Nature | Type | ID | Name | View(s) this relationship pertains to![]() |
---|---|---|---|---|
ChildOf | ![]() | 573 | Failure to Follow Specification | Development Concepts (primary)699 Research Concepts (primary)1000 |
Modifications | ||||
---|---|---|---|---|
Modification Date | Modifier | Organization | Source | |
2008-07-01 | Eric Dalci | Cigital | External | |
updated Potential Mitigations, Time of Introduction | ||||
2008-09-08 | CWE Content Team | MITRE | Internal | |
updated Common Consequences, Relationships, Other Notes | ||||
2009-10-29 | CWE Content Team | MITRE | Internal | |
updated Common Consequences, Description, Other Notes | ||||
Previous Entry Names | ||||
Change Date | Previous Entry Name | |||
2008-01-30 | Object Model Violation: Just One of Equals and Haschode Defined | |||
Security-Database help your corporation foresee and avoid any security risks that may impact your IT infrastructure and business applications.