-
Notifications
You must be signed in to change notification settings - Fork 21
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
Override equals() and hashCode() in Impl-Classes #26
Comments
Comparing urls accurately (taking into account relative links, case insensitivity, etc) is notoriously difficult, so I'm not sure that LinkImpl should implement equals. I think it would be a good idea to make equals and hashcode consistent for RatioImpl. I may have some time Friday to look at this. |
That was a fast answer, thank you :) |
Well one of those properties is a URL and java.net.URL's equals() is famous for actually resolving host names into IP addresses, which is a blocking IO call. java.net.URI addresses some of these issues and would maybe have been a better choice here. |
Wow, totally didn't know about the URL/equals issues - thanks again ;) |
Might work - would probably be best to convert toURI(), then compare those for equality. |
Sounds great, thank you! |
I think
LinkImpl
,RatioImpl
etc. should overrideequals()
andhashCode()
more consistently.LinkImpl
doesn't override any of the twoRatioImpl
overridesequals()
, but nothashCode()
. And the implementation ofequals()
relies on object identity of the numerators und denominatorsMy suggestions would be to generate all
equals
andhashCode
implementations for these classes with your IDE of choice.I would have created a pr, but I read you dont accept any...
The text was updated successfully, but these errors were encountered: