aboutsummaryrefslogtreecommitdiff
path: root/website/templates/features/EqualsAndHashCode.html
diff options
context:
space:
mode:
authorAndre Brait <andrebrait@gmail.com>2020-10-16 02:14:21 +0200
committerRoel Spilker <r.spilker@gmail.com>2020-12-03 23:41:36 +0100
commit80133da5285fbafceaef224fed0f31c06b532b16 (patch)
treeb2bb8585979763ffcf36886e94f13371e8ca3a8e /website/templates/features/EqualsAndHashCode.html
parent965f2367e0e57744c51b10ac341400b8ec57287a (diff)
downloadlombok-80133da5285fbafceaef224fed0f31c06b532b16.tar.gz
lombok-80133da5285fbafceaef224fed0f31c06b532b16.tar.bz2
lombok-80133da5285fbafceaef224fed0f31c06b532b16.zip
Add documentation for cacheStrategy
Diffstat (limited to 'website/templates/features/EqualsAndHashCode.html')
-rw-r--r--website/templates/features/EqualsAndHashCode.html2
1 files changed, 2 insertions, 0 deletions
diff --git a/website/templates/features/EqualsAndHashCode.html b/website/templates/features/EqualsAndHashCode.html
index 2ea2954a..d7c5b583 100644
--- a/website/templates/features/EqualsAndHashCode.html
+++ b/website/templates/features/EqualsAndHashCode.html
@@ -12,6 +12,8 @@
<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: <a href="https://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><p>
<em>NEW in Lombok 1.14.0: </em>To put annotations on the <code>other</code> parameter of the <code>equals</code> (and, if relevant, <code>canEqual</code>) method, you can use <code>onParam=@__({@AnnotationsHere})</code>. Be careful though! This is an experimental feature. For more details see the documentation on the <a ng-click="toFeature('on-x')">onX</a> feature.
+ </p><p>
+ <em>NEW in Lombok 1.18.16: </em>Caching the result of the generated <code>hashCode()</code> can be cached by setting <code>cacheStrategy</code> to a value other than <code>CacheStrategy.NEVER</code>. <em>Do not</em> use this if objects of the annotated class can be modified in any way that would lead to the result of <code>hashCode()</code> changing.
</p>
</@f.overview>