Add intentions to move property from/to primary constructor
#KT-4578 Fixed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.intentions.MovePropertyToConstructorIntention
|
||||
@@ -0,0 +1,8 @@
|
||||
annotation class Annotation1(val a: Int = 0)
|
||||
annotation class Annotation2(val a: Int = 0)
|
||||
annotation class Annotation3(val a: Int = 0)
|
||||
|
||||
|
||||
class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum") {
|
||||
private @Annotation1(42) @field:Annotation2(42) val <caret>text = initialText
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
annotation class Annotation1(val a: Int = 0)
|
||||
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") {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
// WITH_RUNTIME
|
||||
|
||||
class TestClass {
|
||||
private val <caret>text: String by lazy { "Lorem Ipsum" }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
class TestClass {
|
||||
val <caret>text: String
|
||||
get() {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
class TestClass {
|
||||
private lateinit var <caret>text: String
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// IS_APPLICABLE: false
|
||||
|
||||
class TestClass {
|
||||
fun foo() {
|
||||
var <caret>text = ""
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
class TestClass {
|
||||
private val <caret>text = "Lorem Ipsum"
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
class TestClass(private val text: String = "Lorem Ipsum") {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
annotation class SuperAnnotation
|
||||
|
||||
class TestClass(text: String) {
|
||||
@SuperAnnotation val <caret>text = text
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
annotation class SuperAnnotation
|
||||
|
||||
class TestClass(@property:SuperAnnotation val text: String) {
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
annotation class Annotation1(val a: Int = 0)
|
||||
annotation class Annotation2(val a: Int = 0)
|
||||
annotation class Annotation3(val a: Int = 0)
|
||||
|
||||
|
||||
class TestClass(@Annotation1(42) @Annotation3(42) initialText: String = "LoremIpsum") {
|
||||
private @Annotation1(42) @field:Annotation2(42) val <caret>text = "dolor sit amet"
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
annotation class Annotation1(val a: Int = 0)
|
||||
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") {
|
||||
}
|
||||
Reference in New Issue
Block a user