Menu

#2 equals doesn't play well with inheritance

closed
nobody
None
5
2012-09-14
2009-08-28
No

if equals(Object other) is implemented as Pojomatic.equals(this, other), I am pretty sure that this fails the symmetry requirement when a class is extended.

Discussion

  • Ian Robertson

    Ian Robertson - 2009-08-28

    Additionally, if B extends A but adds no properties, B's equals implementation will refuse to accept instances of A.

     
  • Ian Robertson

    Ian Robertson - 2009-09-05

    Moreover, adding the HASH_CODE role to a method in a subclass will likely break the equals-hashCode contract.

     
  • Ian Robertson

    Ian Robertson - 2009-12-07

    Fixed in 1.0-RC3

     

Anonymous
Anonymous

Add attachments
Cancel





Auth0 Logo