1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Aug 05 09:45:25 2010 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Aug 10 14:52:34 2010 +0100 1.3 @@ -40,6 +40,7 @@ 1.4 import static com.sun.tools.javac.code.Flags.*; 1.5 import static com.sun.tools.javac.code.Kinds.*; 1.6 import static com.sun.tools.javac.code.TypeTags.*; 1.7 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; 1.8 import javax.lang.model.element.ElementVisitor; 1.9 1.10 import java.util.Map; 1.11 @@ -1447,7 +1448,7 @@ 1.12 Env<AttrContext> env, 1.13 Type site, 1.14 List<Type> argtypes, 1.15 - List<Type> typeargtypes, boolean reportErrors) { 1.16 + List<Type> typeargtypes) { 1.17 Symbol sym = methodNotFound; 1.18 JCDiagnostic explanation = null; 1.19 List<MethodResolutionPhase> steps = methodResolutionSteps; 1.20 @@ -1466,11 +1467,20 @@ 1.21 } 1.22 steps = steps.tail; 1.23 } 1.24 - if (sym.kind >= AMBIGUOUS && reportErrors) { 1.25 - String key = explanation == null ? 1.26 - "cant.apply.diamond" : 1.27 - "cant.apply.diamond.1"; 1.28 - log.error(pos, key, diags.fragment("diamond", site.tsym), explanation); 1.29 + if (sym.kind >= AMBIGUOUS) { 1.30 + final JCDiagnostic details = explanation; 1.31 + Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") { 1.32 + @Override 1.33 + JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { 1.34 + String key = details == null ? 1.35 + "cant.apply.diamond" : 1.36 + "cant.apply.diamond.1"; 1.37 + return diags.create(dkind, log.currentSource(), pos, key, diags.fragment("diamond", site.tsym), details); 1.38 + } 1.39 + }; 1.40 + MethodResolutionPhase errPhase = firstErroneousResolutionPhase(); 1.41 + sym = access(errSym, pos, site, names.init, true, argtypes, typeargtypes); 1.42 + env.info.varArgs = errPhase.isVarargsRequired(); 1.43 } 1.44 return sym; 1.45 }