changeset 2247:91c60b02c849

8016177: structural most specific and stuckness 8016178: Order of unsticking functional expressions Simplified interaction between stuck expressions and overload resolution. Now implicit lambdas are considered as stuck and cannot be used to disambiguate between multiple applicable methods (same holds for overloaded method reference). In such cases, disambiguation is only provided by the provisional applicability arity-based check. Added new warning (-Xlint:overloads) to flag potentially ambiguous declarations.
author mcimadamore
date Thu, 08 Aug 2013 14:30:47 +0100
parents 93e9a9aa6e18
children 0184ece97062
files src/share/classes/com/sun/tools/javac/code/Flags.java src/share/classes/com/sun/tools/javac/code/Lint.java src/share/classes/com/sun/tools/javac/code/Types.java src/share/classes/com/sun/tools/javac/comp/Attr.java src/share/classes/com/sun/tools/javac/comp/Check.java src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java src/share/classes/com/sun/tools/javac/comp/Infer.java src/share/classes/com/sun/tools/javac/comp/Resolve.java src/share/classes/com/sun/tools/javac/resources/compiler.properties test/tools/javac/Diagnostics/compressed/T8012003c.java test/tools/javac/Diagnostics/compressed/T8012003c.out test/tools/javac/diags/examples/BadArgTypesInLambda.java test/tools/javac/diags/examples/PotentiallyAmbiguousOverload.java test/tools/javac/lambda/8016177/T8016177a.java test/tools/javac/lambda/8016177/T8016177a.out test/tools/javac/lambda/8016177/T8016177c.java test/tools/javac/lambda/8016177/T8016177c.out test/tools/javac/lambda/8019480/T8019480.out test/tools/javac/lambda/BadRecovery.out test/tools/javac/lambda/ErroneousLambdaExpr.java test/tools/javac/lambda/ErroneousLambdaExpr.out test/tools/javac/lambda/MethodReference22.out test/tools/javac/lambda/MethodReference23.out test/tools/javac/lambda/MethodReference41.java test/tools/javac/lambda/MethodReference41.out test/tools/javac/lambda/MethodReference42.java test/tools/javac/lambda/MethodReference42.out test/tools/javac/lambda/MethodReference43.java test/tools/javac/lambda/MethodReference43.out test/tools/javac/lambda/MethodReference44.java test/tools/javac/lambda/MethodReference44.out test/tools/javac/lambda/MethodReference46.java test/tools/javac/lambda/MethodReference46.out test/tools/javac/lambda/MethodReference47.java test/tools/javac/lambda/MethodReference47.out test/tools/javac/lambda/MethodReference48.java test/tools/javac/lambda/MethodReference48.out test/tools/javac/lambda/MethodReference70.out test/tools/javac/lambda/MethodReference71.out test/tools/javac/lambda/MostSpecific04.java test/tools/javac/lambda/MostSpecific04.out test/tools/javac/lambda/MostSpecific05.java test/tools/javac/lambda/MostSpecific05.out test/tools/javac/lambda/MostSpecific08.java test/tools/javac/lambda/MostSpecific08.out test/tools/javac/lambda/TargetType01.java test/tools/javac/lambda/TargetType01.out test/tools/javac/lambda/TargetType02.java test/tools/javac/lambda/TargetType02.out test/tools/javac/lambda/TargetType21.java test/tools/javac/lambda/TargetType21.out test/tools/javac/lambda/TargetType24.java test/tools/javac/lambda/TargetType24.out test/tools/javac/lambda/TargetType26.out test/tools/javac/lambda/TargetType39.out test/tools/javac/lambda/TargetType43.out test/tools/javac/lambda/TargetType57.out test/tools/javac/lambda/TargetType66.java test/tools/javac/lambda/TargetType66.out test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java test/tools/javac/lambda/typeInference/InferenceTest5.java test/tools/javac/lambda/typeInference/InferenceTest_neg1_2.out
diffstat 62 files changed, 587 insertions(+), 606 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/code/Flags.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Flags.java	Thu Aug 08 14:30:47 2013 +0100
@@ -265,6 +265,11 @@
      * Flag that marks inference variables used in a 'throws' clause
      */
     public static final long THROWS = 1L<<47;
+    
+    /**
+     * Flag that marks potentially ambiguous overloads
+     */
+    public static final long POTENTIALLY_AMBIGUOUS = 1L<<48;
 
     /** Modifier masks.
      */
--- a/src/share/classes/com/sun/tools/javac/code/Lint.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Lint.java	Thu Aug 08 14:30:47 2013 +0100
@@ -173,6 +173,11 @@
          * Warn about issues relating to use of command line options
          */
         OPTIONS("options"),
+        
+        /**
+         * Warn about issues regarding method overloads.
+         */
+        OVERLOADS("overloads"),
 
         /**
          * Warn about issues regarding method overrides.
--- a/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Aug 08 14:30:47 2013 +0100
@@ -3014,7 +3014,7 @@
     /**
      * Does t have the same bounds for quantified variables as s?
      */
-    boolean hasSameBounds(ForAll t, ForAll s) {
+    public boolean hasSameBounds(ForAll t, ForAll s) {
         List<Type> l1 = t.tvars;
         List<Type> l2 = s.tvars;
         while (l1.nonEmpty() && l2.nonEmpty() &&
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Aug 08 14:30:47 2013 +0100
@@ -2386,36 +2386,12 @@
                 recoveryInfo :
                 new ResultInfo(VAL, lambdaType.getReturnType(), funcContext);
             localEnv.info.returnResult = bodyResultInfo;
-
-            Log.DeferredDiagnosticHandler lambdaDeferredHandler = new Log.DeferredDiagnosticHandler(log);
-            try {
-                if (that.getBodyKind() == JCLambda.BodyKind.EXPRESSION) {
-                    attribTree(that.getBody(), localEnv, bodyResultInfo);
-                } else {
-                    JCBlock body = (JCBlock)that.body;
-                    attribStats(body.stats, localEnv);
-                }
-
-                if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.SPECULATIVE) {
-                    //check for errors in lambda body
-                    for (JCDiagnostic deferredDiag : lambdaDeferredHandler.getDiagnostics()) {
-                        if (deferredDiag.getKind() == JCDiagnostic.Kind.ERROR) {
-                            resultInfo.checkContext
-                                    .report(that, diags.fragment("bad.arg.types.in.lambda", TreeInfo.types(that.params),
-                                    deferredDiag)); //hidden diag parameter
-                            //we mark the lambda as erroneous - this is crucial in the recovery step
-                            //as parameter-dependent type error won't be reported in that stage,
-                            //meaning that a lambda will be deemed erroeneous only if there is
-                            //a target-independent error (which will cause method diagnostic
-                            //to be skipped).
-                            result = that.type = types.createErrorType(target);
-                            return;
-                        }
-                    }
-                }
-            } finally {
-                lambdaDeferredHandler.reportDeferredDiagnostics();
-                log.popDiagnosticHandler(lambdaDeferredHandler);
+            
+            if (that.getBodyKind() == JCLambda.BodyKind.EXPRESSION) {
+                attribTree(that.getBody(), localEnv, bodyResultInfo);
+            } else {
+                JCBlock body = (JCBlock)that.body;
+                attribStats(body.stats, localEnv);
             }
 
             result = check(that, target, VAL, resultInfo);
@@ -3717,7 +3693,7 @@
      * Check that method arguments conform to its instantiation.
      **/
     public Type checkMethod(Type site,
-                            Symbol sym,
+                            final Symbol sym,
                             ResultInfo resultInfo,
                             Env<AttrContext> env,
                             final List<JCExpression> argtrees,
@@ -3806,8 +3782,19 @@
             resultInfo.checkContext.report(env.tree.pos(), ex.getDiagnostic());
             return types.createErrorType(site);
         } catch (Resolve.InapplicableMethodException ex) {
-            Assert.error(ex.getDiagnostic().getMessage(Locale.getDefault()));
-            return null;
+            final JCDiagnostic diag = ex.getDiagnostic();
+            Resolve.InapplicableSymbolError errSym = rs.new InapplicableSymbolError(null) {
+                @Override
+                protected Pair<Symbol, JCDiagnostic> errCandidate() {
+                    return new Pair<Symbol, JCDiagnostic>(sym, diag);
+                }
+            };
+            List<Type> argtypes2 = Type.map(argtypes,
+                    rs.new ResolveDeferredRecoveryMap(AttrMode.CHECK, sym, env.info.pendingResolutionPhase));
+            JCDiagnostic errDiag = errSym.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
+                    env.tree, sym, site, sym.name, argtypes2, typeargtypes);
+            log.report(errDiag);
+            return types.createErrorType(site);
         }
     }
 
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Aug 08 14:30:47 2013 +0100
@@ -2355,7 +2355,10 @@
         //for each method m1 that is overridden (directly or indirectly)
         //by method 'sym' in 'site'...
         for (Symbol m1 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
-            if (!sym.overrides(m1, site.tsym, types, false)) continue;
+             if (!sym.overrides(m1, site.tsym, types, false)) {
+                 checkPotentiallyAmbiguousOverloads(pos, site, sym, (MethodSymbol)m1);
+                 continue;
+             }
              //...check each method m2 that is a member of 'site'
              for (Symbol m2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
                 if (m2 == m1) continue;
@@ -2393,14 +2396,17 @@
         for (Symbol s : types.membersClosure(site, true).getElementsByName(sym.name, cf)) {
             //if (i) the signature of 'sym' is not a subsignature of m1 (seen as
             //a member of 'site') and (ii) 'sym' has the same erasure as m1, issue an error
-            if (!types.isSubSignature(sym.type, types.memberType(site, s), allowStrictMethodClashCheck) &&
-                    types.hasSameArgs(s.erasure(types), sym.erasure(types))) {
-                log.error(pos,
-                        "name.clash.same.erasure.no.hide",
-                        sym, sym.location(),
-                        s, s.location());
-                return;
-             }
+            if (!types.isSubSignature(sym.type, types.memberType(site, s), allowStrictMethodClashCheck)) {
+                if  (types.hasSameArgs(s.erasure(types), sym.erasure(types))) {
+                    log.error(pos,
+                            "name.clash.same.erasure.no.hide",
+                            sym, sym.location(),
+                            s, s.location());
+                    return;
+                } else {
+                    checkPotentiallyAmbiguousOverloads(pos, site, sym, (MethodSymbol)s);
+                }
+            }
          }
      }
 
@@ -2427,6 +2433,56 @@
          }
      }
      
