KT-2836 Rename kotlin base function with overrides
#KT-2836 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
5350dc265a
commit
97c8e05984
+27
@@ -0,0 +1,27 @@
|
||||
package testing.rename
|
||||
|
||||
trait A {
|
||||
fun second() : Int
|
||||
}
|
||||
|
||||
public open class B: A {
|
||||
override fun second() = 1
|
||||
|
||||
fun first(a: Int) = 12
|
||||
}
|
||||
|
||||
class C: B() {
|
||||
override fun second() = 2
|
||||
}
|
||||
|
||||
fun usages() {
|
||||
val b = B()
|
||||
val a: A = b
|
||||
val c = C()
|
||||
|
||||
a.second()
|
||||
b.second()
|
||||
c.second()
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package testing;
|
||||
|
||||
import testing.rename.*;
|
||||
|
||||
class JavaClient {
|
||||
public void foo(A a) {
|
||||
a.second();
|
||||
new B().second();
|
||||
new C().second();
|
||||
new D().second();
|
||||
}
|
||||
|
||||
public static class D implements A {
|
||||
@Override
|
||||
public int second() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
public static class E extends D {
|
||||
@Override
|
||||
public int second() {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package testing.rename
|
||||
|
||||
trait A {
|
||||
fun first() : Int
|
||||
}
|
||||
|
||||
public open class B: A {
|
||||
override fun first() = 1
|
||||
|
||||
fun first(a: Int) = 12
|
||||
}
|
||||
|
||||
class C: B() {
|
||||
override fun first() = 2
|
||||
}
|
||||
|
||||
fun usages() {
|
||||
val b = B()
|
||||
val a: A = b
|
||||
val c = C()
|
||||
|
||||
a.first()
|
||||
b.first()
|
||||
c.first()
|
||||
}
|
||||
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package testing;
|
||||
|
||||
import testing.rename.*;
|
||||
|
||||
class JavaClient {
|
||||
public void foo(A a) {
|
||||
a.first();
|
||||
new B().first();
|
||||
new C().first();
|
||||
new D().first();
|
||||
}
|
||||
|
||||
public static class D implements A {
|
||||
@Override
|
||||
public int first() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
public static class E extends D {
|
||||
@Override
|
||||
public int first() {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
// RENAME: JAVA_METHOD->testing.rename.A->void first()->second
|
||||
@@ -0,0 +1,3 @@
|
||||
// RENAME: KOTLIN_FUNCTION->testing.rename.A.first->second
|
||||
|
||||
// KT-2836 Rename method with all its implementations
|
||||
Reference in New Issue
Block a user