--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Feb 21 15:25:03 2013 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Feb 21 15:26:46 2013 +0000
@@ -1244,9 +1244,12 @@
boolean useVarargs,
boolean operator) {
if (sym.kind == ERR ||
- !sym.isInheritedIn(site.tsym, types) ||
- (useVarargs && (sym.flags() & VARARGS) == 0)) {
+ !sym.isInheritedIn(site.tsym, types)) {
return bestSoFar;
+ } else if (useVarargs && (sym.flags() & VARARGS) == 0) {
+ return bestSoFar.kind >= ERRONEOUS ?
+ new BadVarargsMethod((ResolveError)bestSoFar) :
+ bestSoFar;
}
Assert.check(sym.kind < AMBIGUOUS);
try {
@@ -3522,6 +3525,31 @@
}
}
+ class BadVarargsMethod extends ResolveError {
+
+ ResolveError delegatedError;
+
+ BadVarargsMethod(ResolveError delegatedError) {
+ super(delegatedError.kind, "badVarargs");
+ this.delegatedError = delegatedError;
+ }
+
+ @Override
+ protected Symbol access(Name name, TypeSymbol location) {
+ return delegatedError.access(name, location);
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+
+ @Override
+ JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
+ return delegatedError.getDiagnostic(dkind, pos, location, site, name, argtypes, typeargtypes);
+ }
+ }
+
enum MethodResolutionPhase {
BASIC(false, false),
BOX(true, false),