+     /**
+      * Report warnings for potentially ambiguous method declarations. Two declarations
+      * are potentially ambiguous if they feature two unrelated functional interface
+      * in same argument position (in which case, a call site passing an implicit
+      * lambda would be ambigiuous).
+      */
+     void checkPotentiallyAmbiguousOverloads(DiagnosticPosition pos, Type site,
+             MethodSymbol msym1, MethodSymbol msym2) {
+         if (msym1 != msym2 &&
+                 allowDefaultMethods &&
+                 lint.isEnabled(LintCategory.OVERLOADS) &&
+                 (msym1.flags() & POTENTIALLY_AMBIGUOUS) == 0 &&
+                 (msym2.flags() & POTENTIALLY_AMBIGUOUS) == 0) {
+            Type mt1 = types.memberType(site, msym1);
+            Type mt2 = types.memberType(site, msym2);
+            //if both generic methods, adjust type variables
+            if (mt1.hasTag(FORALL) && mt2.hasTag(FORALL) &&
+                    types.hasSameBounds((ForAll)mt1, (ForAll)mt2)) {
+                mt2 = types.subst(mt2, ((ForAll)mt2).tvars, ((ForAll)mt1).tvars);
+            }
+            //expand varargs methods if needed
+            int maxLength = Math.max(mt1.getParameterTypes().length(), mt2.getParameterTypes().length());
+            List<Type> args1 = rs.adjustArgs(mt1.getParameterTypes(), msym1, maxLength, true);
+            List<Type> args2 = rs.adjustArgs(mt2.getParameterTypes(), msym2, maxLength, true);
+            //if arities don't match, exit
+            if (args1.length() != args2.length()) return;
+            while (args1.nonEmpty() && args2.nonEmpty()) {
+                Type s = args1.head;
+                Type t = args2.head;
+                if (types.isFunctionalInterface(s) && types.isFunctionalInterface(t) &&
+                        !types.isSameType(t, s) &&
+                        types.isSubtype(t, s) == types.isSubtype(s, t) &&
+                        types.findDescriptorType(s).getParameterTypes().length() > 0 &&
+                        types.findDescriptorType(s).getParameterTypes().length() ==
+                        types.findDescriptorType(t).getParameterTypes().length()) {
+                    //we found two incompatible functional interfaces with same arity
+                    //this means a call site passing an implicit lambda would be ambigiuous
+                    msym1.flags_field |= POTENTIALLY_AMBIGUOUS;
+                    msym2.flags_field |= POTENTIALLY_AMBIGUOUS;
+                    log.warning(LintCategory.OVERLOADS, pos, "potentially.ambiguous.overload",
+                                msym1, msym1.location(),
+                                msym2, msym2.location());
+                    return;
+                }
+                args1 = args1.tail;
+                args2 = args2.tail;
+            }
+         }
+     }  
+     
      void checkDefaultMethodClashes(DiagnosticPosition pos, Type site) {
         DefaultMethodClashFilter dcf = new DefaultMethodClashFilter(site);
         for (Symbol m : types.membersClosure(site, false).getElements(dcf)) {
--- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Thu Aug 08 14:30:47 2013 +0100
@@ -100,7 +100,7 @@
         emptyDeferredAttrContext =
             new DeferredAttrContext(AttrMode.CHECK, null, MethodResolutionPhase.BOX, infer.emptyContext, null, null) {
                 @Override
-                void addDeferredAttrNode(DeferredType dt, ResultInfo ri, Set<Type> stuckVars, Set<Type> outVars) {
+                void addDeferredAttrNode(DeferredType dt, ResultInfo ri, DeferredStuckPolicy deferredStuckPolicy) {
                     Assert.error("Empty deferred context!");
                 }
                 @Override
@@ -201,17 +201,24 @@
          * attribution round must follow one or more speculative rounds.
          */
         Type check(ResultInfo resultInfo) {
-            Pair<Set<Type>, Set<Type>> stuckRes = stuckVars(tree, env, resultInfo);
-            return check(resultInfo, stuckRes.fst, stuckRes.snd, basicCompleter);
+            DeferredStuckPolicy deferredStuckPolicy;
+            if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
+                deferredStuckPolicy = dummyStuckPolicy;
+            } else if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.SPECULATIVE) {
+                deferredStuckPolicy = new OverloadStuckPolicy(resultInfo, this);
+            } else {
+                deferredStuckPolicy = new CheckStuckPolicy(resultInfo, this);
+            }
+            return check(resultInfo, deferredStuckPolicy, basicCompleter);
         }
 
-        private Type check(ResultInfo resultInfo, Set<Type> stuckVars, Set<Type> depVars,
+        private Type check(ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy,
                 DeferredTypeCompleter deferredTypeCompleter) {
             DeferredAttrContext deferredAttrContext =
                     resultInfo.checkContext.deferredAttrContext();
             Assert.check(deferredAttrContext != emptyDeferredAttrContext);
-            if (!stuckVars.isEmpty()) {
-                deferredAttrContext.addDeferredAttrNode(this, resultInfo, stuckVars, depVars);
+            if (deferredStuckPolicy.isStuck()) {
+                deferredAttrContext.addDeferredAttrNode(this, resultInfo, deferredStuckPolicy);
                 return Type.noType;
             } else {
                 try {
@@ -235,6 +242,7 @@
          */
         Type complete(DeferredType dt, ResultInfo resultInfo, DeferredAttrContext deferredAttrContext);
     }
+    
 
     /**
      * A basic completer for deferred types. This completer type-checks a deferred type
@@ -266,6 +274,45 @@
             return dt.tree.type = Type.stuckType;
         }
     };
+    
+    /**
+     * Policy for detecting stuck expressions. Different criteria might cause
+     * an expression to be judged as stuck, depending on whether the check
+     * is performed during overload resolution or after most specific.
+     */
+    interface DeferredStuckPolicy {
+        /**
+         * Has the policy detected that a given expression should be considered stuck?
+         */
+        boolean isStuck();
+        /**
+         * Get the set of inference variables a given expression depends upon.
+         */
+        Set<Type> stuckVars();
+        /**
+         * Get the set of inference variables which might get new constraints
+         * if a given expression is being type-checked.
+         */
+        Set<Type> depVars();
+    }
+    
+    /**
+     * Basic stuck policy; an expression is never considered to be stuck.
+     */
+    DeferredStuckPolicy dummyStuckPolicy = new DeferredStuckPolicy() {
+        @Override
+        public boolean isStuck() {
+            return false;
+        }
+        @Override
+        public Set<Type> stuckVars() {
+            return Collections.emptySet();
+        }
+        @Override
+        public Set<Type> depVars() {
+            return Collections.emptySet();
+        }
+    };
 
     /**
      * The 'mode' in which the deferred type is to be type-checked
@@ -389,8 +436,8 @@
          * Nodes added this way act as 'roots' for the out-of-order method checking process.
          */
         void addDeferredAttrNode(final DeferredType dt, ResultInfo resultInfo,
-                Set<Type> stuckVars, Set<Type> depVars) {
-            deferredAttrNodes.add(new DeferredAttrNode(dt, resultInfo, stuckVars, depVars));
+                DeferredStuckPolicy deferredStuckPolicy) {
+            deferredAttrNodes.add(new DeferredAttrNode(dt, resultInfo, deferredStuckPolicy));
         }
 
         /**
@@ -408,11 +455,12 @@
                 //attribution round can add new nodes to the list
                 for (DeferredAttrNode deferredAttrNode : List.from(deferredAttrNodes)) {
                     if (!deferredAttrNode.process(this)) {
-                        List<Type> restStuckVars = List.from(deferredAttrNode.stuckVars)
+                        List<Type> restStuckVars =
+                                List.from(deferredAttrNode.deferredStuckPolicy.stuckVars())
                                 .intersect(inferenceContext.restvars());
                         stuckVars = stuckVars.prependList(restStuckVars);
                         //update dependency map
-                        for (Type t : List.from(deferredAttrNode.depVars)
+                        for (Type t : List.from(deferredAttrNode.deferredStuckPolicy.depVars())
                                 .intersect(inferenceContext.restvars())) {
                             Set<Type> prevDeps = depVarsMap.get(t);
                             if (prevDeps == null) {
@@ -427,12 +475,14 @@
                     }
                 }
                 if (!progress) {
+                    if (mode == AttrMode.SPECULATIVE) {
+                        //unsticking does not take place during overload
+                        break;
+                    }
                     //remove all variables that have already been instantiated
                     //from the list of stuck variables
                     try {
-                        inferenceContext.solveAny(stuckVars, depVarsMap,
-                                mode == AttrMode.SPECULATIVE ? targetFreevars() : List.<Type>nil(),
-                                warn);
+                        inferenceContext.solveAny(stuckVars, depVarsMap, warn);
                         inferenceContext.notifyChange();
                     } catch (Infer.GraphStrategy.NodeNotFoundException ex) {
                         //this means that we are in speculative mode and the
@@ -468,7 +518,7 @@
      * Class representing a deferred attribution node. It keeps track of
      * a deferred type, along with the expected target type information.
      */
-    class DeferredAttrNode implements Infer.FreeTypeListener {
+    class DeferredAttrNode {
 
         /** underlying deferred type */
         DeferredType dt;
@@ -476,27 +526,13 @@
         /** underlying target type information */
         ResultInfo resultInfo;
 
-        /** set of uninferred inference variables causing this node to be stuck */
-        Set<Type> stuckVars;
-        
-        /** set of uninferred inference variables that depends on this node */
-        Set<Type> depVars;
-        
+        /** stuck policy associated with this node */
+        DeferredStuckPolicy deferredStuckPolicy;
 
-        DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, Set<Type> stuckVars, Set<Type> depVars) {
+        DeferredAttrNode(DeferredType dt, ResultInfo resultInfo, DeferredStuckPolicy deferredStuckPolicy) {
             this.dt = dt;
             this.resultInfo = resultInfo;
-            this.stuckVars = stuckVars;
-            this.depVars = depVars;
-            if (!stuckVars.isEmpty()) {
-                resultInfo.checkContext.inferenceContext().addFreeTypeListener(List.from(stuckVars), this);
-            }
-        }
-
-        @Override
-        public void typesInferred(InferenceContext inferenceContext) {
-            stuckVars.clear();
-            resultInfo = resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
+            this.deferredStuckPolicy = deferredStuckPolicy;            
         }
 
         /**
@@ -507,20 +543,18 @@
         boolean process(final DeferredAttrContext deferredAttrContext) {
             switch (deferredAttrContext.mode) {
                 case SPECULATIVE:
-                    if (!stuckVars.isEmpty()) {
-                        dt.check(resultInfo, Collections.<Type>emptySet(),
-                                    Collections.<Type>emptySet(), new StructuralStuckChecker());
-                        return false;
+                    if (deferredStuckPolicy.isStuck()) {
+                        dt.check(resultInfo, dummyStuckPolicy, new StructuralStuckChecker());
+                        return true;
                     } else {
-                        dt.check(resultInfo, stuckVars, depVars, basicCompleter);
-                        return true;
+                        Assert.error("Cannot get here");
                     }
                 case CHECK:
-                    if (!stuckVars.isEmpty()) {
+                    if (deferredStuckPolicy.isStuck()) {
                         //stuck expression - see if we can propagate
                         if (deferredAttrContext.parent != emptyDeferredAttrContext &&
                                 Type.containsAny(deferredAttrContext.parent.inferenceContext.inferencevars,
-                                        List.from(stuckVars))) {
+                                        List.from(deferredStuckPolicy.stuckVars()))) {
                             deferredAttrContext.parent.addDeferredAttrNode(dt,
                                     resultInfo.dup(new Check.NestedCheckContext(resultInfo.checkContext) {
                                 @Override
@@ -531,15 +565,16 @@
                                 public DeferredAttrContext deferredAttrContext() {
                                     return deferredAttrContext.parent;
                                 }
-                            }), stuckVars, depVars);
-                            dt.check(resultInfo, Collections.<Type>emptySet(),
-                                    Collections.<Type>emptySet(), dummyCompleter);
+                            }), deferredStuckPolicy);
+                            dt.tree.type = Type.stuckType;
                             return true;
                         } else {
                             return false;
                         }
                     } else {
-                        dt.check(resultInfo, stuckVars, depVars, basicCompleter);
+                        ResultInfo instResultInfo =
+                                resultInfo.dup(deferredAttrContext.inferenceContext.asInstType(resultInfo.pt));
+                        dt.check(instResultInfo, dummyStuckPolicy, basicCompleter);
                         return true;
                     }
                 default:
@@ -626,9 +661,7 @@
                         case Kinds.ABSENT_MTH:
                         case Kinds.WRONG_MTH:
                         case Kinds.WRONG_MTHS:
-                        case Kinds.STATICERR:
-                        case Kinds.MISSING_ENCL:
-                           checkContext.report(null, diags.fragment("incompatible.arg.types.in.mref"));
+                           checkContext.report(tree, diags.fragment("incompatible.arg.types.in.mref"));
                     }
                 }
             }
@@ -654,18 +687,12 @@
                     infer.emptyContext, emptyDeferredAttrContext, types.noWarnings);
         }
 
-        protected boolean validState(DeferredType dt) {
-            return dt.mode != null &&
-                    deferredAttrContext.mode.ordinal() <= dt.mode.ordinal();
-        }
-
         @Override
         public Type apply(Type t) {
             if (!t.hasTag(DEFERRED)) {
                 return t.map(this);
             } else {
                 DeferredType dt = (DeferredType)t;
-                Assert.check(validState(dt));
                 return typeOf(dt);
             }
         }
@@ -702,11 +729,6 @@
                         recover(dt) : owntype;
         }
 
-        @Override
-        protected boolean validState(DeferredType dt) {
-            return true;
-        }
-
         /**
          * Synthesize a type for a deferred type that hasn't been previously
          * reduced to an ordinary type. Functional deferred types and conditionals
@@ -726,26 +748,6 @@
     }
 
     /**
-     * Retrieves the list of inference variables that need to be inferred before
-     * an AST node can be type-checked, along with the inference variables that
-     * will get constraints should the stuck expression be type-checked.
-     */
-    @SuppressWarnings("fallthrough")
-    Pair<Set<Type>, Set<Type>> stuckVars(JCTree tree, Env<AttrContext> env, ResultInfo resultInfo) {
-        if (resultInfo.pt.hasTag(NONE) || resultInfo.pt.isErroneous()) {
-            return new Pair<Set<Type>, Set<Type>>(Collections.<Type>emptySet(), Collections.<Type>emptySet());
-        } else {
-            return stuckVarsInternal(tree, resultInfo.pt, env, resultInfo.checkContext.inferenceContext());
-        }
-    }
-    //where
-        private Pair<Set<Type>, Set<Type>> stuckVarsInternal(JCTree tree, Type pt, Env<AttrContext> env, Infer.InferenceContext inferenceContext) {
-            StuckChecker sc = new StuckChecker(pt, env, inferenceContext);
-            sc.scan(tree);
-            return new Pair<Set<Type>, Set<Type>>(sc.stuckVars, sc.depVars);
-        }
-
-    /**
      * A special tree scanner that would only visit portions of a given tree.
      * The set of nodes visited by the scanner can be customized at construction-time.
      */
@@ -810,28 +812,51 @@
             //do nothing
         }
     }
-
+    
     /**
      * This visitor is used to check that structural expressions conform
      * to their target - this step is required as inference could end up
      * inferring types that make some of the nested expressions incompatible
      * with their corresponding instantiated target
      */
-    class StuckChecker extends PolyScanner {
-
+    class CheckStuckPolicy extends PolyScanner implements DeferredStuckPolicy, Infer.FreeTypeListener {
+        
         Type pt;
-        Env<AttrContext> env;
         Infer.InferenceContext inferenceContext;
         Set<Type> stuckVars = new LinkedHashSet<Type>();
         Set<Type> depVars = new LinkedHashSet<Type>();
 
-        StuckChecker(Type pt, Env<AttrContext> env, Infer.InferenceContext inferenceContext) {
-            this.pt = pt;
-            this.env = env;
-            this.inferenceContext = inferenceContext;
+        @Override
+        public boolean isStuck() {
+            return !stuckVars.isEmpty();
         }
 
         @Override
+        public Set<Type> stuckVars() {
+            return stuckVars;
+        }
+
+        @Override
+        public Set<Type> depVars() {
+            return depVars;
+        }
+
+        public CheckStuckPolicy(ResultInfo resultInfo, DeferredType dt) {
+            this.pt = resultInfo.pt;
+            this.inferenceContext = resultInfo.checkContext.inferenceContext();
+            scan(dt.tree);
+            if (!stuckVars.isEmpty()) {
+                resultInfo.checkContext.inferenceContext()
+                        .addFreeTypeListener(List.from(stuckVars), this);
+            }
+        }
+        
+        @Override
+        public void typesInferred(InferenceContext inferenceContext) {
+            stuckVars.clear();            
+        }
+        
+        @Override
         public void visitLambda(JCLambda tree) {
             if (inferenceContext.inferenceVars().contains(pt)) {
                 stuckVars.add(pt);
@@ -871,19 +896,25 @@
 
         void scanLambdaBody(JCLambda lambda, final Type pt) {
             if (lambda.getBodyKind() == JCTree.JCLambda.BodyKind.EXPRESSION) {
-                Pair<Set<Type>, Set<Type>> stuckRes =
-                        stuckVarsInternal(lambda.body, pt, env, inferenceContext);
-                stuckVars.addAll(stuckRes.fst);
-                depVars.addAll(stuckRes.snd);
+                Type prevPt = this.pt;
+                try {
+                    this.pt = pt;
+                    scan(lambda.body);
+                } finally {
+                    this.pt = prevPt;
+                }
             } else {
                 LambdaReturnScanner lambdaScanner = new LambdaReturnScanner() {
                     @Override
                     public void visitReturn(JCReturn tree) {
                         if (tree.expr != null) {
-                            Pair<Set<Type>, Set<Type>> stuckRes =
-                                    stuckVarsInternal(tree.expr, pt, env, inferenceContext);
-                            stuckVars.addAll(stuckRes.fst);
-                            depVars.addAll(stuckRes.snd);
+                            Type prevPt = CheckStuckPolicy.this.pt;
+                            try {
+                                CheckStuckPolicy.this.pt = pt;
+                                CheckStuckPolicy.this.scan(tree.expr);
+                            } finally {
+                                CheckStuckPolicy.this.pt = prevPt;
+                            }
                         }
                     }
                 };
@@ -891,6 +922,42 @@
             }
         }
     }
+    
+    /**
+     * This visitor is used to check that structural expressions conform
+     * to their target - this step is required as inference could end up
+     * inferring types that make some of the nested expressions incompatible
+     * with their corresponding instantiated target
+     */
+    class OverloadStuckPolicy extends CheckStuckPolicy implements DeferredStuckPolicy {
+        
+        boolean stuck;
+
+        @Override
+        public boolean isStuck() {
+            return super.isStuck() || stuck;
+        }
+
+        public OverloadStuckPolicy(ResultInfo resultInfo, DeferredType dt) {
+            super(resultInfo, dt);
+        }
+        
+        @Override
+        public void visitLambda(JCLambda tree) {
+            super.visitLambda(tree);
+            if (tree.paramKind == JCLambda.ParameterKind.IMPLICIT) {
+                stuck = true;
+            }
+        }
+
+        @Override
+        public void visitReference(JCMemberReference tree) {
+            super.visitReference(tree);
+            if (tree.overloadKind == JCMemberReference.OverloadKind.OVERLOADED) {
+                stuck = true;
+            }
+        }
+    }
 
     /**
      * Does the argument expression {@code expr} need speculative type-checking?
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1059,13 +1059,9 @@
 
         /** list of ivars of which at least one must be solved */
         List<Type> varsToSolve;
-        
-        /** list of ivars that the solver should not touch */
-        List<Type> varsToAvoid;
 
-        BestLeafSolver(List<Type> varsToSolve, List<Type> varsToAvoid) {
+        BestLeafSolver(List<Type> varsToSolve) {
             this.varsToSolve = varsToSolve;
-            this.varsToAvoid = varsToAvoid;
         }
 
         /**
@@ -1114,18 +1110,12 @@
         public Node pickNode(final InferenceGraph g) {
             treeCache.clear(); //graph changes at every step - cache must be cleared
             Pair<List<Node>, Integer> bestPath = noPath;
-            Set<Node> avoidClosure = new LinkedHashSet<Node>();
-            //compute closure of all variables to avoid
-            for (Type t : varsToAvoid) {
-                avoidClosure.addAll(g.findNode(t).closure(DependencyKind.BOUND));
-            }
             for (Node n : g.nodes) {
                 if (!Collections.disjoint(n.data, varsToSolve)) {
                     Pair<List<Node>, Integer> path = computeTreeToLeafs(n);
                     //discard all paths containing at least a node in the
                     //closure computed above
-                    if (Collections.disjoint(path.fst, avoidClosure) &&
-                            path.snd < bestPath.snd) {
+                    if (path.snd < bestPath.snd) {
                         bestPath = path;
                     }
                 }
@@ -2018,7 +2008,7 @@
          * Solve all variables in the given list.
          */
         public void solve(final List<Type> vars, Warner warn) {
-            solve(new BestLeafSolver(vars, List.<Type>nil()) {
+            solve(new BestLeafSolver(vars) {
                 public boolean done() {
                     return !free(asInstTypes(vars));
                 }
@@ -2028,8 +2018,8 @@
         /**
          * Solve at least one variable in given list.
          */
-        public void solveAny(List<Type> varsToSolve, Map<Type, Set<Type>> optDeps, List<Type> varsToAvoid, Warner warn) {
-            solve(new BestLeafSolver(varsToSolve.intersect(restvars()), varsToAvoid) {
+        public void solveAny(List<Type> varsToSolve, Map<Type, Set<Type>> optDeps, Warner warn) {
+            solve(new BestLeafSolver(varsToSolve.intersect(restvars())) {
                 public boolean done() {
                     return instvars().intersect(varsToSolve).nonEmpty();
                 }
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Aug 08 14:30:47 2013 +0100
@@ -568,8 +568,10 @@
                                     currentResolutionContext,
                                     warn);
 
-        currentResolutionContext.methodCheck.argumentsAcceptable(env, currentResolutionContext.deferredAttrContext(m, infer.emptyContext, resultInfo, warn),
+        DeferredAttr.DeferredAttrContext dc = currentResolutionContext.deferredAttrContext(m, infer.emptyContext, resultInfo, warn);
+        currentResolutionContext.methodCheck.argumentsAcceptable(env, dc,
                                 argtypes, mt.getParameterTypes(), warn);
+        dc.complete();
         return mt;
     }
 
@@ -1555,7 +1557,8 @@
             currentResolutionContext = prevResolutionContext;
         }
     }
-    private List<Type> adjustArgs(List<Type> args, Symbol msym, int length, boolean allowVarargs) {
+
+    List<Type> adjustArgs(List<Type> args, Symbol msym, int length, boolean allowVarargs) {
         if ((msym.flags() & VARARGS) != 0 && allowVarargs) {
             Type varargsElem = types.elemtype(args.last());
             if (varargsElem == null) {
@@ -2213,32 +2216,32 @@
         public List<Type> getArgumentTypes(ResolveError errSym, Symbol accessedSym, Name name, List<Type> argtypes) {
             return (syms.operatorNames.contains(name)) ?
                     argtypes :
-                    Type.map(argtypes, new ResolveDeferredRecoveryMap(accessedSym));
-        }
-
-        class ResolveDeferredRecoveryMap extends DeferredAttr.RecoveryDeferredTypeMap {
-
-            public ResolveDeferredRecoveryMap(Symbol msym) {
-                deferredAttr.super(AttrMode.SPECULATIVE, msym, currentResolutionContext.step);
-            }
-
-            @Override
-            protected Type typeOf(DeferredType dt) {
-                Type res = super.typeOf(dt);
-                if (!res.isErroneous()) {
-                    switch (TreeInfo.skipParens(dt.tree).getTag()) {
-                        case LAMBDA:
-                        case REFERENCE:
-                            return dt;
-                        case CONDEXPR:
-                            return res == Type.recoveryType ?
-                                    dt : res;
-                    }
-                }
-                return res;
-            }
+                    Type.map(argtypes, new ResolveDeferredRecoveryMap(AttrMode.SPECULATIVE, accessedSym, currentResolutionContext.step));
         }
     };
+    
+    class ResolveDeferredRecoveryMap extends DeferredAttr.RecoveryDeferredTypeMap {
+
+        public ResolveDeferredRecoveryMap(AttrMode mode, Symbol msym, MethodResolutionPhase step) {
+            deferredAttr.super(mode, msym, step);
+        }
+
+        @Override
+        protected Type typeOf(DeferredType dt) {
+            Type res = super.typeOf(dt);
+            if (!res.isErroneous()) {
+                switch (TreeInfo.skipParens(dt.tree).getTag()) {
+                    case LAMBDA:
+                    case REFERENCE:
+                        return dt;
+                    case CONDEXPR:
+                        return res == Type.recoveryType ?
+                                dt : res;
+                }
+            }
+            return res;
+        }
+    }
 
     /** Check that sym is not an abstract method.
      */
@@ -3915,26 +3918,6 @@
 
         static {
             String argMismatchRegex = MethodCheckDiag.ARG_MISMATCH.regex();
-            rewriters.put(new Template(argMismatchRegex, new Template("(.*)(bad.arg.types.in.lambda)", skip, skip)),
-                    new DiagnosticRewriter() {
-                @Override
-                public JCDiagnostic rewriteDiagnostic(JCDiagnostic.Factory diags,
-                        DiagnosticPosition preferedPos, DiagnosticSource preferredSource,
-                        DiagnosticType preferredKind, JCDiagnostic d) {
-                    return (JCDiagnostic)((JCDiagnostic)d.getArgs()[0]).getArgs()[1];
-                }
-            });
-            
-            rewriters.put(new Template(argMismatchRegex, skip, new Template("(.*)(bad.arg.types.in.lambda)", skip, skip)),
-                    new DiagnosticRewriter() {
-                @Override
-                public JCDiagnostic rewriteDiagnostic(JCDiagnostic.Factory diags,
-                        DiagnosticPosition preferedPos, DiagnosticSource preferredSource,
-                        DiagnosticType preferredKind, JCDiagnostic d) {
-                    return (JCDiagnostic)((JCDiagnostic)d.getArgs()[1]).getArgs()[1];
-                }
-            });
-
             rewriters.put(new Template(argMismatchRegex, skip),
                     new DiagnosticRewriter() {
                 @Override
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Jul 26 13:20:55 2013 +0100
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Aug 08 14:30:47 2013 +0100
@@ -746,11 +746,6 @@
 compiler.misc.incompatible.arg.types.in.mref=\
     incompatible parameter types in method reference
 
-# 0: list of type, 1: message segment
-compiler.misc.bad.arg.types.in.lambda=\
-    cannot type-check lambda expression with inferred parameter types\n\
-    inferred types: {0}
-
 compiler.err.new.not.allowed.in.annotation=\
     ''new'' not allowed in an annotation
 
@@ -1393,6 +1388,10 @@
 compiler.warn.missing.SVUID=\
     serializable class {0} has no definition of serialVersionUID
 
+# 0: symbol, 1: symbol, 2: symbol, 3: symbol
+compiler.warn.potentially.ambiguous.overload=\
+    {0} in {1} is potentially ambiguous with {2} in {3}
+
 # 0: message segment
 compiler.warn.override.varargs.missing=\
     {0}; overridden method has no ''...''
--- a/test/tools/javac/Diagnostics/compressed/T8012003c.java	Fri Jul 26 13:20:55 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/**
- * @test /nodynamiccopyright/
- * @bug     8012003
- * @summary Method diagnostics resolution need to be simplified in some cases
- *          test simplification of lambda type-checking error leading to resolution failure
- * @compile/fail/ref=T8012003c.out -XDrawDiagnostics -Xdiags:compact T8012003c.java
- */
-
-class T8012003c {
-
-    interface I {
-        void m(P p);
-    }
-
-    void m(I i) { }
-
-    void test() {
-        m(p->p.m());
-    }
-}
-
-class P {
-    private void m() { }
-}
--- a/test/tools/javac/Diagnostics/compressed/T8012003c.out	Fri Jul 26 13:20:55 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-T8012003c.java:18:15: compiler.err.report.access: m(), private, P
-- compiler.note.compressed.diags
-1 error
--- a/test/tools/javac/diags/examples/BadArgTypesInLambda.java	Fri Jul 26 13:20:55 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.cant.apply.symbol
-// key: compiler.misc.no.conforming.assignment.exists
-// key: compiler.misc.bad.arg.types.in.lambda
-// key: compiler.err.prob.found.req
-// key: compiler.misc.inconvertible.types
-// options: -Xdiags:verbose
-
-class BadArgTypesInLambda {
-    interface SAM {
-        void m(Integer i);
-    }
-
-    void g(SAM s) { }
-
-    void test() {
-        g(x->{ String s = x; });
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/PotentiallyAmbiguousOverload.java	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.potentially.ambiguous.overload
+// options: -Xlint:overloads
+
+class PotentiallyAmbiguousOverload {
+    interface F1 {
+        void m(String s);
+    }
+    
+    interface F2 {
+        void m(Integer s);
+    }
+    
+    void m(F1 f1) { }
+    void m(F2 f2) { }
+}
--- a/test/tools/javac/lambda/8016177/T8016177a.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/8016177/T8016177a.java	Thu Aug 08 14:30:47 2013 +0100
@@ -35,8 +35,8 @@
     <T extends R,R> List<T> m6(List<T> s, ToIntFunction<T> f) { return null; }
 
     void test(List<String> ss) {
-         m1(ss, s->s.length()); //ok
-         m2(ss, s->s.length()); //ok
+         m1(ss, s->s.length()); //ambiguous
+         m2(ss, s->s.length()); //ambiguous
          m3(ss, s->s.length()); //ambiguous
          m4(ss, s->s.length()); //ambiguous
          m5(ss, s->s.length()); //ambiguous
--- a/test/tools/javac/lambda/8016177/T8016177a.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/8016177/T8016177a.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,6 +1,8 @@
+T8016177a.java:38:10: compiler.err.ref.ambiguous: m1, kindname.method, <T,R>m1(java.util.List<T>,T8016177a.Function<T,R>), T8016177a, kindname.method, <T,R>m1(java.util.List<T>,T8016177a.ToIntFunction<T>), T8016177a
+T8016177a.java:39:10: compiler.err.ref.ambiguous: m2, kindname.method, <T,R>m2(java.util.List<T>,T8016177a.Function<T,R>), T8016177a, kindname.method, <T,R>m2(java.util.List<T>,T8016177a.ToIntFunction<T>), T8016177a
 T8016177a.java:40:10: compiler.err.ref.ambiguous: m3, kindname.method, <T,R>m3(java.util.List<T>,T8016177a.Function<T,R>), T8016177a, kindname.method, <T,R>m3(java.util.List<T>,T8016177a.ToIntFunction<T>), T8016177a
 T8016177a.java:41:10: compiler.err.ref.ambiguous: m4, kindname.method, <T,R>m4(java.util.List<T>,T8016177a.Function<T,R>), T8016177a, kindname.method, <T,R>m4(java.util.List<T>,T8016177a.ToIntFunction<T>), T8016177a
 T8016177a.java:42:10: compiler.err.ref.ambiguous: m5, kindname.method, <T,R>m5(java.util.List<T>,T8016177a.Function<T,R>), T8016177a, kindname.method, <T,R>m5(java.util.List<T>,T8016177a.ToIntFunction<T>), T8016177a
 T8016177a.java:43:10: compiler.err.ref.ambiguous: m6, kindname.method, <T,R>m6(java.util.List<T>,T8016177a.Function<T,R>), T8016177a, kindname.method, <T,R>m6(java.util.List<T>,T8016177a.ToIntFunction<T>), T8016177a
 T8016177a.java:43:12: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: T,R, (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
-5 errors
+7 errors
--- a/test/tools/javac/lambda/8016177/T8016177c.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/8016177/T8016177c.java	Thu Aug 08 14:30:47 2013 +0100
@@ -33,7 +33,7 @@
         m3((Integer x)->x); //ok - explicit lambda (only one applicable)
         
         m1(x->1); //ambiguous - stuck lambda
-        m2(x->1); //ok - subtyping picks most specific
+        m2(x->1); //ambiguous - stuck lambda
         m3(x->1); //ambiguous - implicit lambda & different params
 
         m1(this::g1); //ok - unambiguous ref - subtyping picks most specific
@@ -41,7 +41,7 @@
         m3(this::g1); //ambiguous - both applicable, neither most specific
         
         m1(this::g2); //ambiguous - stuck mref
-        m2(this::g2); //ok - subtyping picks most specific
+        m2(this::g2); //ambiguous - stuck mref
         m3(this::g2); //ambiguous - different params
     }
 }
--- a/test/tools/javac/lambda/8016177/T8016177c.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/8016177/T8016177c.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,6 +1,8 @@
 T8016177c.java:35:9: compiler.err.ref.ambiguous: m1, kindname.method, <U,V>m1(T8016177c.Function<U,V>), T8016177c, kindname.method, <U,V>m1(T8016177c.ExtFunction<U,V>), T8016177c
+T8016177c.java:36:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(T8016177c.Function<java.lang.Integer,java.lang.Integer>), T8016177c, kindname.method, m2(T8016177c.ExtFunction<java.lang.Integer,java.lang.Integer>), T8016177c
 T8016177c.java:37:9: compiler.err.ref.ambiguous: m3, kindname.method, m3(T8016177c.Function<java.lang.Integer,java.lang.Integer>), T8016177c, kindname.method, m3(T8016177c.ExtFunction<java.lang.Object,java.lang.Integer>), T8016177c
 T8016177c.java:41:9: compiler.err.ref.ambiguous: m3, kindname.method, m3(T8016177c.Function<java.lang.Integer,java.lang.Integer>), T8016177c, kindname.method, m3(T8016177c.ExtFunction<java.lang.Object,java.lang.Integer>), T8016177c
 T8016177c.java:43:9: compiler.err.ref.ambiguous: m1, kindname.method, <U,V>m1(T8016177c.Function<U,V>), T8016177c, kindname.method, <U,V>m1(T8016177c.ExtFunction<U,V>), T8016177c
+T8016177c.java:44:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(T8016177c.Function<java.lang.Integer,java.lang.Integer>), T8016177c, kindname.method, m2(T8016177c.ExtFunction<java.lang.Integer,java.lang.Integer>), T8016177c
 T8016177c.java:45:9: compiler.err.ref.ambiguous: m3, kindname.method, m3(T8016177c.Function<java.lang.Integer,java.lang.Integer>), T8016177c, kindname.method, m3(T8016177c.ExtFunction<java.lang.Object,java.lang.Integer>), T8016177c
-5 errors
+7 errors
--- a/test/tools/javac/lambda/8019480/T8019480.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/8019480/T8019480.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,3 +1,4 @@
 T8019480.java:21:46: compiler.err.report.access: clone(), protected, java.lang.Object
 T8019480.java:21:34: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, java.util.Collection, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(U), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, U))),(compiler.misc.inapplicable.method: kindname.method, java.util.List, add(int,U), (compiler.misc.arg.length.mismatch))}
-2 errors
+T8019480.java:21:24: compiler.err.incompatible.thrown.types.in.lambda: java.lang.CloneNotSupportedException
+3 errors
--- a/test/tools/javac/lambda/BadRecovery.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/BadRecovery.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,2 +1,3 @@
+BadRecovery.java:17:9: compiler.err.cant.apply.symbol: kindname.method, m, BadRecovery.SAM1, @369, kindname.class, BadRecovery, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.arg.types.in.lambda))
 BadRecovery.java:17:77: compiler.err.cant.resolve.location: kindname.variable, f, , , (compiler.misc.location: kindname.class, BadRecovery, null)
-1 error
+2 errors
--- a/test/tools/javac/lambda/ErroneousLambdaExpr.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/ErroneousLambdaExpr.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  stale state after speculative attribution round leads to missing classfiles
+ * @compile/fail/ref=ErroneousLambdaExpr.out -XDrawDiagnostics ErroneousLambdaExpr.java
  */
 public class ErroneousLambdaExpr<T> {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/ErroneousLambdaExpr.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,2 @@
+ErroneousLambdaExpr.java:63:13: compiler.err.ref.ambiguous: call, kindname.method, call(ErroneousLambdaExpr.SAM1<T>), ErroneousLambdaExpr, kindname.method, call(ErroneousLambdaExpr.SAM2), ErroneousLambdaExpr
+1 error
--- a/test/tools/javac/lambda/MethodReference22.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference22.out	Thu Aug 08 14:30:47 2013 +0100
@@ -3,13 +3,17 @@
 MethodReference22.java:46:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
 MethodReference22.java:47:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
 MethodReference22.java:51:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22))
-MethodReference22.java:52:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1401, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22)))
+MethodReference22.java:52:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1401, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22)))
 MethodReference22.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22))
-MethodReference22.java:54:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1504, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22)))
+MethodReference22.java:54:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1504, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22)))
 MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22))
-MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1607, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22)))
+MethodReference22.java:56:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1607, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22)))
 MethodReference22.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))
