aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-01-08 23:59:22 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-01-09 00:00:32 +0100
commit14407cedb5e061d8e7a53ebdd167dc82db779df0 (patch)
tree79643976a63ac7ac1f5fc6370c9bff8aabdbc8c7
parent209c082530cc759d26ab30c25f970ea5f7b7ab3a (diff)
downloadlombok-14407cedb5e061d8e7a53ebdd167dc82db779df0.tar.gz
lombok-14407cedb5e061d8e7a53ebdd167dc82db779df0.tar.bz2
lombok-14407cedb5e061d8e7a53ebdd167dc82db779df0.zip
[fixes #1553] attriber of JDK9 checks the enclosing class’s type, which we intentionally haven’t set yet. To avoid NPEs, let’s set it.
-rw-r--r--src/core/lombok/javac/JavacResolution.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/lombok/javac/JavacResolution.java b/src/core/lombok/javac/JavacResolution.java
index ded6284b..79c7cad2 100644
--- a/src/core/lombok/javac/JavacResolution.java
+++ b/src/core/lombok/javac/JavacResolution.java
@@ -222,6 +222,11 @@ public class JavacResolution {
}
private void attrib(JCTree tree, Env<AttrContext> env) {
+ if (env.enclClass.type == null) try {
+ env.enclClass.type = Type.noType;
+ } catch (Throwable ignore) {
+ // This addresses issue #1553 which involves JDK9; if it doesn't exist, we probably don't need to set it.
+ }
if (tree instanceof JCBlock) attr.attribStat(tree, env);
else if (tree instanceof JCMethodDecl) attr.attribStat(((JCMethodDecl) tree).body, env);
else if (tree instanceof JCVariableDecl) attr.attribStat(tree, env);