mirror of
https://github.com/tiennm99/lombok.git
synced 2026-08-22 18:25:32 +00:00
Added link to SpoonVennersOdersky paper about equality.
This commit is contained in:
@@ -35,9 +35,9 @@
|
||||
</p><p>
|
||||
<em>NEW in Lombok 0.10: </em>Unless your class is <code>final</code> and extends <code>java.lang.Object</code>, lombok generates a <code>canEqual</code> 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 <code>canEqual</code>
|
||||
if you change <code>equals</code> and <code>hashCode</code>.
|
||||
why such a method is necessary are explained in this paper: <a href="http://www.artima.com/lejava/articles/equality.html">How to Write an Equality Method in Java</a>.
|
||||
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 <code>canEqual</code> if you change <code>equals</code> and <code>hashCode</code>.
|
||||
</p>
|
||||
</div>
|
||||
<div class="snippets">
|
||||
|
||||
Reference in New Issue
Block a user