Lines 12337-12340
Link Here
|
12337 |
"src/b324109/X.java void b324109.X.run() [run] POTENTIAL_MATCH" |
12337 |
"src/b324109/X.java void b324109.X.run() [run] POTENTIAL_MATCH" |
12338 |
); |
12338 |
); |
12339 |
} |
12339 |
} |
|
|
12340 |
/** |
12341 |
* @bug 329727 Invalid check in the isConstructor() method of the IMethod implementation. |
12342 |
* @test check that in a binary type, method's name doesn't contain the enclosing type name and |
12343 |
* that IMethod#isContructor returns correct value |
12344 |
* |
12345 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=329727" |
12346 |
* @throws CoreException |
12347 |
* @throws IOException |
12348 |
*/ |
12349 |
public void testBug329727() throws CoreException, IOException { |
12350 |
IJavaProject project = getJavaProject("JavaSearchBugs"); |
12351 |
IClasspathEntry[] originalCP = project.getRawClasspath(); |
12352 |
try { |
12353 |
int cpLength = originalCP.length; |
12354 |
IClasspathEntry[] newCP = new IClasspathEntry[cpLength + 1]; |
12355 |
System.arraycopy(originalCP, 0, newCP, 0, cpLength); |
12356 |
createLibrary(project, "bug329727.jar", null, new String[] { |
12357 |
"p/OuterClass.java", |
12358 |
"package p;\n" + "public class OuterClass {\n" |
12359 |
+ " public OuterClass(){}\n" |
12360 |
+ " class InnerClass {\n" |
12361 |
+ " public InnerClass(){}\n" + " }\n" + "}\n" }, |
12362 |
new String[0], JavaCore.VERSION_1_4); |
12363 |
newCP[cpLength] = JavaCore.newLibraryEntry( |
12364 |
new Path("/JavaSearchBugs/bug329727.jar"), null, null); |
12365 |
project.setRawClasspath(newCP, null); |
12366 |
|
12367 |
final String txtPattern = "InnerClas*"; |
12368 |
SearchPattern pattern = SearchPattern.createPattern(txtPattern, |
12369 |
IJavaSearchConstants.CONSTRUCTOR, |
12370 |
IJavaSearchConstants.DECLARATIONS, |
12371 |
SearchPattern.R_CASE_SENSITIVE |
12372 |
| SearchPattern.R_PATTERN_MATCH); |
12373 |
|
12374 |
SearchParticipant[] participants = new SearchParticipant[1]; |
12375 |
participants[0] = SearchEngine.getDefaultSearchParticipant(); |
12376 |
|
12377 |
SearchRequestor requestor = new SearchRequestor() { |
12378 |
public void acceptSearchMatch(SearchMatch match) |
12379 |
throws CoreException { |
12380 |
assertTrue("Incorrect Element", match.getElement() instanceof IMethod); |
12381 |
assertTrue("Must be a constructor", ((IMethod) match.getElement()).isConstructor()); |
12382 |
assertEquals("Incorrect Constructor name", "InnerClass", ((IMethod)match.getElement()).getElementName()); |
12383 |
} |
12384 |
}; |
12385 |
|
12386 |
SearchEngine engine = new SearchEngine(); |
12387 |
IJavaSearchScope scope = SearchEngine.createWorkspaceScope(); |
12388 |
engine.search(pattern, participants, scope, requestor, null); |
12389 |
} |
12390 |
finally{ |
12391 |
project.setRawClasspath(originalCP, null); |
12392 |
deleteFile("/JavaSearchBugs/bug329727.jar"); |
12393 |
} |
12394 |
} |
12340 |
} |
12395 |
} |