Lines 4464-4467
Link Here
|
4464 |
// Should have same types with these 2 searches |
4464 |
// Should have same types with these 2 searches |
4465 |
assertEquals("Found types sounds not to be correct", requestor.toString(), collector.toString()); |
4465 |
assertEquals("Found types sounds not to be correct", requestor.toString(), collector.toString()); |
4466 |
} |
4466 |
} |
|
|
4467 |
/** |
4468 |
* @bug 329727 Invalid check in the isConstructor() method of the IMethod implementation. |
4469 |
* @test check that in a binary type, method's name doesn't contain the enclosing type name and |
4470 |
* that IMethod#isContructor returns correct value |
4471 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=329727" |
4472 |
* @throws CoreException |
4473 |
* @throws IOException |
4474 |
*/ |
4475 |
public void testBug329727() throws CoreException, IOException { |
4476 |
|
4477 |
IJavaProject project = getJavaProject("JavaSearch"); |
4478 |
IClasspathEntry[] originalCP = project.getRawClasspath(); |
4479 |
try { |
4480 |
int cpLength = originalCP.length; |
4481 |
IClasspathEntry[] newCP = new IClasspathEntry[cpLength + 1]; |
4482 |
System.arraycopy(originalCP, 0, newCP, 0, cpLength); |
4483 |
createLibrary(project, "bug329727.jar", null, new String[] { |
4484 |
"p/OuterClass.java", |
4485 |
"package p;\n" + "public class OuterClass {\n" |
4486 |
+ " public OuterClass(){}\n" |
4487 |
+ " class InnerClass {\n" |
4488 |
+ " public InnerClass(){}\n" + " }\n" + "}\n" }, |
4489 |
new String[0], JavaCore.VERSION_1_4); |
4490 |
newCP[cpLength] = JavaCore.newLibraryEntry( |
4491 |
new Path("/JavaSearch/bug329727.jar"), null, null); |
4492 |
project.setRawClasspath(newCP, null); |
4493 |
|
4494 |
final String txtPattern = "InnerClas*"; |
4495 |
SearchPattern pattern = SearchPattern.createPattern(txtPattern, |
4496 |
IJavaSearchConstants.CONSTRUCTOR, |
4497 |
IJavaSearchConstants.DECLARATIONS, |
4498 |
SearchPattern.R_CASE_SENSITIVE |
4499 |
| SearchPattern.R_PATTERN_MATCH); |
4500 |
|
4501 |
SearchParticipant[] participants = new SearchParticipant[1]; |
4502 |
participants[0] = SearchEngine.getDefaultSearchParticipant(); |
4503 |
|
4504 |
SearchRequestor requestor = new SearchRequestor() { |
4505 |
public void acceptSearchMatch(SearchMatch match) |
4506 |
throws CoreException { |
4507 |
assertTrue("Incorrect Element", match.getElement() instanceof IMethod); |
4508 |
assertTrue("Must be a constructor", ((IMethod) match.getElement()).isConstructor()); |
4509 |
assertEquals("Incorrect Constructor name", "InnerClass", ((IMethod)match.getElement()).getElementName()); |
4510 |
} |
4511 |
}; |
4512 |
|
4513 |
SearchEngine engine = new SearchEngine(); |
4514 |
IJavaSearchScope scope = SearchEngine.createWorkspaceScope(); |
4515 |
engine.search(pattern, participants, scope, requestor, null); |
4516 |
} |
4517 |
finally{ |
4518 |
project.setRawClasspath(originalCP, null); |
4519 |
} |
4520 |
|
4521 |
} |
4467 |
} |
4522 |
} |