View | Details | Raw Unified | Return to bug 86901
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/compiler/SourceElementParser.java (-1 / +6 lines)
Lines 449-455 Link Here
449
		// => accept unknown ref on identifier
449
		// => accept unknown ref on identifier
450
		int length = impt.tokens.length-1;
450
		int length = impt.tokens.length-1;
451
		int start = (int) (impt.sourcePositions[length] >>> 32);
451
		int start = (int) (impt.sourcePositions[length] >>> 32);
452
		requestor.acceptUnknownReference(impt.tokens[length], start);
452
		char[] last = impt.tokens[length];
453
		// accept all possible kind for last name, index users will have to select the right one...
454
		// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=86901
455
		requestor.acceptFieldReference(last, start);
456
		requestor.acceptMethodReference(last, 0,start);
457
		requestor.acceptTypeReference(last, start);
453
		// accept type name
458
		// accept type name
454
		if (length > 0) {
459
		if (length > 0) {
455
			char[][] compoundName = new char[length][];
460
			char[][] compoundName = new char[length][];
(-)search/org/eclipse/jdt/core/search/SearchPattern.java (-6 lines)
Lines 696-702 Link Here
696
					parameterTypeQualifications, 
696
					parameterTypeQualifications, 
697
					parameterTypeSimpleNames,
697
					parameterTypeSimpleNames,
698
					parameterTypeSignatures,
698
					parameterTypeSignatures,
699
					false,
700
					typeArguments,
699
					typeArguments,
701
					matchRule);
700
					matchRule);
702
		} else {
701
		} else {
Lines 713-719 Link Here
713
					parameterTypeQualifications,
712
					parameterTypeQualifications,
714
					parameterTypeSimpleNames,
713
					parameterTypeSimpleNames,
715
					parameterTypeSignatures,
714
					parameterTypeSignatures,
716
					false,
717
					typeArguments,
715
					typeArguments,
718
					matchRule);
716
					matchRule);
719
		}
717
		}
Lines 1018-1024 Link Here
1018
				char[] selector = method.getElementName().toCharArray();
1016
				char[] selector = method.getElementName().toCharArray();
1019
				char[] returnSimpleName;
1017
				char[] returnSimpleName;
1020
				char[] returnQualification;
1018
				char[] returnQualification;
1021
				boolean varargs = false;
1022
				String returnSignature;
1019
				String returnSignature;
1023
				try {
1020
				try {
1024
					returnSignature = method.getReturnType();
1021
					returnSignature = method.getReturnType();
Lines 1036-1042 Link Here
1036
							CharOperation.concat(IIndexConstants.ONE_STAR, returnQualification);
1033
							CharOperation.concat(IIndexConstants.ONE_STAR, returnQualification);
1037
						}
1034
						}
1038
					}
1035
					}
1039
					varargs = Flags.isVarargs(method.getFlags());
1040
				} catch (JavaModelException e) {
1036
				} catch (JavaModelException e) {
1041
					return null;
1037
					return null;
1042
				}
1038
				}
Lines 1087-1093 Link Here
1087
							parameterSimpleNames,
1083
							parameterSimpleNames,
1088
							parameterSignatures,
1084
							parameterSignatures,
1089
							method,
1085
							method,
1090
							varargs,
1091
							matchRule);
1086
							matchRule);
1092
				} else {
1087
				} else {
1093
					searchPattern =
1088
					searchPattern =
Lines 1103-1109 Link Here
1103
							parameterQualifications, 
1098
							parameterQualifications, 
1104
							parameterSimpleNames,
1099
							parameterSimpleNames,
1105
							parameterSignatures,
1100
							parameterSignatures,
1106
							varargs,
1107
							method,
1101
							method,
1108
							matchRule);
1102
							matchRule);
1109
				}
1103
				}
(-)search/org/eclipse/jdt/internal/core/index/DiskIndex.java (-1 / +3 lines)
Lines 13-18 Link Here
13
import java.io.*;
13
import java.io.*;
14
14
15
import org.eclipse.jdt.core.search.*;
15
import org.eclipse.jdt.core.search.*;
16
import org.eclipse.jdt.internal.core.search.matching.JavaSearchPattern;
16
import org.eclipse.jdt.internal.core.util.*;
17
import org.eclipse.jdt.internal.core.util.*;
17
import org.eclipse.jdt.internal.compiler.util.HashtableOfIntValues;
18
import org.eclipse.jdt.internal.compiler.util.HashtableOfIntValues;
18
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
19
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
Lines 140-146 Link Here
140
	if (this.categoryOffsets == null)
141
	if (this.categoryOffsets == null)
141
		return results; // file is empty
142
		return results; // file is empty
142
143
143
	if (matchRule == SearchPattern.R_EXACT_MATCH + SearchPattern.R_CASE_SENSITIVE) {
144
	int rule = matchRule & JavaSearchPattern.MATCH_RULE_INDEX_MASK;
145
	if (rule == SearchPattern.R_EXACT_MATCH + SearchPattern.R_CASE_SENSITIVE) {
144
		for (int i = 0, l = categories.length; i < l; i++) {
146
		for (int i = 0, l = categories.length; i < l; i++) {
145
			HashtableOfObject wordsToDocNumbers = readCategoryTable(categories[i], false);
147
			HashtableOfObject wordsToDocNumbers = readCategoryTable(categories[i], false);
146
			if (wordsToDocNumbers != null && wordsToDocNumbers.containsKey(key))
148
			if (wordsToDocNumbers != null && wordsToDocNumbers.containsKey(key))
(-)search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java (-3 / +3 lines)
Lines 35-41 Link Here
35
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
35
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
36
	if (!(node instanceof ExplicitConstructorCall)) return IMPOSSIBLE_MATCH;
36
	if (!(node instanceof ExplicitConstructorCall)) return IMPOSSIBLE_MATCH;
37
37
38
	if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) {
38
	if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) {
39
		int length = this.pattern.parameterSimpleNames.length;
39
		int length = this.pattern.parameterSimpleNames.length;
40
		Expression[] args = ((ExplicitConstructorCall) node).arguments;
40
		Expression[] args = ((ExplicitConstructorCall) node).arguments;
41
		int argsLength = args == null ? 0 : args.length;
41
		int argsLength = args == null ? 0 : args.length;
Lines 60-66 Link Here
60
	if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, typeName[typeName.length-1]))
60
	if (this.pattern.declaringSimpleName != null && !matchesName(this.pattern.declaringSimpleName, typeName[typeName.length-1]))
61
		return IMPOSSIBLE_MATCH;
61
		return IMPOSSIBLE_MATCH;
62
62
63
	if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) {
63
	if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) {
64
		int length = this.pattern.parameterSimpleNames.length;
64
		int length = this.pattern.parameterSimpleNames.length;
65
		Expression[] args = allocation.arguments;
65
		Expression[] args = allocation.arguments;
66
		int argsLength = args == null ? 0 : args.length;
66
		int argsLength = args == null ? 0 : args.length;
Lines 80-86 Link Here
80
			return IMPOSSIBLE_MATCH;
80
			return IMPOSSIBLE_MATCH;
81
	}
81
	}
82
82
83
	if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) {
83
	if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) {
84
		int length = this.pattern.parameterSimpleNames.length;
84
		int length = this.pattern.parameterSimpleNames.length;
85
		Expression[] args = allocation.arguments;
85
		Expression[] args = allocation.arguments;
86
		int argsLength = args == null ? 0 : args.length;
86
		int argsLength = args == null ? 0 : args.length;
(-)search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java (-10 / +17 lines)
Lines 13-19 Link Here
13
import java.io.IOException;
13
import java.io.IOException;
14
14
15
import org.eclipse.jdt.core.BindingKey;
15
import org.eclipse.jdt.core.BindingKey;
16
import org.eclipse.jdt.core.Flags;
16
import org.eclipse.jdt.core.IMethod;
17
import org.eclipse.jdt.core.IMethod;
18
import org.eclipse.jdt.core.JavaModelException;
17
import org.eclipse.jdt.core.compiler.CharOperation;
19
import org.eclipse.jdt.core.compiler.CharOperation;
18
import org.eclipse.jdt.core.search.SearchPattern;
20
import org.eclipse.jdt.core.search.SearchPattern;
19
import org.eclipse.jdt.internal.core.index.EntryResult;
21
import org.eclipse.jdt.internal.core.index.EntryResult;
Lines 32-38 Link Here
32
public char[][] parameterQualifications;
34
public char[][] parameterQualifications;
33
public char[][] parameterSimpleNames;
35
public char[][] parameterSimpleNames;
34
public int parameterCount;
36
public int parameterCount;
35
public boolean varargs;
37
public int flags = 0;
36
38
37
// Signatures and arguments for generic search
39
// Signatures and arguments for generic search
38
char[][][] parametersTypeSignatures;
40
char[][][] parametersTypeSignatures;
Lines 65-71 Link Here
65
	char[] declaringQualification,
67
	char[] declaringQualification,
66
	char[][] parameterQualifications,
68
	char[][] parameterQualifications,
67
	char[][] parameterSimpleNames,
69
	char[][] parameterSimpleNames,
68
	boolean varargs,
69
	int matchRule) {
70
	int matchRule) {
70
71
71
	this(matchRule);
72
	this(matchRule);
Lines 86-92 Link Here
86
	} else {
87
	} else {
87
		this.parameterCount = -1;
88
		this.parameterCount = -1;
88
	}
