Well if you are saying that the contract is being broken, then yes it is. But what do you expect. Do you think that it will be a compiler error. If you think so than you are wrong.
The equals and hashCode contract is just a suggestion so that you can use your classes in Collections. If you don't follow the contract, you will not get any errors but will get unexpected outputs like you won't be able to find objects is hash based collections etc....
The "contract" about equals and hashCode is more than a "suggestion." What you are doing by implementing an equals() method which overrides the Object#equals(java.lang.Object) method is telling users (implicitly) that you are fulfilling the requirements stated there. And you don't want your classes going round telling fibs to their users, do you?
But you are correct that it is specifically used in Maps and Sets.
Joined: Oct 30, 2008
Keep in mind that legal hashCode() override is different than an efficient override
There's an "exam watch" in that section that talks about legal and appropriate hashCode override.