Review Request 7174736 : JCK test api/java_util/HashMap/index_EntrySet failing

Mike Duigou mike.duigou at oracle.com
Thu Jun 7 07:56:05 UTC 2012


Hello all;

Alan Bateman tracked down a regression introduced by the Alternative HashMap changes which was caught by the JCK tests. The fix is a one liner:

diff --git a/src/share/classes/java/util/HashMap.java b/src/share/classes/java/util/HashMap.java
--- a/src/share/classes/java/util/HashMap.java
+++ b/src/share/classes/java/util/HashMap.java
@@ -611,7 +611,7 @@ public class HashMap<K,V>

        Map.Entry<?,?> entry = (Map.Entry<?,?>) o;
        Object key = entry.getKey();
-        int hash = (key == null) ? 0 : hash(key.hashCode());
+        int hash = (key == null) ? 0 : hash(key);
        int i = indexFor(hash, table.length);
        @SuppressWarnings("unchecked")
            Entry<K,V> prev = (Entry<K,V>)table[i];

Which is unfortunately similar to another error discovered during pre-commit review. Barring complaints, I will push this change on Thursday.

Mike


More information about the core-libs-dev mailing list