mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
[kotlin] Migrate deprecated analysis.project.structure declaration usages
^KT-68462 GitOrigin-RevId: 877b58ed95d522cb596d90aecfe41c33b052a8d1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
33487a9cdf
commit
cd3ceca779
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.analysis.api.projectStructure.KaDanglingFileModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaLibrarySourceModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaSourceModule
|
||||
import org.jetbrains.kotlin.analysis.project.structure.allDirectDependencies
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.allDirectDependencies
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.KtSourceModuleByModuleInfoForOutsider
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.ModuleDependencyCollector
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.collectDependencies
|
||||
|
||||
@@ -106,7 +106,7 @@ internal class FirIdeOutOfBlockPsiTreeChangePreprocessor(private val project: Pr
|
||||
* We don't want to publish any global out-of-block modification on roots changes, because relevant roots changes already cause module
|
||||
* state modification events. Such a module state modification event includes the exact module that was affected by the roots change,
|
||||
* instead of a less specific global out-of-block modification event. This allows a consumer such as session invalidation to invalidate
|
||||
* sessions more granularly. Additionally, many roots changes don't require any event to be published because a corresponding [KaModule][org.jetbrains.kotlin.analysis.project.structure.KaModule]
|
||||
* sessions more granularly. Additionally, many roots changes don't require any event to be published because a corresponding [KaModule][org.jetbrains.kotlin.analysis.api.projectStructure.KaModule]
|
||||
* does not exist for the changed module (e.g. when no content roots have been added yet), so roots changes [PsiTreeChangeEvent]s are
|
||||
* overzealous, while the module state modification service can handle such cases gracefully.
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.analysis.api.projectStructure.KaNotUnderContentRootM
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaScriptDependencyModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaScriptModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaSourceModule
|
||||
import org.jetbrains.kotlin.analysis.project.structure.*
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.danglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.idea.base.projectStructure.moduleInfo.*
|
||||
import org.jetbrains.kotlin.idea.base.util.getOutsiderFileOrigin
|
||||
|
||||
@@ -4,7 +4,7 @@ package org.jetbrains.kotlin.idea.codeinsight.api.applicable
|
||||
import org.jetbrains.kotlin.analysis.api.KaSession
|
||||
import org.jetbrains.kotlin.analysis.api.analyze
|
||||
import org.jetbrains.kotlin.analysis.api.analyzeCopy
|
||||
import org.jetbrains.kotlin.analysis.project.structure.DanglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaDanglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.psi.KtElement
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ internal fun <E : KtElement, C> ContextProvider<E, C>.getElementContext(
|
||||
element: E,
|
||||
): C? = if (element.isPhysical) analyze(element) {
|
||||
prepareContext(element)
|
||||
} else analyzeCopy(element, DanglingFileResolutionMode.PREFER_SELF) {
|
||||
} else analyzeCopy(element, KaDanglingFileResolutionMode.PREFER_SELF) {
|
||||
prepareContext(element)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,11 @@ import org.jetbrains.kotlin.analysis.api.projectStructure.KaLibraryModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaLibrarySourceModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaModuleProvider
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.allDirectDependencies
|
||||
import org.jetbrains.kotlin.analysis.api.renderer.types.impl.KtTypeRendererForSource
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KaCallableSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KaFunctionSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.receiverType
|
||||
import org.jetbrains.kotlin.analysis.project.structure.*
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex
|
||||
import org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelPropertyFqnNameIndex
|
||||
|
||||
@@ -13,11 +13,11 @@ import org.jetbrains.kotlin.analysis.api.annotations.*
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtDataFlowExitPointSnapshot
|
||||
import org.jetbrains.kotlin.analysis.api.components.KtDiagnosticCheckerFilter
|
||||
import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KaFirDiagnostic
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaDanglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KaCallableSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KaAnnotatedSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtNonErrorClassType
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtType
|
||||
import org.jetbrains.kotlin.analysis.project.structure.DanglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.base.util.names.FqNames
|
||||
import org.jetbrains.kotlin.idea.base.util.names.FqNames.OptInFqNames.isRequiresOptInFqName
|
||||
@@ -158,6 +158,7 @@ internal class ExtractionDataAnalyzer(private val extractionData: ExtractionData
|
||||
abstract fun registerModifiedVar(e: KtProperty)
|
||||
}
|
||||
|
||||
@OptIn(KaNonPublicApi::class)
|
||||
override fun createOutputDescriptor(): OutputDescriptor<KtType> {
|
||||
analyze(extractionData.commonParent) {
|
||||
val exitSnapshot: KtDataFlowExitPointSnapshot = getExitPointSnapshot(extractionData.expressions)
|
||||
@@ -232,7 +233,7 @@ internal class ExtractionDataAnalyzer(private val extractionData: ExtractionData
|
||||
)
|
||||
|
||||
val generatedDeclaration = Generator.generateDeclaration(config, null).declaration
|
||||
val illegalSuspendInside = analyzeCopy(generatedDeclaration, DanglingFileResolutionMode.PREFER_SELF) {
|
||||
val illegalSuspendInside = analyzeCopy(generatedDeclaration, KaDanglingFileResolutionMode.PREFER_SELF) {
|
||||
generatedDeclaration.descendantsOfType<KtExpression>()
|
||||
.flatMap {
|
||||
it.getDiagnostics(KtDiagnosticCheckerFilter.ONLY_COMMON_CHECKERS)
|
||||
@@ -348,7 +349,7 @@ fun ExtractableCodeDescriptor.validate(target: ExtractionTarget = ExtractionTarg
|
||||
)
|
||||
val result = Generator.generateDeclaration(config, null)
|
||||
|
||||
return analyzeCopy(result.declaration, DanglingFileResolutionMode.PREFER_SELF) {
|
||||
return analyzeCopy(result.declaration, KaDanglingFileResolutionMode.PREFER_SELF) {
|
||||
validateTempResult(result)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import org.jetbrains.kotlin.analysis.api.KaExperimentalApi
|
||||
import org.jetbrains.kotlin.analysis.api.KaSession
|
||||
import org.jetbrains.kotlin.analysis.api.analyze
|
||||
import org.jetbrains.kotlin.analysis.api.analyzeCopy
|
||||
import org.jetbrains.kotlin.analysis.api.projectStructure.KaDanglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.markers.KaSymbolWithVisibility
|
||||
import org.jetbrains.kotlin.analysis.project.structure.DanglingFileResolutionMode
|
||||
import org.jetbrains.kotlin.asJava.toLightElements
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle
|
||||
@@ -193,8 +193,8 @@ private fun KtNamedDeclaration.isVisibleTo(usage: PsiElement): Boolean {
|
||||
}
|
||||
|
||||
private fun KtNamedDeclaration.kotlinIsVisibleTo(usage: KtElement) = when {
|
||||
!isPhysical -> analyzeCopy(this, DanglingFileResolutionMode.PREFER_SELF) { isVisibleTo(usage) }
|
||||
!usage.isPhysical -> analyzeCopy(usage, DanglingFileResolutionMode.PREFER_SELF) { isVisibleTo(usage) }
|
||||
!isPhysical -> analyzeCopy(this, KaDanglingFileResolutionMode.PREFER_SELF) { isVisibleTo(usage) }
|
||||
!usage.isPhysical -> analyzeCopy(usage, KaDanglingFileResolutionMode.PREFER_SELF) { isVisibleTo(usage) }
|
||||
else -> analyze(this) { isVisibleTo(usage) }
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ fun checkModuleDependencyConflictsForInternalUsages(
|
||||
tryFindConflict {
|
||||
val usageElement = usageInfo.element ?: return@tryFindConflict null
|
||||
val referencedDeclaration = usageInfo.upToDateReferencedElement as? PsiNamedElement ?: return@tryFindConflict null
|
||||
analyzeCopy(refExprCopy, DanglingFileResolutionMode.PREFER_SELF) {
|
||||
analyzeCopy(refExprCopy, KaDanglingFileResolutionMode.PREFER_SELF) {
|
||||
if (refExprCopy.mainReference.resolveToSymbol() == null) {
|
||||
val module = refExprCopy.containingModule() ?: return@analyzeCopy null
|
||||
usageElement.createAccessibilityConflictInternal(referencedDeclaration, module)
|
||||
|
||||
Reference in New Issue
Block a user