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

Collapse All | Expand All

(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java (-41 / +76 lines)
Lines 38-43 Link Here
38
import org.eclipse.jdt.internal.compiler.CompilationResult;
38
import org.eclipse.jdt.internal.compiler.CompilationResult;
39
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
39
import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
40
import org.eclipse.jdt.internal.compiler.ast.*;
40
import org.eclipse.jdt.internal.compiler.ast.*;
41
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
41
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
42
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
42
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
43
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
43
import org.eclipse.jdt.internal.compiler.env.*;
44
import org.eclipse.jdt.internal.compiler.env.*;
Lines 396-431 Link Here
396
	}
397
	}
397
	return this.basicParser;
398
	return this.basicParser;
398
}
399
}
399
/**
400
 * Add the possibleMatch to the loop
401
 *  ->  build compilation unit declarations, their bindings and record their results.
402
 */
403
protected void parseAndBuildBindings(PossibleMatch possibleMatch, boolean mustResolve) {
404
	if (this.progressMonitor != null && this.progressMonitor.isCanceled())
405
		throw new OperationCanceledException();
406
407
	try {
408
		if (BasicSearchEngine.VERBOSE)
409
			System.out.println("Parsing " + possibleMatch.openable.toStringWithAncestors()); //$NON-NLS-1$
410
411
		this.parser.nodeSet = possibleMatch.nodeSet;
412
		CompilationResult unitResult = new CompilationResult(possibleMatch, 1, 1, this.options.maxProblemsPerUnit);
413
		CompilationUnitDeclaration parsedUnit = this.parser.dietParse(possibleMatch, unitResult);
414
		if (parsedUnit != null) {
415
			if (mustResolve && !parsedUnit.isEmpty())
416
				this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
417
418
			// add the possibleMatch with its parsedUnit to matchesToProcess
419
			possibleMatch.parsedUnit = parsedUnit;
420
			int size = this.matchesToProcess.length;
421
			if (this.numberOfMatches == size)
422
				System.arraycopy(this.matchesToProcess, 0, this.matchesToProcess = new PossibleMatch[size == 0 ? 1 : size * 2], 0, this.numberOfMatches);
423
			this.matchesToProcess[this.numberOfMatches++] = possibleMatch;
424
		}
425
	} finally {
426
		this.parser.nodeSet = null;
427
	}
428
}
429
/*
400
/*
430
 * Caches the given binary type in the lookup environment and returns it.
401
 * Caches the given binary type in the lookup environment and returns it.
431
 * Returns the existing one if already cached.
402
 * Returns the existing one if already cached.
Lines 711-717 Link Here
711
protected IType getFocusType() {
682
protected IType getFocusType() {
712
	return this.scope instanceof HierarchyScope ? ((HierarchyScope) this.scope).focusType : null;
683
	return this.scope instanceof HierarchyScope ? ((HierarchyScope) this.scope).focusType : null;
713
}
684
}
714
protected void getMethodBodies(CompilationUnitDeclaration unit) {
685
protected void getMethodBodies(CompilationUnitDeclaration unit, MatchingNodeSet nodeSet) {
715
	if (unit.ignoreMethodBodies) {
686
	if (unit.ignoreMethodBodies) {
716
		unit.ignoreFurtherInvestigation = true;
687
		unit.ignoreFurtherInvestigation = true;
717
		return; // if initial diet parse did not work, no need to dig into method bodies.
688
		return; // if initial diet parse did not work, no need to dig into method bodies.
Lines 730-736 Link Here
730
			char[] contents = compilationResult.compilationUnit.getContents();
701
			char[] contents = compilationResult.compilationUnit.getContents();
731
			this.parser.javadocParser.scanner.setSource(contents);
702
			this.parser.javadocParser.scanner.setSource(contents);
732
		}
703
		}
733
		this.parser.nodeSet = this.currentPossibleMatch.nodeSet;
704
		this.parser.nodeSet = nodeSet;
734
		this.parser.parseBodies(unit);
705
		this.parser.parseBodies(unit);
735
	} finally {
706
	} finally {
736
		this.parser.nodeSet = null;
707
		this.parser.nodeSet = null;
Lines 876-897 Link Here
876
	initialize(javaProject, length);
847
	initialize(javaProject, length);
877
848
878
	// create and resolve binding (equivalent to beginCompilation() in Compiler)
849
	// create and resolve binding (equivalent to beginCompilation() in Compiler)
879
	boolean mustResolve = ((InternalSearchPattern)this.pattern).mustResolve;
850
	boolean mustResolvePattern = ((InternalSearchPattern)this.pattern).mustResolve;
851
	boolean mustResolve = mustResolvePattern;
852
	this.patternLocator.mayBeGeneric = this.options.sourceLevel >= ClassFileConstants.JDK1_5;
880
	boolean bindingsWereCreated = mustResolve;
853
	boolean bindingsWereCreated = mustResolve;
881
	try {
854
	try {
882
		for (int i = start, maxUnits = start + length; i < maxUnits; i++) {
855
		for (int i = start, maxUnits = start + length; i < maxUnits; i++) {
883
			PossibleMatch possibleMatch = possibleMatches[i];
856
			PossibleMatch possibleMatch = possibleMatches[i];
884
			try {
857
			try {
885
				parseAndBuildBindings(possibleMatch, mustResolve);
858
				if (!parseAndBuildBindings(possibleMatch, mustResolvePattern)) continue;
886
				if (!mustResolve) {
859
				// Currently we only need to resolve over pattern flag if there's potential parameterized types
860
				if (this.patternLocator.mayBeGeneric) {
861
					// If pattern does not resolve then rely on possible match node set resolution
862
					// which may have been modified while locator was adding possible matches to it
863
					if (!mustResolvePattern) {
864
						mustResolve = possibleMatch.nodeSet.mustResolve;
865
						bindingsWereCreated = mustResolve;
866
					}
867
				} else {
868
					// Reset matching node resolution with pattern one if there's no potential parameterized type
869
					// to minimize side effect on previous search behavior
870
					possibleMatch.nodeSet.mustResolve = mustResolvePattern;
871
				}
872
				// possible match node resolution has been merged with pattern one, so rely on it to know
873
				// whether we need to process compilation unit now or later
874
				if (!possibleMatch.nodeSet.mustResolve) {
887
					if (this.progressMonitor != null) {
875
					if (this.progressMonitor != null) {
888
						this.progressWorked++;
876
						this.progressWorked++;
889
						if ((this.progressWorked%this.progressStep)==0) this.progressMonitor.worked(this.progressStep);
877
						if ((this.progressWorked%this.progressStep)==0) this.progressMonitor.worked(this.progressStep);
890
					}
878
					}
891
					process(possibleMatch, bindingsWereCreated);
879
					process(possibleMatch, bindingsWereCreated);
880
					if (this.numberOfMatches>0 && this.matchesToProcess[this.numberOfMatches-1] == possibleMatch) {
881
						// forget last possible match as it was processed
882
						this.numberOfMatches--;
883
					}
892
				}
884
				}
893
			} finally {
885
			} finally {
894
				if (!mustResolve)
886
				if (!possibleMatch.nodeSet.mustResolve)
895
					possibleMatch.cleanUp();
887
					possibleMatch.cleanUp();
896
			}
888
			}
897
		}
889
		}
Lines 1073-1079 Link Here
1073
				}
1065
				}
1074
				previousJavaProject = javaProject;
1066
				previousJavaProject = javaProject;
1075
			}
1067
			}
1076
			matchSet.add(new PossibleMatch(this, resource, openable, searchDocument));
1068
			matchSet.add(new PossibleMatch(this, resource, openable, searchDocument, ((InternalSearchPattern) this.pattern).mustResolve));
1077
		}
1069
		}
1078
1070
1079
		// last project
1071
		// last project
Lines 1112-1118 Link Here
1112
		IJavaElement focus = ((InternalSearchPattern) searchPattern).focus;
1104
		IJavaElement focus = ((InternalSearchPattern) searchPattern).focus;
1113
		if (focus != null) {
1105
		if (focus != null) {
1114
			SearchDocument document = participant.getDocument(focus.getPath().toString());
1106
			SearchDocument document = participant.getDocument(focus.getPath().toString());
1115
			this.currentPossibleMatch = new PossibleMatch(this, focus.getResource(), null, document);
1107
			this.currentPossibleMatch = new PossibleMatch(this, focus.getResource(), null, document, ((InternalSearchPattern) searchPattern).mustResolve);
1116
			if (encloses(focus)) {
1108
			if (encloses(focus)) {
1117
				SearchMatch match = newDeclarationMatch(focus.getAncestor(IJavaElement.PACKAGE_FRAGMENT), null/*no binding*/, SearchMatch.A_ACCURATE, -1, -1);
