Lines 1045-1050
Link Here
|
1045 |
|
1045 |
|
1046 |
// Internal use only - use findMethod() |
1046 |
// Internal use only - use findMethod() |
1047 |
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { |
1047 |
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite) { |
|
|
1048 |
return findMethod(receiverType, selector, argumentTypes, invocationSite, false); |
1049 |
} |
1050 |
|
1051 |
// Internal use only - use findMethod() |
1052 |
public MethodBinding findMethod(ReferenceBinding receiverType, char[] selector, TypeBinding[] argumentTypes, InvocationSite invocationSite, boolean inStaticContext) { |
1048 |
ReferenceBinding currentType = receiverType; |
1053 |
ReferenceBinding currentType = receiverType; |
1049 |
boolean receiverTypeIsInterface = receiverType.isInterface(); |
1054 |
boolean receiverTypeIsInterface = receiverType.isInterface(); |
1050 |
ObjectVector found = new ObjectVector(3); |
1055 |
ObjectVector found = new ObjectVector(3); |
Lines 1257-1262
Link Here
|
1257 |
} |
1262 |
} |
1258 |
} |
1263 |
} |
1259 |
|
1264 |
|
|
|
1265 |
if (inStaticContext) { |
1266 |
MethodBinding[] staticCandidates = new MethodBinding[visiblesCount]; |
1267 |
int staticCount = 0; |
1268 |
for (int i = 0; i < visiblesCount; i++) |
1269 |
if (candidates[i].isStatic()) |
1270 |
staticCandidates[staticCount++] = candidates[i]; |
1271 |
if (staticCount == 1) |
1272 |
return staticCandidates[0]; |
1273 |
if (staticCount > 1) |
1274 |
return mostSpecificMethodBinding(staticCandidates, staticCount, argumentTypes, invocationSite, receiverType); |
1275 |
} |
1276 |
|
1260 |
MethodBinding mostSpecificMethod = mostSpecificMethodBinding(candidates, visiblesCount, argumentTypes, invocationSite, receiverType); |
1277 |
MethodBinding mostSpecificMethod = mostSpecificMethodBinding(candidates, visiblesCount, argumentTypes, invocationSite, receiverType); |
1261 |
if (searchForDefaultAbstractMethod) { // search interfaces for a better match |
1278 |
if (searchForDefaultAbstractMethod) { // search interfaces for a better match |
1262 |
if (mostSpecificMethod.isValidBinding()) |
1279 |
if (mostSpecificMethod.isValidBinding()) |
Lines 1909-1921
Link Here
|
1909 |
if (importBinding.onDemand) { |
1926 |
if (importBinding.onDemand) { |
1910 |
if (!skipOnDemand && resolvedImport instanceof ReferenceBinding) |
1927 |
if (!skipOnDemand && resolvedImport instanceof ReferenceBinding) |
1911 |
// answers closest approximation, may not check argumentTypes or visibility |
1928 |
// answers closest approximation, may not check argumentTypes or visibility |
1912 |
possible = findMethod((ReferenceBinding) resolvedImport, selector, argumentTypes, invocationSite); |
1929 |
possible = findMethod((ReferenceBinding) resolvedImport, selector, argumentTypes, invocationSite, true); |
1913 |
} else { |
1930 |
} else { |
1914 |
if (resolvedImport instanceof MethodBinding) { |
1931 |
if (resolvedImport instanceof MethodBinding) { |
1915 |
MethodBinding staticMethod = (MethodBinding) resolvedImport; |
1932 |
MethodBinding staticMethod = (MethodBinding) resolvedImport; |
1916 |
if (CharOperation.equals(staticMethod.selector, selector)) |
1933 |
if (CharOperation.equals(staticMethod.selector, selector)) |
1917 |
// answers closest approximation, may not check argumentTypes or visibility |
1934 |
// answers closest approximation, may not check argumentTypes or visibility |
1918 |
possible = findMethod(staticMethod.declaringClass, selector, argumentTypes, invocationSite); |
1935 |
possible = findMethod(staticMethod.declaringClass, selector, argumentTypes, invocationSite, true); |
1919 |
} else if (resolvedImport instanceof FieldBinding) { |
1936 |
} else if (resolvedImport instanceof FieldBinding) { |
1920 |
// check to see if there are also methods with the same name |
1937 |
// check to see if there are also methods with the same name |
1921 |
FieldBinding staticField = (FieldBinding) resolvedImport; |
1938 |
FieldBinding staticField = (FieldBinding) resolvedImport; |
Lines 1925-1931
Link Here
|
1925 |
TypeBinding referencedType = getType(importName, importName.length - 1); |
1942 |
TypeBinding referencedType = getType(importName, importName.length - 1); |
1926 |
if (referencedType != null) |
1943 |
if (referencedType != null) |
1927 |
// answers closest approximation, may not check argumentTypes or visibility |
1944 |
// answers closest approximation, may not check argumentTypes or visibility |
1928 |
possible = findMethod((ReferenceBinding) referencedType, selector, argumentTypes, invocationSite); |
1945 |
possible = findMethod((ReferenceBinding) referencedType, selector, argumentTypes, invocationSite, true); |
1929 |
} |
1946 |
} |
1930 |
} |
1947 |
} |
1931 |
} |
1948 |
} |