-MethodReference22.java:58:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1710, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
+MethodReference22.java:58:14: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1710, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)))
+MethodReference22.java:62:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
 MethodReference22.java:62:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))
+MethodReference22.java:63:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
+MethodReference22.java:64:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
+MethodReference22.java:65:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22
 MethodReference22.java:65:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))
-14 errors
+18 errors
--- a/test/tools/javac/lambda/MethodReference23.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference23.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,6 +1,6 @@
 MethodReference23.java:52:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23))
-MethodReference23.java:53:9: compiler.err.cant.apply.symbol: kindname.method, call11, MethodReference23.SAM11, @1140, kindname.class, MethodReference23, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23)))
+MethodReference23.java:53:15: compiler.err.cant.apply.symbol: kindname.method, call11, MethodReference23.SAM11, @1140, kindname.class, MethodReference23, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, MethodReference23, MethodReference23)))
 MethodReference23.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23))
-MethodReference23.java:58:9: compiler.err.cant.apply.symbol: kindname.method, call12, MethodReference23.SAM12, @1282, kindname.class, MethodReference23, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23)))
+MethodReference23.java:58:15: compiler.err.cant.apply.symbol: kindname.method, call12, MethodReference23.SAM12, @1282, kindname.class, MethodReference23, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.access.inner.cls.constr: Inner1, , MethodReference23)))
 MethodReference23.java:72:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference23.SAM21), MethodReference23, kindname.method, call3(MethodReference23.SAM22), MethodReference23
 5 errors
