aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java12
-rw-r--r--test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java4
-rw-r--r--test/transform/resource/after-delombok/NonNullOnRecord.java10
-rw-r--r--test/transform/resource/after-delombok/NonNullOnRecord2.java10
-rw-r--r--test/transform/resource/after-delombok/NonNullOnRecord3.java13
-rw-r--r--test/transform/resource/before/NonNullOnRecord.java3
-rw-r--r--test/transform/resource/before/NonNullOnRecord2.java9
-rw-r--r--test/transform/resource/before/NonNullOnRecord3.java13
8 files changed, 56 insertions, 18 deletions
diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java
index 13acdf55..46eb54a0 100644
--- a/test/core/src/lombok/RunTestsViaDelombok.java
+++ b/test/core/src/lombok/RunTestsViaDelombok.java
@@ -120,6 +120,7 @@ public class RunTestsViaDelombok extends AbstractRunTests {
@Override public void scan(JCTree tree) {
if (tree == null) return;
if (tree instanceof JCMethodDecl && (((JCMethodDecl) tree).mods.flags & Flags.GENERATEDCONSTR) != 0) return;
+ astContext.push(tree);
try {
if (tree instanceof JCModifiers) return;
@@ -139,14 +140,19 @@ public class RunTestsViaDelombok extends AbstractRunTests {
if ("super".equals("" + ((JCIdent) tree).name)) check = false;
}
+ if (tree instanceof JCVariableDecl && (((JCVariableDecl) tree).mods.flags & Javac.GENERATED_MEMBER) != 0) return;
+
if (check && tree.pos == -1) fail(craftFailMsg("Start", astContext));
+
if (check && Javac.getEndPosition(tree, unit) == -1) {
fail(craftFailMsg("End", astContext));
}
} finally {
- astContext.push(tree);
- super.scan(tree);
- astContext.pop();
+ try {
+ super.scan(tree);
+ } finally {
+ astContext.pop();
+ }
}
}
diff --git a/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java b/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java
index 02b66dd1..15e0aa66 100644
--- a/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java
+++ b/test/transform/resource/after-delombok/NonNullExistingConstructorOnRecord.java
@@ -8,14 +8,12 @@ record NonNullOnRecord(@NonNull String a, @NonNull String b) {
}
}
@java.lang.SuppressWarnings("all")
- public NonNullOnRecord(@NonNull final String a, @NonNull final String b) {
+ public NonNullOnRecord {
if (a == null) {
throw new java.lang.NullPointerException("a is marked non-null but is null");
}
if (b == null) {
throw new java.lang.NullPointerException("b is marked non-null but is null");
}
- this.a = a;
- this.b = b;
}
}
diff --git a/test/transform/resource/after-delombok/NonNullOnRecord.java b/test/transform/resource/after-delombok/NonNullOnRecord.java
index 2ff4a8f7..7acfab36 100644
--- a/test/transform/resource/after-delombok/NonNullOnRecord.java
+++ b/test/transform/resource/after-delombok/NonNullOnRecord.java
@@ -1,21 +1,13 @@
// version 14:
import lombok.NonNull;
record NonNullOnRecord(@NonNull String a, @NonNull String b) {
- public void method(@NonNull String param) {
- if (param == null) {
- throw new java.lang.NullPointerException("param is marked non-null but is null");
- }
- String asd = "a";
- }
@java.lang.SuppressWarnings("all")
- public NonNullOnRecord(@NonNull final String a, @NonNull final String b) {
+ public NonNullOnRecord {
if (a == null) {
throw new java.lang.NullPointerException("a is marked non-null but is null");
}
if (b == null) {
throw new java.lang.NullPointerException("b is marked non-null but is null");
}
- this.a = a;
- this.b = b;
}
}
diff --git a/test/transform/resource/after-delombok/NonNullOnRecord2.java b/test/transform/resource/after-delombok/NonNullOnRecord2.java
new file mode 100644
index 00000000..a166190c
--- /dev/null
+++ b/test/transform/resource/after-delombok/NonNullOnRecord2.java
@@ -0,0 +1,10 @@
+// version 14:
+import lombok.NonNull;
+record NonNullOnRecord2(@NonNull String a) {
+ public NonNullOnRecord2 {
+ if (a == null) {
+ throw new java.lang.NullPointerException("a is marked non-null but is null");
+ }
+ System.out.println("Hello");
+ }
+}
diff --git a/test/transform/resource/after-delombok/NonNullOnRecord3.java b/test/transform/resource/after-delombok/NonNullOnRecord3.java
new file mode 100644
index 00000000..b1ecf6c0
--- /dev/null
+++ b/test/transform/resource/after-delombok/NonNullOnRecord3.java
@@ -0,0 +1,13 @@
+// version 14:
+import lombok.NonNull;
+record NonNullOnRecord3(@NonNull String a) {
+ public NonNullOnRecord3(String a) {
+ this.a = a;
+ }
+ public void method(@NonNull String param) {
+ if (param == null) {
+ throw new java.lang.NullPointerException("param is marked non-null but is null");
+ }
+ String asd = "a";
+ }
+}
diff --git a/test/transform/resource/before/NonNullOnRecord.java b/test/transform/resource/before/NonNullOnRecord.java
index 223f8cbb..56a96433 100644
--- a/test/transform/resource/before/NonNullOnRecord.java
+++ b/test/transform/resource/before/NonNullOnRecord.java
@@ -3,7 +3,4 @@
import lombok.NonNull;
record NonNullOnRecord(@NonNull String a, @NonNull String b) {
- public void method(@NonNull String param) {
- String asd = "a";
- }
} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullOnRecord2.java b/test/transform/resource/before/NonNullOnRecord2.java
new file mode 100644
index 00000000..3a4eacd4
--- /dev/null
+++ b/test/transform/resource/before/NonNullOnRecord2.java
@@ -0,0 +1,9 @@
+// version 14:
+
+import lombok.NonNull;
+
+record NonNullOnRecord2(@NonNull String a) {
+ public NonNullOnRecord2 {
+ System.out.println("Hello");
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/NonNullOnRecord3.java b/test/transform/resource/before/NonNullOnRecord3.java
new file mode 100644
index 00000000..88870192
--- /dev/null
+++ b/test/transform/resource/before/NonNullOnRecord3.java
@@ -0,0 +1,13 @@
+// version 14:
+
+import lombok.NonNull;
+
+record NonNullOnRecord3(@NonNull String a) {
+ public NonNullOnRecord3(String a) {
+ this.a = a;
+ }
+
+ public void method(@NonNull String param) {
+ String asd = "a";
+ }
+} \ No newline at end of file