From 15df143df6d35dd64459d717a451a039eb26d761 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 13 Aug 2019 15:04:43 +0200 Subject: [checkerframework] A bit of a shadow feature because the checker framework folks need to do some work on their side. this update makes lombok generate a few checker framework annotations (if configured to do so) which let the checker framework add warnings and errors for example if you misuse builders, or ignore the return values of withers, etc. --- .../resource/before/CheckerFrameworkBasic.java | 11 +++++++++++ .../resource/before/CheckerFrameworkBuilder.java | 12 ++++++++++++ .../resource/before/CheckerFrameworkSuperBuilder.java | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 test/transform/resource/before/CheckerFrameworkBasic.java create mode 100644 test/transform/resource/before/CheckerFrameworkBuilder.java create mode 100644 test/transform/resource/before/CheckerFrameworkSuperBuilder.java (limited to 'test/transform/resource/before') diff --git a/test/transform/resource/before/CheckerFrameworkBasic.java b/test/transform/resource/before/CheckerFrameworkBasic.java new file mode 100644 index 00000000..5b59165a --- /dev/null +++ b/test/transform/resource/before/CheckerFrameworkBasic.java @@ -0,0 +1,11 @@ +//CONF: checkerframework = 3.0 +import lombok.Data; +import lombok.experimental.Accessors; +import lombok.experimental.Wither; + +@Data @Accessors(chain = true) +class CheckerFrameworkBasic { + @Wither private final int x; + private final int y; + private int z; +} diff --git a/test/transform/resource/before/CheckerFrameworkBuilder.java b/test/transform/resource/before/CheckerFrameworkBuilder.java new file mode 100644 index 00000000..4b501ab8 --- /dev/null +++ b/test/transform/resource/before/CheckerFrameworkBuilder.java @@ -0,0 +1,12 @@ +//CONF: checkerframework = true +import java.util.List; +import lombok.Builder; +import lombok.Singular; + +@Builder +class CheckerFrameworkBuilder { + @Builder.Default int x = 5; + int y; + int z; + @Singular List names; +} diff --git a/test/transform/resource/before/CheckerFrameworkSuperBuilder.java b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java new file mode 100644 index 00000000..74d50ef1 --- /dev/null +++ b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java @@ -0,0 +1,19 @@ +//CONF: checkerframework = true +import java.util.List; +import lombok.Singular; + +class CheckerFrameworkSuperBuilder { + @lombok.experimental.SuperBuilder + public static class Parent { + @lombok.Builder.Default int x = 5; + int y; + int z; + @Singular List names; + } + + @lombok.experimental.SuperBuilder + public static class Child extends Parent { + @lombok.Builder.Default int a = 1; + int b; + } +} -- cgit