--- a/test/tools/javac/lambda/MethodReference41.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference41.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  check that diamond inference is applied when using raw constructor reference qualifier
- * @run main MethodReference41
+ * @compile/fail/ref=MethodReference41.out -XDrawDiagnostics MethodReference41.java
  */
 public class MethodReference41 {
-
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
+    
     interface SAM1 {
        void m(String s);
     }
@@ -53,14 +45,21 @@
     static class Foo<X extends Number> {
         Foo(X x) { }
     }
+    
+    static void m1(SAM1 s) { }
+    
+    static void m2(SAM2 s) { }
+    
+    static void m3(SAM3 s) { }
 
-
-    static void m(SAM1 s) { assertTrue(false); }
-    static void m(SAM2 s) { assertTrue(true); }
-    static void m(SAM3 s) { assertTrue(false); }
+    static void m4(SAM1 s) { }
+    static void m4(SAM2 s) { }
+    static void m4(SAM3 s) { }
 
     public static void main(String[] args) {
-        m(Foo::new);
-        assertTrue(assertionCount == 1);
+        m1(Foo::new);
+        m2(Foo::new);
+        m3(Foo::new);
+        m4(Foo::new);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference41.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,4 @@
+MethodReference41.java:60:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference41.SAM1, @1819, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference41.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))))
+MethodReference41.java:62:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference41.SAM3, @1863, kindname.class, MethodReference41, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference41.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
+MethodReference41.java:63:9: compiler.err.ref.ambiguous: m4, kindname.method, m4(MethodReference41.SAM2), MethodReference41, kindname.method, m4(MethodReference41.SAM3), MethodReference41
+3 errors
--- a/test/tools/javac/lambda/MethodReference42.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference42.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  check that diamond inference is applied when using raw constructor reference qualifier
- * @run main MethodReference42
+ * @compile/fail/ref=MethodReference42.out -XDrawDiagnostics MethodReference42.java
  */
 public class MethodReference42 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     static class SuperFoo<X> { }
 
     static class Foo<X extends Number> extends SuperFoo<X> { }
