When a class overrides Object.equals
, this indicates that the class not just considers object identity as equal (the default
implementation of Object.equals
) but implements another logic for what is considered equal in the context of this class. Usually (but not
necessarily), the semantics of equals
in this case is that two objects are equal when their state is equal field by field.
Because of this, adding new fields to a subclass of a class that overrides Object.equals
but not updating the implementation of
equals
in the subclass is most likely an error.