langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
changeset 24226 08b586e22328
parent 23132 00a059740d87
child 24293 0d889f759fac
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Apr 30 23:02:14 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu May 01 20:36:11 2014 +0100
@@ -564,7 +564,7 @@
                                     tvars,
                                     (MethodType)mt,
                                     resultInfo,
-                                    m,
+                                    (MethodSymbol)m,
                                     argtypes,
                                     allowBoxing,
                                     useVarargs,
@@ -772,6 +772,7 @@
         public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
             return nilMethodCheck;
         }
+
     }
 
     /**
@@ -783,6 +784,11 @@
         void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
             //do nothing - actual always compatible to formals
         }
+
+        @Override
+        public String toString() {
+            return "arityMethodCheck";
+        }
     };
 
     List<Type> dummyArgs(int length) {
@@ -868,6 +874,11 @@
         public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
             return new MostSpecificCheck(strict, actuals);
         }
+
+        @Override
+        public String toString() {
+            return "resolveMethodCheck";
+        }
     };
 
     /**
@@ -899,7 +910,9 @@
                 @Override
                 public boolean compatible(Type found, Type req, Warner warn) {
                     found = pendingInferenceContext.asUndetVar(found);
-                    req = infer.returnConstraintTarget(found, req);
+                    if (found.hasTag(UNDETVAR) && req.isPrimitive()) {
+                        req = types.boxedClass(req).type;
+                    }
                     return super.compatible(found, req, warn);
                 }
 
@@ -915,6 +928,11 @@
         public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
             return new MostSpecificCheck(strict, actuals);
         }
+
+        @Override
+        public String toString() {
+            return "MethodReferenceCheck";
+        }
     }
 
     /**
@@ -954,6 +972,11 @@
         public DeferredAttrContext deferredAttrContext() {
             return deferredAttrContext;
         }
+
+        @Override
+        public String toString() {
+            return "MethodCheckContext";
+        }
     }
 
     /**
@@ -972,7 +995,12 @@
                 DeferredType dt = (DeferredType)found;
                 return dt.check(this);
             } else {
-                return super.check(pos, chk.checkNonVoid(pos, types.capture(U(found.baseType()))));
+                Type uResult = U(found.baseType());
+                Type capturedType = pos == null || pos.getTree() == null ?
+                        types.capture(uResult) :
+                        checkContext.inferenceContext()
+                            .cachedCapture(pos.getTree(), uResult, true);
+                return super.check(pos, chk.checkNonVoid(pos, capturedType));
             }
         }