@@ -53,13 +45,21 @@
     interface SAM3 {
         SuperFoo<Object> m();
     }
+    
+    static void m1(SAM1 s) { }
 
-    static void m(SAM1 s) { assertTrue(false); }
-    static void m(SAM2 s) { assertTrue(true); }
-    static void m(SAM3 s) { assertTrue(false); }
+    static void m2(SAM2 s) { }
+
+    static void m3(SAM3 s) { }
+
+    static void m4(SAM1 s) { }
+    static void m4(SAM2 s) { }
+    static void m4(SAM3 s) { }
 
     public static void main(String[] args) {
-        m(Foo::new);
-        assertTrue(assertionCount == 1);
+        m1(Foo::new);
+        m2(Foo::new);
+        m3(Foo::new);
+        m4(Foo::new);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference42.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,4 @@
+MethodReference42.java:60:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference42.SAM1, @1851, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
+MethodReference42.java:62:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference42.SAM3, @1895, kindname.class, MethodReference42, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number))
+MethodReference42.java:63:9: compiler.err.ref.ambiguous: m4, kindname.method, m4(MethodReference42.SAM2), MethodReference42, kindname.method, m4(MethodReference42.SAM3), MethodReference42
+3 errors
--- a/test/tools/javac/lambda/MethodReference43.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference43.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  check that diamond inference is applied when using raw constructor reference qualifier
- * @run main MethodReference43
+ * @compile/fail/ref=MethodReference43.out -XDrawDiagnostics MethodReference43.java
  */
 public class MethodReference43 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     interface SAM1 {
        Foo<?> m(String s);
     }
@@ -57,15 +49,25 @@
     static class Foo<X extends Number> {
         Foo(X x) { }
     }
+    
+    static void m1(SAM1 s) { }
 
+    static void m2(SAM2 s) { }
 
