Can I please get a review for this change which proposes to fix the issue 
reported in https://bugs.openjdk.java.net/browse/JDK-8003417?

The issue notes that this is applicable for `WeakHashMap` which have `null` 
keys. However, the issue is even applicable for `WeakHashMap` instances which 
don't have `null` keys, as reproduced and shown by the newly added jtreg test 
case in this PR.

The root cause of the issue is that once the iterator is used to iterate till 
the end and the `remove()` is called, then the 
`WeakHashMap$HashIterator#remove()` implementation used to pass `null` as the 
key to remove from the map, instead of the key of the last returned entry. The 
commit in this PR fixes that part.

A new jtreg test has been added which reproduces the issue as well as verifies 
the fix.
`tier1` testing and this new test have passed after this change. However, I 
guess this will require a JCK run to be run too, perhaps? If so, I will need 
help from someone who has access to them to have this run against those please.

-------------

Commit messages:
 - 8003417: WeakHashMap$HashIterator removes wrong entry

Changes: https://git.openjdk.java.net/jdk/pull/6488/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6488&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8003417
  Stats: 164 lines in 2 files changed: 162 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6488.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6488/head:pull/6488

PR: https://git.openjdk.java.net/jdk/pull/6488

Reply via email to