Hi,

Please review a fix to the key/value/entry spliterators of HashMap/WeakHashMap 
when mixed traversal is performed:

  http://cr.openjdk.java.net/~psandoz/tl/JDK-8013649/webrev/

A call to forEachRemaning does not correctly check and set the state to 
detect/signal all elements have been traversed.

There are two conditions for traversal:
1) if the index into the entry table is less than the fence; or
2) if the current entry is not null.

forEachRemaining was only checking the first condition before traversing and 
only setting the state associated with the first condition rendering it false 
on subsequent calls.

If mixed traversal (a combination of tryAdvance and forEachRemaining) is 
performed this can result in forEachRemaining not traversing elements or 
tryAdvance traversing previously traversed elements.

Note that failure only occurs for certain distributions of elements which is 
why the current tests did not detect this case. Additional tests have been 
added that induce the conditions whereby table entries contain 2 or more 
elements thus enabling tryAdvance to set up condition 2).

--

This has already been fixed in the lambda repo:

  http://hg.openjdk.java.net/lambda/lambda/jdk/rev/d3baf2241054

Paul.

Reply via email to