|
Lines 4425-4430
Link Here
|
| 4425 |
this.resultCollector, |
4425 |
this.resultCollector, |
| 4426 |
null); |
4426 |
null); |
| 4427 |
} |
4427 |
} |
|
|
4428 |
/** @bug 431357 |
| 4429 |
* [1.8][compiler] NPE when creating LambdaMethod element for lambda expressions with errors |
| 4430 |
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=431357" |
| 4431 |
*/ |
| 4432 |
public void testBug431357() throws CoreException { |
| 4433 |
this.workingCopies = new ICompilationUnit[1]; |
| 4434 |
this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java", |
| 4435 |
"interface I { \n" + |
| 4436 |
" public void query(Foo.InnerKey key);// Search result of method query(Foo.InnerKey) returns the method query(Bar.InnerKey) too \n" + |
| 4437 |
" public void query(Bar.InnerKey key);\n" + |
| 4438 |
"}\n" + |
| 4439 |
"\n" + |
| 4440 |
"class Foo { \n" + |
| 4441 |
" static class InnerKey {}\n" + |
| 4442 |
"}\n" + |
| 4443 |
"class Bar {\n" + |
| 4444 |
" static class InnerKey {}\n" + |
| 4445 |
"}\n" + |
| 4446 |
"\n" + |
| 4447 |
"class X {\n" + |
| 4448 |
" public static void foo(I i, Foo.InnerKey key) {\n" + |
| 4449 |
" i.query(key);\n" + |
| 4450 |
" }\n" + |
| 4451 |
" public static void bar(I i, Bar.InnerKey key) {\n" + |
| 4452 |
" i.query(key);\n" + |
| 4453 |
" }\n" + |
| 4454 |
" public static I getInstance() {\n" + |
| 4455 |
" return null;\n" + |
| 4456 |
" }\n" + |
| 4457 |
"}\n" |
| 4458 |
); |
| 4459 |
|
| 4460 |
String str = this.workingCopies[0].getSource(); |
| 4461 |
String selection = "query"; |
| 4462 |
int start = str.indexOf(selection); |
| 4463 |
int length = selection.length(); |
| 4464 |
|
| 4465 |
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length); |
| 4466 |
MethodPattern pattern = (MethodPattern) SearchPattern.createPattern(elements[0], REFERENCES, EXACT_RULE | ERASURE_RULE); |
| 4467 |
|
| 4468 |
new SearchEngine(this.workingCopies).search(pattern, |
| 4469 |
new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, |
| 4470 |
getJavaSearchWorkingCopiesScope(), |
| 4471 |
this.resultCollector, |
| 4472 |
null); |
| 4473 |
assertSearchResults( |
| 4474 |
"src/X.java void X.foo(I, Foo.InnerKey) [query(key)] EXACT_MATCH" |
| 4475 |
); |
| 4476 |
} |
| 4428 |
// Add new tests in JavaSearchBugs8Tests |
4477 |
// Add new tests in JavaSearchBugs8Tests |
| 4429 |
} |
4478 |
} |
| 4430 |
|
4479 |
|