diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-01-09 00:46:44 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-01-09 00:46:44 +0100 |
commit | 369df91756e632b32440eb585253f7fb1ddba9d2 (patch) | |
tree | c7250991eba453ae39661ad0e85bd9693faf98a3 /src/core/lombok/javac/JavacResolution.java | |
parent | 14407cedb5e061d8e7a53ebdd167dc82db779df0 (diff) | |
download | lombok-369df91756e632b32440eb585253f7fb1ddba9d2.tar.gz lombok-369df91756e632b32440eb585253f7fb1ddba9d2.tar.bz2 lombok-369df91756e632b32440eb585253f7fb1ddba9d2.zip |
[fixes #1554] javac9 now caches type lookups based on ‘position’ which is slapped together by a tuple based on the position (as gleaned from the JCTree object) and the source file (as gleaned from.. Log. *facepalm*). We didn’t update log when resolving for i.e. ‘val’, so the caches get all jumbled up. Fixed by setting the Log’s ‘useSource’ method.
Diffstat (limited to 'src/core/lombok/javac/JavacResolution.java')
-rw-r--r-- | src/core/lombok/javac/JavacResolution.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/core/lombok/javac/JavacResolution.java b/src/core/lombok/javac/JavacResolution.java index 79c7cad2..26ba86c0 100644 --- a/src/core/lombok/javac/JavacResolution.java +++ b/src/core/lombok/javac/JavacResolution.java @@ -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(); } |