A typical pitfall in broken transitivity is when the equals() method in a subclass calls the equals() method of its superclass as part of its equals comparasion. The equals() method in the subclass has ususally code equivalent to the following line.
The idea is to compare only the subclass-specific aspects in the subclass equals() method and to leverage on superclass equals() method..............
The problem lies in getting the equivalence contract fulfilled bilaterally between the superclass and the subclass equals() methods.
If the subclass equals method does not interoperate with superclass objects : symmetry is easily broken .If the subclass equals method does interoperate with superclass objects transitivity is easily broken.
If the superclass is abstract, leveraging on the superclass equals()method works well. .... The subclass equals() method can safely call the superclass equals() method to compare the superclass specific aspects of subclass objects.
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
how do I do my own kindle-like thing - without amazonhttps://coderanch.com/t/711421/engineering/kindle-amazon