Rename: Fix processing of overriding methods with mangled names

#KT-24460 Fixed
This commit is contained in:
Alexey Sedunov
2018-05-30 13:47:40 +03:00
parent eea9113d1c
commit 862dc76ed9
21 changed files with 320 additions and 25 deletions
@@ -0,0 +1,6 @@
class J extends X.Y {
@Override
public int newOverridableMethod$production_sources_for_module_light_idea_test_case(int x) {
return super.newOverridableMethod$production_sources_for_module_light_idea_test_case(x);
}
}
@@ -0,0 +1,21 @@
sealed class X {
internal abstract fun newOverridableMethod(x: Int): Int
abstract class Y : X() {
override fun newOverridableMethod(x: Int): Int = 1
}
class Z : Y() {
override fun newOverridableMethod(x: Int): Int =
if (x > 0) x
else super.newOverridableMethod(x)
}
}
fun get() : X? {
return X.Z()
}
fun test() {
get()?.newOverridableMethod(2)
}
@@ -0,0 +1,6 @@
class J extends X.Y {
@Override
public int overridableMethod$production_sources_for_module_light_idea_test_case(int x) {
return super.overridableMethod$production_sources_for_module_light_idea_test_case(x);
}
}
@@ -0,0 +1,21 @@
sealed class X {
internal abstract fun /*rename*/overridableMethod(x: Int): Int
abstract class Y : X() {
override fun overridableMethod(x: Int): Int = 1
}
class Z : Y() {
override fun overridableMethod(x: Int): Int =
if (x > 0) x
else super.overridableMethod(x)
}
}
fun get() : X? {
return X.Z()
}
fun test() {
get()?.overridableMethod(2)
}
@@ -0,0 +1,5 @@
{
"type": "MARKED_ELEMENT",
"mainFile": "test.kt",
"newName": "newOverridableMethod"
}
@@ -0,0 +1,11 @@
class J extends X.Y {
@Override
public int getNewOverridableVar$production_sources_for_module_light_idea_test_case() {
return super.getNewOverridableVar$production_sources_for_module_light_idea_test_case();
}
@Override
public void setNewOverridableVar$production_sources_for_module_light_idea_test_case(int value) {
super.setNewOverridableVar$production_sources_for_module_light_idea_test_case(value);
}
}
@@ -0,0 +1,24 @@
sealed class X {
internal abstract var newOverridableVar: Int
abstract class Y : X() {
override var newOverridableVar: Int
get() = 1
set(value) {}
}
class Z : Y() {
override var newOverridableVar: Int
get() = super.newOverridableVar
set(value) { super.newOverridableVar = value }
}
}
fun get() : X? {
return X.Z()
}
fun test() {
get()?.newOverridableVar
get()?.newOverridableVar = 3
}
@@ -0,0 +1,11 @@
class J extends X.Y {
@Override
public int getOverridableVar$production_sources_for_module_light_idea_test_case() {
return super.getOverridableVar$production_sources_for_module_light_idea_test_case();
}
@Override
public void setOverridableVar$production_sources_for_module_light_idea_test_case(int value) {
super.setOverridableVar$production_sources_for_module_light_idea_test_case(value);
}
}
@@ -0,0 +1,24 @@
sealed class X {
internal abstract var /*rename*/overridableVar: Int
abstract class Y : X() {
override var overridableVar: Int
get() = 1
set(value) {}
}
class Z : Y() {
override var overridableVar: Int
get() = super.overridableVar
set(value) { super.overridableVar = value }
}
}
fun get() : X? {
return X.Z()
}
fun test() {
get()?.overridableVar
get()?.overridableVar = 3
}
@@ -0,0 +1,5 @@
{
"type": "MARKED_ELEMENT",
"mainFile": "test.kt",
"newName": "newOverridableVar"
}