8170733: HashMap.HashIterator.remove method does not use cached value for the hash code.
authorpsandoz
Mon, 05 Dec 2016 13:00:32 -0800
changeset 42361 b64a8f0c668e
parent 42360 5e60b1e45041
child 42362 7b70c5bfe82e
8170733: HashMap.HashIterator.remove method does not use cached value for the hash code. Reviewed-by: martin, dl, shade
jdk/src/java.base/share/classes/java/util/HashMap.java
jdk/src/java.base/share/classes/java/util/LinkedHashMap.java
--- a/jdk/src/java.base/share/classes/java/util/HashMap.java	Mon Dec 05 12:53:53 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/HashMap.java	Mon Dec 05 13:00:32 2016 -0800
@@ -1502,8 +1502,7 @@
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
             current = null;
-            K key = p.key;
-            removeNode(hash(key), key, null, false, false);
+            removeNode(p.hash, p.key, null, false, false);
             expectedModCount = modCount;
         }
     }
--- a/jdk/src/java.base/share/classes/java/util/LinkedHashMap.java	Mon Dec 05 12:53:53 2016 +0530
+++ b/jdk/src/java.base/share/classes/java/util/LinkedHashMap.java	Mon Dec 05 13:00:32 2016 -0800
@@ -731,8 +731,7 @@
             if (modCount != expectedModCount)
                 throw new ConcurrentModificationException();
             current = null;
-            K key = p.key;
-            removeNode(hash(key), key, null, false, false);
+            removeNode(p.hash, p.key, null, false, false);
             expectedModCount = modCount;
         }
     }