Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
logological opened this issue Sep 9, 2015 · 0 comments
Open

Comments

@logological
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant