Rename: Fixed rename of Kotlin enum constants/@JvmField properties through Java references
#KT-11817 Fixed
This commit is contained in:
@@ -33,6 +33,7 @@ Issues fixed:
|
||||
- [KT-11736](https://youtrack.jetbrains.com/issue/KT-11736) Fixed searching of Java usages for @JvmStatic properties and @JvmStatic @JvmOverloads functions
|
||||
- [KT-8817](https://youtrack.jetbrains.com/issue/KT-8817) Fixed rename of Java getters/setters through synthetic property references in Kotlin
|
||||
- [KT-11617](https://youtrack.jetbrains.com/issue/KT-11617) Fixed title of Introduce Parameter declaration chooser
|
||||
- [KT-11817](https://youtrack.jetbrains.com/issue/KT-11817) Fixed rename of Kotlin enum constants through Java references
|
||||
|
||||
#### Debugger
|
||||
|
||||
|
||||
@@ -65,8 +65,10 @@ sealed class KtLightFieldImpl(
|
||||
|
||||
override fun computeConstantValue() = clsDelegate.computeConstantValue()
|
||||
|
||||
@Throws(IncorrectOperationException::class)
|
||||
override fun setName(@NonNls name: String) = throw IncorrectOperationException("Not supported")
|
||||
override fun setName(@NonNls name: String): PsiElement {
|
||||
(kotlinOrigin as? KtNamedDeclaration)?.setName(name)
|
||||
return this
|
||||
}
|
||||
|
||||
private val _modifierList by lazy {
|
||||
if (lightMemberOrigin is LightMemberOriginForDeclaration)
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class EnumJavaRef {
|
||||
public void use(EnumTarget p) {
|
||||
System.out.println(p == EnumTarget.YELLOW);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
enum class EnumTarget { YELLOW, GREEN, BLUE }
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public class EnumJavaRef {
|
||||
public void use(EnumTarget p) {
|
||||
System.out.println(p == EnumTarget./*rename*/RED);
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
enum class EnumTarget { RED, GREEN, BLUE }
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "MARKED_ELEMENT",
|
||||
"mainFile": "EnumJavaRef.java",
|
||||
"newName": "YELLOW",
|
||||
"byRef": "true"
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package testing.rename
|
||||
|
||||
public open class C {
|
||||
@JvmStatic var <caret> second = 1
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package testing;
|
||||
|
||||
import testing.rename.C;
|
||||
|
||||
class JavaClient {
|
||||
public void foo(C c) {
|
||||
int n = c.second;
|
||||
c.second = 2;
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package testing.rename
|
||||
|
||||
public open class C {
|
||||
@JvmStatic var <caret>first = 1
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
package testing;
|
||||
|
||||
import testing.rename.C;
|
||||
|
||||
class JavaClient {
|
||||
public void foo(C c) {
|
||||
int n = c.first;
|
||||
c.first = 2;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"type": "KOTLIN_PROPERTY",
|
||||
"classId": "testing/rename/C",
|
||||
"oldName": "first",
|
||||
"newName": "second",
|
||||
"withRuntime": "true"
|
||||
}
|
||||
@@ -305,6 +305,12 @@ public class RenameTestGenerated extends AbstractRenameTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("renameKotlinEnumConstByJavaRef/renameKotlinEnumConstByJavaRef.test")
|
||||
public void testRenameKotlinEnumConstByJavaRef_RenameKotlinEnumConstByJavaRef() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/renameKotlinEnumConstByJavaRef/renameKotlinEnumConstByJavaRef.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("renameKotlinEnumEntry/renameKotlinEnumEntry.test")
|
||||
public void testRenameKotlinEnumEntry_RenameKotlinEnumEntry() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/renameKotlinEnumEntry/renameKotlinEnumEntry.test");
|
||||
@@ -389,6 +395,12 @@ public class RenameTestGenerated extends AbstractRenameTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("renameKotlinPropertyWithJvmField/renameKotlinPropertyWithJvmField.test")
|
||||
public void testRenameKotlinPropertyWithJvmField_RenameKotlinPropertyWithJvmField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/renameKotlinPropertyWithJvmField/renameKotlinPropertyWithJvmField.test");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("renameKotlinStaticMethod/renameKotlinStaticMethod.test")
|
||||
public void testRenameKotlinStaticMethod_RenameKotlinStaticMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/refactoring/rename/renameKotlinStaticMethod/renameKotlinStaticMethod.test");
|
||||
|
||||
Reference in New Issue
Block a user