View | Details | Raw Unified | Return to bug 100772 | Differences between
and this patch

Collapse All | Expand All

(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java (-2 / +1 lines)
Lines 1113-1118 Link Here
1113
			this.nameEnvironment.cleanup();
1113
			this.nameEnvironment.cleanup();
1114
		manager.flushZipFiles();
1114
		manager.flushZipFiles();
1115
		this.bindings = null;
1115
		this.bindings = null;
1116
		this.patternLocator.clear();
1116
	}
1117
	}
1117
}
1118
}
1118
/**
1119
/**
Lines 2012-2020 Link Here
2012
	
2013
	
2013
	// Clear handle cache
2014
	// Clear handle cache
2014
	this.methodHandles = null;
2015
	this.methodHandles = null;
2015
	this.bindings.removeKey(this.pattern);
2016
	this.patternLocator.mustResolve = locatorMustResolve;
2016
	this.patternLocator.mustResolve = locatorMustResolve;
2017
	this.patternLocator.clear();
2018
}
2017
}
2019
/**
2018
/**
2020
 * Visit the given field declaration and report the nodes that match exactly the
2019
 * Visit the given field declaration and report the nodes that match exactly the
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java (-12 / +25 lines)
Lines 63-69 Link Here
63
/*
63
/*
64
 * Return whether a type name is in pattern all super declaring types names.
64
 * Return whether a type name is in pattern all super declaring types names.
65
 */
65
 */
66
private boolean isTypeInSuperDeclaringTypeNames(char[][] typeName) {
66
boolean isTypeInSuperDeclaringTypeNames(char[][] typeName) {
67
	if (allSuperDeclaringTypeNames == null) return false;
67
	if (allSuperDeclaringTypeNames == null) return false;
68
	int length = allSuperDeclaringTypeNames.length;
68
	int length = allSuperDeclaringTypeNames.length;
69
	for (int i= 0; i<length; i++) {
69
	for (int i= 0; i<length; i++) {
Lines 268-274 Link Here
268
					if (matchMethod == null) {
268
					if (matchMethod == null) {
269
						if (methodParametersEqualsPattern(methods[i].original())) return true;
269
						if (methodParametersEqualsPattern(methods[i].original())) return true;
270
					} else {
270
					} else {
271
						if (methods[i].original().areParametersEqual(matchMethod)) return true;
271
						if (methodsHaveSameParameters(methods[i].original(), matchMethod)) return true;
272
					}
272
					}
273
				}
273
				}
274
			}
274
			}
Lines 291-297 Link Here
291
					if (matchMethod == null) {
291
					if (matchMethod == null) {
292
						if (methodParametersEqualsPattern(methods[i].original())) return true;
292
						if (methodParametersEqualsPattern(methods[i].original())) return true;
293
					} else {
293
					} else {
294
						if (methods[i].original().areParametersEqual(matchMethod)) return true;
294
						if (methodsHaveSameParameters(methods[i].original(), matchMethod)) return true;
295
					}
295
					}
296
				}
296
				}
297
			}
297
			}
Lines 439-444 Link Here
439
	}
439
	}
440
	return true;
440
	return true;
441
}
441
}
442
private boolean methodsHaveSameParameters(MethodBinding method, MethodBinding matchMethod) {
443
	TypeBinding[] methodParameters = method.parameters;
444
	TypeBinding[] matchMethodParameters = matchMethod.parameters;
445
446
	int length = methodParameters==null ? 0 : methodParameters.length;
447
	int matchLength = matchMethodParameters==null ? 0 : matchMethodParameters.length;
448
	if (length != matchLength) return false;
449
450
	for (int i = 0; i < length; i++) {
451
		if (!CharOperation.equals(methodParameters[i].readableName(), matchMethodParameters[i].readableName(), this.isCaseSensitive)) {
452
			return false;
453
		}
454
	}
455
	return true;
456
}
442
public SearchMatch newDeclarationMatch(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, int length, MatchLocator locator) {
457
public SearchMatch newDeclarationMatch(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, int length, MatchLocator locator) {
443
	if (elementBinding != null) {
458
	if (elementBinding != null) {
444
		MethodBinding methodBinding = (MethodBinding) elementBinding;
459
		MethodBinding methodBinding = (MethodBinding) elementBinding;
Lines 452-471 Link Here
452
				}
467
				}
453
				return null;
468
				return null;
454
			}
469
			}
470
			// If method binding override a method in super hierarchy which original match pattern then report match
455
			if (matchOverriddenMethod(methodBinding.declaringClass, methodBinding, null)) {
471
			if (matchOverriddenMethod(methodBinding.declaringClass, methodBinding, null)) {
456
				this.methodDeclarationsWithInvalidParam.put(reference, Boolean.TRUE);
472
				this.methodDeclarationsWithInvalidParam.put(reference, Boolean.TRUE);
457
				return super.newDeclarationMatch(reference, element, elementBinding, accuracy, length, locator);
473
				return super.newDeclarationMatch(reference, element, elementBinding, accuracy, length, locator);
458
			}
474
			}
459
			if (isTypeInSuperDeclaringTypeNames(methodBinding.declaringClass.compoundName)) {
475
			// If pattern binding override a method in super hierarchy which original match method binding then report match
460
				MethodBinding patternBinding = locator.getMethodBinding(this.pattern);
476
			MethodBinding patternBinding = locator.getMethodBinding(this.pattern);
461
				if (patternBinding != null) {
477
			if (patternBinding != null) {
462
					if (!matchOverriddenMethod(patternBinding.declaringClass, patternBinding, methodBinding)) {
478
				if (matchOverriddenMethod(patternBinding.declaringClass, patternBinding, methodBinding)) {
463
						this.methodDeclarationsWithInvalidParam.put(reference, Boolean.FALSE);
479
					this.methodDeclarationsWithInvalidParam.put(reference, Boolean.TRUE);
464
						return null;
480
					return super.newDeclarationMatch(reference, element, elementBinding, accuracy, length, locator);
465
					}
466
				}
481
				}
467
				this.methodDeclarationsWithInvalidParam.put(reference, Boolean.TRUE);
468
				return super.newDeclarationMatch(reference, element, elementBinding, accuracy, length, locator);
469
			}
482
			}
470
			this.methodDeclarationsWithInvalidParam.put(reference, Boolean.FALSE);
483
			this.methodDeclarationsWithInvalidParam.put(reference, Boolean.FALSE);
471
			return null;
484
			return null;

Return to bug 100772