changeset 726:77cc34d5e548

5088624: cannot find symbol message should be more intelligent Summary: Resolve.java should keep track of all candidates found during a method resolution sweep to generate more meaningful diagnostics Reviewed-by: jjg
author mcimadamore
date Sat, 18 Sep 2010 09:56:23 -0700
parents 50f9ac2f4730
children 0c1ef2af7a8e
files src/share/classes/com/sun/tools/javac/comp/Attr.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 src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java test/tools/javac/6758789/T6758789a.out test/tools/javac/6840059/T6840059.out test/tools/javac/6857948/T6857948.out test/tools/javac/Diagnostics/6722234/T6722234a_1.out test/tools/javac/Diagnostics/6722234/T6722234a_2.out test/tools/javac/Diagnostics/6722234/T6722234b_1.out test/tools/javac/Diagnostics/6722234/T6722234b_2.out test/tools/javac/Diagnostics/6722234/T6722234c.out test/tools/javac/Diagnostics/6799605/T6799605.out test/tools/javac/Diagnostics/6862608/T6862608a.out test/tools/javac/Diagnostics/6862608/T6862608b.out test/tools/javac/T6326754.out test/tools/javac/diags/Example.java test/tools/javac/diags/examples.not-yet.txt test/tools/javac/diags/examples/ExplicitParamsDoNotConformToBounds.java test/tools/javac/diags/examples/InapplicableSymbols.java test/tools/javac/diags/examples/IncompatibleTypes1.java test/tools/javac/diags/examples/InferArgsLengthMismatch.java test/tools/javac/diags/examples/KindnameConstructor.java test/tools/javac/diags/examples/NoArgs.java test/tools/javac/diags/examples/VarargsArgumentMismatch.java test/tools/javac/diags/examples/WhereCaptured.java test/tools/javac/diags/examples/WhereCaptured1.java test/tools/javac/diags/examples/WhereTypeVar.java test/tools/javac/generics/diamond/neg/Neg06.out test/tools/javac/generics/inference/6315770/T6315770.out test/tools/javac/generics/inference/6611449/T6611449.out test/tools/javac/generics/inference/6638712/T6638712a.out test/tools/javac/generics/inference/6638712/T6638712b.out test/tools/javac/generics/inference/6638712/T6638712c.out test/tools/javac/generics/inference/6638712/T6638712d.out test/tools/javac/generics/inference/6638712/T6638712e.out
diffstat 37 files changed, 403 insertions(+), 139 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Sat Sep 18 09:56:23 2010 -0700
@@ -1422,7 +1422,8 @@
 
             // Compute the result type.
             Type restype = mtype.getReturnType();
-            assert restype.tag != WILDCARD : mtype;
+            if (restype.tag == WILDCARD)
+                throw new AssertionError(mtype);
 
             // as a special case, array.clone() has a result that is
             // the same as static type of the array being cloned
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Sat Sep 18 09:56:23 2010 -0700
@@ -80,25 +80,12 @@
 
     }
 
