From c86d0fcc37cee701d9781e255e5fc22dc9e2fa41 Mon Sep 17 00:00:00 2001
From: Reinier Zwitserloot
NEW in Lombok 0.10: Unless your class is final
and extends java.lang.Object
, lombok generates a canEqual
method
which means JPA proxies can still be equal to their base class, but subclasses that add new state don't break the equals contract. The complicated reasons for
- why such a method is necessary are explained in this paper: (TODO: Find link to Venners/Spoon/Odersky). If all classes in a hierarchy are a mix of scala case classes
- and classes with lombok-generated equals methods, all equality will 'just work'. If you need to write your own equals methods, you should always override canEqual
- if you change equals
and hashCode
.
+ why such a method is necessary are explained in this paper: How to Write an Equality Method in Java.
+ If all classes in a hierarchy are a mix of scala case classes and classes with lombok-generated equals methods, all equality will 'just work'.
+ If you need to write your own equals methods, you should always override canEqual
if you change equals
and hashCode
.