From d6f22676bb9229f24e441fcb4943a6c6f9f49c0c Mon Sep 17 00:00:00 2001 From: Cailliaud Date: Tue, 29 Jun 2021 08:45:24 +0200 Subject: [PATCH] [Lombok] RequiredArgConstructor : private or @NonNull fields Example of Streamable using @RequiredArgConstructor(staticName = "of") won't generate a static "of" if the field streamable is not final or at least with @NonNull. It will generate an java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class [...] Products --- src/main/asciidoc/repositories.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/asciidoc/repositories.adoc b/src/main/asciidoc/repositories.adoc index 795518eeba..76952b5351 100644 --- a/src/main/asciidoc/repositories.adoc +++ b/src/main/asciidoc/repositories.adoc @@ -650,7 +650,7 @@ class Product { <1> @RequiredArgConstructor(staticName = "of") class Products implements Streamable { <2> - private Streamable streamable; + private final Streamable streamable; public MonetaryAmount getTotal() { <3> return streamable.stream()