Fix NPE in GotoSuperActionHandler.java (EA-77295)

This commit is contained in:
Nikolay Krasko
2016-01-25 17:32:47 +03:00
parent aebf681809
commit 06939b11e4
3 changed files with 16 additions and 1 deletions
@@ -65,7 +65,7 @@ public class GotoSuperActionHandler implements CodeInsightActionHandler {
List<PsiElement> superDeclarations = findSuperDeclarations(descriptor);
if (superDeclarations.isEmpty()) return;
if (superDeclarations == null || superDeclarations.isEmpty()) return;
if (superDeclarations.size() == 1) {
Navigatable navigatable = EditSourceUtil.getDescriptor(superDeclarations.get(0));
if (navigatable != null && navigatable.canNavigate()) {
@@ -100,6 +100,7 @@ public class GotoSuperActionHandler implements CodeInsightActionHandler {
return null;
}
@Nullable
private static List<PsiElement> findSuperDeclarations(DeclarationDescriptor descriptor) {
Collection<? extends DeclarationDescriptor> superDescriptors;
if (descriptor instanceof ClassDescriptor) {
@@ -0,0 +1,8 @@
// FILE: before.kt
fun test() {
val a = { <caret>a: Int -> 1}
}
// FILE: after.kt
fun test() {
val a = { <caret>a: Int -> 1}
}
@@ -35,6 +35,12 @@ public class GotoSuperTestGenerated extends AbstractGotoSuperTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/navigation/gotoSuper"), Pattern.compile("^(.+)\\.test$"), true);
}
@TestMetadata("BadPositionLambdaParameter.test")
public void testBadPositionLambdaParameter() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/gotoSuper/BadPositionLambdaParameter.test");
doTest(fileName);
}
@TestMetadata("ClassSimple.test")
public void testClassSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/navigation/gotoSuper/ClassSimple.test");