-    public static class InferenceException extends RuntimeException {
+    public static class InferenceException extends Resolve.InapplicableMethodException {
         private static final long serialVersionUID = 0;
 
-        JCDiagnostic diagnostic;
-        JCDiagnostic.Factory diags;
-
         InferenceException(JCDiagnostic.Factory diags) {
-            this.diagnostic = null;
-            this.diags = diags;
+            super(diags);
         }
-
-        InferenceException setMessage(String key, Object... args) {
-            this.diagnostic = diags.fragment(key, args);
-            return this;
-        }
-
-        public JCDiagnostic getDiagnostic() {
-             return diagnostic;
-         }
     }
 
     public static class NoInstanceException extends InferenceException {
@@ -320,7 +307,7 @@
         Type qtype1 = types.subst(that.qtype, that.tvars, undetvars);
         if (!types.isSubtype(qtype1, to)) {
             throw unambiguousNoInstanceException
-                .setMessage("no.conforming.instance.exists",
+                .setMessage("infer.no.conforming.instance.exists",
                             that.tvars, that.qtype, to);
         }
         for (List<Type> l = undetvars; l.nonEmpty(); l = l.tail)
@@ -378,6 +365,11 @@
         // instantiate all polymorphic argument types and
         // set up lower bounds constraints for undetvars
         Type varargsFormal = useVarargs ? formals.last() : null;
+        if (varargsFormal == null &&
+                actuals.size() != formals.size()) {
+            throw unambiguousNoInstanceException
+                .setMessage("infer.arg.length.mismatch");
+        }
         while (actuals.nonEmpty() && formals.head != varargsFormal) {
             Type formal = formals.head;
             Type actual = actuals.head.baseType();
@@ -390,19 +382,16 @@
                 : types.isSubtypeUnchecked(actual, undetFormal, warn);
             if (!works) {
                 throw unambiguousNoInstanceException
-                    .setMessage("no.conforming.assignment.exists",
+                    .setMessage("infer.no.conforming.assignment.exists",
                                 tvars, actualNoCapture, formal);
             }
             formals = formals.tail;
             actuals = actuals.tail;
             actualsNoCapture = actualsNoCapture.tail;
         }
-        if (formals.head != varargsFormal || // not enough args
-            !useVarargs && actuals.nonEmpty()) { // too many args
-            // argument lists differ in length
-            throw unambiguousNoInstanceException
-                .setMessage("arg.length.mismatch");
-        }
+
+        if (formals.head != varargsFormal) // not enough args
+            throw unambiguousNoInstanceException.setMessage("infer.arg.length.mismatch");
 
         // for varargs arguments as well
         if (useVarargs) {
@@ -416,7 +405,7 @@
                 boolean works = types.isConvertible(actual, elemUndet, warn);
                 if (!works) {
                     throw unambiguousNoInstanceException
-                        .setMessage("no.conforming.assignment.exists",
+                        .setMessage("infer.no.conforming.assignment.exists",
                                     tvars, actualNoCapture, elemType);
                 }
                 actuals = actuals.tail;
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Sat Sep 18 09:56:23 2010 -0700
@@ -119,6 +119,8 @@
                 target.hasInvokedynamic()) &&
                 options.get("invokedynamic") != null;
         polymorphicSignatureScope = new Scope(syms.noSymbol);
+
+        inapplicableMethodException = new InapplicableMethodException(diags);
     }
 
     /** error symbols, which are returned when resolution fails
@@ -318,7 +320,8 @@
         throws Infer.InferenceException {
         boolean polymorphicSignature = (m.isPolymorphicSignatureGeneric() && allowMethodHandles) ||
                                         isTransitionalDynamicCallSite(site, m);
-        if (useVarargs && (m.flags() & VARARGS) == 0) return null;
+        if (useVarargs && (m.flags() & VARARGS) == 0)
+            throw inapplicableMethodException.setMessage(null);
         Type mt = types.memberType(site, m);
 
         // tvars is the list of formal type variables for which type arguments
@@ -334,7 +337,7 @@
         } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) {
             ForAll pmt = (ForAll) mt;
             if (typeargtypes.length() != pmt.tvars.length())
-                return null;
+                throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args
             // Check type arguments are within bounds
             List<Type> formals = pmt.tvars;
             List<Type> actuals = typeargtypes;
@@ -343,7 +346,7 @@
                                                 pmt.tvars, typeargtypes);
                 for (; bounds.nonEmpty(); bounds = bounds.tail)
                     if (!types.isSubtypeUnchecked(actuals.head, bounds.head, warn))
-                        return null;
+                        throw inapplicableMethodException.setMessage("explicit.param.do.not.conform.to.bounds",actuals.head, bounds);
                 formals = formals.tail;
                 actuals = actuals.tail;
             }
@@ -375,11 +378,10 @@
                                     allowBoxing,
                                     useVarargs,
                                     warn);
-        return
-            argumentsAcceptable(argtypes, mt.getParameterTypes(),
-                                allowBoxing, useVarargs, warn)
-            ? mt
-            : null;
+
+        checkRawArgumentsAcceptable(argtypes, mt.getParameterTypes(),
+                                allowBoxing, useVarargs, warn);
+        return mt;
     }
 
     boolean isTransitionalDynamicCallSite(Type site, Symbol sym) {
@@ -403,7 +405,7 @@
         try {
             return rawInstantiate(env, site, m, argtypes, typeargtypes,
                                   allowBoxing, useVarargs, warn);
-        } catch (Infer.InferenceException ex) {
+        } catch (InapplicableMethodException ex) {
             return null;
         }
     }
@@ -415,26 +417,76 @@
                                 boolean allowBoxing,
                                 boolean useVarargs,
                                 Warner warn) {
+        try {
+            checkRawArgumentsAcceptable(argtypes, formals, allowBoxing, useVarargs, warn);
+            return true;
+        } catch (InapplicableMethodException ex) {
+            return false;
+        }
+    }
+    void checkRawArgumentsAcceptable(List<Type> argtypes,
+                                List<Type> formals,
+                                boolean allowBoxing,
+                                boolean useVarargs,
+                                Warner warn) {
         Type varargsFormal = useVarargs ? formals.last() : null;
+        if (varargsFormal == null &&
+                argtypes.size() != formals.size()) {
+            throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args
+        }
+
         while (argtypes.nonEmpty() && formals.head != varargsFormal) {
             boolean works = allowBoxing
                 ? types.isConvertible(argtypes.head, formals.head, warn)
                 : types.isSubtypeUnchecked(argtypes.head, formals.head, warn);
-            if (!works) return false;
+            if (!works)
+                throw inapplicableMethodException.setMessage("no.conforming.assignment.exists",
+                        argtypes.head,
+                        formals.head);
             argtypes = argtypes.tail;
             formals = formals.tail;
         }
-        if (formals.head != varargsFormal) return false; // not enough args
-        if (!useVarargs)
-            return argtypes.isEmpty();
-        Type elt = types.elemtype(varargsFormal);
-        while (argtypes.nonEmpty()) {
-            if (!types.isConvertible(argtypes.head, elt, warn))
-                return false;
-            argtypes = argtypes.tail;
+
+        if (formals.head != varargsFormal)
+            throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args
+
+        if (useVarargs) {
+            Type elt = types.elemtype(varargsFormal);
+            while (argtypes.nonEmpty()) {
+                if (!types.isConvertible(argtypes.head, elt, warn))
+                    throw inapplicableMethodException.setMessage("varargs.argument.mismatch",
+                            argtypes.head,
+                            elt);
+                argtypes = argtypes.tail;
+            }
         }
-        return true;
+        return;
     }
+    // where
+        public static class InapplicableMethodException extends RuntimeException {
+            private static final long serialVersionUID = 0;
+
+            JCDiagnostic diagnostic;
+            JCDiagnostic.Factory diags;
+
+            InapplicableMethodException(JCDiagnostic.Factory diags) {
+                this.diagnostic = null;
+                this.diags = diags;
+            }
+            InapplicableMethodException setMessage(String key) {
+                this.diagnostic = key != null ? diags.fragment(key) : null;
+                return this;
+            }
+            InapplicableMethodException setMessage(String key, Object... args) {
+                this.diagnostic = key != null ? diags.fragment(key, args) : null;
+                return this;
+            }
+
+            public JCDiagnostic getDiagnostic() {
+                return diagnostic;
+            }
+        }
+        private final InapplicableMethodException inapplicableMethodException;
 
 /* ***************************************************************************
  *  Symbol lookup
@@ -595,6 +647,7 @@
      *  @param allowBoxing Allow boxing conversions of arguments.
      *  @param useVarargs Box trailing arguments into an array for varargs.
      */
+    @SuppressWarnings("fallthrough")
     Symbol selectBest(Env<AttrContext> env,
                       Type site,
                       List<Type> argtypes,
@@ -608,21 +661,16 @@
         if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
         assert sym.kind < AMBIGUOUS;
         try {
-            if (rawInstantiate(env, site, sym, argtypes, typeargtypes,
-                               allowBoxing, useVarargs, Warner.noWarnings) == null) {
-                // inapplicable
-                switch (bestSoFar.kind) {
-                case ABSENT_MTH: return wrongMethod.setWrongSym(sym);
-                case WRONG_MTH: return wrongMethods;
-                default: return bestSoFar;
-                }
-            }
-        } catch (Infer.InferenceException ex) {
+            rawInstantiate(env, site, sym, argtypes, typeargtypes,
+                               allowBoxing, useVarargs, Warner.noWarnings);
+        } catch (InapplicableMethodException ex) {
             switch (bestSoFar.kind) {
             case ABSENT_MTH:
                 return wrongMethod.setWrongSym(sym, ex.getDiagnostic());
             case WRONG_MTH:
-                return wrongMethods;
+                wrongMethods.addCandidate(currentStep, wrongMethod.sym, wrongMethod.explanation);
+            case WRONG_MTHS:
+                return wrongMethods.addCandidate(currentStep, sym, ex.getDiagnostic());
             default:
                 return bestSoFar;
             }
@@ -631,7 +679,7 @@
             return (bestSoFar.kind == ABSENT_MTH)
                 ? new AccessError(env, site, sym)
                 : bestSoFar;
-        }
+            }
         return (bestSoFar.kind > AMBIGUOUS)
             ? sym
             : mostSpecific(sym, bestSoFar, env, site,
@@ -1253,11 +1301,12 @@
                          Name name,
                          List<Type> argtypes,
                          List<Type> typeargtypes) {
-        Symbol sym = methodNotFound;
+        Symbol sym = startResolution();
         List<MethodResolutionPhase> steps = methodResolutionSteps;
         while (steps.nonEmpty() &&
                steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
                sym.kind >= ERRONEOUS) {
+            currentStep = steps.head;
             sym = findFun(env, name, argtypes, typeargtypes,
                     steps.head.isBoxingRequired,
                     env.info.varArgs = steps.head.isVarargsRequired);
@@ -1274,6 +1323,12 @@
         return sym;
     }
 
+    private Symbol startResolution() {
+        wrongMethod.clear();
+        wrongMethods.clear();
+        return methodNotFound;
+    }
+
     /** Resolve a qualified method identifier
      *  @param pos       The position to use for error reporting.
      *  @param env       The environment current at the method invocation.
@@ -1286,11 +1341,12 @@
     Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
                                   Type site, Name name, List<Type> argtypes,
                                   List<Type> typeargtypes) {
-        Symbol sym = methodNotFound;
+        Symbol sym = startResolution();
         List<MethodResolutionPhase> steps = methodResolutionSteps;
         while (steps.nonEmpty() &&
                steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
                sym.kind >= ERRONEOUS) {
+            currentStep = steps.head;
             sym = findMethod(env, site, name, argtypes, typeargtypes,
                     steps.head.isBoxingRequired(),
                     env.info.varArgs = steps.head.isVarargsRequired(), false);
@@ -1404,11 +1460,12 @@
                               Type site,
                               List<Type> argtypes,
                               List<Type> typeargtypes) {
-        Symbol sym = methodNotFound;
+        Symbol sym = startResolution();
         List<MethodResolutionPhase> steps = methodResolutionSteps;
         while (steps.nonEmpty() &&
                steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
                sym.kind >= ERRONEOUS) {
+            currentStep = steps.head;
             sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
                     steps.head.isBoxingRequired(),
                     env.info.varArgs = steps.head.isVarargsRequired());
@@ -1439,26 +1496,22 @@
                               Type site,
                               List<Type> argtypes,
                               List<Type> typeargtypes) {
-        Symbol sym = methodNotFound;
-        JCDiagnostic explanation = null;
+        Symbol sym = startResolution();
         List<MethodResolutionPhase> steps = methodResolutionSteps;
         while (steps.nonEmpty() &&
                steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
                sym.kind >= ERRONEOUS) {
+            currentStep = steps.head;
             sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
                     steps.head.isBoxingRequired(),
                     env.info.varArgs = steps.head.isVarargsRequired());
             methodResolutionCache.put(steps.head, sym);
-            if (sym.kind == WRONG_MTH &&
-                    ((InapplicableSymbolError)sym).explanation != null) {
-                //if the symbol is an inapplicable method symbol, then the
-                //explanation contains the reason for which inference failed
-                explanation = ((InapplicableSymbolError)sym).explanation;
-            }
             steps = steps.tail;
         }
         if (sym.kind >= AMBIGUOUS) {
-            final JCDiagnostic details = explanation;
+            final JCDiagnostic details = sym.kind == WRONG_MTH ?
+                ((InapplicableSymbolError)sym).explanation :
+                null;
             Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
                 @Override
                 JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
@@ -1860,7 +1913,8 @@
          */
         InapplicableSymbolError setWrongSym(Symbol sym, JCDiagnostic explanation) {
             this.sym = sym;
-            this.explanation = explanation;
+            if (this.sym == sym && explanation != null)
+                this.explanation = explanation; //update the details
             return this;
         }
 
@@ -1868,7 +1922,6 @@
          */
         InapplicableSymbolError setWrongSym(Symbol sym) {
             this.sym = sym;
-            this.explanation = null;
             return this;
         }
 
@@ -1905,6 +1958,10 @@
             }
         }
 
+        void clear() {
+            explanation = null;
+        }
+
         @Override
         public Symbol access(Name name, TypeSymbol location) {
             return types.createErrorType(name, location, syms.errSymbol.type).tsym;
@@ -1917,6 +1974,9 @@
      * given an actual arguments/type argument list.
      */
     class InapplicableSymbolsError extends ResolveError {
+
+        private List<Candidate> candidates = List.nil();
+
         InapplicableSymbolsError(Symbol sym) {
             super(WRONG_MTHS, "inapplicable symbols");
         }
@@ -1928,8 +1988,85 @@
                 Name name,
                 List<Type> argtypes,
                 List<Type> typeargtypes) {
-            return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
+            if (candidates.nonEmpty()) {
+                JCDiagnostic err = diags.create(dkind,
+                        log.currentSource(),
+                        pos,
+                        "cant.apply.symbols",
+                        name == names.init ? KindName.CONSTRUCTOR : absentKind(kind),
+                        getName(),
+                        argtypes);
+                return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site));
+            } else {
+                return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
                     site, name, argtypes, typeargtypes);
+            }
+        }
+
+        //where
+        List<JCDiagnostic> candidateDetails(Type site) {
+            List<JCDiagnostic> details = List.nil();
+            for (Candidate c : candidates)
+                details = details.prepend(c.getDiagnostic(site));
+            return details.reverse();
+        }
+
+        Symbol addCandidate(MethodResolutionPhase currentStep, Symbol sym, JCDiagnostic details) {
+            Candidate c = new Candidate(currentStep, sym, details);
+            if (c.isValid() && !candidates.contains(c))
+                candidates = candidates.append(c);
+            return this;
+        }
+
+        void clear() {
+            candidates = List.nil();
+        }
+
+        private Name getName() {
+            Symbol sym = candidates.head.sym;
+            return sym.name == names.init ?
+                sym.owner.name :
+                sym.name;
+        }
+
+        private class Candidate {
+
+            final MethodResolutionPhase step;
+            final Symbol sym;
+            final JCDiagnostic details;
+
+            private Candidate(MethodResolutionPhase step, Symbol sym, JCDiagnostic details) {
+                this.step = step;
+                this.sym = sym;
+                this.details = details;
+            }
+
+            JCDiagnostic getDiagnostic(Type site) {
+                return diags.fragment("inapplicable.method",
+                        Kinds.kindName(sym),
+                        sym.location(site, types),
+                        sym.asMemberOf(site, types),
+                        details);
+            }
+
+            @Override
+            public boolean equals(Object o) {
+                if (o instanceof Candidate) {
+                    Symbol s1 = this.sym;
+                    Symbol s2 = ((Candidate)o).sym;
+                    if  ((s1 != s2 &&
+                        (s1.overrides(s2, s1.owner.type.tsym, types, false) ||
+                        (s2.overrides(s1, s2.owner.type.tsym, types, false)))) ||
+                        ((s1.isConstructor() || s2.isConstructor()) && s1.owner != s2.owner))
+                        return true;
+                }
+                return false;
+            }
+
+            boolean isValid() {
+                return  (((sym.flags() & VARARGS) != 0 && step == VARARITY) ||
+                          (sym.flags() & VARARGS) == 0 && step == (boxingEnabled ? BOX : BASIC));
+            }
         }
     }
 
