Skip to content

Asymmetric equals methods in Index.Element implementations #4049

@dimas-b

Description

@dimas-b

Following up from #4018

Original comment: https://github.com/apache/polaris/pull/4018/changes#r2954587783

Test code:

 @Test void compareWithIndexElem() { IndexKey key = IndexKey.key("test"); DirectIndexElement<Object> d = new DirectIndexElement<>(key, null); Index.Element<String> e = Index.Element.of(key, "test"); assertThat(d.equals(e)).isFalse(); assertThat(e.equals(d)).isFalse(); } 

The first assertion passes, but the second assertion throws a NullPointerException. This indicates that this .equals() impl. in non-commutative in general.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions