src/share/classes/com/sun/tools/javac/comp/Resolve.java

Print this page
rev 108 : 6638712: Inference with wildcard types causes selection of inapplicable method
Summary: Added global sanity check in order to make sure that return type inference does not violate bounds constraints
Reviewed-by: jjg

*** 277,287 **** List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, Warner warn) ! throws Infer.NoInstanceException { if (useVarargs && (m.flags() & VARARGS) == 0) return null; Type mt = types.memberType(site, m); // tvars is the list of formal type variables for which type arguments // need to inferred. --- 277,287 ---- List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, Warner warn) ! throws Infer.InferenceException { if (useVarargs && (m.flags() & VARARGS) == 0) return null; Type mt = types.memberType(site, m); // tvars is the list of formal type variables for which type arguments // need to inferred.
*** 348,358 **** boolean useVarargs, Warner warn) { try { return rawInstantiate(env, site, m, argtypes, typeargtypes, allowBoxing, useVarargs, warn); ! } catch (Infer.NoInstanceException ex) { return null; } } /** Check if a parameter list accepts a list of args. --- 348,358 ---- boolean useVarargs, Warner warn) { try { return rawInstantiate(env, site, m, argtypes, typeargtypes, allowBoxing, useVarargs, warn); ! } catch (Infer.InferenceException ex) { return null; } } /** Check if a parameter list accepts a list of args.
*** 560,570 **** case ABSENT_MTH: return wrongMethod.setWrongSym(sym); case WRONG_MTH: return wrongMethods; default: return bestSoFar; } } ! } catch (Infer.NoInstanceException ex) { switch (bestSoFar.kind) { case ABSENT_MTH: return wrongMethod.setWrongSym(sym, ex.getDiagnostic()); case WRONG_MTH: return wrongMethods; --- 560,570 ---- case ABSENT_MTH: return wrongMethod.setWrongSym(sym); case WRONG_MTH: return wrongMethods; default: return bestSoFar; } } ! } catch (Infer.InferenceException ex) { switch (bestSoFar.kind) { case ABSENT_MTH: return wrongMethod.setWrongSym(sym, ex.getDiagnostic()); case WRONG_MTH: return wrongMethods;