@@ -2093,6 +2230,8 @@
 
     final List<MethodResolutionPhase> methodResolutionSteps = List.of(BASIC, BOX, VARARITY);
 
+    private MethodResolutionPhase currentStep = null;
+
     private MethodResolutionPhase firstErroneousResolutionPhase() {
         MethodResolutionPhase bestSoFar = BASIC;
         Symbol sym = methodNotFound;
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Sat Sep 18 09:54:51 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Sat Sep 18 09:56:23 2010 -0700
@@ -93,6 +93,8 @@
     required: {2}\n\
     found: {3}\n\
     reason: {6}
+compiler.err.cant.apply.symbols=\
+    no suitable {0} found for {1}({2})
 compiler.err.cant.assign.val.to.final.var=\
     cannot assign a value to final variable {0}
 compiler.err.cant.deref=\
@@ -1075,11 +1077,11 @@
     no unique maximal instance exists for type variable {0} with upper bounds {1}
 compiler.misc.no.unique.minimal.instance.exists=\
     no unique minimal instance exists for type variable {0} with lower bounds {1}
-compiler.misc.no.conforming.instance.exists=\
+compiler.misc.infer.no.conforming.instance.exists=\
     no instance(s) of type variable(s) {0} exist so that {1} conforms to {2}
-compiler.misc.no.conforming.assignment.exists=\
+compiler.misc.infer.no.conforming.assignment.exists=\
     no instance(s) of type variable(s) {0} exist so that argument type {1} conforms to formal parameter type {2}
-compiler.misc.arg.length.mismatch=\
+compiler.misc.infer.arg.length.mismatch=\
     cannot instantiate from arguments because actual and formal argument lists differ in length
 compiler.misc.inferred.do.not.conform.to.bounds=\
     inferred type does not conform to declared bound(s)\n\
@@ -1095,6 +1097,16 @@
     type argument {0} inferred for {1} is not allowed in this context
 compiler.misc.diamond.invalid.args=\
     type arguments {0} inferred for {1} are not allowed in this context
+
+compiler.misc.explicit.param.do.not.conform.to.bounds=\
+    explicit type argument {0} does not conform to declared bound(s) {1}
+
+compiler.misc.arg.length.mismatch=\
+    actual and formal argument lists differ in length
+compiler.misc.no.conforming.assignment.exists=\
+    actual argument {0} cannot be converted to {1} by method invocation conversion
+compiler.misc.varargs.argument.mismatch=\
+    argument type {0} does not conform to vararg element type {1}
 #####
 
 ## The first argument ({0}) is a "kindname".
@@ -1232,6 +1244,10 @@
 compiler.misc.non.denotable.type=\
     Non-denotable type {0} not allowed here
 
+compiler.misc.inapplicable.method=\
+    {0} {1}.{2} is not applicable\n\
+    ({3})
+
 ########################################
 # Diagnostics for language feature changes
 ########################################
--- a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Sat Sep 18 09:56:23 2010 -0700
@@ -65,8 +65,6 @@
  */
 public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
 
-    protected int currentIndentation = 0;
-
     /**
      * Create a basic formatter based on the supplied options.
      *
@@ -107,33 +105,28 @@
     }
 
     public String formatMessage(JCDiagnostic d, Locale l) {
-        int prevIndentation = currentIndentation;
-        try {
-            StringBuilder buf = new StringBuilder();
-            Collection<String> args = formatArguments(d, l);
-            String msg = localize(l, d.getCode(), args.toArray());
-            String[] lines = msg.split("\n");
-            if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) {
-                currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY);
-                buf.append(indent(lines[0], currentIndentation)); //summary
+        int currentIndentation = 0;
+        StringBuilder buf = new StringBuilder();
+        Collection<String> args = formatArguments(d, l);
+        String msg = localize(l, d.getCode(), args.toArray());
+        String[] lines = msg.split("\n");
+        if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) {
+            currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY);
+            buf.append(indent(lines[0], currentIndentation)); //summary
+        }
+        if (lines.length > 1 && getConfiguration().getVisible().contains(DiagnosticPart.DETAILS)) {
+            currentIndentation += getConfiguration().getIndentation(DiagnosticPart.DETAILS);
+            for (int i = 1;i < lines.length; i++) {
+                buf.append("\n" + indent(lines[i], currentIndentation));
             }
-            if (lines.length > 1 && getConfiguration().getVisible().contains(DiagnosticPart.DETAILS)) {
-                currentIndentation += getConfiguration().getIndentation(DiagnosticPart.DETAILS);
-                for (int i = 1;i < lines.length; i++) {
-                    buf.append("\n" + indent(lines[i], currentIndentation));
-                }
+        }
+        if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) {
+            currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS);
+                for (String sub : formatSubdiagnostics(d, l)) {
+                    buf.append("\n" + indent(sub, currentIndentation));
             }
-            if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) {
-                currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS);
-                for (String sub : formatSubdiagnostics(d, l)) {
-                    buf.append("\n" + sub);
-                }
-            }
-            return buf.toString();
         }
-        finally {
-            currentIndentation = prevIndentation;
-        }
+        return buf.toString();
     }
 
     protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
--- a/test/tools/javac/6758789/T6758789a.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/6758789/T6758789a.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,3 +1,3 @@
-T6758789a.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m1, compiler.misc.no.args, int, kindname.class, T6758789a, null
-T6758789a.java:15:9: compiler.err.cant.apply.symbol: kindname.method, m2, int, compiler.misc.no.args, kindname.class, T6758789a, null
+T6758789a.java:14:9: compiler.err.cant.apply.symbol.1: kindname.method, m1, compiler.misc.no.args, int, kindname.class, T6758789a, (compiler.misc.arg.length.mismatch)
+T6758789a.java:15:9: compiler.err.cant.apply.symbol.1: kindname.method, m2, int, compiler.misc.no.args, kindname.class, T6758789a, (compiler.misc.arg.length.mismatch)
 2 errors
--- a/test/tools/javac/6840059/T6840059.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/6840059/T6840059.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,3 +1,3 @@
-T6840059.java:15:9: compiler.err.cant.apply.symbol: kindname.constructor, T6840059, java.lang.Integer, java.lang.String, kindname.class, T6840059, null
-T6840059.java:15:25: compiler.err.cant.apply.symbol: kindname.constructor, T6840059, java.lang.Integer, compiler.misc.no.args, kindname.class, T6840059, null
+T6840059.java:15:9: compiler.err.cant.apply.symbol.1: kindname.constructor, T6840059, java.lang.Integer, java.lang.String, kindname.class, T6840059, (compiler.misc.no.conforming.assignment.exists: java.lang.String, java.lang.Integer)
+T6840059.java:15:25: compiler.err.cant.apply.symbol.1: kindname.constructor, T6840059, java.lang.Integer, compiler.misc.no.args, kindname.class, T6840059, (compiler.misc.arg.length.mismatch)
 2 errors
--- a/test/tools/javac/6857948/T6857948.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/6857948/T6857948.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,3 +1,3 @@
 T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , kindname.class, Test
-T6857948.java:16:50: compiler.err.cant.apply.symbol: kindname.constructor, Foo, java.lang.String, compiler.misc.no.args, kindname.class, Foo, null
+T6857948.java:16:50: compiler.err.cant.apply.symbol.1: kindname.constructor, Foo, java.lang.String, compiler.misc.no.args, kindname.class, Foo, (compiler.misc.arg.length.mismatch)
 2 errors
--- a/test/tools/javac/Diagnostics/6722234/T6722234a_1.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6722234/T6722234a_1.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6722234a.java:12:9: compiler.err.cant.apply.symbol: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a<compiler.misc.type.var: T, 1>, null
+T6722234a.java:12:9: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a<compiler.misc.type.var: T, 1>, (compiler.misc.no.conforming.assignment.exists: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1)
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234a_2.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6722234/T6722234a_2.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,3 +1,3 @@
-T6722234a.java:12:9: compiler.err.cant.apply.symbol: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a<compiler.misc.type.var: T, 1>, null
+T6722234a.java:12:9: compiler.err.cant.apply.symbol.1: kindname.method, m, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T6722234a<compiler.misc.type.var: T, 1>, (compiler.misc.no.conforming.assignment.exists: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1)
 - compiler.misc.where.description.typevar.1: compiler.misc.type.var: T, 1,compiler.misc.type.var: T, 2,{(compiler.misc.where.typevar: compiler.misc.type.var: T, 1, java.lang.String, kindname.class, T6722234a),(compiler.misc.where.typevar: compiler.misc.type.var: T, 2, java.lang.Integer, kindname.method, <compiler.misc.type.var: T, 2>test(compiler.misc.type.var: T, 2))}
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234b_1.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6722234/T6722234b_1.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.type.captureof: 1, ? extends T6722234b>,List<compiler.misc.type.captureof: 2, ? extends T6722234b>, kindname.class, T6722234b, null
+T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List<T>,List<T>, List<compiler.misc.type.captureof: 1, ? extends T6722234b>,List<compiler.misc.type.captureof: 2, ? extends T6722234b>, kindname.class, T6722234b, (compiler.misc.infer.no.conforming.assignment.exists: T, List<compiler.misc.type.captureof: 2, ? extends T6722234b>, List<T>)
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234b_2.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6722234/T6722234b_2.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,4 +1,4 @@
-T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List<T>,List<T>, List<compiler.misc.captured.type: 1>,List<compiler.misc.captured.type: 2>, kindname.class, T6722234b, null
+T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List<T>,List<T>, List<compiler.misc.captured.type: 1>,List<compiler.misc.captured.type: 2>, kindname.class, T6722234b, (compiler.misc.infer.no.conforming.assignment.exists: T, List<compiler.misc.captured.type: 2>, List<T>)
 - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, Object, kindname.method, <T>m(List<T>,List<T>))}
 - compiler.misc.where.description.captured.1: compiler.misc.captured.type: 1,compiler.misc.captured.type: 2,{(compiler.misc.where.captured.1: compiler.misc.captured.type: 1, T6722234b, compiler.misc.type.null, ? extends T6722234b),(compiler.misc.where.captured.1: compiler.misc.captured.type: 2, T6722234b, compiler.misc.type.null, ? extends T6722234b)}
 1 error
--- a/test/tools/javac/Diagnostics/6722234/T6722234c.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6722234/T6722234c.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6722234c.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, T6722234c.String, java.lang.String, kindname.class, T6722234c, null
+T6722234c.java:14:9: compiler.err.cant.apply.symbol.1: kindname.method, m, T6722234c.String, java.lang.String, kindname.class, T6722234c, (compiler.misc.infer.no.conforming.assignment.exists: T, java.lang.String, T6722234c.String)
 1 error
--- a/test/tools/javac/Diagnostics/6799605/T6799605.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6799605/T6799605.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,4 +1,4 @@
-T6799605.java:17:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605<compiler.misc.type.captureof: 1, ?>, kindname.class, T6799605<X>
-T6799605.java:18:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>, kindname.class, T6799605<X>
-T6799605.java:19:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>, kindname.class, T6799605<X>
+T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.inferred.do.not.conform.to.bounds: compiler.misc.type.captureof: 1, ?, T6799605<compiler.misc.type.captureof: 1, ?>))}
+T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.no.conforming.assignment.exists: T, T6799605<compiler.misc.type.captureof: 2, ?>, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch))}
+T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605<compiler.misc.type.captureof: 1, ?>,T6799605<compiler.misc.type.captureof: 2, ?>,T6799605<compiler.misc.type.captureof: 3, ?>,{(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>,T6799605<T>), (compiler.misc.infer.no.conforming.assignment.exists: T, T6799605<compiler.misc.type.captureof: 2, ?>, T6799605<T>)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>,T6799605<T>), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, <T>m(T6799605<T>), (compiler.misc.infer.arg.length.mismatch))}
 3 errors
--- a/test/tools/javac/Diagnostics/6862608/T6862608a.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,3 +1,3 @@
-T6862608a.java:19:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
+T6862608a.java:19:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
 - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, <T>compound(java.lang.Iterable<? extends java.util.Comparator<? super T>>))}
 1 error
--- a/test/tools/javac/Diagnostics/6862608/T6862608b.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/Diagnostics/6862608/T6862608b.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,3 +1,3 @@
-T6862608b.java:11:7: compiler.err.cant.apply.symbol: kindname.method, test, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T66862608b<compiler.misc.type.var: T, 1,compiler.misc.type.var: S, 2>, null
+T6862608b.java:11:7: compiler.err.cant.apply.symbol.1: kindname.method, test, compiler.misc.type.var: T, 1, compiler.misc.type.var: T, 2, kindname.class, T66862608b<compiler.misc.type.var: T, 1,compiler.misc.type.var: S, 2>, (compiler.misc.no.conforming.assignment.exists: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1)
 - compiler.misc.where.description.typevar.1: compiler.misc.type.var: T, 1,compiler.misc.type.var: T, 2,compiler.misc.type.var: S, 1,compiler.misc.type.var: S, 2,{(compiler.misc.where.typevar: compiler.misc.type.var: T, 1, java.lang.String, kindname.class, T66862608b),(compiler.misc.where.typevar: compiler.misc.type.var: T, 2, compiler.misc.type.var: S, 1, kindname.method, <compiler.misc.type.var: S, 1,compiler.misc.type.var: T, 2>foo(compiler.misc.type.var: T, 2)),(compiler.misc.where.typevar: compiler.misc.type.var: S, 1, java.lang.Object, kindname.method, <compiler.misc.type.var: S, 1,compiler.misc.type.var: T, 2>foo(compiler.misc.type.var: T, 2)),(compiler.misc.where.typevar: compiler.misc.type.var: S, 2, java.lang.Object, kindname.class, T66862608b)}
 1 error
--- a/test/tools/javac/T6326754.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/T6326754.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,7 +1,7 @@
 T6326754.java:44:12: compiler.err.name.clash.same.erasure: TestConstructor(T), TestConstructor(K)
 T6326754.java:52:17: compiler.err.name.clash.same.erasure: setT(K), setT(T)
 T6326754.java:64:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), T, T
-T6326754.java:70:11: compiler.err.cant.apply.symbol: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC<T>, null
+T6326754.java:70:11: compiler.err.cant.apply.symbol.1: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC<T>, (compiler.misc.arg.length.mismatch)
 - compiler.note.unchecked.filename: T6326754.java
 - compiler.note.unchecked.recompile
 4 errors
--- a/test/tools/javac/diags/Example.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/Example.java	Sat Sep 18 09:56:23 2010 -0700
@@ -401,7 +401,7 @@
                 }
             }
             for (JCDiagnostic sd: d.getSubdiagnostics())
-                scanForKeys(d, keys);
+                scanForKeys(sd, keys);
         }
     }
 
--- a/test/tools/javac/diags/examples.not-yet.txt	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/examples.not-yet.txt	Sat Sep 18 09:56:23 2010 -0700
@@ -3,7 +3,7 @@
 compiler.err.annotation.value.not.allowable.type        # cannot happen: precluded by complete type-specific tests
 compiler.err.assignment.from.super-bound                # DEAD
 compiler.err.assignment.to.extends-bound                # DEAD
-compiler.err.cant.apply.symbol.1
+compiler.err.cant.apply.symbol
 compiler.err.cant.read.file                             # (apt.JavaCompiler?)
 compiler.err.cant.select.static.class.from.param.type
 compiler.err.illegal.char.for.encoding
@@ -43,7 +43,6 @@
 compiler.err.unexpected.type
 compiler.err.unknown.enum.constant                      # in bad class file
 compiler.err.unsupported.cross.fp.lit                   # Scanner: host system dependent
-compiler.misc.arg.length.mismatch
 compiler.misc.assignment.from.super-bound
 compiler.misc.assignment.to.extends-bound
 compiler.misc.bad.class.file.header                     # bad class file
@@ -73,7 +72,6 @@
 compiler.misc.kindname.type.variable
 compiler.misc.kindname.type.variable.bound
 compiler.misc.kindname.value
-compiler.misc.no.conforming.assignment.exists
 compiler.misc.non.denotable.type
 compiler.misc.no.unique.minimal.instance.exists
 compiler.misc.resume.abort                              # prompt for a response
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/ExplicitParamsDoNotConformToBounds.java	Sat Sep 18 09:56:23 2010 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 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.1
+// key: compiler.misc.explicit.param.do.not.conform.to.bounds
+
+class ExplicitParamsDoNotConformToBounds {
+    <X extends Number> void m() {}
+    { this.<String>m(); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/InapplicableSymbols.java	Sat Sep 18 09:56:23 2010 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 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.symbols
+// key: compiler.misc.arg.length.mismatch
+// key: compiler.misc.inapplicable.method
+
+class ExplicitParamsDoNotConformToBounds {
+    void m(int i1) {}
+    void m(int i1, int i2) {}
+    { this.m(); }
+}
--- a/test/tools/javac/diags/examples/IncompatibleTypes1.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/examples/IncompatibleTypes1.java	Sat Sep 18 09:56:23 2010 -0700
@@ -22,7 +22,7 @@
  */
 
 // key: compiler.misc.incompatible.types.1
-// key: compiler.misc.no.conforming.instance.exists
+// key: compiler.misc.infer.no.conforming.instance.exists
 // key: compiler.err.prob.found.req
 
 class IncompatibleTypes1<V> {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/InferArgsLengthMismatch.java	Sat Sep 18 09:56:23 2010 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 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.1
+// key: compiler.misc.infer.arg.length.mismatch
+
+class InferArgsLengthMismatch {
+    <X extends Number> void m(X x1, X x2) {}
+    { this.m(1); }
+}
--- a/test/tools/javac/diags/examples/KindnameConstructor.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/examples/KindnameConstructor.java	Sat Sep 18 09:56:23 2010 -0700
@@ -24,7 +24,9 @@
 // key: compiler.misc.kindname.constructor
 // key: compiler.misc.kindname.class
 // key: compiler.misc.no.args
-// key: compiler.err.cant.apply.symbol
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.arg.length.mismatch
+// key: compiler.misc.no.conforming.assignment.exists
 // key: compiler.misc.count.error.plural
 // run: backdoor
 
--- a/test/tools/javac/diags/examples/NoArgs.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/examples/NoArgs.java	Sat Sep 18 09:56:23 2010 -0700
@@ -22,7 +22,8 @@
  */
 
 // key: compiler.misc.no.args
-// key: compiler.err.cant.apply.symbol
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.arg.length.mismatch
 // run: simple
 
 class X {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/VarargsArgumentMismatch.java	Sat Sep 18 09:56:23 2010 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, 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.1
+// key: compiler.misc.varargs.argument.mismatch
+
+class VarargsArgumentMismatch {
+    void m(String s, Integer... is) {}
+    { this.m("1", "2", "3"); }
+}
--- a/test/tools/javac/diags/examples/WhereCaptured.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/examples/WhereCaptured.java	Sat Sep 18 09:56:23 2010 -0700
@@ -25,7 +25,8 @@
 // key: compiler.misc.where.description.captured.1
 // key: compiler.misc.where.description.typevar
 // key: compiler.misc.where.typevar
-// key: compiler.err.cant.apply.symbol
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.infer.no.conforming.assignment.exists
 // key: compiler.misc.captured.type
 // options: -XDdiags=where,simpleNames
 // run: simple
--- a/test/tools/javac/diags/examples/WhereCaptured1.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/examples/WhereCaptured1.java	Sat Sep 18 09:56:23 2010 -0700
@@ -25,7 +25,8 @@
 // key: compiler.misc.where.description.captured.1
 // key: compiler.misc.where.description.typevar
 // key: compiler.misc.where.typevar
-// key: compiler.err.cant.apply.symbol
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.infer.no.conforming.assignment.exists
 // key: compiler.misc.captured.type
 // key: compiler.misc.type.null
 // options: -XDdiags=where,simpleNames
--- a/test/tools/javac/diags/examples/WhereTypeVar.java	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/diags/examples/WhereTypeVar.java	Sat Sep 18 09:56:23 2010 -0700
@@ -24,7 +24,8 @@
 // key: compiler.misc.where.typevar
 // key: compiler.misc.where.description.typevar.1
 // key: compiler.misc.type.var
-// key: compiler.err.cant.apply.symbol
+// key: compiler.err.cant.apply.symbol.1
+// key: compiler.misc.no.conforming.assignment.exists
 // options: -XDdiags=where,disambiguateTvars
 // run: simple
 
--- a/test/tools/javac/generics/diamond/neg/Neg06.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg06.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,4 +1,4 @@
-Neg06.java:18:36: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.IFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.IFoo<X>, Neg06.ISuperFoo<java.lang.String>)
-Neg06.java:19:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
-Neg06.java:20:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
+Neg06.java:18:36: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.IFoo), (compiler.misc.infer.no.conforming.instance.exists: X, Neg06.IFoo<X>, Neg06.ISuperFoo<java.lang.String>)
+Neg06.java:19:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.infer.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
+Neg06.java:20:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.infer.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
 3 errors
--- a/test/tools/javac/generics/inference/6315770/T6315770.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/inference/6315770/T6315770.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,3 +1,3 @@
 T6315770.java:16:42: compiler.err.undetermined.type.1: <T>T6315770<T>, (compiler.misc.no.unique.maximal.instance.exists: T, java.lang.String,java.lang.Integer,java.lang.Runnable)
-T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String>
+T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, T6315770<T>, T6315770<? super java.lang.String>)), <T>T6315770<T>, T6315770<? super java.lang.String>
 2 errors
