On Jun 13, 2013, at 3:21 PM, Remi Forax <fo...@univ-mlv.fr> wrote: > On 06/13/2013 07:28 AM, Mike Duigou wrote: >> I have updated my webrev with Remi's improvements and some other >> improvements to the fast-fail concurrent modification checking. >> >> Revised webrev: >> >> http://cr.openjdk.java.net/~mduigou/JDK-8016446/1/webrev/ >> >> Mike > > Hi Mike, > > in TreeMap.forEach (and replaceAll), the check for co-modification should be > done *before* action.accept(...) > and not after because the semantics of the Iterator allows users to modify > the map (hashmap or treemap) > if it's the last element (so we should not check modCount after the last > element).
That creates conditions that may or may not fail with a CME depending on the map implementation (e.g. if state is hoisted or referenced) and the state of the map instance e.g. if the size of the map is 1 or > 1 and the BiConsumer instance add a new value to the map. Interference caused by function values passed to collection/map bulk operations should always result in an CME regardless of the state of the collection/map instance. Paul.