JDK-4634394 : JDK code doesn't respect contract for equals and hashCode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2002-02-07
  • Updated: 2002-03-09
  • Resolved: 2002-03-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.1 hopperFixed
Related Reports
Relates :  
Description
The following problem was originally reported in 4634068.

There are a number of classes that do not respect the
implied contract for equals and hashCode. See, for example,
Joshua Bloch's book "Effective Java", items 7-8.

javax.swing.text.SimpleAttributeSet$EmptyAttributeSet redefines
  equals(Object) but not
  hashCode()

Problems found by applying automatic tools to JDK
libraries. However, manual inspectation of the classes
reveals the same problems.

-- iag@sfbay 2002-02-06

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic hopper FIXED IN: hopper INTEGRATED IN: hopper
14-06-2004

EVALUATION Closing the bug as fixed ###@###.### 2002-02-20 ------------------------------------------- This bug is rather precaution than a real problem. The test case is creating two equal javax.swing.text.SimpleAttributeSet$EmptyAttributeSet object.equals(..) returns true, but they have different hashCodes ###@###.### 2002-03-06
06-03-2002

SUGGESTED FIX In the attached webrev ###@###.### 2002-02-20
20-02-2002