JDK-4634383 : JDK code doesn't respect contract for equals and hashCode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.2.1,1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2002-02-07
  • Updated: 2003-07-07
  • Resolved: 2003-07-07
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
5.0 tigerFixed
Related Reports
Duplicate :  
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.

java.awt.font.GlyphVector defines
  equals(java.awt.font.GlyphVector) but doesn't redefine
  equals(Object)
java.awt.geom.Area defines
  equals(java.awt.geom.Area) but doesn't redefine
  equals(Object)
java.awt.Font$FontLineMetrics 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: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b10
14-06-2004

EVALUATION Should fix for hopper. ###@###.### 2002-02-06 =============================== java.awt.font.GlyphVector is an abstract class. We can't provide a sensible default implementation, nor can we force equals(Object) and hashCode() to be abstract as that would be an incompatible change. Also the only concrete implementation already does override equals and hashCode() so there's nothing to do here. Area is broken out as 4391558 But java.awt.Font$FontLineMetrics can be fixed to override hashCode(). ###@###.### 2003-06-16 ============================
16-06-2003