JDK-4634068 : JDK code doesn't respect contract for equals and hashCode
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.4.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2002-02-06
  • Updated: 2002-02-07
  • Resolved: 2002-02-07
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description

Name: nt126004			Date: 02/06/2002


FULL PRODUCT VERSION :
java version "1.4.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b91)
Java HotSpot(TM) Server VM (build 1.4.0-rc-b91, mixed mode)

FULL OPERATING SYSTEM VERSION :
SunOS savoir 5.8 Generic_108528-12 sun4u sparc
SUNW,Ultra-5_10



A DESCRIPTION OF THE PROBLEM :
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.

 ava.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)
org.apache.xpath.objects.XObject defines
equals(org.apache.xpath.objects.XObject) but doesn't
redefine equals(Object)
sun.security.krb5.Realm defines
equals(sun.security.krb5.Realm) but doesn't redefine
equals(Object)
sun.security.krb5.internal.HostAddresses defines
equals(sun.security.krb5.internal.HostAddresses) but
doesn't redefine equals(Object)
sun.security.krb5.internal.KerberosTime defines
equals(sun.security.krb5.internal.KerberosTime) but
doesn't redefine equals(Object)
com.sun.corba.se.internal.core.ORBVersionImpl
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.AlternateIIOPAddressCo
mponent redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.CodeSetsComponent
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.GenericIdEncapsulation
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.IIOPAddressBase
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.IIOPProfile redefines
equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.JavaCodebaseCompone
nt redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.ORBTypeComponent
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.ObjectId redefines
equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.ObjectKey redefines
equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.ObjectKeyTemplateBase
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.OldPOAObjectKeyTempl
ate redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.POAIdBase redefines
equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.POAObjectKeyTemplate
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.ior.WireObjectKeyTemplate
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.orbutil.RepIdDelegator
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.orbutil.RepIdDelegator_1_3
redefines equals(Object) but not hashCode()
com.sun.corba.se.internal.orbutil.RepIdDelegator_1_3
_1 redefines equals(Object) but not hashCode()
java.awt.Font$FontLineMetrics redefines
equals(Object) but not hashCode()
java.beans.IndexedPropertyDescriptor redefines
equals(Object) but not hashCode()
java.beans.PropertyDescriptor redefines
equals(Object) but not hashCode()
java.text.CharSet redefines equals(Object) but not
hashCode()
javax.imageio.ImageTypeSpecifier redefines
equals(Object) but not hashCode()
javax.imageio.ImageTypeSpecifier$Banded redefines
equals(Object) but not hashCode()
javax.imageio.ImageTypeSpecifier$Interleaved
redefines equals(Object) but not hashCode()
javax.swing.text.SimpleAttributeSet$EmptyAttributeSet
redefines equals(Object) but not hashCode()
org.apache.xalan.transformer.StackGuard redefines
equals(Object) but not hashCode()
org.apache.xml.utils.URI redefines equals(Object) but
not hashCode()
org.apache.xpath.Arg redefines equals(Object) but not
hashCode()
sun.security.krb5.internal.rcache.a9 redefines
equals(Object) but not hashCode()
sun.security.x509.AVAComparator redefines
equals(Object) but not hashCode()
sun.security.x509.EDIPartyName redefines
equals(Object) but not hashCode()
sun.security.x509.GeneralName redefines
equals(Object) but not hashCode()
sun.security.x509.GeneralSubtree redefines
equals(Object) but not hashCode()
sun.security.x509.OtherName redefines equals(Object)
but not hashCode()
sun.security.x509.PolicyInformation redefines
equals(Object) but not hashCode()
com.sun.corba.se.internal.core.GIOPVersion redefines
equals(Object) but not hashCode()
org.apache.xml.dtm.ref.DTMNodeProxy redefines
equals(Object) but not hashCode()
sun.security.jgss.ProviderList$PreferencesEntry
redefines equals(Object) but not hashCode()
java.awt.DisplayMode defines
equals(java.awt.DisplayMode) but doesn't redefine
equals(Object)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Problems found by applying automatic tools to JDK
libraries. However, manual inspectation of the classes
reveals the same problems.
(Review ID: 139108) 
======================================================================

Comments
EVALUATION These classes are owned by a number of different groups. I have distributed this problem as follows: NEW BUG CATEGORY/SUBCATEGORY 4634380 idl/orb 4634383 java/classes_2D 4634385 java/classes_awt 4634390 java/classes_beans 4634391 java/classes_text 4634392 java/classes_security 4634394 java/classes_swing 4630399 java/imageio 4630400 jaxp/other Please use these newly created bugs to track this problem. -- iag@sfbay 2002-02-06
06-02-2002