aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/JavacResolution.java
diff options
context:
space:
mode:
authorcnuessgens <christian@nuessgens.com>2018-01-18 21:18:14 +0100
committercnuessgens <christian@nuessgens.com>2018-01-18 21:18:14 +0100
commit1b6de01bf187def687cb0e757da4295b0790f0ac (patch)
treef86c0951a8669fb67689a92fd9059df7589d17da /src/core/lombok/javac/JavacResolution.java
parentcdee2996514723dfbcf6ac177d82446acef260f3 (diff)
parent01754d914056b3baa0a6bfe3b20bf5c40f6a5199 (diff)
downloadlombok-1b6de01bf187def687cb0e757da4295b0790f0ac.tar.gz
lombok-1b6de01bf187def687cb0e757da4295b0790f0ac.tar.bz2
lombok-1b6de01bf187def687cb0e757da4295b0790f0ac.zip
Merge remote-tracking branch 'remotes/upstream/master'
Diffstat (limited to 'src/core/lombok/javac/JavacResolution.java')
-rw-r--r--src/core/lombok/javac/JavacResolution.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/core/lombok/javac/JavacResolution.java b/src/core/lombok/javac/JavacResolution.java
index ded6284b..8cc239e1 100644
--- a/src/core/lombok/javac/JavacResolution.java
+++ b/src/core/lombok/javac/JavacResolution.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2015 The Project Lombok Authors.
+ * Copyright (C) 2011-2018 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -31,6 +31,7 @@ import java.util.ArrayDeque;
import java.util.Map;
import javax.lang.model.type.TypeKind;
+import javax.tools.JavaFileObject;
import lombok.Lombok;
import lombok.core.debug.AssertionLogger;
@@ -59,6 +60,7 @@ import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
+import com.sun.tools.javac.util.Log;
public class JavacResolution {
private final Attr attr;
@@ -142,9 +144,14 @@ public class JavacResolution {
TreeMirrorMaker mirrorMaker = new TreeMirrorMaker(node.getTreeMaker(), node.getContext());
JCTree copy = mirrorMaker.copy(finder.copyAt());
-
- memberEnterAndAttribute(copy, finder.get(), node.getContext());
- return mirrorMaker.getOriginalToCopyMap();
+ Log log = Log.instance(node.getContext());
+ JavaFileObject oldFileObject = log.useSource(((JCCompilationUnit) node.top().get()).getSourceFile());
+ try {
+ memberEnterAndAttribute(copy, finder.get(), node.getContext());
+ return mirrorMaker.getOriginalToCopyMap();
+ } finally {
+ log.useSource(oldFileObject);
+ }
} finally {
messageSuppressor.enableLoggers();
}
@@ -222,6 +229,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);