Rename: Record new name for Kotlin function which is being renamed via light method
#KT-12732 Fixed (cherry picked from commit 28b9d3e)
This commit is contained in:
@@ -243,6 +243,7 @@
|
||||
- [`KT-10713`](https://youtrack.jetbrains.com/issue/KT-10713) Skip read-only declarations when renaming parameters
|
||||
- [`KT-10687`](https://youtrack.jetbrains.com/issue/KT-10687) Qualify property references to avoid shadowing by parameters
|
||||
- [`KT-12543`](https://youtrack.jetbrains.com/issue/KT-12543) Qualify property references with 'this' to avoid renaming conflicts
|
||||
- [`KT-12732`](https://youtrack.jetbrains.com/issue/KT-12732) Copy default parameter values to overriding function which is renamed by Java reference while its base function is unchanged
|
||||
|
||||
#### Java to Kotlin converter
|
||||
|
||||
|
||||
@@ -85,6 +85,9 @@ class RenameKotlinFunctionProcessor : RenameKotlinPsiProcessor() {
|
||||
|
||||
override fun prepareRenaming(element: PsiElement, newName: String?, allRenames: MutableMap<PsiElement, String>, scope: SearchScope) {
|
||||
super.prepareRenaming(element, newName, allRenames, scope)
|
||||
if (element is KtLightMethod && newName != null && getJvmName(element) == null) {
|
||||
(element.kotlinOrigin as? KtNamedFunction)?.let { allRenames[it] = newName }
|
||||
}
|
||||
val psiMethod = wrapPsiMethod(element)
|
||||
if (psiMethod?.containingClass != null) {
|
||||
javaMethodProcessorInstance.prepareRenaming(psiMethod, newName, allRenames, scope)
|
||||
|
||||
Reference in New Issue
Block a user