changeset 42361:b64a8f0c668e

8170733: HashMap.HashIterator.remove method does not use cached value for the hash code. Reviewed-by: martin, dl, shade
author psandoz
date Mon, 05 Dec 2016 13:00:32 -0800
parents 5e60b1e45041
children 7b70c5bfe82e
files jdk/src/java.base/share/classes/java/util/HashMap.java jdk/src/java.base/share/classes/java/util/LinkedHashMap.java
diffstat 2 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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;
         }
     }