Skip to content

SetAnnotation.equals() should not use toString() to test equality #20

@logological

Description

@logological

The SetAnnotation class has an implementation of equals() which tests equality by converting the operands to Strings. I don't think this is a good idea. Users may be comparing annotations represented by arbitrary objects, and those objects may implement toString() methods which return the same text even when the objects are different. (Or perhaps the objects don't even have their own implementation of toString(), causing Java to output distinct numeric references even when the objects' actual values are equivalent.)

Unless I'm missing something important here, shouldn't equals() simply be eliminated and the class allowed to use the parent HashSet implementation?

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