From 3b4d1dd7bffa948bcc3e4ee52e099579f3feeb42 Mon Sep 17 00:00:00 2001 From: Natalia Selezneva Date: Tue, 22 Jan 2019 10:27:28 +0300 Subject: [PATCH] Optimize ChangeVisibilityModifierIntention: do not analyze element if declaration isn't local --- .../idea/intentions/ChangeVisibilityModifierIntention.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ChangeVisibilityModifierIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ChangeVisibilityModifierIntention.kt index 5c435d7abee..78cb8849bb1 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ChangeVisibilityModifierIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ChangeVisibilityModifierIntention.kt @@ -39,12 +39,12 @@ open class ChangeVisibilityModifierIntention protected constructor( val modifierList = element.modifierList if (modifierList?.hasModifier(modifier) == true) return null + if (KtPsiUtil.isLocal((element as? KtPropertyAccessor)?.property ?: element)) return null + val descriptor = element.toDescriptor() as? DeclarationDescriptorWithVisibility ?: return null val targetVisibility = modifier.toVisibility() if (descriptor.visibility == targetVisibility) return null - if (KtPsiUtil.isLocal((element as? KtPropertyAccessor)?.property ?: element)) return null - if (modifierList?.hasModifier(KtTokens.OVERRIDE_KEYWORD) == true) { val callableDescriptor = descriptor as? CallableDescriptor ?: return null // cannot make visibility less than (or non-comparable with) any of the supers