Rename kotlin properties with all usages

#KT-4317 Fixed
 #KT-4316 Fixed
This commit is contained in:
Nikolay Krasko
2014-03-28 14:05:45 +04:00
parent b779141845
commit 7c94e8a9af
24 changed files with 569 additions and 21 deletions
@@ -0,0 +1,29 @@
package testing.rename
trait AP {
val second: Int // <--- Rename base here
}
public open class BP: AP {
override val second: Int get() = 12 // <-- Rename with Java getter here
}
class CP: BP() {
override val second = 2 // <--- Rename overriden here
}
class CPOther {
val first: Int = 111
}
fun usagesProp() {
val b = BP()
val a: AP = b
val c = CP()
a.second
b.second
c.second
CPOther().first
}
@@ -0,0 +1,32 @@
package testing;
import testing.rename.*;
class JavaClient {
public void foo(AP ap, DP dp) {
ap.getSecond();
new BP().getSecond();
new CP().getSecond();
dp.getSecond();
new EP().getSecond();
new FP().getSecond();
}
public interface DP extends AP {
}
public static class EP implements DP {
@Override
public int getSecond() {
return 3;
}
}
public static class FP extends EP {
@Override
public int getSecond() {
return 4;
}
}
}
@@ -0,0 +1,29 @@
package testing.rename
trait AP {
val first: Int // <--- Rename base here
}
public open class BP: AP {
override val first: Int get() = 12 // <-- Rename with Java getter here
}
class CP: BP() {
override val first = 2 // <--- Rename overriden here
}
class CPOther {
val first: Int = 111
}
fun usagesProp() {
val b = BP()
val a: AP = b
val c = CP()
a.first
b.first
c.first
CPOther().first
}
@@ -0,0 +1,32 @@
package testing;
import testing.rename.*;
class JavaClient {
public void foo(AP ap, DP dp) {
ap.getFirst();
new BP().getFirst();
new CP().getFirst();
dp.getFirst();
new EP().getFirst();
new FP().getFirst();
}
public interface DP extends AP {
}
public static class EP implements DP {
@Override
public int getFirst() {
return 3;
}
}
public static class FP extends EP {
@Override
public int getFirst() {
return 4;
}
}
}
@@ -0,0 +1,6 @@
{
"type": "JAVA_METHOD",
"classFQN": "testing.rename.BP",
"methodSignature": "int getFirst()",
"newName": "second"
}
@@ -0,0 +1,6 @@
{
"type": "KOTLIN_PROPERTY",
"classFQN": "testing.rename.AP",
"oldName": "first",
"newName": "second"
}
@@ -0,0 +1,6 @@
{
"type": "KOTLIN_PROPERTY",
"classFQN": "testing.rename.CP",
"oldName": "first",
"newName": "second"
}
@@ -0,0 +1,33 @@
package testing.rename
trait AP {
var second: Int // <--- Rename base here, rename as Java getter and setter here
}
public open class BP: AP {
override var second = 1 // <--- Rename overriden here
}
class CP: BP() {
override var second = 2
}
class CPOther {
var first: Int = 111
}
fun usagesProp() {
val b = BP()
val a: AP = b
val c = CP()
a.second
b.second
c.second
a.second = 1
b.second = 2
c.second = 3
CPOther().first
}
@@ -0,0 +1,36 @@
package testing;
import testing.rename.*;
class JavaClient {
public void foo(AP ap, DP dp) {
ap.getSecond();
new BP().getSecond();
new CP().getSecond();
dp.getSecond();
new EP().getSecond();
new FP().getSecond();
}
public interface DP extends AP {
}
public static class EP implements DP {
@Override
public int getSecond() {
return 3;
}
}
public static class FP extends EP {
@Override
public int getSecond() {
return 4;
}
@Override
public void setSecond(int value) {
}
}
}
@@ -0,0 +1,33 @@
package testing.rename
trait AP {
var first: Int // <--- Rename base here, rename as Java getter and setter here
}
public open class BP: AP {
override var first = 1 // <--- Rename overriden here
}
class CP: BP() {
override var first = 2
}
class CPOther {
var first: Int = 111
}
fun usagesProp() {
val b = BP()
val a: AP = b
val c = CP()
a.first
b.first
c.first
a.first = 1
b.first = 2
c.first = 3
CPOther().first
}
@@ -0,0 +1,36 @@
package testing;
import testing.rename.*;
class JavaClient {
public void foo(AP ap, DP dp) {
ap.getFirst();
new BP().getFirst();
new CP().getFirst();
dp.getFirst();
new EP().getFirst();
new FP().getFirst();
}
public interface DP extends AP {
}
public static class EP implements DP {
@Override
public int getFirst() {
return 3;
}
}
public static class FP extends EP {
@Override
public int getFirst() {
return 4;
}
@Override
public void setFirst(int value) {
}
}
}
@@ -0,0 +1,6 @@
{
"type": "JAVA_METHOD",
"classFQN": "testing.rename.AP",
"methodSignature": "int getFirst()",
"newName": "second"
}
@@ -0,0 +1,6 @@
{
"type": "JAVA_METHOD",
"classFQN": "testing.rename.AP",
"methodSignature": "void setFirst(int value)",
"newName": "second"
}
@@ -0,0 +1,6 @@
{
"type": "KOTLIN_PROPERTY",
"classFQN": "testing.rename.AP",
"oldName": "first",
"newName": "second"
}
@@ -0,0 +1,6 @@
{
"type": "KOTLIN_PROPERTY",
"classFQN": "testing.rename.BP",
"oldName": "first",
"newName": "second"
}