Convert primary constructor to secondary: KNPE fixed #KT-14745 Fixed
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention<KtP
|
||||
for (valueParameter in element.valueParameters) {
|
||||
val annotations = valueParameter.annotationEntries.joinToString(separator = " ") { it.text }
|
||||
val vararg = if (valueParameter.isVarArg) VARARG_KEYWORD.value else ""
|
||||
param("$annotations $vararg ${valueParameter.name!!}",
|
||||
param("$annotations $vararg ${valueParameter.name ?: ""}",
|
||||
valueParameter.typeReference!!.text, valueParameter.defaultValue?.text)
|
||||
}
|
||||
noReturnType()
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
class My<caret>(: Int)
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
|
||||
class My {
|
||||
constructor(: Int)
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user