-    static void m(SAM1 s) { assertTrue(false); }
-    static void m(SAM2 s) { assertTrue(false); }
-    static void m(SAM3 s) { assertTrue(false); }
-    static void m(SAM4 s) { assertTrue(true); }
+    static void m3(SAM3 s) { }
+
+    static void m4(SAM4 s) { }
+
+    static void m5(SAM1 s) { }
+    static void m5(SAM2 s) { }
+    static void m5(SAM3 s) { }
+    static void m5(SAM4 s) { }
 
     public static void main(String[] args) {
-        m(Foo::new);
-        assertTrue(assertionCount == 1);
+        m1(Foo::new);
+        m2(Foo::new);
+        m3(Foo::new);
+        m4(Foo::new);
+        m5(Foo::new);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference43.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,5 @@
+MethodReference43.java:67:11: compiler.err.cant.apply.symbol: kindname.method, m1, MethodReference43.SAM1, @1937, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.String, kindname.class, MethodReference43.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))))
+MethodReference43.java:69:11: compiler.err.cant.apply.symbol: kindname.method, m3, MethodReference43.SAM3, @1981, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
+MethodReference43.java:71:9: compiler.err.ref.ambiguous: m5, kindname.method, m5(MethodReference43.SAM3), MethodReference43, kindname.method, m5(MethodReference43.SAM4), MethodReference43
+MethodReference43.java:71:11: compiler.err.cant.apply.symbol: kindname.method, m5, MethodReference43.SAM3, @2025, kindname.class, MethodReference43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.constructor, (compiler.misc.cant.apply.symbol: kindname.constructor, Foo, java.lang.Number, java.lang.Object, kindname.class, MethodReference43.Foo<X>, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
+4 errors
--- a/test/tools/javac/lambda/MethodReference44.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference44.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  check that generic method reference is inferred when type parameters are omitted
- * @run main MethodReference44
+ * @compile/fail/ref=MethodReference44.out -XDrawDiagnostics MethodReference44.java
  */
 public class MethodReference44 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     static class SuperFoo<X> { }
 
     static class Foo<X extends Number> extends SuperFoo<X> { }
@@ -55,13 +47,21 @@
     }
 
     static <X extends Number> Foo<X> m() { return null; }
+    
+    static void g1(SAM1 s) { }
 
-    static void g(SAM1 s) { assertTrue(false); }
-    static void g(SAM2 s) { assertTrue(true); }
-    static void g(SAM3 s) { assertTrue(false); }
+    static void g2(SAM2 s) { }
+
+    static void g3(SAM3 s) { }
+
+    static void g4(SAM1 s) { }
+    static void g4(SAM2 s) { }
+    static void g4(SAM3 s) { }
 
     public static void main(String[] args) {
-        g(MethodReference44::m);
-        assertTrue(assertionCount == 1);
+        g1(MethodReference44::m);
+        g2(MethodReference44::m);
+        g3(MethodReference44::m);
+        g4(MethodReference44::m);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference44.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,4 @@
+MethodReference44.java:62:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference44.SAM1, @1904, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String, java.lang.Number))
+MethodReference44.java:64:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference44.SAM3, @1972, kindname.class, MethodReference44, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.Object, java.lang.Number))
+MethodReference44.java:65:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference44.SAM2), MethodReference44, kindname.method, g4(MethodReference44.SAM3), MethodReference44
+3 errors
--- a/test/tools/javac/lambda/MethodReference46.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference46.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  check that generic method reference is inferred when type parameters are omitted
- * @run main MethodReference46
+ * @compile/fail/ref=MethodReference46.out -XDrawDiagnostics MethodReference46.java
  */
 public class MethodReference46 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     interface SAM1 {
        void m(String s);
     }
@@ -55,13 +47,21 @@
     }
 
     static <X extends Number> void m(X fx) { }
+    
+    static void g1(SAM1 s) { }
 
-    static void g(SAM1 s) { assertTrue(false); }
-    static void g(SAM2 s) { assertTrue(true); }
-    static void g(SAM3 s) { assertTrue(false); }
+    static void g2(SAM2 s) { }
+
+    static void g3(SAM3 s) { }
+
+    static void g4(SAM1 s) { }
+    static void g4(SAM2 s) { }
+    static void g4(SAM3 s) { }
 
     public static void main(String[] args) {
-        g(MethodReference46::m);
-        assertTrue(assertionCount == 1);
+        g1(MethodReference46::m);
+        g2(MethodReference46::m);
+        g3(MethodReference46::m);
+        g4(MethodReference46::m);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference46.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,4 @@
+MethodReference46.java:62:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference46.SAM1, @1849, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.String, kindname.class, MethodReference46, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.String, java.lang.Number))))
+MethodReference46.java:64:11: compiler.err.cant.apply.symbol: kindname.method, g3, MethodReference46.SAM3, @1917, kindname.class, MethodReference46, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m, X, java.lang.Object, kindname.class, MethodReference46, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object, java.lang.Number))))
+MethodReference46.java:65:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference46.SAM2), MethodReference46, kindname.method, g4(MethodReference46.SAM3), MethodReference46
+3 errors
--- a/test/tools/javac/lambda/MethodReference47.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference47.java	Thu Aug 08 14:30:47 2013 +0100
@@ -7,14 +7,6 @@
  */
 public class MethodReference47 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     interface SAM1 {
        void m(Integer s);
     }
@@ -34,7 +26,7 @@
     static void g2(SAM2 s) { }
 
     public static void main(String[] args) {
-        g1(MethodReference46::m);
-        g2(MethodReference46::m);
+        g1(MethodReference47::m);
+        g2(MethodReference47::m);
     }
 }
--- a/test/tools/javac/lambda/MethodReference47.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference47.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,2 +1,2 @@
-MethodReference47.java:38:9: compiler.err.ref.ambiguous: g2, kindname.method, g2(MethodReference47.SAM1), MethodReference47, kindname.method, g2(MethodReference47.SAM2), MethodReference47
+MethodReference47.java:30:9: compiler.err.ref.ambiguous: g2, kindname.method, g2(MethodReference47.SAM1), MethodReference47, kindname.method, g2(MethodReference47.SAM2), MethodReference47
 1 error
--- a/test/tools/javac/lambda/MethodReference48.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference48.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  check that raw qualifier in unbound method reference is inferred from descriptor
- * @run main MethodReference48
+ * @compile/fail/ref=MethodReference48.out -XDrawDiagnostics MethodReference48.java
  */
 public class MethodReference48 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     static class Foo<X> {
         X m() { return null; };
     }
@@ -53,13 +45,21 @@
     interface SAM3 {
         Object m(Foo<Integer> fi);
     }
+    
+    static void g1(SAM1 s) { } //return type not compatible
 
-    static void g(SAM1 s) { assertTrue(false); } //return type not compatible
-    static void g(SAM2 s) { assertTrue(true); } //ok
-    static void g(SAM3 s) { assertTrue(false); } //ok but less specific
+    static void g2(SAM2 s) { } //ok
+
+    static void g3(SAM3 s) { } //ok
+
+    static void g4(SAM1 s) { } //return type not compatible
+    static void g4(SAM2 s) { } //ok
+    static void g4(SAM3 s) { } //ok
 
     public static void main(String[] args) {
-        g(Foo::m);
-        assertTrue(assertionCount == 1);
+        g1(Foo::m);
+        g2(Foo::m);
+        g3(Foo::m);
+        g4(Foo::m);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference48.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,3 @@
+MethodReference48.java:60:11: compiler.err.cant.apply.symbol: kindname.method, g1, MethodReference48.SAM1, @1909, kindname.class, MethodReference48, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.mref: (compiler.misc.inconvertible.types: java.lang.String, MethodReference48.Foo<java.lang.Object>)))
+MethodReference48.java:63:9: compiler.err.ref.ambiguous: g4, kindname.method, g4(MethodReference48.SAM2), MethodReference48, kindname.method, g4(MethodReference48.SAM3), MethodReference48
+2 errors
--- a/test/tools/javac/lambda/MethodReference70.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference70.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,2 +1,3 @@
-MethodReference70.java:26:10: compiler.err.cant.apply.symbols: kindname.method, g, @553,{(compiler.misc.inapplicable.method: kindname.method, MethodReference70, <Z>g(MethodReference70.F<Z>), (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m2, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, MethodReference70, m2(java.lang.Integer), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Integer))),(compiler.misc.inapplicable.method: kindname.method, MethodReference70, m2(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))})))),(compiler.misc.inapplicable.method: kindname.method, MethodReference70, <Z>g(MethodReference70.G<Z>), (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m2, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, MethodReference70, m2(java.lang.Integer), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Integer))),(compiler.misc.inapplicable.method: kindname.method, MethodReference70, m2(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))}))))}
-1 error
+MethodReference70.java:26:10: compiler.err.ref.ambiguous: g, kindname.method, <Z>g(MethodReference70.F<Z>), MethodReference70, kindname.method, <Z>g(MethodReference70.G<Z>), MethodReference70
+MethodReference70.java:26:11: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m2, java.lang.Object,{(compiler.misc.inapplicable.method: kindname.method, MethodReference70, m2(java.lang.Integer), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Integer))),(compiler.misc.inapplicable.method: kindname.method, MethodReference70, m2(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))})))
+2 errors
--- a/test/tools/javac/lambda/MethodReference71.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MethodReference71.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,2 +1,3 @@
-MethodReference71.java:24:10: compiler.err.cant.apply.symbols: kindname.method, g, @523,{(compiler.misc.inapplicable.method: kindname.method, MethodReference71, <Z>g(MethodReference71.F<Z>), (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer[], java.lang.Object, kindname.class, MethodReference71, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Integer)))))),(compiler.misc.inapplicable.method: kindname.method, MethodReference71, <Z>g(MethodReference71.G<Z>), (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer[], java.lang.Object, kindname.class, MethodReference71, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Integer))))))}
-1 error
+MethodReference71.java:24:10: compiler.err.ref.ambiguous: g, kindname.method, <Z>g(MethodReference71.F<Z>), MethodReference71, kindname.method, <Z>g(MethodReference71.G<Z>), MethodReference71
+MethodReference71.java:24:11: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer[], java.lang.Object, kindname.class, MethodReference71, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.Integer)))))
+2 errors
--- a/test/tools/javac/lambda/MostSpecific04.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MostSpecific04.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,17 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  Structural most specific doesn't handle cases with wildcards in functional interfaces
+ * @compile/fail/ref=MostSpecific04.out -XDrawDiagnostics MostSpecific04.java
  */
 public class MostSpecific04 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     interface DoubleMapper<T> {
         double map(T t);
     }
