Lines 49-54
Link Here
|
49 |
protected int fineGrain() { |
49 |
protected int fineGrain() { |
50 |
return this.pattern.fineGrain; |
50 |
return this.pattern.fineGrain; |
51 |
} |
51 |
} |
|
|
52 |
|
53 |
private MethodBinding getMethodBinding(ReferenceBinding type, TypeBinding[] argumentTypes) { |
54 |
MethodBinding[] methods = type.getMethods(this.pattern.selector); |
55 |
MethodBinding method = null; |
56 |
methodsLoop: for (int i=0, length=methods.length; i<length; i++) { |
57 |
method = methods[i]; |
58 |
TypeBinding[] parameters = method.parameters; |
59 |
if (argumentTypes.length == parameters.length) { |
60 |
for (int j=0,l=parameters.length; j<l; j++) { |
61 |
if (parameters[j].erasure() != argumentTypes[j].erasure()) { |
62 |
continue methodsLoop; |
63 |
} |
64 |
} |
65 |
return method; |
66 |
} |
67 |
} |
68 |
return null; |
69 |
} |
70 |
|
52 |
public void initializePolymorphicSearch(MatchLocator locator) { |
71 |
public void initializePolymorphicSearch(MatchLocator locator) { |
53 |
long start = 0; |
72 |
long start = 0; |
54 |
if (BasicSearchEngine.VERBOSE) { |
73 |
if (BasicSearchEngine.VERBOSE) { |
Lines 662-668
Link Here
|
662 |
|
681 |
|
663 |
int level = resolveLevelForType(qualifiedPattern, type); |
682 |
int level = resolveLevelForType(qualifiedPattern, type); |
664 |
if (level != IMPOSSIBLE_MATCH) { |
683 |
if (level != IMPOSSIBLE_MATCH) { |
665 |
if (!type.isAbstract() && !type.isInterface()) { // if concrete class, then method is overridden |
684 |
MethodBinding method = argumentTypes == null ? null : getMethodBinding(type, argumentTypes); |
|
|
685 |
if ((method != null && !method.isAbstract() || !type.isAbstract()) && !type.isInterface()) { // if concrete, then method is overridden |
666 |
level |= OVERRIDDEN_METHOD_FLAVOR; |
686 |
level |= OVERRIDDEN_METHOD_FLAVOR; |
667 |
} |
687 |
} |
668 |
return level; |
688 |
return level; |
Lines 674-701
Link Here
|
674 |
if (level != IMPOSSIBLE_MATCH) { |
694 |
if (level != IMPOSSIBLE_MATCH) { |
675 |
if (argumentTypes != null) { |
695 |
if (argumentTypes != null) { |
676 |
// need to verify if method may be overridden |
696 |
// need to verify if method may be overridden |
677 |
MethodBinding[] methods = type.getMethods(this.pattern.selector); |
697 |
MethodBinding method = getMethodBinding(type, argumentTypes); |
678 |
for (int i=0, length=methods.length; i<length; i++) { |
698 |
if (method != null) { // one method match in hierarchy |
679 |
MethodBinding method = methods[i]; |
699 |
if ((level & OVERRIDDEN_METHOD_FLAVOR) != 0) { |
680 |
TypeBinding[] parameters = method.parameters; |
700 |
// this method is already overridden on a super class, current match is impossible |
681 |
if (argumentTypes.length == parameters.length) { |
701 |
return IMPOSSIBLE_MATCH; |
682 |
boolean found = true; |
702 |
} |
683 |
for (int j=0,l=parameters.length; j<l; j++) { |
703 |
if (!method.isAbstract() && !type.isInterface()) { |
684 |
if (parameters[j].erasure() != argumentTypes[j].erasure()) { |
704 |
// store the fact that the method is overridden |
685 |
found = false; |
705 |
level |= OVERRIDDEN_METHOD_FLAVOR; |
686 |
break; |
|
|
687 |
} |
688 |
} |
689 |
if (found) { // one method match in hierarchy |
690 |
if ((level & OVERRIDDEN_METHOD_FLAVOR) != 0) { |
691 |
// this method is already overridden on a super class, current match is impossible |
692 |
return IMPOSSIBLE_MATCH; |
693 |
} |
694 |
if (!method.isAbstract() && !type.isInterface()) { |
695 |
// store the fact that the method is overridden |
696 |
level |= OVERRIDDEN_METHOD_FLAVOR; |
697 |
} |
698 |
} |
699 |
} |
706 |
} |
700 |
} |
707 |
} |
701 |
} |
708 |
} |