aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-03-23 05:08:19 +0100
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2021-03-23 05:19:24 +0100
commitcc98adac012d0d18c70628eb5e6f1646ce574e8a (patch)
tree92e77d3437d7d0ba2b55576cc87fedbb0e04dec1 /test/core/src/lombok
parent2eabd8485df6fb01e05cf7bcf797d922b9d4e012 (diff)
downloadlombok-cc98adac012d0d18c70628eb5e6f1646ce574e8a.tar.gz
lombok-cc98adac012d0d18c70628eb5e6f1646ce574e8a.tar.bz2
lombok-cc98adac012d0d18c70628eb5e6f1646ce574e8a.zip
[records] [javac] Putting `@NonNull` on a 'field' of a record now affects the compact constructors, generating one if need be.
Diffstat (limited to 'test/core/src/lombok')
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java12
1 files changed, 9 insertions, 3 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();
+ }
}
}