[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.

This commit is contained in:
Reinier Zwitserloot committed 2018-01-09 00:00:32 +01:00
1 parent 209c082530
commit 14407cedb5
1 file changed
+5
@@ -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);