mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-216172 ApiUsageUastVisitor.isInsideImportStatement speedup: avoid UAST conversion overhead for Java code.
GitOrigin-RevId: e0100c89a48c31c153b6582ed6a8d2ff6960818b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3f1226a367
commit
8cc152e0f6
+9
-1
@@ -1,7 +1,9 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInspection.apiUsage
|
||||
|
||||
import com.intellij.lang.java.JavaLanguage
|
||||
import com.intellij.psi.*
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.uast.UastVisitorAdapter
|
||||
import org.jetbrains.uast.*
|
||||
import org.jetbrains.uast.visitor.AbstractUastNonRecursiveVisitor
|
||||
@@ -263,7 +265,13 @@ class ApiUsageUastVisitor(private val apiUsageProcessor: ApiUsageProcessor) : Ab
|
||||
return false
|
||||
}
|
||||
|
||||
private fun isInsideImportStatement(node: UElement) = node.sourcePsi.findContaining(UImportStatement::class.java) != null
|
||||
private fun isInsideImportStatement(node: UElement): Boolean {
|
||||
val sourcePsi = node.sourcePsi
|
||||
if (sourcePsi != null && sourcePsi.language == JavaLanguage.INSTANCE) {
|
||||
return PsiTreeUtil.getParentOfType(sourcePsi, PsiImportStatementBase::class.java) != null
|
||||
}
|
||||
return sourcePsi.findContaining(UImportStatement::class.java) != null
|
||||
}
|
||||
|
||||
private fun maybeProcessImplicitConstructorInvocationAtSubclassDeclaration(sourceNode: UElement, subclassDeclaration: UClass) {
|
||||
val instantiatedClass = subclassDeclaration.javaPsi.superClass ?: return
|
||||
|
||||
Reference in New Issue
Block a user