From 60f575496b3184c2279e9dba470097ed164d5adf Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Sat, 29 May 2021 18:49:05 +0200 Subject: [fixes #2838] Handle anonymous classes properly Generated qualified names (e.g. Outer.Inner) now stop at anonymous classes instead of adding an empty part. All handlers that add static fields/methods/types now add error messages instead of generating invalid code. --- .../ConstructorsInAnonymousClass.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java (limited to 'test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java') diff --git a/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java b/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java new file mode 100644 index 00000000..56e96ae3 --- /dev/null +++ b/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java @@ -0,0 +1,33 @@ +import lombok.NonNull; + +public class ConstructorsInAnonymousClass { + Object annonymous = new Object() { + + class Inner { + private String string; + @NonNull + private String string2; + + @java.lang.SuppressWarnings("all") + public Inner(final String string, @NonNull final String string2) { + if (string2 == null) { + throw new java.lang.NullPointerException("string2 is marked non-null but is null"); + } + this.string = string; + this.string2 = string2; + } + + @java.lang.SuppressWarnings("all") + public Inner(@NonNull final String string2) { + if (string2 == null) { + throw new java.lang.NullPointerException("string2 is marked non-null but is null"); + } + this.string2 = string2; + } + + @java.lang.SuppressWarnings("all") + public Inner() { + } + } + }; +} -- cgit From 0f358d38c5e8dc3253503b081c91458c07f71685 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Sun, 6 Jun 2021 10:39:52 +0200 Subject: [testing] Fix javac6 tests --- test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java | 1 + test/transform/resource/after-delombok/WithByInAnonymousClass.java | 1 + test/transform/resource/before/ConstructorsInAnonymousClass.java | 1 + test/transform/resource/before/WithByInAnonymousClass.java | 1 + 4 files changed, 4 insertions(+) (limited to 'test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java') diff --git a/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java b/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java index 56e96ae3..7483718f 100644 --- a/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java +++ b/test/transform/resource/after-delombok/ConstructorsInAnonymousClass.java @@ -1,3 +1,4 @@ +//version 8: import lombok.NonNull; public class ConstructorsInAnonymousClass { diff --git a/test/transform/resource/after-delombok/WithByInAnonymousClass.java b/test/transform/resource/after-delombok/WithByInAnonymousClass.java index e3c70763..d84955b6 100644 --- a/test/transform/resource/after-delombok/WithByInAnonymousClass.java +++ b/test/transform/resource/after-delombok/WithByInAnonymousClass.java @@ -1,3 +1,4 @@ +//version 8: public class WithByInAnonymousClass { Object annonymous = new Object() { diff --git a/test/transform/resource/before/ConstructorsInAnonymousClass.java b/test/transform/resource/before/ConstructorsInAnonymousClass.java index b6e78dd3..a74a7f11 100644 --- a/test/transform/resource/before/ConstructorsInAnonymousClass.java +++ b/test/transform/resource/before/ConstructorsInAnonymousClass.java @@ -1,3 +1,4 @@ +//version 8: import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.NonNull; diff --git a/test/transform/resource/before/WithByInAnonymousClass.java b/test/transform/resource/before/WithByInAnonymousClass.java index b366f168..afed6adf 100644 --- a/test/transform/resource/before/WithByInAnonymousClass.java +++ b/test/transform/resource/before/WithByInAnonymousClass.java @@ -1,3 +1,4 @@ +//version 8: import lombok.experimental.WithBy; public class WithByInAnonymousClass { -- cgit