diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/MovePropertyToConstructorIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/MovePropertyToConstructorIntention.kt index bdccc333fa4..f27555d66c2 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/MovePropertyToConstructorIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/MovePropertyToConstructorIntention.kt @@ -24,6 +24,7 @@ import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.descriptors.ParameterDescriptor import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall @@ -77,7 +78,7 @@ class MovePropertyToConstructorIntention : val propertyAnnotationsText = element.modifierList?.annotationEntries?.joinToString(separator = " ") { if (it.isApplicableToConstructorParameter()) { - it.getTextWithUseSiteIfMissing("property") + it.getTextWithUseSiteIfMissing(AnnotationUseSiteTarget.FIELD.renderName) } else { it.text } diff --git a/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt b/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt index c5416db290a..113f247c93b 100644 --- a/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt +++ b/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt @@ -4,5 +4,5 @@ annotation class Annotation3(val a: Int = 0) class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum") { - private @Annotation1(42) @field:Annotation2(42) val text = initialText + private @Annotation1(42) @property:Annotation2(42) val text = initialText } \ No newline at end of file diff --git a/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt.after b/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt.after index 709fa1a04a8..f1505435a54 100644 --- a/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt.after +++ b/idea/testData/intentions/movePropertyToConstructor/annotationWithUseSite.kt.after @@ -3,5 +3,5 @@ annotation class Annotation2(val a: Int = 0) annotation class Annotation3(val a: Int = 0) -class TestClass(private @property:Annotation1(42) @field:Annotation2(42) @Annotation1(42) @Annotation3(42) val text: String = "LoremIpsum") { +class TestClass(private @field:Annotation1(42) @property:Annotation2(42) @Annotation1(42) @Annotation3(42) val text: String = "LoremIpsum") { } \ No newline at end of file diff --git a/idea/testData/intentions/movePropertyToConstructor/simpleAnnotation.kt.after b/idea/testData/intentions/movePropertyToConstructor/simpleAnnotation.kt.after index e04169ff64b..26c0cee5e88 100644 --- a/idea/testData/intentions/movePropertyToConstructor/simpleAnnotation.kt.after +++ b/idea/testData/intentions/movePropertyToConstructor/simpleAnnotation.kt.after @@ -1,4 +1,4 @@ annotation class SuperAnnotation -class TestClass(@property:SuperAnnotation val text: String) { +class TestClass(@field:SuperAnnotation val text: String) { } \ No newline at end of file diff --git a/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt b/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt index 9709fe7ea4b..5d6350bbe2b 100644 --- a/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt +++ b/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt @@ -4,5 +4,5 @@ annotation class Annotation3(val a: Int = 0) class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum") { - private @Annotation1(42) @field:Annotation2(42) val text = "dolor sit amet" + private @Annotation1(42) @property:Annotation2(42) val text = "dolor sit amet" } \ No newline at end of file diff --git a/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt.after b/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt.after index e310a176513..c6cc01a819a 100644 --- a/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt.after +++ b/idea/testData/intentions/movePropertyToConstructor/withoutMatchingParameter.kt.after @@ -3,5 +3,5 @@ annotation class Annotation2(val a: Int = 0) annotation class Annotation3(val a: Int = 0) -class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum", private @property:Annotation1(42) @field:Annotation2(42) val text: String = "dolor sit amet") { +class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum", private @field:Annotation1(42) @property:Annotation2(42) val text: String = "dolor sit amet") { } \ No newline at end of file