goto implementation: when no implementations are possible (e.g. static method), include self into presentation

This commit is contained in:
Anna.Kozlova
2016-11-21 16:28:18 +01:00
parent 8bc0d93c07
commit 25d5c187d7
2 changed files with 13 additions and 1 deletions
@@ -249,6 +249,18 @@ public class GotoImplementationHandlerTest extends JavaCodeInsightFixtureTestCas
assertEquals("A", aClass.getName());
}
public void testStaticMethodReference() {
PsiFile file = myFixture.addFileToProject("Foo.java",
"class C {\n" +
" static void a(){}\n" +
" {a<caret>();}" +
"}");
myFixture.configureFromExistingVirtualFile(file.getVirtualFile());
final PsiElement[] impls = getTargets(file);
assertEquals(1, impls.length);
}
private PsiElement[] getTargets(PsiFile file) {
GotoTargetHandler.GotoData gotoData = CodeInsightTestUtil.gotoImplementation(myFixture.getEditor(), file);
assertNotNull(gotoData);
@@ -149,7 +149,7 @@ public class ImplementationSearcher {
return null;
}
PsiElement foundElement = result[0];
return foundElement != null ? new PsiElement[] {foundElement} : null;
return foundElement != null ? new PsiElement[] {foundElement} : PsiElement.EMPTY_ARRAY;
}
protected boolean canShowPopupWithOneItem(PsiElement element) {