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 |
} |