diff --git a/src/share/classes/com/sun/tools/javac/comp/Attr.java b/src/share/classes/com/sun/tools/javac/comp/Attr.java index 69f7934537b4b17db08c48561209ff06f71772a0..ab6c322e7db513bfa7499897bdd1ebc2ced5863f 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java @@ -1422,7 +1422,8 @@ public class Attr extends JCTree.Visitor { // 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 diff --git a/src/share/classes/com/sun/tools/javac/comp/Infer.java b/src/share/classes/com/sun/tools/javac/comp/Infer.java index 8eb0c46606a460fed53a7b02b7987390aaf3a7a4..b7d28fdaa6f45f47a1c99d3423bcba9e4395a0b7 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java @@ -80,25 +80,12 @@ public class Infer { } - 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; - } - - InferenceException setMessage(String key, Object... args) { - this.diagnostic = diags.fragment(key, args); - return this; + super(diags); } - - public JCDiagnostic getDiagnostic() { - return diagnostic; - } } public static class NoInstanceException extends InferenceException { @@ -320,7 +307,7 @@ public class Infer { 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 l = undetvars; l.nonEmpty(); l = l.tail) @@ -378,6 +365,11 @@ public class Infer { // 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 @@ public class Infer { : 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 @@ public class Infer { 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; diff --git a/src/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/share/classes/com/sun/tools/javac/comp/Resolve.java index d2920e9ec1b4fb501589ad261d47b7565b4a83b5..10141b1e58f5c8b5251a3c223027562dc92b8059 100644 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -119,6 +119,8 @@ public class Resolve { 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 @@ public class Resolve { 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 @@ public class Resolve { } 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 formals = pmt.tvars; List actuals = typeargtypes; @@ -343,7 +346,7 @@ public class Resolve { 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 @@ public class Resolve { 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 @@ public class Resolve { try { return rawInstantiate(env, site, m, argtypes, typeargtypes, allowBoxing, useVarargs, warn); - } catch (Infer.InferenceException ex) { + } catch (InapplicableMethodException ex) { return null; } } @@ -415,26 +417,76 @@ public class Resolve { boolean allowBoxing, boolean useVarargs, Warner warn) { + try { + checkRawArgumentsAcceptable(argtypes, formals, allowBoxing, useVarargs, warn); + return true; + } catch (InapplicableMethodException ex) { + return false; + } + } + void checkRawArgumentsAcceptable(List argtypes, + List 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 @@ public class Resolve { * @param allowBoxing Allow boxing conversions of arguments. * @param useVarargs Box trailing arguments into an array for varargs. */ + @SuppressWarnings("fallthrough") Symbol selectBest(Env env, Type site, List argtypes, @@ -608,21 +661,16 @@ public class Resolve { 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 @@ public class Resolve { 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 @@ public class Resolve { Name name, List argtypes, List typeargtypes) { - Symbol sym = methodNotFound; + Symbol sym = startResolution(); List 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 @@ public class Resolve { 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 @@ public class Resolve { Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env env, Type site, Name name, List argtypes, List typeargtypes) { - Symbol sym = methodNotFound; + Symbol sym = startResolution(); List 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 @@ public class Resolve { Type site, List argtypes, List typeargtypes) { - Symbol sym = methodNotFound; + Symbol sym = startResolution(); List 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 @@ public class Resolve { Type site, List argtypes, List typeargtypes) { - Symbol sym = methodNotFound; - JCDiagnostic explanation = null; + Symbol sym = startResolution(); List 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 argtypes, List typeargtypes) { @@ -1860,7 +1913,8 @@ public class Resolve { */ 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 @@ public class Resolve { */ InapplicableSymbolError setWrongSym(Symbol sym) { this.sym = sym; - this.explanation = null; return this; } @@ -1905,6 +1958,10 @@ public class Resolve { } } + 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 @@ public class Resolve { * given an actual arguments/type argument list. */ class InapplicableSymbolsError extends ResolveError { + + private List candidates = List.nil(); + InapplicableSymbolsError(Symbol sym) { super(WRONG_MTHS, "inapplicable symbols"); } @@ -1928,8 +1988,85 @@ public class Resolve { Name name, List argtypes, List 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 candidateDetails(Type site) { + List 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 @@ public class Resolve { final List methodResolutionSteps = List.of(BASIC, BOX, VARARITY); + private MethodResolutionPhase currentStep = null; + private MethodResolutionPhase firstErroneousResolutionPhase() { MethodResolutionPhase bestSoFar = BASIC; Symbol sym = methodNotFound; diff --git a/src/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/share/classes/com/sun/tools/javac/resources/compiler.properties index dfb32c01cffcda5ccb414e6bfd0ef64fd0ce0ae2..36309876dbcba73a8b1d6269ff9fbbcb2dc96dbd 100644 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -93,6 +93,8 @@ compiler.err.cant.apply.symbol.1=\ 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 @@ compiler.misc.no.unique.maximal.instance.exists=\ 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 @@ compiler.misc.diamond.invalid.arg=\ 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.varargs.clash.with=\ 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 ######################################## diff --git a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java index 1fa1b87ffc29f8cd6b1dea9bd6b565e7b914f101..b4035a81e2540ba5897f464177658bac51ede933 100644 --- a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java +++ b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java @@ -65,8 +65,6 @@ import static com.sun.tools.javac.util.LayoutCharacters.*; */ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { - protected int currentIndentation = 0; - /** * Create a basic formatter based on the supplied options. * @@ -107,33 +105,28 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { } public String formatMessage(JCDiagnostic d, Locale l) { - int prevIndentation = currentIndentation; - try { - StringBuilder buf = new StringBuilder(); - Collection 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)); - } + int currentIndentation = 0; + StringBuilder buf = new StringBuilder(); + Collection 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 (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { - currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS); + } + if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { + currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS); for (String sub : formatSubdiagnostics(d, l)) { - buf.append("\n" + sub); - } + buf.append("\n" + indent(sub, currentIndentation)); } - return buf.toString(); - } - finally { - currentIndentation = prevIndentation; } + return buf.toString(); } protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) { diff --git a/test/tools/javac/6758789/T6758789a.out b/test/tools/javac/6758789/T6758789a.out index 1e1ec6c7b38bec49bf9cd8a429aadfa0e985fd2e..4d82fbc487777ba41c21970b88e38afe81b8e9a1 100644 --- a/test/tools/javac/6758789/T6758789a.out +++ b/test/tools/javac/6758789/T6758789a.out @@ -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 diff --git a/test/tools/javac/6840059/T6840059.out b/test/tools/javac/6840059/T6840059.out index a93cdf688a4d5f2ba591160a7115f4689e1be21b..c8f01866e797bedad3fef90783d3d08ba3b90dcd 100644 --- a/test/tools/javac/6840059/T6840059.out +++ b/test/tools/javac/6840059/T6840059.out @@ -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 diff --git a/test/tools/javac/6857948/T6857948.out b/test/tools/javac/6857948/T6857948.out index f6a79ed7745a20701f109f623d35634c51312e34..0ba7deb6a5577e7d775199e2567c1d483fba29e8 100644 --- a/test/tools/javac/6857948/T6857948.out +++ b/test/tools/javac/6857948/T6857948.out @@ -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 diff --git a/test/tools/javac/Diagnostics/6722234/T6722234a_1.out b/test/tools/javac/Diagnostics/6722234/T6722234a_1.out index 72032584edf7a36f33af980418b37008e88cf227..adfe7af8a68e35f3f4bee3f6bcee124bd99618cc 100644 --- a/test/tools/javac/Diagnostics/6722234/T6722234a_1.out +++ b/test/tools/javac/Diagnostics/6722234/T6722234a_1.out @@ -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, 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.no.conforming.assignment.exists: compiler.misc.type.var: T, 2, compiler.misc.type.var: T, 1) 1 error diff --git a/test/tools/javac/Diagnostics/6722234/T6722234a_2.out b/test/tools/javac/Diagnostics/6722234/T6722234a_2.out index 70155066aa1a53f231b8c6bcd92f3ff43957d715..e535bdce962654f18fe198c30c6aabd3874fa1c8 100644 --- a/test/tools/javac/Diagnostics/6722234/T6722234a_2.out +++ b/test/tools/javac/Diagnostics/6722234/T6722234a_2.out @@ -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, 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.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, test(compiler.misc.type.var: T, 2))} 1 error diff --git a/test/tools/javac/Diagnostics/6722234/T6722234b_1.out b/test/tools/javac/Diagnostics/6722234/T6722234b_1.out index cc41483011ebe2831de0c40573450dec179f2537..b019f8ab213fef7bf005628093a560ea07b80890 100644 --- a/test/tools/javac/Diagnostics/6722234/T6722234b_1.out +++ b/test/tools/javac/Diagnostics/6722234/T6722234b_1.out @@ -1,2 +1,2 @@ -T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List,List, List,List, kindname.class, T6722234b, null +T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List,List, List,List, kindname.class, T6722234b, (compiler.misc.infer.no.conforming.assignment.exists: T, List, List) 1 error diff --git a/test/tools/javac/Diagnostics/6722234/T6722234b_2.out b/test/tools/javac/Diagnostics/6722234/T6722234b_2.out index d9cc6dab61b5e6c42f56f357c6e643092b605527..e4e669363c702eb12a7dfec25240a0414d0ecfb6 100644 --- a/test/tools/javac/Diagnostics/6722234/T6722234b_2.out +++ b/test/tools/javac/Diagnostics/6722234/T6722234b_2.out @@ -1,4 +1,4 @@ -T6722234b.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, List,List, List,List, kindname.class, T6722234b, null +T6722234b.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, List,List, List,List, kindname.class, T6722234b, (compiler.misc.infer.no.conforming.assignment.exists: T, List, List) - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, Object, kindname.method, m(List,List))} - 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 diff --git a/test/tools/javac/Diagnostics/6722234/T6722234c.out b/test/tools/javac/Diagnostics/6722234/T6722234c.out index b79e0d1d19eba68bd2211e4663c85e036046808d..a51891398125be197915db5d56f06c5c9580fabc 100644 --- a/test/tools/javac/Diagnostics/6722234/T6722234c.out +++ b/test/tools/javac/Diagnostics/6722234/T6722234c.out @@ -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 diff --git a/test/tools/javac/Diagnostics/6799605/T6799605.out b/test/tools/javac/Diagnostics/6799605/T6799605.out index f3933ef7461798f7a72402518a4f958cee19591e..323a354d73eb94a9c9920b40e0d59132ff4afe06 100644 --- a/test/tools/javac/Diagnostics/6799605/T6799605.out +++ b/test/tools/javac/Diagnostics/6799605/T6799605.out @@ -1,4 +1,4 @@ -T6799605.java:17:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605, kindname.class, T6799605 -T6799605.java:18:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605,T6799605, kindname.class, T6799605 -T6799605.java:19:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605,T6799605,T6799605, kindname.class, T6799605 +T6799605.java:17:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.inferred.do.not.conform.to.bounds: compiler.misc.type.captureof: 1, ?, T6799605))} +T6799605.java:18:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.infer.no.conforming.assignment.exists: T, T6799605, T6799605)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.infer.arg.length.mismatch))} +T6799605.java:19:9: compiler.err.cant.apply.symbols: kindname.method, m, T6799605,T6799605,T6799605,{(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605,T6799605), (compiler.misc.infer.no.conforming.assignment.exists: T, T6799605, T6799605)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605,T6799605), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, T6799605, m(T6799605), (compiler.misc.infer.arg.length.mismatch))} 3 errors diff --git a/test/tools/javac/Diagnostics/6862608/T6862608a.out b/test/tools/javac/Diagnostics/6862608/T6862608a.out index 59d1c9b5c3fb53dc8b4f85c93653b0897d66a556..b9f85252aaab97294761f2e19c362444d8c2482a 100644 --- a/test/tools/javac/Diagnostics/6862608/T6862608a.out +++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out @@ -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, java.util.Comparator)), java.util.Comparator, java.util.Comparator +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, java.util.Comparator)), java.util.Comparator, java.util.Comparator - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, compound(java.lang.Iterable>))} 1 error diff --git a/test/tools/javac/Diagnostics/6862608/T6862608b.out b/test/tools/javac/Diagnostics/6862608/T6862608b.out index 415700b77ea43a116a9f60a0ef62f2c4a9fb56dc..d24e7cd1fa940d9b4f493cc8f6daf34e0d87a242 100644 --- a/test/tools/javac/Diagnostics/6862608/T6862608b.out +++ b/test/tools/javac/Diagnostics/6862608/T6862608b.out @@ -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, 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.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, foo(compiler.misc.type.var: T, 2)),(compiler.misc.where.typevar: compiler.misc.type.var: S, 1, java.lang.Object, kindname.method, 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 diff --git a/test/tools/javac/T6326754.out b/test/tools/javac/T6326754.out index efbd8393b8bd08f82f960b4da103f1146daff59b..faa786bdc0e7541a8d9e8bb5483913433e961d00 100644 --- a/test/tools/javac/T6326754.out +++ b/test/tools/javac/T6326754.out @@ -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, null +T6326754.java:70:11: compiler.err.cant.apply.symbol.1: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC, (compiler.misc.arg.length.mismatch) - compiler.note.unchecked.filename: T6326754.java - compiler.note.unchecked.recompile 4 errors diff --git a/test/tools/javac/diags/Example.java b/test/tools/javac/diags/Example.java index 9b833f659893b6288cc68ea339e7ed125d3bc47e..2cb3a414d2ec8e6ed1a1b03f4467e32e381da180 100644 --- a/test/tools/javac/diags/Example.java +++ b/test/tools/javac/diags/Example.java @@ -401,7 +401,7 @@ class Example implements Comparable { } } for (JCDiagnostic sd: d.getSubdiagnostics()) - scanForKeys(d, keys); + scanForKeys(sd, keys); } } diff --git a/test/tools/javac/diags/examples.not-yet.txt b/test/tools/javac/diags/examples.not-yet.txt index 40ddcf385f46c7aaf9e7c0ae17e50f880d29eebb..1a1fe5101aa18b8faf75dec8558c4e9a2f8860c7 100644 --- a/test/tools/javac/diags/examples.not-yet.txt +++ b/test/tools/javac/diags/examples.not-yet.txt @@ -3,7 +3,7 @@ compiler.err.already.defined.this.unit # seems to be masked by 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.undetermined.type 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.static 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 diff --git a/test/tools/javac/diags/examples/ExplicitParamsDoNotConformToBounds.java b/test/tools/javac/diags/examples/ExplicitParamsDoNotConformToBounds.java new file mode 100644 index 0000000000000000000000000000000000000000..255a09c8cbb292b58a98ecba228015b4c5ad5f43 --- /dev/null +++ b/test/tools/javac/diags/examples/ExplicitParamsDoNotConformToBounds.java @@ -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 { + void m() {} + { this.m(); } +} diff --git a/test/tools/javac/diags/examples/InapplicableSymbols.java b/test/tools/javac/diags/examples/InapplicableSymbols.java new file mode 100644 index 0000000000000000000000000000000000000000..17ee4a1f9ec5f515485d9730ba25ffa39342e5ea --- /dev/null +++ b/test/tools/javac/diags/examples/InapplicableSymbols.java @@ -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(); } +} diff --git a/test/tools/javac/diags/examples/IncompatibleTypes1.java b/test/tools/javac/diags/examples/IncompatibleTypes1.java index 25b5edc260103cb3076b9318b0d54774603f457c..1305d7ff75d667d7618cc7e9838b328c63f53e21 100644 --- a/test/tools/javac/diags/examples/IncompatibleTypes1.java +++ b/test/tools/javac/diags/examples/IncompatibleTypes1.java @@ -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 { diff --git a/test/tools/javac/diags/examples/InferArgsLengthMismatch.java b/test/tools/javac/diags/examples/InferArgsLengthMismatch.java new file mode 100644 index 0000000000000000000000000000000000000000..28411b4a4a42a79003a72ff7c73d927e5ea093de --- /dev/null +++ b/test/tools/javac/diags/examples/InferArgsLengthMismatch.java @@ -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 { + void m(X x1, X x2) {} + { this.m(1); } +} diff --git a/test/tools/javac/diags/examples/KindnameConstructor.java b/test/tools/javac/diags/examples/KindnameConstructor.java index a8a47cf6fffcc4359353d73a30f41728e2083333..c451c3a3ad9b930475679202c274ba926751822b 100644 --- a/test/tools/javac/diags/examples/KindnameConstructor.java +++ b/test/tools/javac/diags/examples/KindnameConstructor.java @@ -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 diff --git a/test/tools/javac/diags/examples/NoArgs.java b/test/tools/javac/diags/examples/NoArgs.java index f4b6b931c00d38a733a1a7cee01ac8cf978f24fc..59c27950b7895ee499d0f92c6f40a3abd84414b3 100644 --- a/test/tools/javac/diags/examples/NoArgs.java +++ b/test/tools/javac/diags/examples/NoArgs.java @@ -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 { diff --git a/test/tools/javac/diags/examples/VarargsArgumentMismatch.java b/test/tools/javac/diags/examples/VarargsArgumentMismatch.java new file mode 100644 index 0000000000000000000000000000000000000000..62ac55217f5e48757e4148b7608c17ccaeca2e7b --- /dev/null +++ b/test/tools/javac/diags/examples/VarargsArgumentMismatch.java @@ -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"); } +} diff --git a/test/tools/javac/diags/examples/WhereCaptured.java b/test/tools/javac/diags/examples/WhereCaptured.java index 7eda22fb464501d493420734f30522fffc37aeb4..78ded49f606ba0bc0c23df5bf66e00a23b65bb5d 100644 --- a/test/tools/javac/diags/examples/WhereCaptured.java +++ b/test/tools/javac/diags/examples/WhereCaptured.java @@ -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 diff --git a/test/tools/javac/diags/examples/WhereCaptured1.java b/test/tools/javac/diags/examples/WhereCaptured1.java index 397b022b01e656f08c46759e7e496adfe9be5b84..28ef10a4739ac0075add385f4874e85e5f7b43dc 100644 --- a/test/tools/javac/diags/examples/WhereCaptured1.java +++ b/test/tools/javac/diags/examples/WhereCaptured1.java @@ -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 diff --git a/test/tools/javac/diags/examples/WhereTypeVar.java b/test/tools/javac/diags/examples/WhereTypeVar.java index dc307fc5f981395cca74ebfb29013c5aade3a70e..f7c41d6ea7949933b921b7c037c9e2a7c72125dc 100644 --- a/test/tools/javac/diags/examples/WhereTypeVar.java +++ b/test/tools/javac/diags/examples/WhereTypeVar.java @@ -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 diff --git a/test/tools/javac/generics/diamond/neg/Neg06.out b/test/tools/javac/generics/diamond/neg/Neg06.out index eaf8633c51f4190e192a8d6fe29da8ccca4bd510..0347e2f1b12fc3bcee1229641dff33167d1a50bc 100644 --- a/test/tools/javac/generics/diamond/neg/Neg06.out +++ b/test/tools/javac/generics/diamond/neg/Neg06.out @@ -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, Neg06.ISuperFoo) -Neg06.java:19:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.CFoo, Neg06.CSuperFoo) -Neg06.java:20:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.CFoo, Neg06.CSuperFoo) +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, Neg06.ISuperFoo) +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, Neg06.CSuperFoo) +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, Neg06.CSuperFoo) 3 errors diff --git a/test/tools/javac/generics/inference/6315770/T6315770.out b/test/tools/javac/generics/inference/6315770/T6315770.out index 67967d0c8ee1acdfd81c4f455fe7ccc2d9a350ce..befd56eb63efaa478e565ab22ad4ad2a7a49828e 100644 --- a/test/tools/javac/generics/inference/6315770/T6315770.out +++ b/test/tools/javac/generics/inference/6315770/T6315770.out @@ -1,3 +1,3 @@ T6315770.java:16:42: compiler.err.undetermined.type.1: T6315770, (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, T6315770)), T6315770, T6315770 +T6315770.java:17:40: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: T, T6315770, T6315770)), T6315770, T6315770 2 errors diff --git a/test/tools/javac/generics/inference/6611449/T6611449.out b/test/tools/javac/generics/inference/6611449/T6611449.out index e5ff00a6d2b6773515ac1c73fb7fe5b2f18c6fe2..388f3b7c752589595fd2847b48485583bbe4c512 100644 --- a/test/tools/javac/generics/inference/6611449/T6611449.out +++ b/test/tools/javac/generics/inference/6611449/T6611449.out @@ -1,5 +1,5 @@ -T6611449.java:18:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6611449, , int, kindname.class, T6611449 -T6611449.java:19:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6611449, , int,int, kindname.class, T6611449 -T6611449.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, T, int, kindname.class, T6611449, null -T6611449.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, T,T, int,int, kindname.class, T6611449, null +T6611449.java:18:9: compiler.err.cant.apply.symbols: kindname.constructor, T6611449, int,{(compiler.misc.inapplicable.method: kindname.constructor, T6611449, T6611449(T,T), (compiler.misc.infer.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, 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, T6611449(T,T), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S)),(compiler.misc.inapplicable.method: kindname.constructor, T6611449, 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, (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, (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.Integer, S) 4 errors diff --git a/test/tools/javac/generics/inference/6638712/T6638712a.out b/test/tools/javac/generics/inference/6638712/T6638712a.out index e20744cc1b8e9a1208836d94c3f29267b50ca000..c65e749bd55e22fc8efcb90659d4d44cf0257904 100644 --- a/test/tools/javac/generics/inference/6638712/T6638712a.out +++ b/test/tools/javac/generics/inference/6638712/T6638712a.out @@ -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, java.util.Comparator)), java.util.Comparator, java.util.Comparator +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, java.util.Comparator)), java.util.Comparator, java.util.Comparator 1 error diff --git a/test/tools/javac/generics/inference/6638712/T6638712b.out b/test/tools/javac/generics/inference/6638712/T6638712b.out index ed77740a425df39c81e0e4c40a88616a3a189338..003315022db497e48dc971812828b40db7c0751e 100644 --- a/test/tools/javac/generics/inference/6638712/T6638712b.out +++ b/test/tools/javac/generics/inference/6638712/T6638712b.out @@ -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, 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, java.lang.String 1 error diff --git a/test/tools/javac/generics/inference/6638712/T6638712c.out b/test/tools/javac/generics/inference/6638712/T6638712c.out index 8b0db849a79176026df426fdcefabed4419cf5e1..d57185e23c690e48d40a4ff31d324e9d8a271786 100644 --- a/test/tools/javac/generics/inference/6638712/T6638712c.out +++ b/test/tools/javac/generics/inference/6638712/T6638712c.out @@ -1,2 +1,2 @@ -T6638712c.java:16:9: compiler.err.cant.apply.symbol: kindname.method, sort, T[],java.util.Comparator, java.lang.Enum[],java.util.Comparator>, kindname.class, T6638712c, null +T6638712c.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, sort, T[],java.util.Comparator, java.lang.Enum[],java.util.Comparator>, kindname.class, T6638712c, (compiler.misc.inferred.do.not.conform.to.params: java.lang.Enum[],java.util.Comparator, java.lang.Enum[],java.util.Comparator>) 1 error diff --git a/test/tools/javac/generics/inference/6638712/T6638712d.out b/test/tools/javac/generics/inference/6638712/T6638712d.out index c8c574044ebd9d0e67dea05d2926b1a1e155c139..1b0285a9c23c9bf02bfe2fd47b5052a0c6c5fdc9 100644 --- a/test/tools/javac/generics/inference/6638712/T6638712d.out +++ b/test/tools/javac/generics/inference/6638712/T6638712d.out @@ -1,2 +1,2 @@ -T6638712d.java:16:9: compiler.err.cant.apply.symbol: kindname.method, m, U,java.util.List>, int,java.util.List>, kindname.class, T6638712d, null +T6638712d.java:16:9: compiler.err.cant.apply.symbol.1: kindname.method, m, U,java.util.List>, int,java.util.List>, kindname.class, T6638712d, (compiler.misc.inferred.do.not.conform.to.params: java.lang.String,java.util.List>, int,java.util.List>) 1 error diff --git a/test/tools/javac/generics/inference/6638712/T6638712e.out b/test/tools/javac/generics/inference/6638712/T6638712e.out index 1ca268b830b81c0b4f14a3115be87665cd914797..3216ed28cca06711041074bfb167de0063622458 100644 --- a/test/tools/javac/generics/inference/6638712/T6638712e.out +++ b/test/tools/javac/generics/inference/6638712/T6638712e.out @@ -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, T6638712e.Foo)), T6638712e.Foo, T6638712e.Foo +T6638712e.java:17:27: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.infer.no.conforming.instance.exists: X, T6638712e.Foo, T6638712e.Foo)), T6638712e.Foo, T6638712e.Foo 1 error