--- a/test/tools/javac/generics/inference/6611449/T6611449.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/inference/6611449/T6611449.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,5 +1,5 @@
-T6611449.java:18:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6611449, , int, kindname.class, T6611449<S>
-T6611449.java:19:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6611449, , int,int, kindname.class, T6611449<S>
-T6611449.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, T, int, kindname.class, T6611449<S>, null
-T6611449.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, T,T, int,int, kindname.class, T6611449<S>, null
+T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S))}
+T6611449.java:19:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T,T), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, <T>T6611449(T), (compiler.misc.infer.arg.length.mismatch))}
+T6611449.java:20:9: compiler.err.cant.apply.symbol.1: kindname.method, m1, T, int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S)
+T6611449.java:21:9: compiler.err.cant.apply.symbol.1: kindname.method, m2, T,T, int,int, kindname.class, T6611449<S>, (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S)
 4 errors
--- a/test/tools/javac/generics/inference/6638712/T6638712a.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/inference/6638712/T6638712a.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6638712a.java:16:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
+T6638712a.java:16:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712b.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/inference/6638712/T6638712b.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6638712b.java:14:21: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, T, java.lang.String)), <T>T, java.lang.String
+T6638712b.java:14:21: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, T, java.lang.String)), <T>T, java.lang.String
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712c.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/inference/6638712/T6638712c.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6638712c.java:16:9: compiler.err.cant.apply.symbol: kindname.method, sort, T[],java.util.Comparator<? super T>, java.lang.Enum[],java.util.Comparator<java.lang.Enum<?>>, kindname.class, T6638712c, null
+T6638712c.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, sort, T[],java.util.Comparator<? super T>, java.lang.Enum[],java.util.Comparator<java.lang.Enum<?>>, kindname.class, T6638712c, (compiler.misc.inferred.do.not.conform.to.params: java.lang.Enum[],java.util.Comparator<? super java.lang.Enum>, java.lang.Enum[],java.util.Comparator<java.lang.Enum<?>>)
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712d.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/inference/6638712/T6638712d.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, null
+T6638712d.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, U,java.util.List<java.util.List<U>>, int,java.util.List<java.util.List<java.lang.String>>, kindname.class, T6638712d, (compiler.misc.inferred.do.not.conform.to.params: java.lang.String,java.util.List<java.util.List<java.lang.String>>, int,java.util.List<java.util.List<java.lang.String>>)
 1 error
--- a/test/tools/javac/generics/inference/6638712/T6638712e.out	Sat Sep 18 09:54:51 2010 -0700
+++ b/test/tools/javac/generics/inference/6638712/T6638712e.out	Sat Sep 18 09:56:23 2010 -0700
@@ -1,2 +1,2 @@
-T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: X, T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>)), <X>T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>
+T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: X, T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>)), <X>T6638712e.Foo<X,java.lang.String>, T6638712e.Foo<java.lang.Object,java.lang.String>
 1 error