--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Mon Oct 24 13:00:20 2011 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Mon Oct 24 13:00:30 2011 +0100
@@ -34,7 +34,8 @@
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.code.Type.ForAll.ConstraintKind;
import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.util.JCDiagnostic;
+import com.sun.tools.javac.comp.Resolve.VerboseResolutionMode;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import static com.sun.tools.javac.code.TypeTags.*;
@@ -56,6 +57,7 @@
Types types;
Check chk;
Resolve rs;
+ Log log;
JCDiagnostic.Factory diags;
public static Infer instance(Context context) {
@@ -70,6 +72,7 @@
syms = Symtab.instance(context);
types = Types.instance(context);
rs = Resolve.instance(context);
+ log = Log.instance(context);
chk = Check.instance(context);
diags = JCDiagnostic.Factory.instance(context);
ambiguousNoInstanceException =
@@ -460,7 +463,7 @@
// quantify result type with them
final List<Type> inferredTypes = insttypes.toList();
final List<Type> all_tvars = tvars; //this is the wrong tvars
- return new UninferredMethodType(mt, restvars.toList()) {
+ return new UninferredMethodType(env.tree.pos(), msym, mt, restvars.toList()) {
@Override
List<Type> getConstraints(TypeVar tv, ConstraintKind ck) {
for (Type t : restundet.toList()) {
@@ -502,13 +505,17 @@
* type - when the return type is instantiated (see Infer.instantiateExpr)
* the underlying method type is also updated.
*/
- static abstract class UninferredMethodType extends DelegatedType {
+ abstract class UninferredMethodType extends DelegatedType {
final List<Type> tvars;
+ final Symbol msym;
+ final DiagnosticPosition pos;
- public UninferredMethodType(MethodType mtype, List<Type> tvars) {
+ public UninferredMethodType(DiagnosticPosition pos, Symbol msym, MethodType mtype, List<Type> tvars) {
super(METHOD, new MethodType(mtype.argtypes, null, mtype.thrown, mtype.tsym));
this.tvars = tvars;
+ this.msym = msym;
+ this.pos = pos;
asMethodType().restype = new UninferredReturnType(tvars, mtype.restype);
}
@@ -543,6 +550,9 @@
public Type inst(List<Type> actuals, Types types) {
Type newRestype = super.inst(actuals, types);
instantiateReturnType(newRestype, actuals, types);
+ if (rs.verboseResolutionMode.contains(VerboseResolutionMode.DEFERRED_INST)) {
+ log.note(pos, "deferred.method.inst", msym, UninferredMethodType.this.qtype, newRestype);
+ }
return newRestype;
}
@Override