Rename: Skip read-only declarations when renaming parameters

#KT-10713 Fixed
This commit is contained in:
Alexey Sedunov
2016-05-24 17:37:19 +03:00
parent 566ed0112f
commit 400d6b5aa0
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -174,6 +174,7 @@
###### Issues fixed
- [`KT-9156`](https://youtrack.jetbrains.com/issue/KT-9156) Quote non-identifier names in Kotlin references
- [`KT-9157`](https://youtrack.jetbrains.com/issue/KT-9157) Fixed in-place rename of Kotlin expression referring Java declaration
- [`KT-10713`](https://youtrack.jetbrains.com/issue/KT-10713) Skip read-only declarations when renaming parameters
#### Java to Kotlin converter
@@ -20,10 +20,9 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.PsiMethod
import com.intellij.psi.PsiNamedElement
import com.intellij.psi.search.SearchScope
import com.intellij.refactoring.listeners.RefactoringElementListener
import com.intellij.usageView.UsageInfo
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptor
import org.jetbrains.kotlin.idea.refactoring.canRefactor
import org.jetbrains.kotlin.idea.refactoring.getAffectedCallables
import org.jetbrains.kotlin.psi.KtCallableDeclaration
import org.jetbrains.kotlin.psi.KtNamedFunction
@@ -40,6 +39,7 @@ class RenameKotlinParameterProcessor : RenameKotlinPsiProcessor() {
val originalDescriptor = function.resolveToDescriptor() as FunctionDescriptor
val affectedCallables = getAffectedCallables(element.project, OverrideResolver.getDeepestSuperDeclarations(originalDescriptor))
for (callable in affectedCallables) {
if (!callable.canRefactor()) continue
val parameter: PsiNamedElement? = when (callable) {
is KtCallableDeclaration -> callable.valueParameters.firstOrNull { it.name == element.name }
is PsiMethod -> callable.parameterList.parameters.firstOrNull { it.name == element.name }