We have found some inconsistencies in the overriding of the equals() method
in some files with respect to the conforming to the contract structure
based on the Java Specification.
The above files all uses instanceof in the overridden equals() method in
comparing two objects.
According to the Java Specification, the equals() method must be reflexive,
symmetric, transitive and consistent. In the case of symmetric, it is
stated that x.equals(y) should return true if and only if y.equals(x)
returns true. Using instanceof is asymmetric and is not a valid symmetric
A more preferred way will be to compare the classes instead. i.e. if
(this.getClass() != o.getClass()).
However, if compiling the source code using JDK 7 and above, and if
developers still prefer to use instanceof, you can make use of the static
methods of Objects such as Objects.equals(this.id, that.id). (Making use of
the static methods of Objects is currently absent in the methods.) It will
be easier to override the equals() method and will ensure that the
overridden equals() method will fulfill the contract rules.