Hi,

Just a small clarification...

Stefan Guggisberg schrieb:

regarding missing hashCode(): i intentionally do never override hashCode()
for mutable objects. hashCode() should imo only be implemented for immutable objects.


Unfortunately this is not in line with the general contract of the hashCode and equals methods, which says - amongst other things - that for two objects being equal according to equals the hashCode must be the same. If you do not overwrite the hashCode method whenever you overwrite the equals method, you will get into troubles. Josh Bloch has written a nice text on this issue in his famous book.

i suggest to disable the related Checkstyle check.


Therefore I strongly oppose to removing that check.

in general: i think that checkstyle is a good tool that helps to improve the quality and consistency of the code base. but we should use common sense when interpreting the recommendations. blindly following all the recommendations or or trying to achieve 0 reported issues is imo not worthwhile.



Regards
Felix



Reply via email to