Lines 91-98
Link Here
|
91 |
ASTNode[] args = node.arguments; |
91 |
ASTNode[] args = node.arguments; |
92 |
int argsLength = args == null ? 0 : args.length; |
92 |
int argsLength = args == null ? 0 : args.length; |
93 |
if (length != argsLength) return IMPOSSIBLE_MATCH; |
93 |
if (length != argsLength) return IMPOSSIBLE_MATCH; |
94 |
for (int i = 0; i < argsLength; i++) { |
94 |
// Disable filter on argument syntax to allow generic type search. |
95 |
if (!matchesTypeReference(this.pattern.parameterSimpleNames[i], ((Argument) args[i]).type)) return IMPOSSIBLE_MATCH; |
95 |
// (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=79990) |
|
|
96 |
if (!this.pattern.mustResolveGeneric) { |
97 |
for (int i = 0; i < argsLength; i++) { |
98 |
if (!matchesTypeReference(this.pattern.parameterSimpleNames[i], ((Argument) args[i]).type)) return IMPOSSIBLE_MATCH; |
99 |
} |
96 |
} |
100 |
} |
97 |
} |
101 |
} |
98 |
|
102 |
|
Lines 215-220
Link Here
|
215 |
return level; |
219 |
return level; |
216 |
} |
220 |
} |
217 |
/** |
221 |
/** |
|
|
222 |
* Return if pattern method may override a method in super classes |
223 |
* or or implement one in super interfaces of given type. |
224 |
* @param type |
225 |
* @return level |
226 |
*/ |
227 |
int matchOverriddenMethod(ReferenceBinding type) { |
228 |
if (type == null) return INACCURATE_MATCH; |
229 |
int level = IMPOSSIBLE_MATCH; |
230 |
|
231 |
// matches superclass |
232 |
if (!type.isInterface() && !CharOperation.equals(type.compoundName, TypeConstants.JAVA_LANG_OBJECT)) { |
233 |
if (type.superclass().isParameterizedType()) { |
234 |
TypeBinding erasure = ((ParameterizedTypeBinding)type.superclass()).erasure(); |
235 |
if (erasure instanceof ReferenceBinding) { |
236 |
MethodBinding[] methods = ((ReferenceBinding)erasure).getMethods(this.pattern.selector); |
237 |
int length = methods.length; |
238 |
for (int i = 0; i<length && level == IMPOSSIBLE_MATCH; i++) { |
239 |
level = matchMethod(methods[i]); |
240 |
} |
241 |
if (level != IMPOSSIBLE_MATCH) return level; |
242 |
} |
243 |
} |
244 |
level = matchOverriddenMethod(type.superclass()); |
245 |
if (level != IMPOSSIBLE_MATCH) return level; |
246 |
} |
247 |
|
248 |
// matches interfaces |
249 |
ReferenceBinding[] interfaces = type.superInterfaces(); |
250 |
if (interfaces == null) return INACCURATE_MATCH; |
251 |
int iLength = interfaces.length; |
252 |
for (int i = 0; i<iLength; i++) { |
253 |
if (interfaces[i].isParameterizedType()) { |
254 |
TypeBinding erasure = ((ParameterizedTypeBinding)interfaces[i]).erasure(); |
255 |
if (erasure instanceof ReferenceBinding) { |
256 |
MethodBinding[] methods = ((ReferenceBinding)erasure).getMethods(this.pattern.selector); |
257 |
int mLength = methods.length; |
258 |
for (int j = 0; j<mLength && level == IMPOSSIBLE_MATCH; j++) { |
259 |
level = matchMethod(methods[j]); |
260 |
} |
261 |
if (level != IMPOSSIBLE_MATCH) return level; |
262 |
} |
263 |
} |
264 |
level = matchOverriddenMethod(interfaces[i]); |
265 |
if (level != IMPOSSIBLE_MATCH) return level; |
266 |
} |
267 |
return IMPOSSIBLE_MATCH; |
268 |
} |
269 |
/** |
218 |
* @see org.eclipse.jdt.internal.core.search.matching.PatternLocator#matchReportReference(org.eclipse.jdt.internal.compiler.ast.ASTNode, org.eclipse.jdt.core.IJavaElement, Binding, int, org.eclipse.jdt.internal.core.search.matching.MatchLocator) |
270 |
* @see org.eclipse.jdt.internal.core.search.matching.PatternLocator#matchReportReference(org.eclipse.jdt.internal.compiler.ast.ASTNode, org.eclipse.jdt.core.IJavaElement, Binding, int, org.eclipse.jdt.internal.core.search.matching.MatchLocator) |
219 |
*/ |
271 |
*/ |
220 |
protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { |
272 |
protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException { |
Lines 415-422
Link Here
|
415 |
int methodLevel = matchMethod(method); |
467 |
int methodLevel = matchMethod(method); |
416 |
if (methodLevel == IMPOSSIBLE_MATCH) { |
468 |
if (methodLevel == IMPOSSIBLE_MATCH) { |
417 |
if (method != method.original()) methodLevel = matchMethod(method.original()); |
469 |
if (method != method.original()) methodLevel = matchMethod(method.original()); |
418 |
if (methodLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH; |
470 |
if (methodLevel == IMPOSSIBLE_MATCH && this.pattern.findDeclarations && this.pattern.mustResolveGeneric) { |
419 |
method = method.original(); |
471 |
methodLevel = matchOverriddenMethod(method.declaringClass); |
|
|
472 |
if (methodLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH; |
473 |
} else { |
474 |
method = method.original(); |
475 |
} |
420 |
} |
476 |
} |
421 |
|
477 |
|
422 |
// declaring type |
478 |
// declaring type |