Sat, 18 Sep 2010 09:56:23 -0700
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
1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Sat Sep 18 09:54:51 2010 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Sat Sep 18 09:56:23 2010 -0700 1.3 @@ -1422,7 +1422,8 @@ 1.4 1.5 // Compute the result type. 1.6 Type restype = mtype.getReturnType(); 1.7 - assert restype.tag != WILDCARD : mtype; 1.8 + if (restype.tag == WILDCARD) 1.9 + throw new AssertionError(mtype); 1.10 1.11 // as a special case, array.clone() has a result that is 1.12 // the same as static type of the array being cloned
2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Sat Sep 18 09:54:51 2010 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Sat Sep 18 09:56:23 2010 -0700 2.3 @@ -80,25 +80,12 @@ 2.4 2.5 } 2.6 2.7 - public static class InferenceException extends RuntimeException { 2.8 + public static class InferenceException extends Resolve.InapplicableMethodException { 2.9 private static final long serialVersionUID = 0; 2.10 2.11 - JCDiagnostic diagnostic; 2.12 - JCDiagnostic.Factory diags; 2.13 - 2.14 InferenceException(JCDiagnostic.Factory diags) { 2.15 - this.diagnostic = null; 2.16 - this.diags = diags; 2.17 + super(diags); 2.18 } 2.19 - 2.20 - InferenceException setMessage(String key, Object... args) { 2.21 - this.diagnostic = diags.fragment(key, args); 2.22 - return this; 2.23 - } 2.24 - 2.25 - public JCDiagnostic getDiagnostic() { 2.26 - return diagnostic; 2.27 - } 2.28 } 2.29 2.30 public static class NoInstanceException extends InferenceException { 2.31 @@ -320,7 +307,7 @@ 2.32 Type qtype1 = types.subst(that.qtype, that.tvars, undetvars); 2.33 if (!types.isSubtype(qtype1, to)) { 2.34 throw unambiguousNoInstanceException 2.35 - .setMessage("no.conforming.instance.exists", 2.36 + .setMessage("infer.no.conforming.instance.exists", 2.37 that.tvars, that.qtype, to); 2.38 } 2.39 for (List<Type> l = undetvars; l.nonEmpty(); l = l.tail) 2.40 @@ -378,6 +365,11 @@ 2.41 // instantiate all polymorphic argument types and 2.42 // set up lower bounds constraints for undetvars 2.43 Type varargsFormal = useVarargs ? formals.last() : null; 2.44 + if (varargsFormal == null && 2.45 + actuals.size() != formals.size()) { 2.46 + throw unambiguousNoInstanceException 2.47 + .setMessage("infer.arg.length.mismatch"); 2.48 + } 2.49 while (actuals.nonEmpty() && formals.head != varargsFormal) { 2.50 Type formal = formals.head; 2.51 Type actual = actuals.head.baseType(); 2.52 @@ -390,19 +382,16 @@ 2.53 : types.isSubtypeUnchecked(actual, undetFormal, warn); 2.54 if (!works) { 2.55 throw unambiguousNoInstanceException 2.56 - .setMessage("no.conforming.assignment.exists", 2.57 + .setMessage("infer.no.conforming.assignment.exists", 2.58 tvars, actualNoCapture, formal); 2.59 } 2.60 formals = formals.tail; 2.61 actuals = actuals.tail; 2.62 actualsNoCapture = actualsNoCapture.tail; 2.63 } 2.64 - if (formals.head != varargsFormal || // not enough args 2.65 - !useVarargs && actuals.nonEmpty()) { // too many args 2.66 - // argument lists differ in length 2.67 - throw unambiguousNoInstanceException 2.68 - .setMessage("arg.length.mismatch"); 2.69 - } 2.70 + 2.71 + if (formals.head != varargsFormal) // not enough args 2.72 + throw unambiguousNoInstanceException.setMessage("infer.arg.length.mismatch"); 2.73 2.74 // for varargs arguments as well 2.75 if (useVarargs) { 2.76 @@ -416,7 +405,7 @@ 2.77 boolean works = types.isConvertible(actual, elemUndet, warn); 2.78 if (!works) { 2.79 throw unambiguousNoInstanceException 2.80 - .setMessage("no.conforming.assignment.exists", 2.81 + .setMessage("infer.no.conforming.assignment.exists", 2.82 tvars, actualNoCapture, elemType); 2.83 } 2.84 actuals = actuals.tail;
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Sat Sep 18 09:54:51 2010 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Sat Sep 18 09:56:23 2010 -0700 3.3 @@ -119,6 +119,8 @@ 3.4 target.hasInvokedynamic()) && 3.5 options.get("invokedynamic") != null; 3.6 polymorphicSignatureScope = new Scope(syms.noSymbol); 3.7 + 3.8 + inapplicableMethodException = new InapplicableMethodException(diags); 3.9 } 3.10 3.11 /** error symbols, which are returned when resolution fails 3.12 @@ -318,7 +320,8 @@ 3.13 throws Infer.InferenceException { 3.14 boolean polymorphicSignature = (m.isPolymorphicSignatureGeneric() && allowMethodHandles) || 3.15 isTransitionalDynamicCallSite(site, m); 3.16 - if (useVarargs && (m.flags() & VARARGS) == 0) return null; 3.17 + if (useVarargs && (m.flags() & VARARGS) == 0) 3.18 + throw inapplicableMethodException.setMessage(null); 3.19 Type mt = types.memberType(site, m); 3.20 3.21 // tvars is the list of formal type variables for which type arguments 3.22 @@ -334,7 +337,7 @@ 3.23 } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) { 3.24 ForAll pmt = (ForAll) mt; 3.25 if (typeargtypes.length() != pmt.tvars.length()) 3.26 - return null; 3.27 + throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args 3.28 // Check type arguments are within bounds 3.29 List<Type> formals = pmt.tvars; 3.30 List<Type> actuals = typeargtypes; 3.31 @@ -343,7 +346,7 @@ 3.32 pmt.tvars, typeargtypes); 3.33 for (; bounds.nonEmpty(); bounds = bounds.tail) 3.34 if (!types.isSubtypeUnchecked(actuals.head, bounds.head, warn)) 3.35 - return null; 3.36 + throw inapplicableMethodException.setMessage("explicit.param.do.not.conform.to.bounds",actuals.head, bounds); 3.37 formals = formals.tail; 3.38 actuals = actuals.tail; 3.39 } 3.40 @@ -375,11 +378,10 @@ 3.41 allowBoxing, 3.42 useVarargs, 3.43 warn); 3.44 - return 3.45 - argumentsAcceptable(argtypes, mt.getParameterTypes(), 3.46 - allowBoxing, useVarargs, warn) 3.47 - ? mt 3.48 - : null; 3.49 + 3.50 + checkRawArgumentsAcceptable(argtypes, mt.getParameterTypes(), 3.51 + allowBoxing, useVarargs, warn); 3.52 + return mt; 3.53 } 3.54 3.55 boolean isTransitionalDynamicCallSite(Type site, Symbol sym) { 3.56 @@ -403,7 +405,7 @@ 3.57 try { 3.58 return rawInstantiate(env, site, m, argtypes, typeargtypes, 3.59 allowBoxing, useVarargs, warn); 3.60 - } catch (Infer.InferenceException ex) { 3.61 + } catch (InapplicableMethodException ex) { 3.62 return null; 3.63 } 3.64 } 3.65 @@ -415,26 +417,76 @@ 3.66 boolean allowBoxing, 3.67 boolean useVarargs, 3.68 Warner warn) { 3.69 + try { 3.70 + checkRawArgumentsAcceptable(argtypes, formals, allowBoxing, useVarargs, warn); 3.71 + return true; 3.72 + } catch (InapplicableMethodException ex) { 3.73 + return false; 3.74 + } 3.75 + } 3.76 + void checkRawArgumentsAcceptable(List<Type> argtypes, 3.77 + List<Type> formals, 3.78 + boolean allowBoxing, 3.79 + boolean useVarargs, 3.80 + Warner warn) { 3.81 Type varargsFormal = useVarargs ? formals.last() : null; 3.82 + if (varargsFormal == null && 3.83 + argtypes.size() != formals.size()) { 3.84 + throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args 3.85 + } 3.86 + 3.87 while (argtypes.nonEmpty() && formals.head != varargsFormal) { 3.88 boolean works = allowBoxing 3.89 ? types.isConvertible(argtypes.head, formals.head, warn) 3.90 : types.isSubtypeUnchecked(argtypes.head, formals.head, warn); 3.91 - if (!works) return false; 3.92 + if (!works) 3.93 + throw inapplicableMethodException.setMessage("no.conforming.assignment.exists", 3.94 + argtypes.head, 3.95 + formals.head); 3.96 argtypes = argtypes.tail; 3.97 formals = formals.tail; 3.98 } 3.99 - if (formals.head != varargsFormal) return false; // not enough args 3.100 - if (!useVarargs) 3.101 - return argtypes.isEmpty(); 3.102 - Type elt = types.elemtype(varargsFormal); 3.103 - while (argtypes.nonEmpty()) { 3.104 - if (!types.isConvertible(argtypes.head, elt, warn)) 3.105 - return false; 3.106 - argtypes = argtypes.tail; 3.107 + 3.108 + if (formals.head != varargsFormal) 3.109 + throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args 3.110 + 3.111 + if (useVarargs) { 3.112 + Type elt = types.elemtype(varargsFormal); 3.113 + while (argtypes.nonEmpty()) { 3.114 + if (!types.isConvertible(argtypes.head, elt, warn)) 3.115 + throw inapplicableMethodException.setMessage("varargs.argument.mismatch", 3.116 + argtypes.head, 3.117 + elt); 3.118 + argtypes = argtypes.tail; 3.119 + } 3.120 } 3.121 - return true; 3.122 + return; 3.123 } 3.124 + // where 3.125 + public static class InapplicableMethodException extends RuntimeException { 3.126 + private static final long serialVersionUID = 0; 3.127 + 3.128 + JCDiagnostic diagnostic; 3.129 + JCDiagnostic.Factory diags; 3.130 + 3.131 + InapplicableMethodException(JCDiagnostic.Factory diags) { 3.132 + this.diagnostic = null; 3.133 + this.diags = diags; 3.134 + } 3.135 + InapplicableMethodException setMessage(String key) { 3.136 + this.diagnostic = key != null ? diags.fragment(key) : null; 3.137 + return this; 3.138 + } 3.139 + InapplicableMethodException setMessage(String key, Object... args) { 3.140 + this.diagnostic = key != null ? diags.fragment(key, args) : null; 3.141 + return this; 3.142 + } 3.143 + 3.144 + public JCDiagnostic getDiagnostic() { 3.145 + return diagnostic; 3.146 + } 3.147 + } 3.148 + private final InapplicableMethodException inapplicableMethodException; 3.149 3.150 /* *************************************************************************** 3.151 * Symbol lookup 3.152 @@ -595,6 +647,7 @@ 3.153 * @param allowBoxing Allow boxing conversions of arguments. 3.154 * @param useVarargs Box trailing arguments into an array for varargs. 3.155 */ 3.156 + @SuppressWarnings("fallthrough") 3.157 Symbol selectBest(Env<AttrContext> env, 3.158 Type site, 3.159 List<Type> argtypes, 3.160 @@ -608,21 +661,16 @@ 3.161 if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar; 3.162 assert sym.kind < AMBIGUOUS; 3.163 try { 3.164 - if (rawInstantiate(env, site, sym, argtypes, typeargtypes, 3.165 - allowBoxing, useVarargs, Warner.noWarnings) == null) { 3.166 - // inapplicable 3.167 - switch (bestSoFar.kind) { 3.168 - case ABSENT_MTH: return wrongMethod.setWrongSym(sym); 3.169 - case WRONG_MTH: return wrongMethods; 3.170 - default: return bestSoFar; 3.171 - } 3.172 - } 3.173 - } catch (Infer.InferenceException ex) { 3.174 + rawInstantiate(env, site, sym, argtypes, typeargtypes, 3.175 + allowBoxing, useVarargs, Warner.noWarnings); 3.176 + } catch (InapplicableMethodException ex) { 3.177 switch (bestSoFar.kind) { 3.178 case ABSENT_MTH: 3.179 return wrongMethod.setWrongSym(sym, ex.getDiagnostic()); 3.180 case WRONG_MTH: 3.181 - return wrongMethods; 3.182 + wrongMethods.addCandidate(currentStep, wrongMethod.sym, wrongMethod.explanation); 3.183 + case WRONG_MTHS: 3.184 + return wrongMethods.addCandidate(currentStep, sym, ex.getDiagnostic()); 3.185 default: 3.186 return bestSoFar; 3.187 } 3.188 @@ -631,7 +679,7 @@ 3.189 return (bestSoFar.kind == ABSENT_MTH) 3.190 ? new AccessError(env, site, sym) 3.191 : bestSoFar; 3.192 - } 3.193 + } 3.194 return (bestSoFar.kind > AMBIGUOUS) 3.195 ? sym 3.196 : mostSpecific(sym, bestSoFar, env, site, 3.197 @@ -1253,11 +1301,12 @@ 3.198 Name name, 3.199 List<Type> argtypes, 3.200 List<Type> typeargtypes) { 3.201 - Symbol sym = methodNotFound; 3.202 + Symbol sym = startResolution(); 3.203 List<MethodResolutionPhase> steps = methodResolutionSteps; 3.204 while (steps.nonEmpty() && 3.205 steps.head.isApplicable(boxingEnabled, varargsEnabled) && 3.206 sym.kind >= ERRONEOUS) { 3.207 + currentStep = steps.head; 3.208 sym = findFun(env, name, argtypes, typeargtypes, 3.209 steps.head.isBoxingRequired, 3.210 env.info.varArgs = steps.head.isVarargsRequired); 3.211 @@ -1274,6 +1323,12 @@ 3.212 return sym; 3.213 } 3.214 3.215 + private Symbol startResolution() { 3.216 + wrongMethod.clear(); 3.217 + wrongMethods.clear(); 3.218 + return methodNotFound; 3.219 + } 3.220 + 3.221 /** Resolve a qualified method identifier 3.222 * @param pos The position to use for error reporting. 3.223 * @param env The environment current at the method invocation. 3.224 @@ -1286,11 +1341,12 @@ 3.225 Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env, 3.226 Type site, Name name, List<Type> argtypes, 3.227 List<Type> typeargtypes) { 3.228 - Symbol sym = methodNotFound; 3.229 + Symbol sym = startResolution(); 3.230 List<MethodResolutionPhase> steps = methodResolutionSteps; 3.231 while (steps.nonEmpty() && 3.232 steps.head.isApplicable(boxingEnabled, varargsEnabled) && 3.233 sym.kind >= ERRONEOUS) { 3.234 + currentStep = steps.head; 3.235 sym = findMethod(env, site, name, argtypes, typeargtypes, 3.236 steps.head.isBoxingRequired(), 3.237 env.info.varArgs = steps.head.isVarargsRequired(), false); 3.238 @@ -1404,11 +1460,12 @@ 3.239 Type site, 3.240 List<Type> argtypes, 3.241 List<Type> typeargtypes) { 3.242 - Symbol sym = methodNotFound; 3.243 + Symbol sym = startResolution(); 3.244 List<MethodResolutionPhase> steps = methodResolutionSteps; 3.245 while (steps.nonEmpty() && 3.246 steps.head.isApplicable(boxingEnabled, varargsEnabled) && 3.247 sym.kind >= ERRONEOUS) { 3.248 + currentStep = steps.head; 3.249 sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, 3.250 steps.head.isBoxingRequired(), 3.251 env.info.varArgs = steps.head.isVarargsRequired()); 3.252 @@ -1439,26 +1496,22 @@ 3.253 Type site, 3.254 List<Type> argtypes, 3.255 List<Type> typeargtypes) { 3.256 - Symbol sym = methodNotFound; 3.257 - JCDiagnostic explanation = null; 3.258 + Symbol sym = startResolution(); 3.259 List<MethodResolutionPhase> steps = methodResolutionSteps; 3.260 while (steps.nonEmpty() && 3.261 steps.head.isApplicable(boxingEnabled, varargsEnabled) && 3.262 sym.kind >= ERRONEOUS) { 3.263 + currentStep = steps.head; 3.264 sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, 3.265 steps.head.isBoxingRequired(), 3.266 env.info.varArgs = steps.head.isVarargsRequired()); 3.267 methodResolutionCache.put(steps.head, sym); 3.268 - if (sym.kind == WRONG_MTH && 3.269 - ((InapplicableSymbolError)sym).explanation != null) { 3.270 - //if the symbol is an inapplicable method symbol, then the 3.271 - //explanation contains the reason for which inference failed 3.272 - explanation = ((InapplicableSymbolError)sym).explanation; 3.273 - } 3.274 steps = steps.tail; 3.275 } 3.276 if (sym.kind >= AMBIGUOUS) { 3.277 - final JCDiagnostic details = explanation; 3.278 + final JCDiagnostic details = sym.kind == WRONG_MTH ? 3.279 + ((InapplicableSymbolError)sym).explanation : 3.280 + null; 3.281 Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") { 3.282 @Override 3.283 JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { 3.284 @@ -1860,7 +1913,8 @@ 3.285 */ 3.286 InapplicableSymbolError setWrongSym(Symbol sym, JCDiagnostic explanation) { 3.287 this.sym = sym; 3.288 - this.explanation = explanation; 3.289 + if (this.sym == sym && explanation != null) 3.290 + this.explanation = explanation; //update the details 3.291 return this; 3.292 } 3.293 3.294 @@ -1868,7 +1922,6 @@ 3.295 */ 3.296 InapplicableSymbolError setWrongSym(Symbol sym) { 3.297 this.sym = sym; 3.298 - this.explanation = null; 3.299 return this; 3.300 } 3.301 3.302 @@ -1905,6 +1958,10 @@ 3.303 } 3.304 } 3.305 3.306 + void clear() { 3.307 + explanation = null; 3.308 + } 3.309 + 3.310 @Override 3.311 public Symbol access(Name name, TypeSymbol location) { 3.312 return types.createErrorType(name, location, syms.errSymbol.type).tsym; 3.313 @@ -1917,6 +1974,9 @@ 3.314 * given an actual arguments/type argument list. 3.315 */ 3.316 class InapplicableSymbolsError extends ResolveError { 3.317 + 3.318 + private List<Candidate> candidates = List.nil(); 3.319 + 3.320 InapplicableSymbolsError(Symbol sym) { 3.321 super(WRONG_MTHS, "inapplicable symbols"); 3.322 } 3.323 @@ -1928,8 +1988,85 @@ 3.324 Name name, 3.325 List<Type> argtypes, 3.326 List<Type> typeargtypes) { 3.327 - return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos, 3.328 + if (candidates.nonEmpty()) { 3.329 + JCDiagnostic err = diags.create(dkind, 3.330 + log.currentSource(), 3.331 + pos, 3.332 + "cant.apply.symbols", 3.333 + name == names.init ? KindName.CONSTRUCTOR : absentKind(kind), 3.334 + getName(), 3.335 + argtypes); 3.336 + return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(site)); 3.337 + } else { 3.338 + return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos, 3.339 site, name, argtypes, typeargtypes); 3.340 + } 3.341 + } 3.342 + 3.343 + //where 3.344 + List<JCDiagnostic> candidateDetails(Type site) { 3.345 + List<JCDiagnostic> details = List.nil(); 3.346 + for (Candidate c : candidates) 3.347 + details = details.prepend(c.getDiagnostic(site)); 3.348 + return details.reverse(); 3.349 + } 3.350 + 3.351 + Symbol addCandidate(MethodResolutionPhase currentStep, Symbol sym, JCDiagnostic details) { 3.352 + Candidate c = new Candidate(currentStep, sym, details); 3.353 + if (c.isValid() && !candidates.contains(c)) 3.354 + candidates = candidates.append(c); 3.355 + return this; 3.356 + } 3.357 + 3.358 + void clear() { 3.359 + candidates = List.nil(); 3.360 + } 3.361 + 3.362 + private Name getName() { 3.363 + Symbol sym = candidates.head.sym; 3.364 + return sym.name == names.init ? 3.365 + sym.owner.name : 3.366 + sym.name; 3.367 + } 3.368 + 3.369 + private class Candidate { 3.370 + 3.371 + final MethodResolutionPhase step; 3.372 + final Symbol sym; 3.373 + final JCDiagnostic details; 3.374 + 3.375 + private Candidate(MethodResolutionPhase step, Symbol sym, JCDiagnostic details) { 3.376 + this.step = step; 3.377 + this.sym = sym; 3.378 + this.details = details; 3.379 + } 3.380 + 3.381 + JCDiagnostic getDiagnostic(Type site) { 3.382 + return diags.fragment("inapplicable.method", 3.383 + Kinds.kindName(sym), 3.384 + sym.location(site, types), 3.385 + sym.asMemberOf(site, types), 3.386 + details); 3.387 + } 3.388 + 3.389 + @Override 3.390 + public boolean equals(Object o) { 3.391 + if (o instanceof Candidate) { 3.392 + Symbol s1 = this.sym; 3.393 + Symbol s2 = ((Candidate)o).sym; 3.394 + if ((s1 != s2 && 3.395 + (s1.overrides(s2, s1.owner.type.tsym, types, false) || 3.396 + (s2.overrides(s1, s2.owner.type.tsym, types, false)))) || 3.397 + ((s1.isConstructor() || s2.isConstructor()) && s1.owner != s2.owner)) 3.398 + return true; 3.399 + } 3.400 + return false; 3.401 + } 3.402 + 3.403 + boolean isValid() { 3.404 + return (((sym.flags() & VARARGS) != 0 && step == VARARITY) || 3.405 + (sym.flags() & VARARGS) == 0 && step == (boxingEnabled ? BOX : BASIC)); 3.406 + } 3.407 } 3.408 } 3.409 3.410 @@ -2093,6 +2230,8 @@ 3.411 3.412 final List<MethodResolutionPhase> methodResolutionSteps = List.of(BASIC, BOX, VARARITY); 3.413 3.414 + private MethodResolutionPhase currentStep = null; 3.415 + 3.416 private MethodResolutionPhase firstErroneousResolutionPhase() { 3.417 MethodResolutionPhase bestSoFar = BASIC; 3.418 Symbol sym = methodNotFound;
4.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Sat Sep 18 09:54:51 2010 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Sat Sep 18 09:56:23 2010 -0700 4.3 @@ -93,6 +93,8 @@ 4.4 required: {2}\n\ 4.5 found: {3}\n\ 4.6 reason: {6} 4.7 +compiler.err.cant.apply.symbols=\ 4.8 + no suitable {0} found for {1}({2}) 4.9 compiler.err.cant.assign.val.to.final.var=\ 4.10 cannot assign a value to final variable {0} 4.11 compiler.err.cant.deref=\ 4.12 @@ -1075,11 +1077,11 @@ 4.13 no unique maximal instance exists for type variable {0} with upper bounds {1} 4.14 compiler.misc.no.unique.minimal.instance.exists=\ 4.15 no unique minimal instance exists for type variable {0} with lower bounds {1} 4.16 -compiler.misc.no.conforming.instance.exists=\ 4.17 +compiler.misc.infer.no.conforming.instance.exists=\ 4.18 no instance(s) of type variable(s) {0} exist so that {1} conforms to {2} 4.19 -compiler.misc.no.conforming.assignment.exists=\ 4.20 +compiler.misc.infer.no.conforming.assignment.exists=\ 4.21 no instance(s) of type variable(s) {0} exist so that argument type {1} conforms to formal parameter type {2} 4.22 -compiler.misc.arg.length.mismatch=\ 4.23 +compiler.misc.infer.arg.length.mismatch=\ 4.24 cannot instantiate from arguments because actual and formal argument lists differ in length 4.25 compiler.misc.inferred.do.not.conform.to.bounds=\ 4.26 inferred type does not conform to declared bound(s)\n\ 4.27 @@ -1095,6 +1097,16 @@ 4.28 type argument {0} inferred for {1} is not allowed in this context 4.29 compiler.misc.diamond.invalid.args=\ 4.30 type arguments {0} inferred for {1} are not allowed in this context 4.31 + 4.32 +compiler.misc.explicit.param.do.not.conform.to.bounds=\ 4.33 + explicit type argument {0} does not conform to declared bound(s) {1} 4.34 + 4.35 +compiler.misc.arg.length.mismatch=\ 4.36 + actual and formal argument lists differ in length 4.37 +compiler.misc.no.conforming.assignment.exists=\ 4.38 + actual argument {0} cannot be converted to {1} by method invocation conversion 4.39 +compiler.misc.varargs.argument.mismatch=\ 4.40 + argument type {0} does not conform to vararg element type {1} 4.41 ##### 4.42 4.43 ## The first argument ({0}) is a "kindname". 4.44 @@ -1232,6 +1244,10 @@ 4.45 compiler.misc.non.denotable.type=\ 4.46 Non-denotable type {0} not allowed here 4.47 4.48 +compiler.misc.inapplicable.method=\ 4.49 + {0} {1}.{2} is not applicable\n\ 4.50 + ({3}) 4.51 + 4.52 ######################################## 4.53 # Diagnostics for language feature changes 4.54 ########################################
5.1 --- a/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Sat Sep 18 09:54:51 2010 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Sat Sep 18 09:56:23 2010 -0700 5.3 @@ -65,8 +65,6 @@ 5.4 */ 5.5 public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter { 5.6 5.7 - protected int currentIndentation = 0; 5.8 - 5.9 /** 5.10 * Create a basic formatter based on the supplied options. 5.11 * 5.12 @@ -107,33 +105,28 @@ 5.13 } 5.14 5.15 public String formatMessage(JCDiagnostic d, Locale l) { 5.16 - int prevIndentation = currentIndentation; 5.17 - try { 5.18 - StringBuilder buf = new StringBuilder(); 5.19 - Collection<String> args = formatArguments(d, l); 5.20 - String msg = localize(l, d.getCode(), args.toArray()); 5.21 - String[] lines = msg.split("\n"); 5.22 - if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) { 5.23 - currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY); 5.24 - buf.append(indent(lines[0], currentIndentation)); //summary 5.25 + int currentIndentation = 0; 5.26 + StringBuilder buf = new StringBuilder(); 5.27 + Collection<String> args = formatArguments(d, l); 5.28 + String msg = localize(l, d.getCode(), args.toArray()); 5.29 + String[] lines = msg.split("\n"); 5.30 + if (getConfiguration().getVisible().contains(DiagnosticPart.SUMMARY)) { 5.31 + currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUMMARY); 5.32 + buf.append(indent(lines[0], currentIndentation)); //summary 5.33 + } 5.34 + if (lines.length > 1 && getConfiguration().getVisible().contains(DiagnosticPart.DETAILS)) { 5.35 + currentIndentation += getConfiguration().getIndentation(DiagnosticPart.DETAILS); 5.36 + for (int i = 1;i < lines.length; i++) { 5.37 + buf.append("\n" + indent(lines[i], currentIndentation)); 5.38 } 5.39 - if (lines.length > 1 && getConfiguration().getVisible().contains(DiagnosticPart.DETAILS)) { 5.40 - currentIndentation += getConfiguration().getIndentation(DiagnosticPart.DETAILS); 5.41 - for (int i = 1;i < lines.length; i++) { 5.42 - buf.append("\n" + indent(lines[i], currentIndentation)); 5.43 - } 5.44 + } 5.45 + if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { 5.46 + currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS); 5.47 + for (String sub : formatSubdiagnostics(d, l)) { 5.48 + buf.append("\n" + indent(sub, currentIndentation)); 5.49 } 5.50 - if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { 5.51 - currentIndentation += getConfiguration().getIndentation(DiagnosticPart.SUBDIAGNOSTICS); 5.52 - for (String sub : formatSubdiagnostics(d, l)) { 5.53 - buf.append("\n" + sub); 5.54 - } 5.55 - } 5.56 - return buf.toString(); 5.57 } 5.58 - finally { 5.59 - currentIndentation = prevIndentation; 5.60 - } 5.61 + return buf.toString(); 5.62 } 5.63 5.64 protected String addSourceLineIfNeeded(JCDiagnostic d, String msg) {
6.1 --- a/test/tools/javac/6758789/T6758789a.out Sat Sep 18 09:54:51 2010 -0700 6.2 +++ b/test/tools/javac/6758789/T6758789a.out Sat Sep 18 09:56:23 2010 -0700 6.3 @@ -1,3 +1,3 @@ 6.4 -T6758789a.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m1, compiler.misc.no.args, int, kindname.class, T6758789a, null 6.5 -T6758789a.java:15:9: compiler.err.cant.apply.symbol: kindname.method, m2, int, compiler.misc.no.args, kindname.class, T6758789a, null 6.6 +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) 6.7 +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) 6.8 2 errors
7.1 --- a/test/tools/javac/6840059/T6840059.out Sat Sep 18 09:54:51 2010 -0700 7.2 +++ b/test/tools/javac/6840059/T6840059.out Sat Sep 18 09:56:23 2010 -0700 7.3 @@ -1,3 +1,3 @@ 7.4 -T6840059.java:15:9: compiler.err.cant.apply.symbol: kindname.constructor, T6840059, java.lang.Integer, java.lang.String, kindname.class, T6840059, null 7.5 -T6840059.java:15:25: compiler.err.cant.apply.symbol: kindname.constructor, T6840059, java.lang.Integer, compiler.misc.no.args, kindname.class, T6840059, null 7.6 +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) 7.7 +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) 7.8 2 errors
8.1 --- a/test/tools/javac/6857948/T6857948.out Sat Sep 18 09:54:51 2010 -0700 8.2 +++ b/test/tools/javac/6857948/T6857948.out Sat Sep 18 09:56:23 2010 -0700 8.3 @@ -1,3 +1,3 @@ 8.4 T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , kindname.class, Test 8.5 -T6857948.java:16:50: compiler.err.cant.apply.symbol: kindname.constructor, Foo, java.lang.String, compiler.misc.no.args, kindname.class, Foo, null 8.6 +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) 8.7 2 errors
9.1 --- a/test/tools/javac/Diagnostics/6722234/T6722234a_1.out Sat Sep 18 09:54:51 2010 -0700 9.2 +++ b/test/tools/javac/Diagnostics/6722234/T6722234a_1.out Sat Sep 18 09:56:23 2010 -0700 9.3 @@ -1,2 +1,2 @@ 9.4 -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 9.5 +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) 9.6 1 error
10.1 --- a/test/tools/javac/Diagnostics/6722234/T6722234a_2.out Sat Sep 18 09:54:51 2010 -0700 10.2 +++ b/test/tools/javac/Diagnostics/6722234/T6722234a_2.out Sat Sep 18 09:56:23 2010 -0700 10.3 @@ -1,3 +1,3 @@ 10.4 -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 10.5 +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) 10.6 - 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))} 10.7 1 error
11.1 --- a/test/tools/javac/Diagnostics/6722234/T6722234b_1.out Sat Sep 18 09:54:51 2010 -0700 11.2 +++ b/test/tools/javac/Diagnostics/6722234/T6722234b_1.out Sat Sep 18 09:56:23 2010 -0700 11.3 @@ -1,2 +1,2 @@ 11.4 -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 11.5 +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>) 11.6 1 error
12.1 --- a/test/tools/javac/Diagnostics/6722234/T6722234b_2.out Sat Sep 18 09:54:51 2010 -0700 12.2 +++ b/test/tools/javac/Diagnostics/6722234/T6722234b_2.out Sat Sep 18 09:56:23 2010 -0700 12.3 @@ -1,4 +1,4 @@ 12.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 12.5 +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>) 12.6 - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, Object, kindname.method, <T>m(List<T>,List<T>))} 12.7 - 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)} 12.8 1 error
13.1 --- a/test/tools/javac/Diagnostics/6722234/T6722234c.out Sat Sep 18 09:54:51 2010 -0700 13.2 +++ b/test/tools/javac/Diagnostics/6722234/T6722234c.out Sat Sep 18 09:56:23 2010 -0700 13.3 @@ -1,2 +1,2 @@ 13.4 -T6722234c.java:14:9: compiler.err.cant.apply.symbol: kindname.method, m, T6722234c.String, java.lang.String, kindname.class, T6722234c, null 13.5 +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) 13.6 1 error
14.1 --- a/test/tools/javac/Diagnostics/6799605/T6799605.out Sat Sep 18 09:54:51 2010 -0700 14.2 +++ b/test/tools/javac/Diagnostics/6799605/T6799605.out Sat Sep 18 09:56:23 2010 -0700 14.3 @@ -1,4 +1,4 @@ 14.4 -T6799605.java:17:9: compiler.err.cant.resolve.location.args: kindname.method, m, , T6799605<compiler.misc.type.captureof: 1, ?>, kindname.class, T6799605<X> 14.5 -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> 14.6 -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> 14.7 +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, ?>))} 14.8 +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))} 14.9 +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))} 14.10 3 errors
15.1 --- a/test/tools/javac/Diagnostics/6862608/T6862608a.out Sat Sep 18 09:54:51 2010 -0700 15.2 +++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out Sat Sep 18 09:56:23 2010 -0700 15.3 @@ -1,3 +1,3 @@ 15.4 -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> 15.5 +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> 15.6 - 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>>))} 15.7 1 error
16.1 --- a/test/tools/javac/Diagnostics/6862608/T6862608b.out Sat Sep 18 09:54:51 2010 -0700 16.2 +++ b/test/tools/javac/Diagnostics/6862608/T6862608b.out Sat Sep 18 09:56:23 2010 -0700 16.3 @@ -1,3 +1,3 @@ 16.4 -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 16.5 +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) 16.6 - 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)} 16.7 1 error
17.1 --- a/test/tools/javac/T6326754.out Sat Sep 18 09:54:51 2010 -0700 17.2 +++ b/test/tools/javac/T6326754.out Sat Sep 18 09:56:23 2010 -0700 17.3 @@ -1,7 +1,7 @@ 17.4 T6326754.java:44:12: compiler.err.name.clash.same.erasure: TestConstructor(T), TestConstructor(K) 17.5 T6326754.java:52:17: compiler.err.name.clash.same.erasure: setT(K), setT(T) 17.6 T6326754.java:64:18: compiler.err.prob.found.req: (compiler.misc.incompatible.types), T, T 17.7 -T6326754.java:70:11: compiler.err.cant.apply.symbol: kindname.method, setT, java.lang.Object, compiler.misc.no.args, kindname.class, TestC<T>, null 17.8 +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) 17.9 - compiler.note.unchecked.filename: T6326754.java 17.10 - compiler.note.unchecked.recompile 17.11 4 errors
18.1 --- a/test/tools/javac/diags/Example.java Sat Sep 18 09:54:51 2010 -0700 18.2 +++ b/test/tools/javac/diags/Example.java Sat Sep 18 09:56:23 2010 -0700 18.3 @@ -401,7 +401,7 @@ 18.4 } 18.5 } 18.6 for (JCDiagnostic sd: d.getSubdiagnostics()) 18.7 - scanForKeys(d, keys); 18.8 + scanForKeys(sd, keys); 18.9 } 18.10 } 18.11
19.1 --- a/test/tools/javac/diags/examples.not-yet.txt Sat Sep 18 09:54:51 2010 -0700 19.2 +++ b/test/tools/javac/diags/examples.not-yet.txt Sat Sep 18 09:56:23 2010 -0700 19.3 @@ -3,7 +3,7 @@ 19.4 compiler.err.annotation.value.not.allowable.type # cannot happen: precluded by complete type-specific tests 19.5 compiler.err.assignment.from.super-bound # DEAD 19.6 compiler.err.assignment.to.extends-bound # DEAD 19.7 -compiler.err.cant.apply.symbol.1 19.8 +compiler.err.cant.apply.symbol 19.9 compiler.err.cant.read.file # (apt.JavaCompiler?) 19.10 compiler.err.cant.select.static.class.from.param.type 19.11 compiler.err.illegal.char.for.encoding 19.12 @@ -43,7 +43,6 @@ 19.13 compiler.err.unexpected.type 19.14 compiler.err.unknown.enum.constant # in bad class file 19.15 compiler.err.unsupported.cross.fp.lit # Scanner: host system dependent 19.16 -compiler.misc.arg.length.mismatch 19.17 compiler.misc.assignment.from.super-bound 19.18 compiler.misc.assignment.to.extends-bound 19.19 compiler.misc.bad.class.file.header # bad class file 19.20 @@ -73,7 +72,6 @@ 19.21 compiler.misc.kindname.type.variable 19.22 compiler.misc.kindname.type.variable.bound 19.23 compiler.misc.kindname.value 19.24 -compiler.misc.no.conforming.assignment.exists 19.25 compiler.misc.non.denotable.type 19.26 compiler.misc.no.unique.minimal.instance.exists 19.27 compiler.misc.resume.abort # prompt for a response
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/diags/examples/ExplicitParamsDoNotConformToBounds.java Sat Sep 18 09:56:23 2010 -0700 20.3 @@ -0,0 +1,30 @@ 20.4 +/* 20.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. 20.11 + * 20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 + * version 2 for more details (a copy is included in the LICENSE file that 20.16 + * accompanied this code). 20.17 + * 20.18 + * You should have received a copy of the GNU General Public License version 20.19 + * 2 along with this work; if not, write to the Free Software Foundation, 20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 + * 20.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.23 + * or visit www.oracle.com if you need additional information or have any 20.24 + * questions. 20.25 + */ 20.26 + 20.27 +// key: compiler.err.cant.apply.symbol.1 20.28 +// key: compiler.misc.explicit.param.do.not.conform.to.bounds 20.29 + 20.30 +class ExplicitParamsDoNotConformToBounds { 20.31 + <X extends Number> void m() {} 20.32 + { this.<String>m(); } 20.33 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/diags/examples/InapplicableSymbols.java Sat Sep 18 09:56:23 2010 -0700 21.3 @@ -0,0 +1,32 @@ 21.4 +/* 21.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 + * 21.8 + * This code is free software; you can redistribute it and/or modify it 21.9 + * under the terms of the GNU General Public License version 2 only, as 21.10 + * published by the Free Software Foundation. 21.11 + * 21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.15 + * version 2 for more details (a copy is included in the LICENSE file that 21.16 + * accompanied this code). 21.17 + * 21.18 + * You should have received a copy of the GNU General Public License version 21.19 + * 2 along with this work; if not, write to the Free Software Foundation, 21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.21 + * 21.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21.23 + * or visit www.oracle.com if you need additional information or have any 21.24 + * questions. 21.25 + */ 21.26 + 21.27 +// key: compiler.err.cant.apply.symbols 21.28 +// key: compiler.misc.arg.length.mismatch 21.29 +// key: compiler.misc.inapplicable.method 21.30 + 21.31 +class ExplicitParamsDoNotConformToBounds { 21.32 + void m(int i1) {} 21.33 + void m(int i1, int i2) {} 21.34 + { this.m(); } 21.35 +}
22.1 --- a/test/tools/javac/diags/examples/IncompatibleTypes1.java Sat Sep 18 09:54:51 2010 -0700 22.2 +++ b/test/tools/javac/diags/examples/IncompatibleTypes1.java Sat Sep 18 09:56:23 2010 -0700 22.3 @@ -22,7 +22,7 @@ 22.4 */ 22.5 22.6 // key: compiler.misc.incompatible.types.1 22.7 -// key: compiler.misc.no.conforming.instance.exists 22.8 +// key: compiler.misc.infer.no.conforming.instance.exists 22.9 // key: compiler.err.prob.found.req 22.10 22.11 class IncompatibleTypes1<V> {
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/tools/javac/diags/examples/InferArgsLengthMismatch.java Sat Sep 18 09:56:23 2010 -0700 23.3 @@ -0,0 +1,30 @@ 23.4 +/* 23.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.23 + * or visit www.oracle.com if you need additional information or have any 23.24 + * questions. 23.25 + */ 23.26 + 23.27 +// key: compiler.err.cant.apply.symbol.1 23.28 +// key: compiler.misc.infer.arg.length.mismatch 23.29 + 23.30 +class InferArgsLengthMismatch { 23.31 + <X extends Number> void m(X x1, X x2) {} 23.32 + { this.m(1); } 23.33 +}
24.1 --- a/test/tools/javac/diags/examples/KindnameConstructor.java Sat Sep 18 09:54:51 2010 -0700 24.2 +++ b/test/tools/javac/diags/examples/KindnameConstructor.java Sat Sep 18 09:56:23 2010 -0700 24.3 @@ -24,7 +24,9 @@ 24.4 // key: compiler.misc.kindname.constructor 24.5 // key: compiler.misc.kindname.class 24.6 // key: compiler.misc.no.args 24.7 -// key: compiler.err.cant.apply.symbol 24.8 +// key: compiler.err.cant.apply.symbol.1 24.9 +// key: compiler.misc.arg.length.mismatch 24.10 +// key: compiler.misc.no.conforming.assignment.exists 24.11 // key: compiler.misc.count.error.plural 24.12 // run: backdoor 24.13
25.1 --- a/test/tools/javac/diags/examples/NoArgs.java Sat Sep 18 09:54:51 2010 -0700 25.2 +++ b/test/tools/javac/diags/examples/NoArgs.java Sat Sep 18 09:56:23 2010 -0700 25.3 @@ -22,7 +22,8 @@ 25.4 */ 25.5 25.6 // key: compiler.misc.no.args 25.7 -// key: compiler.err.cant.apply.symbol 25.8 +// key: compiler.err.cant.apply.symbol.1 25.9 +// key: compiler.misc.arg.length.mismatch 25.10 // run: simple 25.11 25.12 class X {
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/tools/javac/diags/examples/VarargsArgumentMismatch.java Sat Sep 18 09:56:23 2010 -0700 26.3 @@ -0,0 +1,30 @@ 26.4 +/* 26.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. 26.11 + * 26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 + * version 2 for more details (a copy is included in the LICENSE file that 26.16 + * accompanied this code). 26.17 + * 26.18 + * You should have received a copy of the GNU General Public License version 26.19 + * 2 along with this work; if not, write to the Free Software Foundation, 26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 + * 26.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.23 + * or visit www.oracle.com if you need additional information or have any 26.24 + * questions. 26.25 + */ 26.26 + 26.27 +// key: compiler.err.cant.apply.symbol.1 26.28 +// key: compiler.misc.varargs.argument.mismatch 26.29 + 26.30 +class VarargsArgumentMismatch { 26.31 + void m(String s, Integer... is) {} 26.32 + { this.m("1", "2", "3"); } 26.33 +}
27.1 --- a/test/tools/javac/diags/examples/WhereCaptured.java Sat Sep 18 09:54:51 2010 -0700 27.2 +++ b/test/tools/javac/diags/examples/WhereCaptured.java Sat Sep 18 09:56:23 2010 -0700 27.3 @@ -25,7 +25,8 @@ 27.4 // key: compiler.misc.where.description.captured.1 27.5 // key: compiler.misc.where.description.typevar 27.6 // key: compiler.misc.where.typevar 27.7 -// key: compiler.err.cant.apply.symbol 27.8 +// key: compiler.err.cant.apply.symbol.1 27.9 +// key: compiler.misc.infer.no.conforming.assignment.exists 27.10 // key: compiler.misc.captured.type 27.11 // options: -XDdiags=where,simpleNames 27.12 // run: simple
28.1 --- a/test/tools/javac/diags/examples/WhereCaptured1.java Sat Sep 18 09:54:51 2010 -0700 28.2 +++ b/test/tools/javac/diags/examples/WhereCaptured1.java Sat Sep 18 09:56:23 2010 -0700 28.3 @@ -25,7 +25,8 @@ 28.4 // key: compiler.misc.where.description.captured.1 28.5 // key: compiler.misc.where.description.typevar 28.6 // key: compiler.misc.where.typevar 28.7 -// key: compiler.err.cant.apply.symbol 28.8 +// key: compiler.err.cant.apply.symbol.1 28.9 +// key: compiler.misc.infer.no.conforming.assignment.exists 28.10 // key: compiler.misc.captured.type 28.11 // key: compiler.misc.type.null 28.12 // options: -XDdiags=where,simpleNames
29.1 --- a/test/tools/javac/diags/examples/WhereTypeVar.java Sat Sep 18 09:54:51 2010 -0700 29.2 +++ b/test/tools/javac/diags/examples/WhereTypeVar.java Sat Sep 18 09:56:23 2010 -0700 29.3 @@ -24,7 +24,8 @@ 29.4 // key: compiler.misc.where.typevar 29.5 // key: compiler.misc.where.description.typevar.1 29.6 // key: compiler.misc.type.var 29.7 -// key: compiler.err.cant.apply.symbol 29.8 +// key: compiler.err.cant.apply.symbol.1 29.9 +// key: compiler.misc.no.conforming.assignment.exists 29.10 // options: -XDdiags=where,disambiguateTvars 29.11 // run: simple 29.12
30.1 --- a/test/tools/javac/generics/diamond/neg/Neg06.out Sat Sep 18 09:54:51 2010 -0700 30.2 +++ b/test/tools/javac/generics/diamond/neg/Neg06.out Sat Sep 18 09:56:23 2010 -0700 30.3 @@ -1,4 +1,4 @@ 30.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>) 30.5 -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>) 30.6 -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>) 30.7 +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>) 30.8 +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>) 30.9 +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>) 30.10 3 errors
31.1 --- a/test/tools/javac/generics/inference/6315770/T6315770.out Sat Sep 18 09:54:51 2010 -0700 31.2 +++ b/test/tools/javac/generics/inference/6315770/T6315770.out Sat Sep 18 09:56:23 2010 -0700 31.3 @@ -1,3 +1,3 @@ 31.4 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) 31.5 -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> 31.6 +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> 31.7 2 errors
32.1 --- a/test/tools/javac/generics/inference/6611449/T6611449.out Sat Sep 18 09:54:51 2010 -0700 32.2 +++ b/test/tools/javac/generics/inference/6611449/T6611449.out Sat Sep 18 09:56:23 2010 -0700 32.3 @@ -1,5 +1,5 @@ 32.4 -T6611449.java:18:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6611449, , int, kindname.class, T6611449<S> 32.5 -T6611449.java:19:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6611449, , int,int, kindname.class, T6611449<S> 32.6 -T6611449.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m1, T, int, kindname.class, T6611449<S>, null 32.7 -T6611449.java:21:9: compiler.err.cant.apply.symbol: kindname.method, m2, T,T, int,int, kindname.class, T6611449<S>, null 32.8 +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))} 32.9 +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))} 32.10 +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) 32.11 +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) 32.12 4 errors
33.1 --- a/test/tools/javac/generics/inference/6638712/T6638712a.out Sat Sep 18 09:54:51 2010 -0700 33.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712a.out Sat Sep 18 09:56:23 2010 -0700 33.3 @@ -1,2 +1,2 @@ 33.4 -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> 33.5 +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> 33.6 1 error
34.1 --- a/test/tools/javac/generics/inference/6638712/T6638712b.out Sat Sep 18 09:54:51 2010 -0700 34.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712b.out Sat Sep 18 09:56:23 2010 -0700 34.3 @@ -1,2 +1,2 @@ 34.4 -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 34.5 +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 34.6 1 error
35.1 --- a/test/tools/javac/generics/inference/6638712/T6638712c.out Sat Sep 18 09:54:51 2010 -0700 35.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712c.out Sat Sep 18 09:56:23 2010 -0700 35.3 @@ -1,2 +1,2 @@ 35.4 -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 35.5 +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<?>>) 35.6 1 error
36.1 --- a/test/tools/javac/generics/inference/6638712/T6638712d.out Sat Sep 18 09:54:51 2010 -0700 36.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712d.out Sat Sep 18 09:56:23 2010 -0700 36.3 @@ -1,2 +1,2 @@ 36.4 -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 36.5 +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>>) 36.6 1 error
37.1 --- a/test/tools/javac/generics/inference/6638712/T6638712e.out Sat Sep 18 09:54:51 2010 -0700 37.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712e.out Sat Sep 18 09:56:23 2010 -0700 37.3 @@ -1,2 +1,2 @@ 37.4 -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> 37.5 +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> 37.6 1 error