From 80133da5285fbafceaef224fed0f31c06b532b16 Mon Sep 17 00:00:00 2001 From: Andre Brait Date: Fri, 16 Oct 2020 02:14:21 +0200 Subject: Add documentation for cacheStrategy --- website/templates/features/EqualsAndHashCode.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'website/templates/features/EqualsAndHashCode.html') 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 @@ 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: 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.

NEW in Lombok 1.14.0: To put annotations on the other parameter of the equals (and, if relevant, canEqual) method, you can use onParam=@__({@AnnotationsHere}). Be careful though! This is an experimental feature. For more details see the documentation on the onX feature. +

+ NEW in Lombok 1.18.16: Caching the result of the generated hashCode() can be cached by setting cacheStrategy to a value other than CacheStrategy.NEVER. Do not use this if objects of the annotated class can be modified in any way that would lead to the result of hashCode() changing.

-- cgit