"Convert to run / with": don't suggest on java static method call
#KT-25739 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
0a5aa2b60c
commit
28aa0763a9
+6
-2
@@ -17,14 +17,18 @@
|
||||
package org.jetbrains.kotlin.idea.intentions
|
||||
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.psi.PsiClass
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.psi.KtDotQualifiedExpression
|
||||
|
||||
abstract class ConvertDotQualifiedToScopeIntention(
|
||||
text: String
|
||||
text: String
|
||||
) : ConvertToScopeIntention<KtDotQualifiedExpression>(KtDotQualifiedExpression::class.java, text) {
|
||||
|
||||
override fun isApplicableTo(element: KtDotQualifiedExpression, caretOffset: Int): Boolean {
|
||||
val receiverExpressionText = element.getReceiverExpressionText() ?: return false
|
||||
val receiverExpression = element.getLeftMostReceiverExpression()
|
||||
if (receiverExpression.mainReference?.resolve() is PsiClass) return false
|
||||
val receiverExpressionText = receiverExpression.text
|
||||
if (receiverExpressionText in BLACKLIST_RECEIVER_NAME) return false
|
||||
if (!isApplicableWithGivenReceiverText(element, receiverExpressionText)) return false
|
||||
val nextSibling = element.getDotQualifiedSiblingIfAny(forward = true)
|
||||
|
||||
Reference in New Issue
Block a user