Extract Class: Implement 'Extract Superclass' refactoring

#KT-11017 In Progress
This commit is contained in:
Alexey Sedunov
2016-09-05 15:56:16 +03:00
parent 8f5725345f
commit af2de09840
44 changed files with 1145 additions and 125 deletions
@@ -0,0 +1,10 @@
// NAME: X
interface T {}
// SIBLING:
class <caret>A : T {
// INFO: {checked: "true"}
fun foo() {
}
}
@@ -0,0 +1,13 @@
// NAME: X
interface T {}
open class X {
// INFO: {checked: "true"}
fun foo() {
}
}
// SIBLING:
class A : T, X() {
}
@@ -0,0 +1,12 @@
// NAME: X
interface T {}
// SIBLING:
class <caret>A : T {
constructor()
// INFO: {checked: "true"}
fun foo() {
}
}
@@ -0,0 +1,15 @@
// NAME: X
interface T {}
open class X {
// INFO: {checked: "true"}
fun foo() {
}
}
// SIBLING:
class A : T, X {
constructor()
}
@@ -0,0 +1,10 @@
// NAME: X
interface T {}
// SIBLING:
class <caret>A(n: Int) : T {
// INFO: {checked: "true"}
fun foo() {
}
}
@@ -0,0 +1,13 @@
// NAME: X
interface T {}
open class X {
// INFO: {checked: "true"}
fun foo() {
}
}
// SIBLING:
class A(n: Int) : T, X() {
}
@@ -0,0 +1,14 @@
// NAME: B
// INFO: {checked: "true"}
interface I<T>
open class J<T>
// SIBLING:
class <caret>A<T, U : List<T>, V, W, X> : J<X>(), I<W> {
// INFO: {checked: "true"}
fun foo(u: U) {
}
}
@@ -0,0 +1,17 @@
// NAME: B
// INFO: {checked: "true"}
interface I<T>
open class J<T>
open class B<T, U : List<T>, W, X> : J<X>(), I<W> {
// INFO: {checked: "true"}
fun foo(u: U) {
}
}
// SIBLING:
class A<T, U : List<T>, V, W, X> : B<T, U, W, X>() {
}
@@ -0,0 +1,14 @@
// NAME: B
// INFO: {checked: "true"}
interface I<T>
open class J<T>
// SIBLING:
class <caret>A<T, U : List<T>, V, W, X> : J<X>(), I<W> {
// INFO: {checked: "true", toAbstract: "true"}
fun foo() {
val u: U
}
}
@@ -0,0 +1,19 @@
// NAME: B
// INFO: {checked: "true"}
interface I<T>
open class J<T>
abstract class B<W, X> : J<X>(), I<W> {
// INFO: {checked: "true", toAbstract: "true"}
abstract fun foo()
}
// SIBLING:
class A<T, U : List<T>, V, W, X> : B<W, X>() {
// INFO: {checked: "true", toAbstract: "true"}
override fun foo() {
val u: U
}
}
@@ -0,0 +1,3 @@
// NAME: B
// SIBLING:
annotation class <caret>A
@@ -0,0 +1 @@
Superclass cannot be extracted from an annotation class
+9
View File
@@ -0,0 +1,9 @@
// NAME: B
// SIBLING:
enum class <caret>A {
X, Y, Z;
fun foo() {
}
}
@@ -0,0 +1 @@
Superclass cannot be extracted from enum
@@ -0,0 +1,7 @@
// NAME: B
// SIBLING:
interface <caret>A {
fun foo() {
}
}
@@ -0,0 +1 @@
Superclass cannot be extracted from interface
@@ -0,0 +1,7 @@
// NAME: X
// SIBLING:
class A {
private open class B
private class <caret>C : B()
}
@@ -0,0 +1 @@
'B()' uses class B which will be inaccessible after move
@@ -0,0 +1,16 @@
// NAME: X
class A {
open class B
// SIBLING:
class <caret>C : B() {
// INFO: {checked: "true"}
private fun foo() {
}
fun test() {
foo()
}
}
}
@@ -0,0 +1,19 @@
// NAME: X
class A {
open class B
open class X : B() {
// INFO: {checked: "true"}
protected fun foo() {
}
}
// SIBLING:
class C : X() {
fun test() {
foo()
}
}
}
@@ -0,0 +1,12 @@
// NAME: X
interface T {}
open class A
// SIBLING:
class <caret>B : A(), T {
// INFO: {checked: "true"}
fun foo() {
}
}
@@ -0,0 +1,15 @@
// NAME: X
interface T {}
open class A
open class X : A() {
// INFO: {checked: "true"}
fun foo() {
}
}
// SIBLING:
class B : X(), T {
}