From d4995c07f7bbff388202355173707d8440537ad8 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 14 Nov 2016 18:56:37 +0300 Subject: [PATCH] Convert primary constructor to secondary: KNPE fixed #KT-14745 Fixed --- .../ConvertPrimaryConstructorToSecondaryIntention.kt | 2 +- .../convertPrimaryConstructorToSecondary/noArgName.kt | 2 ++ .../convertPrimaryConstructorToSecondary/noArgName.kt.after | 4 ++++ .../kotlin/idea/intentions/IntentionTestGenerated.java | 6 ++++++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgName.kt create mode 100644 idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgName.kt.after diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt index 3d3fb3e74b3..4bfdbbc706e 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt @@ -79,7 +79,7 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention(: Int) \ No newline at end of file diff --git a/idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgName.kt.after b/idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgName.kt.after new file mode 100644 index 00000000000..945f772a32f --- /dev/null +++ b/idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgName.kt.after @@ -0,0 +1,4 @@ + +class My { + constructor(: Int) +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index c8e54b05dc7..a984068cc4d 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -4580,6 +4580,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("noArgName.kt") + public void testNoArgName() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgName.kt"); + doTest(fileName); + } + @TestMetadata("paramsAndProperties.kt") public void testParamsAndProperties() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/paramsAndProperties.kt");