From 93b2c56bb475497d3466b098f4f1ac7fcb096dff Mon Sep 17 00:00:00 2001 From: mglukhikh Date: Mon, 16 Jan 2017 13:30:41 +0300 Subject: [PATCH] Fixed KNPE in convert primary constructor to secondary #KT-14745 Fixed --- .../ConvertPrimaryConstructorToSecondaryIntention.kt | 2 +- .../convertPrimaryConstructorToSecondary/noArgType.kt | 4 ++++ .../noArgType.kt.after | 10 ++++++++++ .../kotlin/idea/intentions/IntentionTestGenerated.java | 6 ++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgType.kt create mode 100644 idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgType.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 4bfdbbc706e..892a4a64932 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt @@ -80,7 +80,7 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention(val x) \ No newline at end of file diff --git a/idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgType.kt.after b/idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgType.kt.after new file mode 100644 index 00000000000..ce6afd6f813 --- /dev/null +++ b/idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgType.kt.after @@ -0,0 +1,10 @@ +// SKIP_ERRORS_BEFORE +// SKIP_ERRORS_AFTER + +class My { + val x + + constructor(x:) { + this.x = x + } +} \ 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 c6b48e4aec1..e4b682bb3fc 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -4862,6 +4862,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("noArgType.kt") + public void testNoArgType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/noArgType.kt"); + doTest(fileName); + } + @TestMetadata("paramsAndProperties.kt") public void testParamsAndProperties() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/paramsAndProperties.kt");