aboutsummaryrefslogtreecommitdiff
path: root/test/core/src/lombok/RunTestsViaDelombok.java
diff options
context:
space:
mode:
authorMichael Ernst <mernst@cs.washington.edu>2021-12-07 11:16:11 -0800
committerMichael Ernst <mernst@cs.washington.edu>2021-12-07 11:16:11 -0800
commit3f5e4a2819d2f03d634a06861ff5487af320b719 (patch)
treeba9ab7ba2f582bb179624e2bb3f717bea5d9a421 /test/core/src/lombok/RunTestsViaDelombok.java
parent0b4cc60c2367845ebc362e4b254f9e96a66d53c3 (diff)
parentd3b763f9dab4a46e88ff10bc2132fb6f12fda639 (diff)
downloadlombok-3f5e4a2819d2f03d634a06861ff5487af320b719.tar.gz
lombok-3f5e4a2819d2f03d634a06861ff5487af320b719.tar.bz2
lombok-3f5e4a2819d2f03d634a06861ff5487af320b719.zip
Merge ../lombok-branch-master into nullness-annotations
Diffstat (limited to 'test/core/src/lombok/RunTestsViaDelombok.java')
-rw-r--r--test/core/src/lombok/RunTestsViaDelombok.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/core/src/lombok/RunTestsViaDelombok.java b/test/core/src/lombok/RunTestsViaDelombok.java
index 23a42c67..e4eb1a30 100644
--- a/test/core/src/lombok/RunTestsViaDelombok.java
+++ b/test/core/src/lombok/RunTestsViaDelombok.java
@@ -42,7 +42,6 @@ import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
-import javax.lang.model.element.ElementKind;
import javax.lang.model.element.TypeElement;
import com.sun.source.util.TreePath;
@@ -211,8 +210,8 @@ public class RunTestsViaDelombok extends AbstractRunTests {
}
@Override public void visitVarDef(JCVariableDecl tree) {
- // Skip non-field variables
- if (!(parent instanceof JCClassDecl)) return;
+ // Skip local variables
+ if (!(parent instanceof JCClassDecl || parent instanceof JCMethodDecl)) return;
validateSymbol(tree, tree.sym);
super.visitVarDef(tree);
@@ -222,8 +221,8 @@ public class RunTestsViaDelombok extends AbstractRunTests {
if (sym == null) {
fail("Missing symbol for " + tree);
}
- // Skip top level classes
- if (sym.owner.getKind() == ElementKind.PACKAGE) return;
+ // Only classes have enclosed elements, skip everything else
+ if (!sym.owner.getKind().isClass()) return;
if (!sym.owner.getEnclosedElements().contains(sym)) {
fail(tree + " not added to parent");