Find Usages: Fix NPE on constructor with missing name

#EA-69907 Fixed
This commit is contained in:
Alexey Sedunov
2015-08-18 15:15:12 +03:00
parent 06cca689fc
commit 69218e2647
4 changed files with 14 additions and 2 deletions
@@ -66,9 +66,9 @@ public abstract class JetConstructor<T : JetConstructor<T>> : JetDeclarationStub
override fun getTypeParameters() = emptyList<JetTypeParameter>()
override fun getName(): String = getContainingClassOrObject().getName()!!
override fun getName(): String? = getContainingClassOrObject().getName()
override fun getNameAsSafeName() = Name.identifier(getName())
override fun getNameAsSafeName() = JetPsiUtil.safeName(getName())
override fun getFqName() = null
@@ -0,0 +1,5 @@
// PSI_ELEMENT: org.jetbrains.kotlin.psi.JetPrimaryConstructor
// OPTIONS: usages
class <caret>() {
}
@@ -756,6 +756,12 @@ public class JetFindUsagesTestGenerated extends AbstractJetFindUsagesTest {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/findUsages/kotlin/findPrimaryConstructorUsages"), Pattern.compile("^(.+)\\.0\\.kt$"), true);
}
@TestMetadata("missingName.0.kt")
public void testMissingName() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/findPrimaryConstructorUsages/missingName.0.kt");
doTest(fileName);
}
@TestMetadata("primaryConstructorByRef.0.kt")
public void testPrimaryConstructorByRef() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/findUsages/kotlin/findPrimaryConstructorUsages/primaryConstructorByRef.0.kt");