1109
				SearchMatch match = newDeclarationMatch(focus.getAncestor(IJavaElement.PACKAGE_FRAGMENT), null/*no binding*/, SearchMatch.A_ACCURATE, -1, -1);
1118
				report(match);
1110
				report(match);
Lines 1153-1159 Link Here
1153
						if (resource == null) // case of a file in an external jar
1145
						if (resource == null) // case of a file in an external jar
1154
							resource = javaProject.getProject();
1146
							resource = javaProject.getProject();
1155
						SearchDocument document = participant.getDocument(resource.getFullPath().toString());
1147
						SearchDocument document = participant.getDocument(resource.getFullPath().toString());
1156
						this.currentPossibleMatch = new PossibleMatch(this, resource, null, document);
1148
						this.currentPossibleMatch = new PossibleMatch(this, resource, null, document, ((InternalSearchPattern) searchPattern).mustResolve);
1157
						try {
1149
						try {
1158
							if (encloses(pkg)) {
1150
							if (encloses(pkg)) {
1159
								SearchMatch match = newDeclarationMatch(pkg, null/*no binding*/, SearchMatch.A_ACCURATE, -1, -1);
1151
								SearchMatch match = newDeclarationMatch(pkg, null/*no binding*/, SearchMatch.A_ACCURATE, -1, -1);
Lines 1352-1357 Link Here
1352
	return newTypeReferenceMatch(enclosingElement, enclosingBinding, accuracy, reference.sourceStart, reference.sourceEnd-reference.sourceStart+1, reference);
1344
	return newTypeReferenceMatch(enclosingElement, enclosingBinding, accuracy, reference.sourceStart, reference.sourceEnd-reference.sourceStart+1, reference);
1353
}
1345
}
1354
1346
1347
/**
1348
 * Add the possibleMatch to the loop
1349
 *  ->  build compilation unit declarations, their bindings and record their results.
1350
 */
1351
protected boolean parseAndBuildBindings(PossibleMatch possibleMatch, boolean mustResolve) throws CoreException {
1352
	if (this.progressMonitor != null && this.progressMonitor.isCanceled())
1353
		throw new OperationCanceledException();
1354
1355
	try {
1356
		if (BasicSearchEngine.VERBOSE)
1357
			System.out.println("Parsing " + possibleMatch.openable.toStringWithAncestors()); //$NON-NLS-1$
1358
1359
		this.parser.nodeSet = possibleMatch.nodeSet;
1360
		CompilationResult unitResult = new CompilationResult(possibleMatch, 1, 1, this.options.maxProblemsPerUnit);
1361
		CompilationUnitDeclaration parsedUnit = this.parser.dietParse(possibleMatch, unitResult);
1362
		if (parsedUnit != null) {
1363
			if (!parsedUnit.isEmpty()) {
1364
				if (mustResolve) {
1365
					this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
1366
				}
1367
				if (hasAlreadyDefinedType(parsedUnit)) return false; // skip type has it is hidden so not visible
1368
				getMethodBodies(parsedUnit, possibleMatch.nodeSet);
1369
				if (this.patternLocator.mayBeGeneric && !mustResolve && possibleMatch.nodeSet.mustResolve) {
1370
					// special case: possible match node set force resolution although pattern does not
1371
					// => we need to build types for this compilation unit
1372
					this.lookupEnvironment.buildTypeBindings(parsedUnit, null /*no access restriction*/);
1373
				}
1374
			}
1375
	
1376
			// add the possibleMatch with its parsedUnit to matchesToProcess
1377
			possibleMatch.parsedUnit = parsedUnit;
1378
			int size = this.matchesToProcess.length;
1379
			if (this.numberOfMatches == size)
1380
				System.arraycopy(this.matchesToProcess, 0, this.matchesToProcess = new PossibleMatch[size == 0 ? 1 : size * 2], 0, this.numberOfMatches);
1381
			this.matchesToProcess[this.numberOfMatches++] = possibleMatch;
1382
		}
1383
	} finally {
1384
		this.parser.nodeSet = null;
1385
	}
1386
	return true;
1387
}
1355
/*
1388
/*
1356
 * Process a compilation unit already parsed and build.
1389
 * Process a compilation unit already parsed and build.
1357
 */
1390
 */
Lines 1370-1378 Link Here
1370
		}
1403
		}