@@ -46,13 +39,13 @@
     }
 
     static class MyList<E> {
-        void map(DoubleMapper<? super E> m) { assertTrue(false); }
-        void map(LongMapper<? super E> m) { assertTrue(true); }
+        void map(DoubleMapper<? super E> m) { }
+        void map(LongMapper<? super E> m) { }
     }
 
     public static void main(String[] args) {
         MyList<String> ls = new MyList<String>();
-        ls.map(e->e.length());
-        assertTrue(assertionCount == 1);
+        ls.map(e->e.length()); //ambiguous - implicit
+        ls.map((String e)->e.length()); //ok
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MostSpecific04.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,2 @@
+MostSpecific04.java:48:11: compiler.err.ref.ambiguous: map, kindname.method, map(MostSpecific04.DoubleMapper<? super E>), MostSpecific04.MyList, kindname.method, map(MostSpecific04.LongMapper<? super E>), MostSpecific04.MyList
+1 error
--- a/test/tools/javac/lambda/MostSpecific05.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MostSpecific05.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,17 +26,10 @@
  * @bug 8003280
  * @summary Add lambda tests
  *  Structural most specific doesn't handle cases with wildcards in functional interfaces
+ * @compile/fail/ref=MostSpecific05.out -XDrawDiagnostics MostSpecific05.java
  */
 public class MostSpecific05 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     interface ObjectConverter<T extends Object> {
         T map(Object o);
     }
@@ -46,13 +39,13 @@
     }
 
     static class MyMapper<A extends Object, B extends Number> {
-        void map(ObjectConverter<? extends A> m) { assertTrue(false); }
-        void map(NumberConverter<? extends B> m) { assertTrue(true); }
+        void map(ObjectConverter<? extends A> m) { }
+        void map(NumberConverter<? extends B> m) { }
     }
 
     public static void main(String[] args) {
         MyMapper<Number, Double> mm = new MyMapper<Number, Double>();
-        mm.map(e->1.0);
-        assertTrue(assertionCount == 1);
+        mm.map(e->1.0); //ambiguous - implicit
+        mm.map((Object e)->1.0); //ok
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MostSpecific05.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,2 @@
+MostSpecific05.java:48:11: compiler.err.ref.ambiguous: map, kindname.method, map(MostSpecific05.ObjectConverter<? extends A>), MostSpecific05.MyMapper, kindname.method, map(MostSpecific05.NumberConverter<? extends B>), MostSpecific05.MyMapper
+1 error
--- a/test/tools/javac/lambda/MostSpecific08.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/MostSpecific08.java	Thu Aug 08 14:30:47 2013 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8008813
  * @summary Structural most specific fails when method reference is passed to overloaded method
- * @compile MostSpecific08.java
+ * @compile/fail/ref=MostSpecific08.out -XDrawDiagnostics MostSpecific08.java
  */
 class MostSpecific08 {
 
@@ -51,12 +51,14 @@
     }
 
     void testMref(Tester t) {
-        IntResult pr = t.apply(C::getInt);
-        ReferenceResult<Integer> rr = t.apply(C::getInteger);
+        IntResult pr = t.apply(C::getInt); //ok - unoverloaded mref
+        ReferenceResult<Integer> rr = t.apply(C::getInteger); //ok - unoverloaded mref
     }
 
     void testLambda(Tester t) {
-        IntResult pr = t.apply(c->c.getInt());
-        ReferenceResult<Integer> rr = t.apply(c->c.getInteger());
+        IntResult pr1 = t.apply(c->c.getInt()); //ambiguous - implicit
+        IntResult pr2 = t.apply((C c)->c.getInt()); //ok
+        ReferenceResult<Integer> rr1 = t.apply(c->c.getInteger()); //ambiguous - implicit
+        ReferenceResult<Integer> rr2 = t.apply((C c)->c.getInteger()); //ok
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MostSpecific08.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,4 @@
+MostSpecific08.java:59:26: compiler.err.ref.ambiguous: apply, kindname.method, apply(MostSpecific08.PrimitiveFunction), MostSpecific08.Tester, kindname.method, <Z>apply(MostSpecific08.ReferenceFunction<Z>), MostSpecific08.Tester
+MostSpecific08.java:61:41: compiler.err.ref.ambiguous: apply, kindname.method, apply(MostSpecific08.PrimitiveFunction), MostSpecific08.Tester, kindname.method, <Z>apply(MostSpecific08.ReferenceFunction<Z>), MostSpecific08.Tester
+MostSpecific08.java:61:47: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: MostSpecific08.IntResult, MostSpecific08.ReferenceResult<java.lang.Integer>)
+3 errors
--- a/test/tools/javac/lambda/TargetType01.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType01.java	Thu Aug 08 14:30:47 2013 +0100
@@ -26,7 +26,7 @@
  * @bug 8003280 8009131
  * @summary Add lambda tests
  *  check nested case of overload resolution and lambda parameter inference
- * @compile TargetType01.java
+ * @compile/fail/ref=TargetType01.out -XDrawDiagnostics TargetType01.java
  */
 
 class TargetType01 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType01.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,3 @@
+TargetType01.java:45:9: compiler.err.ref.ambiguous: M, kindname.method, M(TargetType01.F_I_I), TargetType01, kindname.method, M(TargetType01.F_S_S), TargetType01
+TargetType01.java:45:26: compiler.err.ref.ambiguous: M, kindname.method, M(TargetType01.F_I_I), TargetType01, kindname.method, M(TargetType01.F_S_S), TargetType01
+2 errors
--- a/test/tools/javac/lambda/TargetType02.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType02.java	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,19 +27,11 @@
  * @summary Add lambda tests
  *  check overload resolution and target type inference w.r.t. generic methods
  * @author  Maurizio Cimadamore
- * @run main TargetType02
+ * @compile/fail/ref=TargetType02.out -XDrawDiagnostics TargetType02.java
  */
 
 public class TargetType02 {
 
-    static int assertionCount = 0;
-
-    static void assertTrue(boolean cond) {
-        assertionCount++;
-        if (!cond)
-            throw new AssertionError();
-    }
-
     interface S1<X extends Number> {
         X m(Integer x);
     }
@@ -47,16 +39,17 @@
     interface S2<X extends String> {
         abstract X m(Integer x);
     }
+    
+    static <Z extends Number> void call1(S1<Z> s) { }
+    
+    static <Z extends String> void call2(S2<Z> s) { }
 
-    static <Z extends Number> void call(S1<Z> s) { s.m(1); assertTrue(true); }
-    static <Z extends String> void call(S2<Z> s) { s.m(2); assertTrue(false); }
+    static <Z extends Number> void call3(S1<Z> s) { }
+    static <Z extends String> void call3(S2<Z> s) { }
 
     void test() {
-        call(i -> { toString(); return i; });
-    }
-
-    public static void main(String[] args) {
-        new TargetType02().test();
-        assertTrue(assertionCount == 1);
+        call1(i -> { toString(); return i; });
+        call2(i -> { toString(); return i; });
+        call3(i -> { toString(); return i; });
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/TargetType02.out	Thu Aug 08 14:30:47 2013 +0100
@@ -0,0 +1,3 @@
+TargetType02.java:52:14: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.String)
+TargetType02.java:53:9: compiler.err.ref.ambiguous: call3, kindname.method, <Z>call3(TargetType02.S1<Z>), TargetType02, kindname.method, <Z>call3(TargetType02.S2<Z>), TargetType02
+2 errors
--- a/test/tools/javac/lambda/TargetType21.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType21.java	Thu Aug 08 14:30:47 2013 +0100
@@ -26,8 +26,10 @@
 
     void test() {
         call(x -> { throw new Exception(); }); //ambiguous
-        call(x -> { System.out.println(""); }); //ok (only one is void)
-        call(x -> { return (Object) null; }); //ok (only one returns Object)
+        call((Integer x) -> { System.out.println(""); }); //ok (only one is void)
+        call((Integer x) -> { return (Object) null; }); //ok (only one returns Object)
+        call(x -> { System.out.println(""); }); //ambiguous
+        call(x -> { return (Object) null; }); //ambiguous
         call(x -> { return null; }); //ambiguous
     }
 }
--- a/test/tools/javac/lambda/TargetType21.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType21.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,4 +1,8 @@
 TargetType21.java:28:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
 TargetType21.java:28:14: compiler.err.incompatible.thrown.types.in.lambda: java.lang.Exception
-TargetType21.java:31:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM1), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
-3 errors
+TargetType21.java:31:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
+TargetType21.java:32:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
+TargetType21.java:32:13: compiler.err.cant.apply.symbol: kindname.method, call, TargetType21.SAM2, @888, kindname.class, TargetType21, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.unexpected.ret.val)))
+TargetType21.java:33:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM2), TargetType21, kindname.method, <R,A>call(TargetType21.SAM3<R,A>), TargetType21
+TargetType21.java:33:13: compiler.err.cant.apply.symbol: kindname.method, call, TargetType21.SAM2, @946, kindname.class, TargetType21, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.unexpected.ret.val)))
+7 errors
--- a/test/tools/javac/lambda/TargetType24.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType24.java	Thu Aug 08 14:30:47 2013 +0100
@@ -29,11 +29,14 @@
     }
 
     void test(Array<String> as, final Array<Character> ac) {
-        final boolean b1 = as.forAll(s -> ac.forAll(c -> false)); //ok
+        final boolean b1 = as.forAll((String s) -> ac.forAll((Character c) -> false)); //ok
+        final boolean b2 = as.forAll(s -> ac.forAll(c -> false)); //ambiguous
+        final boolean b3 = as.forAll((String s) -> ac.forAll(c -> false)); //ambiguous
+        final boolean b4 = as.forAll(s -> ac.forAll((Character c) -> false)); //ambiguous
         final String s1 = as.forAll2(s -> ac.forAll2(c -> "")); //ok
-        final boolean b2 = as.forAll(s -> ac.forAll(c -> "" )); //fail
+        final boolean b5 = as.forAll(s -> ac.forAll(c -> "" )); //fail
         final String s2 = as.forAll2(s -> ac.forAll2(c -> false)); //fail
-        final boolean b3 = as.forAll((F<String, Boolean>)s -> ac.forAll((F<Character, Boolean>)c -> "")); //fail
+        final boolean b6 = as.forAll((F<String, Boolean>)s -> ac.forAll((F<Character, Boolean>)c -> "")); //fail
         final String s3 = as.forAll((FSub<String, String>)s -> ac.forAll((FSub<Character, String>)c -> false)); //fail
     }
 }
--- a/test/tools/javac/lambda/TargetType24.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType24.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,5 +1,11 @@
-TargetType24.java:34:37: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, boolean)
-TargetType24.java:35:45: compiler.err.cant.apply.symbol: kindname.method, forAll2, TargetType24.FSub<java.lang.Character,java.lang.String>, @945, kindname.class, TargetType24.Array<A>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: boolean, java.lang.String)))
-TargetType24.java:36:101: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Boolean))
-TargetType24.java:37:104: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: boolean, java.lang.String))
-4 errors
+TargetType24.java:33:30: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
+TargetType24.java:33:45: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
+TargetType24.java:34:54: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
+TargetType24.java:35:30: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
+TargetType24.java:37:30: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
+TargetType24.java:37:45: compiler.err.ref.ambiguous: forAll, kindname.method, forAll(TargetType24.F<A,java.lang.Boolean>), TargetType24.Array, kindname.method, forAll(TargetType24.FSub<A,java.lang.String>), TargetType24.Array
+TargetType24.java:37:52: compiler.err.cant.apply.symbol: kindname.method, forAll, TargetType24.F<java.lang.Character,java.lang.Boolean>, @1149, kindname.class, TargetType24.Array<A>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Boolean)))
+TargetType24.java:38:53: compiler.err.cant.apply.symbol: kindname.method, forAll2, TargetType24.FSub<java.lang.Character,java.lang.String>, @1221, kindname.class, TargetType24.Array<A>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: boolean, java.lang.String)))
+TargetType24.java:39:101: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Boolean))
+TargetType24.java:40:104: compiler.err.prob.found.req: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: boolean, java.lang.String))
+10 errors
--- a/test/tools/javac/lambda/TargetType26.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType26.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,2 +1,2 @@
-TargetType26.java:16:7: compiler.err.cant.apply.symbol: kindname.method, call, Z, @340, kindname.class, TargetType26, (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.not.a.functional.intf: java.lang.Object))
+TargetType26.java:16:11: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: Z, (compiler.misc.not.a.functional.intf: java.lang.Object))
 1 error
