JDK-4634390 : JDK code doesn't respect contract for equals and hashCode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 1.4.0,1.4.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 2002-02-07
  • Updated: 2003-04-02
  • Resolved: 2003-04-02
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 :  
Duplicate :  
Relates :  
Relates :  
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.beans.IndexedPropertyDescriptor redefines
  equals(Object) but not
  hashCode()
java.beans.PropertyDescriptor 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 tiger-beta FIXED IN: tiger INTEGRATED IN: tiger tiger-b04
14-06-2004

EVALUATION Will fix for tiger PropertyDescriptor: public int hashCode() { return (((propertyType == null) ? 0 : propertyType.hashCode()) ^ ((readMethod == null) ? 1 : readMethod.hashCode()) ^ ((writeMethod == null) ? 2 : writeMethod.hashCode()) ^ ((propertyEditorClass == null) ? 3 : propertyEditorClass.hashCode()) ^ ((bound == false) ? 0 : 1) ^ ((constrained == false) ? 0 : 2) ); } IndexedPropertyDescriptor: public int hashCode() { return (super.hashCode() ^ ((indexedPropertyType == null) ? 0 : indexedPropertyType.hashCode()) ^ ((indexedReadMethod == null) ? 1 : indexedReadMethod.hashCode()) ^ ((indexedWriteMethod == null) ? 2 : indexedWriteMethod.hashCode()) ); } ###@###.### 2002-02-08
08-02-2002