Lines 759-766
Link Here
|
759 |
CompilationUnitScope unitScope = compilationUnitScope(); |
759 |
CompilationUnitScope unitScope = compilationUnitScope(); |
760 |
unitScope.recordTypeReferences(argumentTypes); |
760 |
unitScope.recordTypeReferences(argumentTypes); |
761 |
MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, unitScope); |
761 |
MethodBinding exactMethod = receiverType.getExactMethod(selector, argumentTypes, unitScope); |
762 |
if (exactMethod != null && exactMethod.typeVariables == Binding.NO_TYPE_VARIABLES) { |
762 |
if (exactMethod != null && exactMethod.typeVariables == Binding.NO_TYPE_VARIABLES && !exactMethod.isBridge()) { |
763 |
// must find both methods for this case: <S extends A> void foo() {} and <N extends B> N foo() { return null; } |
763 |
// must find both methods for this case: <S extends A> void foo() {} and <N extends B> N foo() { return null; } |
|
|
764 |
// or find an inherited method when the exact match is to a bridge method |
764 |
unitScope.recordTypeReferences(exactMethod.thrownExceptions); |
765 |
unitScope.recordTypeReferences(exactMethod.thrownExceptions); |
765 |
// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type) |
766 |
// special treatment for Object.getClass() in 1.5 mode (substitute parameterized return type) |
766 |
if (receiverType.isInterface() || exactMethod.canBeSeenBy(receiverType, invocationSite, this)) { |
767 |
if (receiverType.isInterface() || exactMethod.canBeSeenBy(receiverType, invocationSite, this)) { |
Lines 1086-1091
Link Here
|
1086 |
continue nextMethod; // keep inherited substituted methods to detect anonymous errors |
1087 |
continue nextMethod; // keep inherited substituted methods to detect anonymous errors |
1087 |
if (matchingMethod.hasSubstitutedParameters() && !currentMethod.original().areParametersEqual(matchingMethod.original())) |
1088 |
if (matchingMethod.hasSubstitutedParameters() && !currentMethod.original().areParametersEqual(matchingMethod.original())) |
1088 |
continue nextMethod; // keep inherited substituted methods to detect anonymous errors |
1089 |
continue nextMethod; // keep inherited substituted methods to detect anonymous errors |
|
|
1090 |
if (matchingMethod.isBridge() && !currentMethod.isBridge()) |
1091 |
continue nextMethod; // keep inherited methods to find concrete method over a bridge method |
1089 |
} |
1092 |
} |
1090 |
currentLength--; |
1093 |
currentLength--; |
1091 |
currentMethods[i] = null; |
1094 |
currentMethods[i] = null; |
Lines 3226-3231
Link Here
|
3226 |
continue nextVisible; |
3229 |
continue nextVisible; |
3227 |
if (!isAcceptableMethod(tiebreakMethod, acceptable)) |
3230 |
if (!isAcceptableMethod(tiebreakMethod, acceptable)) |
3228 |
continue nextVisible; |
3231 |
continue nextVisible; |
|
|
3232 |
// pick a concrete method over a bridge method when parameters are equal since the return type of the concrete method is more specific |
3233 |
if (current.isBridge() && !next.isBridge()) |
3234 |
if (tiebreakMethod.areParametersEqual(acceptable)) |
3235 |
continue nextVisible; // skip current so acceptable wins over this bridge method |
3229 |
} |
3236 |
} |
3230 |
moreSpecific[i] = current; |
3237 |
moreSpecific[i] = current; |
3231 |
count++; |
3238 |
count++; |