1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Mon Oct 24 13:00:20 2011 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Mon Oct 24 13:00:30 2011 +0100 1.3 @@ -34,7 +34,8 @@ 1.4 import com.sun.tools.javac.code.Type.*; 1.5 import com.sun.tools.javac.code.Type.ForAll.ConstraintKind; 1.6 import com.sun.tools.javac.code.Symbol.*; 1.7 -import com.sun.tools.javac.util.JCDiagnostic; 1.8 +import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode; 1.9 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; 1.10 1.11 import static com.sun.tools.javac.code.TypeTags.*; 1.12 1.13 @@ -56,6 +57,7 @@ 1.14 Types types; 1.15 Check chk; 1.16 Resolve rs; 1.17 + Log log; 1.18 JCDiagnostic.Factory diags; 1.19 1.20 public static Infer instance(Context context) { 1.21 @@ -70,6 +72,7 @@ 1.22 syms = Symtab.instance(context); 1.23 types = Types.instance(context); 1.24 rs = Resolve.instance(context); 1.25 + log = Log.instance(context); 1.26 chk = Check.instance(context); 1.27 diags = JCDiagnostic.Factory.instance(context); 1.28 ambiguousNoInstanceException = 1.29 @@ -460,7 +463,7 @@ 1.30 // quantify result type with them 1.31 final List<Type> inferredTypes = insttypes.toList(); 1.32 final List<Type> all_tvars = tvars; //this is the wrong tvars 1.33 - return new UninferredMethodType(mt, restvars.toList()) { 1.34 + return new UninferredMethodType(env.tree.pos(), msym, mt, restvars.toList()) { 1.35 @Override 1.36 List<Type> getConstraints(TypeVar tv, ConstraintKind ck) { 1.37 for (Type t : restundet.toList()) { 1.38 @@ -502,13 +505,17 @@ 1.39 * type - when the return type is instantiated (see Infer.instantiateExpr) 1.40 * the underlying method type is also updated. 1.41 */ 1.42 - static abstract class UninferredMethodType extends DelegatedType { 1.43 + abstract class UninferredMethodType extends DelegatedType { 1.44 1.45 final List<Type> tvars; 1.46 + final Symbol msym; 1.47 + final DiagnosticPosition pos; 1.48 1.49 - public UninferredMethodType(MethodType mtype, List<Type> tvars) { 1.50 + public UninferredMethodType(DiagnosticPosition pos, Symbol msym, MethodType mtype, List<Type> tvars) { 1.51 super(METHOD, new MethodType(mtype.argtypes, null, mtype.thrown, mtype.tsym)); 1.52 this.tvars = tvars; 1.53 + this.msym = msym; 1.54 + this.pos = pos; 1.55 asMethodType().restype = new UninferredReturnType(tvars, mtype.restype); 1.56 } 1.57 1.58 @@ -543,6 +550,9 @@ 1.59 public Type inst(List<Type> actuals, Types types) { 1.60 Type newRestype = super.inst(actuals, types); 1.61 instantiateReturnType(newRestype, actuals, types); 1.62 + if (rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) { 1.63 + log.note(pos, "deferred.method.inst", msym, UninferredMethodType.this.qtype, newRestype); 1.64 + } 1.65 return newRestype; 1.66 } 1.67 @Override