[kotlin] don't suggest classes in libraries as targets for implement method (KTIJ-20822)

GitOrigin-RevId: aebeb984377cf0fd16e40e4a8f544adb8affe266
This commit is contained in:
Anna Kozlova
2022-01-20 14:34:45 +01:00
committed by intellij-monorepo-bot
parent 01f2a89708
commit ca1ef63146

View File

@@ -1,10 +1,11 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.intentions
import com.intellij.codeInsight.CodeInsightBundle
import com.intellij.codeInsight.FileModificationService
import com.intellij.codeInsight.generation.OverrideImplementUtil
import com.intellij.codeInsight.intention.impl.BaseIntentionAction
import com.intellij.ide.util.PsiClassListCellRenderer
import com.intellij.ide.util.PsiClassRenderingInfo
import com.intellij.ide.util.PsiElementListCellRenderer
@@ -73,6 +74,7 @@ abstract class ImplementAbstractMemberIntentionBase : SelfTargetingRangeIntentio
val memberDescriptor = member.resolveToDescriptorIfAny() as? CallableMemberDescriptor ?: return emptySequence()
fun acceptSubClass(subClass: PsiElement): Boolean {
if (!BaseIntentionAction.canModify(subClass)) return false
val classDescriptor = when (subClass) {
is KtLightClass -> subClass.kotlinOrigin?.resolveToDescriptorIfAny()
is KtEnumEntry -> subClass.resolveToDescriptorIfAny()