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.
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)
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()
sun.security.jgss.ProviderList$PreferencesEntry 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
Additional classes reported by a tool that applies similar checks:
sun.security.jgss.spi.GSSNameSpi-
equals signature is: (Lsun/security/jgss/spi/GSSNameSpi;)Z To override it has to be: (Ljava/lang/Object;)Z
sun.security.acl.AllPermissionsImpl -
equals signature is: (Ljava/security/acl/Permission;)Z To override it has to be: (Ljava/lang/Object;)Z
sun.security.acl.GroupImpl -
equals signature is: (Ljava/security/acl/Group;)Z To override it has to be: (Ljava/lang/Object;)Z
The classes listed above for not overriding hashCode method use hashCode method
from the class Object. Hence overriding hashCode is most likely required.
###@###.### 2002-10-30