From 14407cedb5e061d8e7a53ebdd167dc82db779df0 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 8 Jan 2018 23:59:22 +0100 Subject: [PATCH] =?UTF-8?q?[fixes=20#1553]=20attriber=20of=20JDK9=20checks?= =?UTF-8?q?=20the=20enclosing=20class=E2=80=99s=20type,=20which=20we=20int?= =?UTF-8?q?entionally=20haven=E2=80=99t=20set=20yet.=20To=20avoid=20NPEs,?= =?UTF-8?q?=20let=E2=80=99s=20set=20it.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/lombok/javac/JavacResolution.java | 5 +++++ 1 file changed, 5 insertions(+) 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 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);