89
	}
89
	this.varargs = varargs;
90
	((InternalSearchPattern)this).mustResolve = mustResolve();
90
	((InternalSearchPattern)this).mustResolve = mustResolve();
91
}
91
}
92
/*
92
/*
Lines 101-107 Link Here
101
	char[][] parameterSimpleNames,
101
	char[][] parameterSimpleNames,
102
	String[] parameterSignatures,
102
	String[] parameterSignatures,
103
	IMethod method,
103
	IMethod method,
104
	boolean varargs,
104
//	boolean varargs,
105
	int matchRule) {
105
	int matchRule) {
106
106
107
	this(findDeclarations,
107
	this(findDeclarations,
Lines 110-118 Link Here
110
		declaringQualification,
110
		declaringQualification,
111
		parameterQualifications, 
111
		parameterQualifications, 
112
		parameterSimpleNames,
112
		parameterSimpleNames,
113
		varargs,
114
		matchRule);
113
		matchRule);
115
114
115
	// Set flags
116
	try {
117
		this.flags = method.getFlags();
118
	} catch (JavaModelException e) {
119
		// do nothing
120
	}
121
116
	// Get unique key for parameterized constructors
122
	// Get unique key for parameterized constructors
117
	String genericDeclaringTypeSignature = null;
123
	String genericDeclaringTypeSignature = null;
118
	BindingKey key;
124
	BindingKey key;
Lines 159-165 Link Here
159
	char[][] parameterQualifications, 
165
	char[][] parameterQualifications, 
160
	char[][] parameterSimpleNames,
166
	char[][] parameterSimpleNames,
161
	String[] parameterSignatures,
167
	String[] parameterSignatures,
162
	boolean varargs,
163
	char[][] arguments,
168
	char[][] arguments,
164
	int matchRule) {
169
	int matchRule) {
165
170
Lines 169-175 Link Here
169
		declaringQualification,
174
		declaringQualification,
170
		parameterQualifications, 
175
		parameterQualifications, 
171
		parameterSimpleNames,
176
		parameterSimpleNames,
172
		varargs,
173
		matchRule);
177
		matchRule);
174
178
175
	// Store type signature and arguments for declaring type
179
	// Store type signature and arguments for declaring type
Lines 226-232 Link Here
226
public boolean matchesDecodedKey(SearchPattern decodedPattern) {
230
public boolean matchesDecodedKey(SearchPattern decodedPattern) {
227
	ConstructorPattern pattern = (ConstructorPattern) decodedPattern;
231
	ConstructorPattern pattern = (ConstructorPattern) decodedPattern;
228
232
229
	return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || this.varargs)
233
	return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || !shouldCountParameter())
230
		&& matchesName(this.declaringSimpleName, pattern.declaringSimpleName);
234
		&& matchesName(this.declaringSimpleName, pattern.declaringSimpleName);
231
}
235
}
232
protected boolean mustResolve() {
236
protected boolean mustResolve() {
Lines 244-250 Link Here
244
248
245
	switch(getMatchMode()) {
249
	switch(getMatchMode()) {
246
		case R_EXACT_MATCH :
250
		case R_EXACT_MATCH :
247
			if (!this.varargs && this.declaringSimpleName != null && this.parameterCount >= 0)
251
			if (shouldCountParameter() && this.declaringSimpleName != null && this.parameterCount >= 0)
248
				key = createIndexKey(this.declaringSimpleName, this.parameterCount);
252
				key = createIndexKey(this.declaringSimpleName, this.parameterCount);
249
			else // do a prefix query with the declaringSimpleName
253
			else // do a prefix query with the declaringSimpleName
250
				matchRule = matchRule - R_EXACT_MATCH + R_PREFIX_MATCH;
254
				matchRule = matchRule - R_EXACT_MATCH + R_PREFIX_MATCH;
Lines 253-259 Link Here
253
			// do a prefix query with the declaringSimpleName
257
			// do a prefix query with the declaringSimpleName
254
			break;
258
			break;
255
		case R_PATTERN_MATCH :
259
		case R_PATTERN_MATCH :
256
			if (!this.varargs && this.parameterCount >= 0)
260
			if (shouldCountParameter() && this.parameterCount >= 0)
257
				key = createIndexKey(this.declaringSimpleName == null ? ONE_STAR : this.declaringSimpleName, this.parameterCount);
261
				key = createIndexKey(this.declaringSimpleName == null ? ONE_STAR : this.declaringSimpleName, this.parameterCount);
258
			else if (this.declaringSimpleName != null && this.declaringSimpleName[this.declaringSimpleName.length - 1] != '*')
262
			else if (this.declaringSimpleName != null && this.declaringSimpleName[this.declaringSimpleName.length - 1] != '*')
259
				key = CharOperation.concat(this.declaringSimpleName, ONE_STAR, SEPARATOR);
263
				key = CharOperation.concat(this.declaringSimpleName, ONE_STAR, SEPARATOR);
Lines 290-294 Link Here
290
	}
294
	}
291
	output.append(')');
295
	output.append(')');
292
	return super.print(output);
296
	return super.print(output);
297
}
298
boolean shouldCountParameter() {
299
	return (this.flags & Flags.AccStatic) == 0 && (this.flags & Flags.AccVarargs) == 0;
293
}
300
}
294
}
301
}
(-)search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java (-1 / +1 lines)
Lines 21-27 Link Here
21
protected SimpleSet knownMethods;
21
protected SimpleSet knownMethods;
22
22
23
public DeclarationOfReferencedMethodsPattern(IJavaElement enclosingElement) {
23
public DeclarationOfReferencedMethodsPattern(IJavaElement enclosingElement) {
24
	super(false, true, null, null, null, null, null, null, null, false, null, R_PATTERN_MATCH);
24
	super(false, true, null, null, null, null, null, null, null, null, R_PATTERN_MATCH);
25
25
26
	this.enclosingElement = enclosingElement;
26
	this.enclosingElement = enclosingElement;
27
	this.knownMethods = new SimpleSet();
27
	this.knownMethods = new SimpleSet();
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java (-1 / +1 lines)
Lines 110-116 Link Here
110
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
110
	if (!this.pattern.findReferences) return IMPOSSIBLE_MATCH;
111
111
112
	if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH;
112
	if (!matchesName(this.pattern.selector, node.selector)) return IMPOSSIBLE_MATCH;
113
	if (this.pattern.parameterSimpleNames != null && !this.pattern.varargs) {
113
	if (this.pattern.parameterSimpleNames != null && this.pattern.shouldCountParameter()) {
114
		int length = this.pattern.parameterSimpleNames.length;
114
		int length = this.pattern.parameterSimpleNames.length;
115
		ASTNode[] args = node.arguments;
115
		ASTNode[] args = node.arguments;
116
		int argsLength = args == null ? 0 : args.length;
116
		int argsLength = args == null ? 0 : args.length;
(-)search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java (-10 / +14 lines)
Lines 35-41 Link Here
35
public char[][] parameterQualifications;
35
public char[][] parameterQualifications;
36
public char[][] parameterSimpleNames;
36
public char[][] parameterSimpleNames;
37
public int parameterCount;
37
public int parameterCount;
38
public boolean varargs;
38
public int flags = 0;
39
39
40
// extra reference info
40
// extra reference info
41
protected IType declaringType;
41
protected IType declaringType;
Lines 76-82 Link Here
76
	char[] returnSimpleName,
76
	char[] returnSimpleName,
77
	char[][] parameterQualifications, 
77
	char[][] parameterQualifications, 
78
	char[][] parameterSimpleNames,
78
	char[][] parameterSimpleNames,
79
	boolean varargs,
80
	IType declaringType,
79
	IType declaringType,
81
	int matchRule) {
80
	int matchRule) {
82
81
Lines 101-107 Link Here
101
	} else {
100
	} else {
102
		this.parameterCount = -1;
101
		this.parameterCount = -1;
103
	}
102
	}
104
	this.varargs = varargs;
105
	this.declaringType = declaringType;
103
	this.declaringType = declaringType;
106
	((InternalSearchPattern)this).mustResolve = mustResolve();
104
	((InternalSearchPattern)this).mustResolve = mustResolve();
107
}
105
}
Lines 120-126 Link Here
120
	char[][] parameterQualifications, 
118
	char[][] parameterQualifications, 
121
	char[][] parameterSimpleNames,
119
	char[][] parameterSimpleNames,
122
	String[] parameterSignatures,
120
	String[] parameterSignatures,
123
	boolean varargs,
124
	IMethod method,
121
	IMethod method,
125
	int matchRule) {
122
	int matchRule) {
126
123
Lines 133-141 Link Here
133
		returnSimpleName,
130
		returnSimpleName,
134
		parameterQualifications, 
131
		parameterQualifications, 
135
		parameterSimpleNames,
132
		parameterSimpleNames,
136
		varargs,
137
		method.getDeclaringType(),
133
		method.getDeclaringType(),
138
		matchRule);
134
		matchRule);
135
	
136
	// Set flags
137
	try {
138
		this.flags = method.getFlags();
139
	} catch (JavaModelException e) {
140
		// do nothing
141
	}
139
142
140
	// Get unique key for parameterized constructors
143
	// Get unique key for parameterized constructors
141
	String genericDeclaringTypeSignature = null;
144
	String genericDeclaringTypeSignature = null;
Lines 194-200 Link Here
194
	char[][] parameterQualifications, 
197
	char[][] parameterQualifications, 
195
	char[][] parameterSimpleNames,
198
	char[][] parameterSimpleNames,
196
	String[] parameterSignatures,
199
	String[] parameterSignatures,
197
	boolean varargs,
198
	char[][] arguments,
200
	char[][] arguments,
199
	int matchRule) {
201
	int matchRule) {
200
202
Lines 207-213 Link Here
207
		returnSimpleName,
209
		returnSimpleName,
208
		parameterQualifications, 
210
		parameterQualifications, 
209
		parameterSimpleNames,
211
		parameterSimpleNames,
210
		varargs,
211
		null,
212
		null,
212
		matchRule);
213
		matchRule);
213
214
Lines 269-275 Link Here
269
public boolean matchesDecodedKey(SearchPattern decodedPattern) {
270
public boolean matchesDecodedKey(SearchPattern decodedPattern) {
270
	MethodPattern pattern = (MethodPattern) decodedPattern;
271
	MethodPattern pattern = (MethodPattern) decodedPattern;
271
272
272
	return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || this.varargs)
273
	return (this.parameterCount == pattern.parameterCount || this.parameterCount == -1 || !shouldCountParameter())
273
		&& matchesName(this.selector, pattern.selector);
274
		&& matchesName(this.selector, pattern.selector);
274
}
275
}
275
/**
276
/**
Lines 297-303 Link Here
297
298
298
	switch(getMatchMode()) {
299
	switch(getMatchMode()) {
299
		case R_EXACT_MATCH :
300
		case R_EXACT_MATCH :
300
			if (!this.varargs && this.selector != null && this.parameterCount >= 0)
301
			if (shouldCountParameter() && this.selector != null && this.parameterCount >= 0)
301
				key = createIndexKey(this.selector, this.parameterCount);
302
				key = createIndexKey(this.selector, this.parameterCount);
302
			else // do a prefix query with the selector
303
			else // do a prefix query with the selector
303
				matchRule = matchRule - R_EXACT_MATCH + R_PREFIX_MATCH;
304
				matchRule = matchRule - R_EXACT_MATCH + R_PREFIX_MATCH;
Lines 306-312 Link Here
306
			// do a prefix query with the selector
307
			// do a prefix query with the selector
307
			break;
308
			break;
308
		case R_PATTERN_MATCH :
309
		case R_PATTERN_MATCH :
309
			if (!this.varargs && this.parameterCount >= 0)
310
			if (shouldCountParameter() && this.parameterCount >= 0)
310
				key = createIndexKey(this.selector == null ? ONE_STAR : this.selector, this.parameterCount);
311
				key = createIndexKey(this.selector == null ? ONE_STAR : this.selector, this.parameterCount);
311
			else if (this.selector != null && this.selector[this.selector.length - 1] != '*')
312
			else if (this.selector != null && this.selector[this.selector.length - 1] != '*')
312
				key = CharOperation.concat(this.selector, ONE_STAR, SEPARATOR);
313
				key = CharOperation.concat(this.selector, ONE_STAR, SEPARATOR);
Lines 355-359 Link Here
355
	else if (returnQualification != null)
356
	else if (returnQualification != null)
356
		output.append("*"); //$NON-NLS-1$
357
		output.append("*"); //$NON-NLS-1$
357
	return super.print(output);
358
	return super.print(output);
359
}
360
boolean shouldCountParameter() {
361
	return (this.flags & Flags.AccStatic) == 0 && (this.flags & Flags.AccVarargs) == 0;
358
}
362
}
359
}
363
}

Return to bug 86901