Skip to content

NonBlockingIdentityHashMap.replace throws AssertionError when the key is unknown #330

@alefedor

Description

@alefedor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions