There is a bug in NonBlockingIdentityHashMap.replace that causes unexpected AssertionError.
Minimal failing code:
new NonBlockingIdentityHashMap<Object, Object>().replace(new Object(), new Object());
Both NonBlockingHashMap and IdentityHashMap handle the case of a key that is not in the structure correctly by just ignoring the operation.
The exception is thrown on assert res != null; from putIfMatch. Probably, res should have been TOMBSTONE instead of null here to mark the absence of the key.
There is a bug in
NonBlockingIdentityHashMap.replacethat causes unexpectedAssertionError.Minimal failing code:
Both
NonBlockingHashMapandIdentityHashMaphandle the case of a key that is not in the structure correctly by just ignoring the operation.The exception is thrown on
assert res != null;fromputIfMatch. Probably, res should have beenTOMBSTONEinstead ofnullhere to mark the absence of the key.