langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java Wed Jul 05 21:09:59 2017 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java Tue Dec 22 16:37:52 2015 +0530
@@ -25,6 +25,7 @@
package com.sun.tools.javac.comp;
+import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.code.Scope.WriteableScope;
@@ -95,6 +96,13 @@
*/
Type defaultSuperCallSite = null;
+ /** Tree that when non null, is to be preferentially used in diagnostics.
+ * Usually Env<AttrContext>.tree is the tree to be referred to in messages,
+ * but this may not be true during the window a method is looked up in enclosing
+ * contexts (JDK-8145466)
+ */
+ JCTree preferredTreeForDiagnostics;
+
/** Duplicate this context, replacing scope field and copying all others.
*/
AttrContext dup(WriteableScope scope) {
@@ -112,6 +120,7 @@
info.isSpeculative = isSpeculative;
info.isAnonymousDiamond = isAnonymousDiamond;
info.isNewClass = isNewClass;
+ info.preferredTreeForDiagnostics = preferredTreeForDiagnostics;
return info;
}