1371
		if (hasAlreadyDefinedType(unit)) return; // skip type has it is hidden so not visible
1404
		if (hasAlreadyDefinedType(unit)) return; // skip type has it is hidden so not visible
1372
1405
1373
		getMethodBodies(unit);
1406
		// Move getMethodBodies to #parseAndBuildings(...) method to allow possible match resolution management
1407
		//getMethodBodies(unit);
1374
1408
1375
		boolean mustResolve = ((InternalSearchPattern)this.pattern).mustResolve;
1409
		boolean mustResolve = ((InternalSearchPattern)this.pattern).mustResolve || possibleMatch.nodeSet.mustResolve;
1376
		if (bindingsWereCreated &&  mustResolve) {
1410
		if (bindingsWereCreated &&  mustResolve) {
1377
			if (unit.types != null) {
1411
			if (unit.types != null) {
1378
				if (BasicSearchEngine.VERBOSE)
1412
				if (BasicSearchEngine.VERBOSE)
Lines 1839-1844 Link Here
1839
 */
1873
 */
1840
protected void reportMatching(CompilationUnitDeclaration unit, boolean mustResolve) throws CoreException {
1874
protected void reportMatching(CompilationUnitDeclaration unit, boolean mustResolve) throws CoreException {
1841
	MatchingNodeSet nodeSet = this.currentPossibleMatch.nodeSet;
1875
	MatchingNodeSet nodeSet = this.currentPossibleMatch.nodeSet;
1876
	if (nodeSet.mustResolve) this.patternLocator.mustResolve = true;
1842
	if (mustResolve) {
1877
	if (mustResolve) {
1843
		this.unitScope= unit.scope.compilationUnitScope();
1878
		this.unitScope= unit.scope.compilationUnitScope();
1844
		// move the possible matching nodes that exactly match the search pattern to the matching nodes set
1879
		// move the possible matching nodes that exactly match the search pattern to the matching nodes set
(-)search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java (+11 lines)
Lines 36-47 Link Here
36
static Integer ERASURE_MATCH = new Integer(SearchPattern.R_ERASURE_MATCH);
36
static Integer ERASURE_MATCH = new Integer(SearchPattern.R_ERASURE_MATCH);
37
37
38
/**
38
/**
39
 * Tell whether locators need to resolve or not for current matching node set.
40
 */
41
public boolean mustResolve;
42
43
/**
39
 * Set of possible matching ast nodes. They need to be resolved
44
 * Set of possible matching ast nodes. They need to be resolved
40
 * to determine if they really match the search pattern.
45
 * to determine if they really match the search pattern.
41
 */
46
 */
42
SimpleSet possibleMatchingNodesSet = new SimpleSet(7);
47
SimpleSet possibleMatchingNodesSet = new SimpleSet(7);
43
private HashtableOfLong possibleMatchingNodesKeys = new HashtableOfLong(7);
48
private HashtableOfLong possibleMatchingNodesKeys = new HashtableOfLong(7);
44
49
50
51
public MatchingNodeSet(boolean mustResolvePattern) {
52
	super();
53
	mustResolve = mustResolvePattern;
54
}
55
45
public int addMatch(ASTNode node, int matchLevel) {
56
public int addMatch(ASTNode node, int matchLevel) {
46
	switch (matchLevel) {
57
	switch (matchLevel) {
47
		case PatternLocator.INACCURATE_MATCH:
58
		case PatternLocator.INACCURATE_MATCH:
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java (-5 / +68 lines)
Lines 81-86 Link Here
81
//public int match(FieldDeclaration node, MatchingNodeSet nodeSet) - SKIP IT
81
//public int match(FieldDeclaration node, MatchingNodeSet nodeSet) - SKIP IT
82
public int match(MethodDeclaration node, MatchingNodeSet nodeSet) {
82
public int match(MethodDeclaration node, MatchingNodeSet nodeSet) {
83
	if (!this.pattern.findDeclarations) return IMPOSSIBLE_MATCH;
83
	if (!this.pattern.findDeclarations) return IMPOSSIBLE_MATCH;
84
	
85
	boolean resolve = ((InternalSearchPattern)this.pattern).mustResolve;
84
86
85
	// Verify method name
87
	// Verify method name
86
	if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH;
88
	if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH;
Lines 92-98 Link Here
92
		int argsLength = args == null ? 0 : args.length;
94
		int argsLength = args == null ? 0 : args.length;
93
		if (length != argsLength) return IMPOSSIBLE_MATCH;
95
		if (length != argsLength) return IMPOSSIBLE_MATCH;
94
		for (int i = 0; i < argsLength; i++) {
96
		for (int i = 0; i < argsLength; i++) {
95
			if (!matchesTypeReference(this.pattern.parameterSimpleNames[i], ((Argument) args[i]).type)) return IMPOSSIBLE_MATCH;
97
			if (!matchesTypeReference(this.pattern.parameterSimpleNames[i], ((Argument) args[i]).type)) {
98
				if (!mustResolve) {
99
					// Set resolution flag on node set in case of types was inferred in parameterized types from generic ones...
100
				 	// (see  bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=79990)
101
					nodeSet.mustResolve = true;
102
					resolve = true;
103
				}
104
			}
96
		}
105
		}
97
	}
106
	}
98
107
Lines 102-108 Link Here
102
	}
111
	}
103
112
104
	// Method declaration may match pattern
113
	// Method declaration may match pattern
105
	return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
114
	return nodeSet.addMatch(node, resolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
106
}
115
}
107
public int match(MemberValuePair node, MatchingNodeSet nodeSet) {
116
public int match(MemberValuePair node, MatchingNodeSet nodeSet) {
108
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
117
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
Lines 114-119 Link Here
114
public int match(MessageSend node, MatchingNodeSet nodeSet) {
123
public int match(MessageSend node, MatchingNodeSet nodeSet) {
115
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
124
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
116
125
126
	boolean resolve = ((InternalSearchPattern)this.pattern).mustResolve;
127
117
	if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH;
128
	if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH;
118
	if (this.pattern.parameterSimpleNames != null && (this.pattern.shouldCountParameter() || ((node.bits & ASTNode.InsideJavadoc) != 0))) {
129
	if (this.pattern.parameterSimpleNames != null && (this.pattern.shouldCountParameter() || ((node.bits & ASTNode.InsideJavadoc) != 0))) {
119
		int length = this.pattern.parameterSimpleNames.length;
130
		int length = this.pattern.parameterSimpleNames.length;
Lines 122-128 Link Here
122
		if (length != argsLength) return IMPOSSIBLE_MATCH;
133
		if (length != argsLength) return IMPOSSIBLE_MATCH;
123
	}
134
	}
124
135
125
	return nodeSet.addMatch(node, ((InternalSearchPattern)this.pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
136
	return nodeSet.addMatch(node, resolve ? POSSIBLE_MATCH : ACCURATE_MATCH);
126
}
137
}
127
//public int match(Reference node, MatchingNodeSet nodeSet) - SKIP IT
138
//public int match(Reference node, MatchingNodeSet nodeSet) - SKIP IT
128
public int match(Annotation node, MatchingNodeSet nodeSet) {
139
public int match(Annotation node, MatchingNodeSet nodeSet) {
Lines 215-220 Link Here
215
	return level;
226
	return level;
216
}
227
}
217
/**
228
/**
229
 * Return if pattern method may override a method in super classes
230
 * or or implement one in super interfaces of given type.
231
 * @param type
232
 * @return level
233
 */
234
int matchOverriddenMethod(ReferenceBinding type) {
235
	if (type == null) return INACCURATE_MATCH;
236
	int level = IMPOSSIBLE_MATCH;
237
238
	// matches superclass
239
	if (!type.isInterface() && !CharOperation.equals(type.compoundName, TypeConstants.JAVA_LANG_OBJECT)) {
240
		if (type.superclass().isParameterizedType()) {
241
			TypeBinding erasure = ((ParameterizedTypeBinding)type.superclass()).erasure();
242
			if (erasure instanceof ReferenceBinding) {
243
				MethodBinding[] methods = ((ReferenceBinding)erasure).getMethods(this.pattern.selector);
244
				int length = methods.length;
245
				for (int i = 0; i<length && level == IMPOSSIBLE_MATCH; i++) {
246
					level = matchMethod(methods[i]);
247
				}
248
				if (level != IMPOSSIBLE_MATCH) return level;
249
			}
250
		}
251
		level = matchOverriddenMethod(type.superclass());
252
		if (level != IMPOSSIBLE_MATCH) return level;
253
	}
254
255
	// matches interfaces
256
	ReferenceBinding[] interfaces = type.superInterfaces();
257
	if (interfaces == null) return INACCURATE_MATCH;
258
	int iLength = interfaces.length;
259
	for (int i = 0; i<iLength; i++) {
260
		if (interfaces[i].isParameterizedType()) {
261
			TypeBinding erasure = ((ParameterizedTypeBinding)interfaces[i]).erasure();
262
			if (erasure instanceof ReferenceBinding) {
263
				MethodBinding[] methods = ((ReferenceBinding)erasure).getMethods(this.pattern.selector);
264
				int mLength = methods.length;
265
				for (int j = 0; j<mLength && level == IMPOSSIBLE_MATCH; j++) {
266
					level = matchMethod(methods[j]);
267
				}
268
				if (level != IMPOSSIBLE_MATCH) return level;
269
			}
270
		}
271
		level = matchOverriddenMethod(interfaces[i]);
272
		if (level != IMPOSSIBLE_MATCH) return level;
273
	}
274
	return IMPOSSIBLE_MATCH;
275
}
276
/**
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)
277
 * @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
 */
278
 */
220
protected void matchReportReference(ASTNode reference, IJavaElement element, Binding elementBinding, int accuracy, MatchLocator locator) throws CoreException {
279
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);
474
	int methodLevel = matchMethod(method);
416
	if (methodLevel == IMPOSSIBLE_MATCH) {
475
	if (methodLevel == IMPOSSIBLE_MATCH) {
417
		if (method != method.original()) methodLevel = matchMethod(method.original());
476
		if (method != method.original()) methodLevel = matchMethod(method.original());
418
		if (methodLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH;
477
		if (methodLevel == IMPOSSIBLE_MATCH && this.pattern.findDeclarations && this.mayBeGeneric) {
419
		method = method.original();
478
			methodLevel = matchOverriddenMethod(method.declaringClass);
479
			if (methodLevel == IMPOSSIBLE_MATCH) return IMPOSSIBLE_MATCH;
480
		} else {
481
			method = method.original();
482
		}
420
	}
483
	}
421
484
422
	// declaring type
485
	// declaring type
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java (-3 / +7 lines)
Lines 287-295 Link Here
287
	if (returnSimpleName != null || returnQualification != null) return true;
287
	if (returnSimpleName != null || returnQualification != null) return true;
288
288
289
	// parameter types
289
	// parameter types
290
	if (parameterSimpleNames != null)
290
	if (parameterSimpleNames != null) {
291
		for (int i = 0, max = parameterSimpleNames.length; i < max; i++)
291
		for (int i = 0, max = parameterSimpleNames.length; i < max; i++) {
292
			if (parameterQualifications[i] != null) return true;
292
			if (parameterQualifications[i] != null) {
293
				return true;
294
			}
295
		}
296
	}
293
	return false;
297
	return false;
294
}
298
}
295
EntryResult[] queryIn(Index index) throws IOException {
299
EntryResult[] queryIn(Index index) throws IOException {
(-)search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java (+1 lines)
Lines 26-31 Link Here
26
protected boolean isEquivalentMatch;
26
protected boolean isEquivalentMatch;
27
protected boolean isErasureMatch;
27
protected boolean isErasureMatch;
28
protected boolean mustResolve;
28
protected boolean mustResolve;
29
protected boolean mayBeGeneric;
29
30
30
// match to report
31
// match to report
31
SearchMatch match = null;
32
SearchMatch match = null;
(-)search/org/eclipse/jdt/internal/core/search/matching/PossibleMatch.java (-2 / +2 lines)
Lines 33-43 Link Here
33
private String sourceFileName;
33
private String sourceFileName;
34
private char[] source;
34
private char[] source;
35
35
36
public PossibleMatch(MatchLocator locator, IResource resource, Openable openable, SearchDocument document) {
36
public PossibleMatch(MatchLocator locator, IResource resource, Openable openable, SearchDocument document, boolean mustResolve) {
37
	this.resource = resource;
37
	this.resource = resource;
38
	this.openable = openable;
38
	this.openable = openable;
39
	this.document = document;
39
	this.document = document;
40
	this.nodeSet = new MatchingNodeSet();
40
	this.nodeSet = new MatchingNodeSet(mustResolve);
41
	char[] qualifiedName = getQualifiedName();
41
	char[] qualifiedName = getQualifiedName();
42
	if (qualifiedName != null)
42
	if (qualifiedName != null)
43
		this.compoundName = CharOperation.splitOn('.', qualifiedName);
43
		this.compoundName = CharOperation.splitOn('.', qualifiedName);

Return to bug 79990