diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt index 1f266ada25d1..a82334687b90 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/findUsages/KotlinElementDescriptionProvider.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.descriptors.ConstructorDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.refactoring.rename.RenameJavaSyntheticPropertyHandler +import org.jetbrains.kotlin.idea.refactoring.rename.RenameKotlinPropertyProcessor import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.DescriptorUtils @@ -52,6 +53,7 @@ class KotlinElementDescriptionProvider : ElementDescriptionProvider { is KtDestructuringDeclarationEntry -> "variable" is RenameJavaSyntheticPropertyHandler.SyntheticPropertyWrapper -> "property" is KtLightClassForFacade -> "facade class" + is RenameKotlinPropertyProcessor.PropertyMethodWrapper -> "property accessor" else -> null } diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinPropertyProcessor.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinPropertyProcessor.kt index e148786ca665..a26bfacf8647 100644 --- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinPropertyProcessor.kt +++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/refactoring/rename/RenameKotlinPropertyProcessor.kt @@ -16,6 +16,7 @@ package org.jetbrains.kotlin.idea.refactoring.rename +import com.intellij.navigation.NavigationItem import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.editor.Editor import com.intellij.openapi.ui.Messages @@ -249,6 +250,12 @@ class RenameKotlinPropertyProcessor : RenameKotlinPsiProcessor() { return declarationToRename } + class PropertyMethodWrapper(val propertyMethod: PsiMethod) : PsiNamedElement by propertyMethod, NavigationItem by propertyMethod { + override fun getName() = propertyMethod.name + override fun setName(name: String) = this + override fun copy() = this + } + override fun prepareRenaming(element: PsiElement, newName: String?, allRenames: MutableMap, scope: SearchScope) { super.prepareRenaming(element, newName, allRenames, scope) @@ -281,10 +288,7 @@ class RenameKotlinPropertyProcessor : RenameKotlinPsiProcessor() { for (propertyMethod in propertyMethods) { if (element is KtDeclaration && newPropertyName != null) { - val wrapper = object : PsiNamedElement by propertyMethod { - override fun setName(name: String) = this - override fun copy() = this - } + val wrapper = PropertyMethodWrapper(propertyMethod) when { JvmAbi.isGetterName(propertyMethod.name) && getterJvmName == null -> allRenames[wrapper] = JvmAbi.getterName(newPropertyName)