KT-12152: quick fix "make final" for member / containing class

This commit is contained in:
Mikhail Glukhikh
2016-05-30 18:19:26 +03:00
parent a22e7d3bcf
commit de3fbe38f1
17 changed files with 258 additions and 10 deletions
+1
View File
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.LeakingThisInspection
@@ -0,0 +1,5 @@
// "Make 'x' final" "true"
open class My(open val x: Int) {
val y = <caret>x
}
@@ -0,0 +1,5 @@
// "Make 'x' final" "true"
open class My(val x: Int) {
val y = x
}
@@ -0,0 +1,5 @@
// "Make 'My' final" "true"
open class My(open val x: Int) {
val y = <caret>x
}
@@ -0,0 +1,5 @@
// "Make 'My' final" "true"
class My(open val x: Int) {
val y = x
}
@@ -0,0 +1,10 @@
// "Make 'x' final" "false"
// ACTION: Convert property initializer to getter
open class My(open val x: Int) {
val y = <caret>x
}
class Your(x : Int) : My(x) {
override val x: Int get() = 42
}
+10
View File
@@ -0,0 +1,10 @@
// "Make 'init' final" "true"
open class My {
init {
<caret>init()
}
open fun init() {}
}
@@ -0,0 +1,10 @@
// "Make 'init' final" "true"
open class My {
init {
init()
}
fun init() {}
}
@@ -0,0 +1,10 @@
// "Make 'My' final" "true"
open class My {
init {
<caret>init()
}
open fun init() {}
}
@@ -0,0 +1,10 @@
// "Make 'My' final" "true"
class My {
init {
init()
}
open fun init() {}
}
+10
View File
@@ -0,0 +1,10 @@
// "Make 'My' final" "false"
// ACTION: Add 'my =' to argument
abstract class My {
init {
register(<caret>this)
}
}
fun register(my: My) {}
+9
View File
@@ -0,0 +1,9 @@
// "Make 'My' final" "true"
open class My {
init {
register(<caret>this)
}
}
fun register(my: My) {}
@@ -0,0 +1,9 @@
// "Make 'My' final" "true"
class My {
init {
register(this)
}
}
fun register(my: My) {}
+12
View File
@@ -0,0 +1,12 @@
// "Make 'My' final" "false"
// ACTION: Add 'my =' to argument
open class My {
init {
register(<caret>this)
}
}
class Derived : My()
fun register(my: My) {}