United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-8000955 Hashtable.Entry.hashCode() no longer conforms to Map.Entry.hashCode()
JDK-8000955 : Hashtable.Entry.hashCode() no longer conforms to Map.Entry.hashCode()

Details
Type:
Bug
Submit Date:
2012-10-16
Status:
Closed
Updated Date:
2012-12-05
Project Name:
JDK
Resolved Date:
2012-10-17
Component:
core-libs
OS:
Sub-Component:
java.util
CPU:
Priority:
P3
Resolution:
Fixed
Affected Versions:
7-pool,8
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
Neil Richards <neil.richards@ngmr.net> reports:

I notice that the behaviour of java.util.Hashtable.Entry.hashCode() no
longer conforms to the defined behaviour (in the Java API Javadoc [1])
for java.util.Map.Entry.hashCode() implementations.

The code in Hashtable.Entry.hashCode() assumes that the value in
Hashtable.Entry.hash will always be the same as that for
Hashtable.Entry.getKey().hashCode() .

However, since Java bug 7126277 (Alternative String hashing
implementation), the use of Hashtable.hashSeed, a randomizing factor,
has been introduced into the calculation of Hashtable.hash().

It is the result from Hashtable.hash() which ends up stored in the
Hashtable.Entry.hash field.

So the assumption made in Hashtable.Entry.hashCode() is no longer valid,
and the code needs to be corrected, so that it once more complies with
the Java API defined behaviour.
                                    

Comments
See also the OpenJDK core-libs thread:
    http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-October/011842.html
                                     
2012-10-16
URL:   http://hg.openjdk.java.net/jdk8/tl/jdk/rev/5eed4a92ca8c
User:  ngmr
Date:  2012-10-17 12:41:47 +0000

                                     
2012-10-17
URL:   http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/5eed4a92ca8c
User:  lana
Date:  2012-10-31 02:51:07 +0000

                                     
2012-10-31
Test: java/util/Map/EntryHashCode.java 
                                     
2012-12-05



Hardware and Software, Engineered to Work Together