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:
Alexey Sedunov
2016-06-15 14:54:45 +03:00
parent 04f54bee88
commit 46c2dc9895
2 changed files with 4 additions and 0 deletions
+1
View File
@@ -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)