langtools/src/share/classes/com/sun/tools/javac/comp/Check.java
changeset 14057 b4b0377b8dba
parent 14054 7ae16dd77c90
child 14058 c7ec7facdd20
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Sat Sep 29 09:00:58 2012 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Oct 04 13:04:53 2012 +0100
@@ -40,6 +40,7 @@
 import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
 import com.sun.tools.javac.comp.Infer.InferenceContext;
 import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
 
@@ -68,6 +69,7 @@
     private final Resolve rs;
     private final Symtab syms;
     private final Enter enter;
+    private final DeferredAttr deferredAttr;
     private final Infer infer;
     private final Types types;
     private final JCDiagnostic.Factory diags;
@@ -100,6 +102,7 @@
         rs = Resolve.instance(context);
         syms = Symtab.instance(context);
         enter = Enter.instance(context);
+        deferredAttr = DeferredAttr.instance(context);
         infer = Infer.instance(context);
         this.types = Types.instance(context);
         diags = JCDiagnostic.Factory.instance(context);
@@ -433,6 +436,8 @@
         public Warner checkWarner(DiagnosticPosition pos, Type found, Type req);
 
         public Infer.InferenceContext inferenceContext();
+
+        public DeferredAttr.DeferredAttrContext deferredAttrContext();
     }
 
     /**
@@ -463,6 +468,10 @@
         public Infer.InferenceContext inferenceContext() {
             return enclosingContext.inferenceContext();
         }
+
+        public DeferredAttrContext deferredAttrContext() {
+            return enclosingContext.deferredAttrContext();
+        }
     }
 
     /**
@@ -483,6 +492,10 @@
         public InferenceContext inferenceContext() {
             return infer.emptyContext;
         }
+
+        public DeferredAttrContext deferredAttrContext() {
+            return deferredAttr.emptyDeferredAttrContext;
+        }
     };
 
     /** Check that a given type is assignable to a given proto-type.
@@ -817,6 +830,8 @@
                 sym.owner == syms.enumSym)
                 formals = formals.tail.tail;
         List<JCExpression> args = argtrees;
+        DeferredAttr.DeferredTypeMap checkDeferredMap =
+                deferredAttr.new DeferredTypeMap(DeferredAttr.AttrMode.CHECK, sym, env.info.pendingResolutionPhase);
         while (formals.head != last) {
             JCTree arg = args.head;
             Warner warn = convertWarner(arg.pos(), arg.type, formals.head);
@@ -835,7 +850,7 @@
         } else if ((sym.flags() & VARARGS) != 0 && allowVarargs) {
             // non-varargs call to varargs method
             Type varParam = owntype.getParameterTypes().last();
-            Type lastArg = argtypes.last();
+            Type lastArg = checkDeferredMap.apply(argtypes.last());
             if (types.isSubtypeUnchecked(lastArg, types.elemtype(varParam)) &&
                     !types.isSameType(types.erasure(varParam), types.erasure(lastArg)))
                 log.warning(argtrees.last().pos(), "inexact.non-varargs.call",
@@ -847,7 +862,7 @@
                     kindName(sym),
                     sym.name,
                     rs.methodArguments(sym.type.getParameterTypes()),
-                    rs.methodArguments(argtypes),
+                    rs.methodArguments(Type.map(argtypes, checkDeferredMap)),
                     kindName(sym.location()),
                     sym.location());
            owntype = new MethodType(owntype.getParameterTypes(),