mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
javac ast indices: more tests
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
class Bar {
|
||||
|
||||
void m() {
|
||||
new FooImpl().someMethod();
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
interface Foo {
|
||||
void someMethod();
|
||||
}
|
||||
|
||||
class FooImpl implements Foo {
|
||||
@Override
|
||||
public void someMethod() {
|
||||
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Bar {
|
||||
|
||||
void m() {
|
||||
new Foo().run();
|
||||
}
|
||||
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
interface Foo implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,22 @@ public class CompilerReferencesFindUsagesTest extends DaemonAnalyzerTestCase {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/compiler/compilerReferenceFindUsages/";
|
||||
}
|
||||
|
||||
public void testMethodUsageInClassHierarchy() throws Exception {
|
||||
configureByFiles(getName(), getName() + "/Bar.java", getName() + "/Foo.java");
|
||||
PsiMethod methodToSearch = findClass("Foo").findMethodsByName("someMethod", false)[0];
|
||||
assertOneElement(MethodReferencesSearch.search(methodToSearch).findAll());
|
||||
myCompilerTester.rebuild();
|
||||
assertOneElement(MethodReferencesSearch.search(methodToSearch).findAll());
|
||||
}
|
||||
|
||||
public void testMethodUsageInClassHierarchy2() throws Exception {
|
||||
configureByFiles(getName(), getName() + "/Bar.java", getName() + "/Foo.java");
|
||||
PsiMethod methodToSearch = myJavaFacade.findClass(CommonClassNames.JAVA_LANG_RUNNABLE).findMethodsByName("run", false)[0];
|
||||
assertOneElement(MethodReferencesSearch.search(methodToSearch).findAll());
|
||||
myCompilerTester.rebuild();
|
||||
assertOneElement(MethodReferencesSearch.search(methodToSearch).findAll());
|
||||
}
|
||||
|
||||
public void testLibMethodUsage() throws Exception {
|
||||
configureByFile(getName() + "/Foo.java");
|
||||
myCompilerTester.rebuild();
|
||||
|
||||
Reference in New Issue
Block a user