--- a/test/tools/javac/lambda/TargetType39.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType39.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,3 +1,3 @@
-TargetType39.java:19:9: compiler.err.cant.apply.symbol: kindname.method, call, TargetType39.SAM<U,V>, @442, kindname.class, TargetType39, (compiler.misc.infer.no.conforming.assignment.exists: U,V, (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: TargetType39.SAM<java.lang.String,java.lang.Void>, TargetType39.SAM<java.lang.Object,V>)))
-TargetType39.java:20:9: compiler.err.cant.apply.symbol: kindname.method, call, TargetType39.SAM<U,V>, @479, kindname.class, TargetType39, (compiler.misc.infer.no.conforming.assignment.exists: U,V, (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.not.a.functional.intf: java.lang.Object))))
+TargetType39.java:19:13: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U,V, (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: TargetType39.SAM<java.lang.String,java.lang.Void>, TargetType39.SAM<java.lang.Object,V>)))
+TargetType39.java:20:13: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U,V, (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.not.a.functional.intf: java.lang.Object))))
 2 errors
--- a/test/tools/javac/lambda/TargetType43.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType43.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,4 +1,5 @@
 TargetType43.java:13:20: compiler.err.prob.found.req: (compiler.misc.not.a.functional.intf: java.lang.Object)
 TargetType43.java:13:30: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
+TargetType43.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.lang.Object, @359, kindname.class, TargetType43, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: java.lang.Object))
 TargetType43.java:14:21: compiler.err.cant.resolve.location: kindname.class, NonExistentClass, , , (compiler.misc.location: kindname.class, TargetType43, null)
-3 errors
+4 errors
--- a/test/tools/javac/lambda/TargetType57.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType57.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,2 +1,2 @@
-TargetType57.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, java.util.List<S_IN>,java.util.function.Function<S_IN,S_OUT>,java.util.function.Function<S_OUT,R>, java.util.List<java.lang.Integer>,@340,@359, kindname.class, TargetType57, (compiler.misc.infer.no.conforming.assignment.exists: U,R,S_IN,S_OUT, (compiler.misc.bad.arg.types.in.lambda: java.lang.Integer, (compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location.1: kindname.variable, s, java.lang.Integer))))
+TargetType57.java:14:42: compiler.err.cant.resolve.location.args: kindname.method, nonExistentMethod, , , (compiler.misc.location.1: kindname.variable, s, java.lang.Integer)
 1 error
--- a/test/tools/javac/lambda/TargetType66.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType66.java	Thu Aug 08 14:30:47 2013 +0100
@@ -17,8 +17,8 @@
     void g(SAM2 s2) { }
 
     void test() {
-        g(x->{ String s = x; }); //g(SAM1)
-        g(x->{ Integer i = x; }); //g(SAM2)
+        g(x->{ String s = x; }); //ambiguous
+        g(x->{ Integer i = x; }); //ambiguous
         g(x->{ Object o = x; }); //ambiguous
         g(x->{ Character c = x; }); //error: inapplicable methods
         g(x->{ Character c = ""; }); //error: incompatible types
--- a/test/tools/javac/lambda/TargetType66.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/TargetType66.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,4 +1,9 @@
+TargetType66.java:20:9: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType66.SAM1), TargetType66, kindname.method, g(TargetType66.SAM2), TargetType66
+TargetType66.java:21:9: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType66.SAM1), TargetType66, kindname.method, g(TargetType66.SAM2), TargetType66
+TargetType66.java:21:28: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Integer)
 TargetType66.java:22:9: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType66.SAM1), TargetType66, kindname.method, g(TargetType66.SAM2), TargetType66
-TargetType66.java:23:9: compiler.err.cant.apply.symbols: kindname.method, g, @578,{(compiler.misc.inapplicable.method: kindname.method, TargetType66, g(TargetType66.SAM1), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.arg.types.in.lambda: java.lang.String, (compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Character))))),(compiler.misc.inapplicable.method: kindname.method, TargetType66, g(TargetType66.SAM2), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.bad.arg.types.in.lambda: java.lang.Integer, (compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Integer, java.lang.Character)))))}
+TargetType66.java:23:9: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType66.SAM1), TargetType66, kindname.method, g(TargetType66.SAM2), TargetType66
+TargetType66.java:23:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Character)
+TargetType66.java:24:9: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType66.SAM1), TargetType66, kindname.method, g(TargetType66.SAM2), TargetType66
 TargetType66.java:24:30: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, java.lang.Character)
-3 errors
+8 errors
--- a/test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/mostSpecific/StructuralMostSpecificTest.java	Thu Aug 08 14:30:47 2013 +0100
@@ -165,7 +165,7 @@
 
         checkAfterExec();
     }
-
+    
     LambdaReturnKind lrk;
     RetTypeKind rt1, rt2;
     ArgTypeKind ak1, ak2;
@@ -197,7 +197,7 @@
                           "class Test {\n" +
                           "   void m(SAM1 s) { }\n" +
                           "   void m(SAM2 s) { }\n" +
-                          "   { m(x->{ #LR }); }\n" +
+                          "   { m((#A1 x)->{ #LR }); }\n" +
                           "}\n";
 
         String source;
@@ -235,6 +235,9 @@
 
     void check() {
         checkCount.incrementAndGet();
+        
+        if (ak1 != ak2)
+            return;
 
         if (!lrk.compatibleWith(rt1) || !lrk.compatibleWith(rt2))
             return;
@@ -242,8 +245,8 @@
         if (lrk.needsConversion(rt1) != lrk.needsConversion(rt2))
             return;
 
-        boolean m1MoreSpecific = moreSpecific(rt1, rt2, ek1, ek2, ak1, ak2);
-        boolean m2MoreSpecific = moreSpecific(rt2, rt1, ek2, ek1, ak2, ak1);
+        boolean m1MoreSpecific = rt1.moreSpecificThan(rt2);
+        boolean m2MoreSpecific = rt2.moreSpecificThan(rt1);
 
         boolean ambiguous = (m1MoreSpecific == m2MoreSpecific);
 
@@ -268,17 +271,6 @@
         }
     }
 
-    boolean moreSpecific(RetTypeKind rk1, RetTypeKind rk2, ExceptionKind ek1,
-            ExceptionKind ek2, ArgTypeKind ak1, ArgTypeKind ak2) {
-        if (!rk1.moreSpecificThan(rk2))
-            return false;
-
-        if (ak1 != ak2)
-            return false;
-
-        return true;
-    }
-
     static class DiagnosticChecker
         implements javax.tools.DiagnosticListener<JavaFileObject> {
 
--- a/test/tools/javac/lambda/typeInference/InferenceTest5.java	Fri Jul 26 13:20:55 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 8003280
- * @summary Add lambda tests
- *  This test is for overloaded methods, verify that the specific method is
-             selected when type inference occurs
- * @compile InferenceTest5.java
- * @run main InferenceTest5
- */
-
-import java.util.List;
-import java.io.File;
-
-public class InferenceTest5 {
-
-    private static void assertTrue(boolean b) {
-        if(!b)
-            throw new AssertionError();
-    }
-
-    public static void main(String[] args) {
-        InferenceTest5 test = new InferenceTest5();
-        int n = test.method1((a, b) -> {} );
-        assertTrue(n == 1);
-
-        n = test.method1(() -> null);
-        assertTrue(n == 2);
-
-        n = test.method1(a -> null);
-        assertTrue(n == 3);
-
-        n = test.method1(a -> {});
-        assertTrue(n == 4);
-
-        n = test.method1(() -> {});
-        assertTrue(n == 5);
-
-        n = test.method1((a, b) -> 0);
-        assertTrue(n == 6);
-
-        n = test.method1((a, b) -> null);
-        assertTrue(n == 6);
-
-        n = test.method1((a, b) -> null, (a, b) -> null);
-        assertTrue(n == 7);
-    }
-
-    int method1(SAM1<String> s) {
-        return 1;
-    }
-
-    int method1(SAM2 s) {
-        return 2;
-    }
-
-    int method1(SAM3 s) {
-        return 3;
-    }
-
-    int method1(SAM4 s) {
-        return 4;
-    }
-
-    int method1(SAM5 s) {
-        return 5;
-    }
-
-    int method1(SAM6<?, ? super Integer> s) {
-        return 6;
-    }
-
-    int method1(SAM6<?, ?>... s) {
-        return 7;
-    }
-
-    static interface SAM1<T> {
-        void foo(List<T> a, List<T> b);
-    }
-
-    static interface SAM2 {
-        List<String> foo();
-    }
-
-    static interface SAM3 {
-        String foo(int a);
-    }
-
-    static interface SAM4 {
-        void foo(List<File> a);
-    }
-
-    static interface SAM5 {
-        void foo();
-    }
-
-    static interface SAM6<T, V> {
-        V get(T t, T t2);
-    }
-}
--- a/test/tools/javac/lambda/typeInference/InferenceTest_neg1_2.out	Fri Jul 26 13:20:55 2013 +0100
+++ b/test/tools/javac/lambda/typeInference/InferenceTest_neg1_2.out	Thu Aug 08 14:30:47 2013 +0100
@@ -1,4 +1,5 @@
 InferenceTest_neg1_2.java:14:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM5<java.lang.Integer>), InferenceTest_neg1_2
-InferenceTest_neg1_2.java:15:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM2), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>), InferenceTest_neg1_2
-InferenceTest_neg1_2.java:16:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM3<java.lang.Integer>), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM5<java.lang.Integer>), InferenceTest_neg1_2
-3 errors
+InferenceTest_neg1_2.java:15:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM5<java.lang.Integer>), InferenceTest_neg1_2
+InferenceTest_neg1_2.java:16:13: compiler.err.ref.ambiguous: method, kindname.method, method(InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>), InferenceTest_neg1_2, kindname.method, method(InferenceTest_neg1_2.SAM5<java.lang.Integer>), InferenceTest_neg1_2
+InferenceTest_neg1_2.java:16:20: compiler.err.cant.apply.symbol: kindname.method, method, InferenceTest_neg1_2.SAM4<java.lang.Double,java.lang.String>, @597, kindname.class, InferenceTest_neg1_2, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: int, java.lang.String)))
+4 errors