From f66a1556837d15c9a26833cebc61b753e26c38e3 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 19 Feb 2021 17:51:37 +0100 Subject: [PATCH] FIR IDE: use common spelling for analyse functions family --- .../KotlinFirLookupElementFactory.kt | 4 ++-- .../KotlinUsageTypeProviderFirImpl.kt | 4 ++-- .../idea/fir/api/AbstractHLInspection.kt | 4 ++-- .../idea/fir/api/AbstractHLIntention.kt | 4 ++-- .../fir/highlighter/KotlinFirPsiChecker.kt | 8 ++----- ...tlinHighLevelDiagnosticHighlightingPass.kt | 4 ++-- .../jetbrains/kotlin/idea/ideaFirTestUtils.kt | 7 ++---- .../shortenRefs/AbstractFirShortenRefsTest.kt | 4 ++-- .../idea/frontend/api/KtAnalysisSession.kt | 4 ++-- .../frontend/api/KtAnalysisSessionProvider.kt | 22 +++++++++---------- .../asJava/classes/FirLightClassForFacade.kt | 8 ++----- .../idea/asJava/classes/firLightClassUtils.kt | 10 ++++----- .../idea/references/KtFirReferenceResolver.kt | 4 ++-- .../api/AbstractSymbolByFqNameTest.kt | 2 +- .../AbstractExpectedExpressionTypeTest.kt | 10 ++------- .../AbstractHLExpressionTypeTest.kt | 4 ++-- ...stractOverriddenDeclarationProviderTest.kt | 4 ++-- .../AbstractReturnExpressionTargetTest.kt | 8 +++---- .../api/fir/AbstractResolveCallTest.kt | 4 ++-- .../api/scopes/AbstractFileScopeTest.kt | 4 ++-- .../AbstractMemoryLeakInSymbolsTest.kt | 9 +++----- .../frontend/api/types/KtTypeRendererTest.kt | 8 +++---- .../org/jetbrains/kotlin/idea/testUtils.kt | 4 ++-- 23 files changed, 59 insertions(+), 85 deletions(-) diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt index 55e1b430624..cf7dbcb7071 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/completion/KotlinFirLookupElementFactory.kt @@ -19,7 +19,7 @@ import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.core.withRootPrefixIfNeeded import org.jetbrains.kotlin.idea.frontend.api.HackToForceAllowRunningAnalyzeOnEDT import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.fir.utils.addImportToFile import org.jetbrains.kotlin.idea.frontend.api.hackyAllowRunningOnEdt import org.jetbrains.kotlin.idea.frontend.api.symbols.* @@ -376,7 +376,7 @@ private fun alreadyHasImport(file: KtFile, nameToImport: FqName): Boolean { if (file.importDirectives.any { it.importPath?.fqName == nameToImport }) return true withAllowedResolve { - analyze(file) { + analyse(file) { val scopes = file.getScopeContextForFile().scopes if (!scopes.containsName(nameToImport.shortName())) return false diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProviderFirImpl.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProviderFirImpl.kt index c0093f2d15a..3a74a9ed2f2 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProviderFirImpl.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/findUsages/KotlinUsageTypeProviderFirImpl.kt @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.idea.references.mainReference import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.getParentOfTypeAndBranch import org.jetbrains.kotlin.idea.findUsages.UsageTypeEnum.* -import org.jetbrains.kotlin.idea.frontend.api.analyzeWithReadAction +import org.jetbrains.kotlin.idea.frontend.api.analyseWithReadAction import org.jetbrains.kotlin.idea.frontend.api.symbols.* import org.jetbrains.kotlin.idea.references.KtSimpleReference @@ -52,7 +52,7 @@ class KotlinUsageTypeProviderFirImpl : KotlinUsageTypeProvider() { } } - return analyzeWithReadAction(refExpr) { + return analyseWithReadAction(refExpr) { when (val targetElement = reference.resolveToSymbol()) { is KtClassOrObjectSymbol -> when { diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLInspection.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLInspection.kt index bd820d5c685..8b10f8beb73 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLInspection.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLInspection.kt @@ -11,7 +11,7 @@ import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import org.jetbrains.kotlin.idea.fir.api.applicator.* import org.jetbrains.kotlin.idea.frontend.api.HackToForceAllowRunningAnalyzeOnEDT -import org.jetbrains.kotlin.idea.frontend.api.analyzeWithReadAction +import org.jetbrains.kotlin.idea.frontend.api.analyseWithReadAction import org.jetbrains.kotlin.idea.frontend.api.hackyAllowRunningOnEdt import org.jetbrains.kotlin.idea.inspections.AbstractKotlinInspection import org.jetbrains.kotlin.psi.KtElement @@ -79,7 +79,7 @@ abstract class AbstractHLInspection( @OptIn(HackToForceAllowRunningAnalyzeOnEDT::class) private fun getInput(element: PSI): INPUT? = hackyAllowRunningOnEdt { - analyzeWithReadAction(element) { + analyseWithReadAction(element) { with(inputProvider) { provideInput(element) } } } diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLIntention.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLIntention.kt index c69ec7d216f..57296a405ad 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLIntention.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/api/AbstractHLIntention.kt @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.idea.fir.api.applicator.HLApplicator import org.jetbrains.kotlin.idea.fir.api.applicator.HLApplicatorInput import org.jetbrains.kotlin.idea.fir.api.applicator.HLApplicatorInputProvider import org.jetbrains.kotlin.idea.frontend.api.HackToForceAllowRunningAnalyzeOnEDT -import org.jetbrains.kotlin.idea.frontend.api.analyzeWithReadAction +import org.jetbrains.kotlin.idea.frontend.api.analyseWithReadAction import org.jetbrains.kotlin.idea.frontend.api.hackyAllowRunningOnEdt import org.jetbrains.kotlin.idea.intentions.SelfTargetingIntention import org.jetbrains.kotlin.psi.KtElement @@ -49,7 +49,7 @@ abstract class AbstractHLIntention( @OptIn(HackToForceAllowRunningAnalyzeOnEDT::class) private fun getInput(element: PSI): INPUT? = hackyAllowRunningOnEdt { - analyzeWithReadAction(element) { + analyseWithReadAction(element) { with(inputProvider) { provideInput(element) } } } diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinFirPsiChecker.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinFirPsiChecker.kt index 4c25a02e27e..cb0cab71116 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinFirPsiChecker.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinFirPsiChecker.kt @@ -9,13 +9,9 @@ import com.intellij.lang.annotation.AnnotationHolder import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.progress.ProcessCanceledException import com.intellij.psi.PsiElement -import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.idea.fir.highlighter.visitors.FirAfterResolveHighlightingVisitor -import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.highlighter.AbstractKotlinPsiChecker -import org.jetbrains.kotlin.idea.highlighter.Diagnostic2Annotation -import org.jetbrains.kotlin.idea.highlighter.IdeErrorMessages import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile @@ -29,7 +25,7 @@ class KotlinFirPsiChecker : AbstractKotlinPsiChecker() { if (ApplicationManager.getApplication().isDispatchThread) { throw ProcessCanceledException() } - analyze(element) { + analyse(element) { FirAfterResolveHighlightingVisitor .createListOfVisitors(this, holder) .forEach(element::accept) diff --git a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinHighLevelDiagnosticHighlightingPass.kt b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinHighLevelDiagnosticHighlightingPass.kt index bf7a6da0605..f89a5105e7d 100644 --- a/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinHighLevelDiagnosticHighlightingPass.kt +++ b/idea/idea-fir/src/org/jetbrains/kotlin/idea/fir/highlighter/KotlinHighLevelDiagnosticHighlightingPass.kt @@ -25,7 +25,7 @@ import com.intellij.openapi.project.Project import com.intellij.psi.PsiFile import org.jetbrains.kotlin.diagnostics.Severity import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.diagnostics.KtDiagnostic import org.jetbrains.kotlin.idea.frontend.api.diagnostics.KtDiagnosticWithPsi import org.jetbrains.kotlin.idea.frontend.api.diagnostics.getDefaultMessageWithFactoryName @@ -43,7 +43,7 @@ class KotlinHighLevelDiagnosticHighlightingPass( val annotationHolder = AnnotationHolderImpl(AnnotationSession(ktFile)) override fun doCollectInformation(progress: ProgressIndicator) { - analyze(ktFile) { + analyse(ktFile) { ktFile.collectDiagnosticsForFile(KtDiagnosticCheckerFilter.ONLY_COMMON_CHECKERS).forEach { diagnostic -> addDiagnostic(diagnostic) } diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/ideaFirTestUtils.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/ideaFirTestUtils.kt index 53ca25dcc2f..f453eb32f53 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/ideaFirTestUtils.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/ideaFirTestUtils.kt @@ -12,13 +12,10 @@ import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.DuplicatedFir import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProvider -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSessionProvider import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.trackers.KotlinOutOfBlockModificationTrackerFactory -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.io.File fun Throwable.shouldBeRethrown(): Boolean = when (this) { is DuplicatedFirSourceElementsException -> true @@ -31,6 +28,6 @@ internal fun Project.invalidateCaches(context: KtElement?) { (service() as KotlinFirOutOfBlockModificationTrackerFactory).incrementModificationsCount() (service() as KtFirAnalysisSessionProvider).clearCaches() if (context != null) { - executeOnPooledThreadInReadAction { analyze(context) {} } + executeOnPooledThreadInReadAction { analyse(context) {} } } } \ No newline at end of file diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/shortenRefs/AbstractFirShortenRefsTest.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/shortenRefs/AbstractFirShortenRefsTest.kt index 10b99b09299..7b54b405ba2 100644 --- a/idea/idea-fir/tests/org/jetbrains/kotlin/shortenRefs/AbstractFirShortenRefsTest.kt +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/shortenRefs/AbstractFirShortenRefsTest.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.shortenRefs import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.util.TextRange import org.jetbrains.kotlin.AbstractImportsTest -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.util.application.executeWriteCommand import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.psi.KtFile @@ -24,7 +24,7 @@ abstract class AbstractFirShortenRefsTest : AbstractImportsTest() { val shortenings = executeOnPooledThread { runReadAction { - analyze(file) { + analyse(file) { collectPossibleReferenceShortenings(file, selection) } } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt index 4c4c866000f..44d074901f4 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSession.kt @@ -15,12 +15,12 @@ import org.jetbrains.kotlin.psi.* * - Should not be accessed from event dispatch thread * - Should not be accessed outside read action * - Should not be leaked outside read action it was created in - * - To be sure that session is not leaked it is forbidden to store it in a variable, consider working with it only in [analyze] context + * - To be sure that session is not leaked it is forbidden to store it in a variable, consider working with it only in [analyse] context * - All entities retrieved from analysis session should not be leaked outside the read action KtAnalysisSession was created in * * To pass a symbol from one read action to another use [KtSymbolPointer] which can be created from a symbol by [KtSymbol.createPointer] * - * To create analysis session consider using [analyze] + * To create analysis session consider using [analyse] */ abstract class KtAnalysisSession(final override val token: ValidityToken) : ValidityTokenOwner, KtSmartCastProviderMixIn, diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt index e4e2d27bbe7..db772e84f18 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt @@ -7,19 +7,17 @@ package org.jetbrains.kotlin.idea.frontend.api import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.service -import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.progress.Task import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.utils.PrintingLogger @RequiresOptIn("To use analysis session, consider using analyze/analyzeWithReadAction/analyseInModalWindow methods") annotation class InvalidWayOfUsingAnalysisSession /** * Provides [KtAnalysisSession] by [contextElement] - * Should not be used directly, consider using [analyze]/[analyzeWithReadAction]/[analyseInModalWindow] instead + * Should not be used directly, consider using [analyse]/[analyseWithReadAction]/[analyseInModalWindow] instead */ @InvalidWayOfUsingAnalysisSession abstract class KtAnalysisSessionProvider { @@ -41,30 +39,30 @@ fun getAnalysisSessionFor(contextElement: KtElement): KtAnalysisSession = * To analyse something from EDT thread, consider using [analyseInModalWindow] * * @see KtAnalysisSession - * @see analyzeWithReadAction + * @see analyseWithReadAction */ @OptIn(InvalidWayOfUsingAnalysisSession::class) -inline fun analyze(contextElement: KtElement, action: KtAnalysisSession.() -> R): R = +inline fun analyse(contextElement: KtElement, action: KtAnalysisSession.() -> R): R = getAnalysisSessionFor(contextElement).action() /** - * Execute given [action] in [KtAnalysisSession] context like [analyze] does but execute it in read action + * Execute given [action] in [KtAnalysisSession] context like [analyse] does but execute it in read action * Uses [contextElement] to get a module from which you would like to see the other modules * Usually [contextElement] is some element form the module you currently analysing now * * Should be called from read action * To analyse something from EDT thread, consider using [analyseInModalWindow] - * If you are already in read action, consider using [analyze] + * If you are already in read action, consider using [analyse] * * @see KtAnalysisSession - * @see analyze + * @see analyse */ -inline fun analyzeWithReadAction( +inline fun analyseWithReadAction( contextElement: KtElement, crossinline action: KtAnalysisSession.() -> R ): R = runReadAction { - analyze(contextElement, action) + analyse(contextElement, action) } /** @@ -72,7 +70,7 @@ inline fun analyzeWithReadAction( * and execute given [action] task with [KtAnalysisSession] context * If [action] throws some exception, then [analyseInModalWindow] will rethrow it * Should be executed from EDT only - * If you want to analyse something from non-EDT thread, consider using [analyze]/[analyzeWithReadAction] + * If you want to analyse something from non-EDT thread, consider using [analyse]/[analyseWithReadAction] */ inline fun analyseInModalWindow( contextElement: KtElement, @@ -81,7 +79,7 @@ inline fun analyseInModalWindow( ): R { ApplicationManager.getApplication().assertIsDispatchThread() val task = object : Task.WithResult(contextElement.project, windowTitle, /*canBeCancelled*/ true) { - override fun compute(indicator: ProgressIndicator): R = analyzeWithReadAction(contextElement) { action() } + override fun compute(indicator: ProgressIndicator): R = analyseWithReadAction(contextElement) { action() } } task.queue() return task.result diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt index 52850b5be27..f4e7f6b8633 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/FirLightClassForFacade.kt @@ -11,24 +11,20 @@ import com.intellij.psi.* import com.intellij.psi.impl.light.LightEmptyImplementsList import com.intellij.psi.impl.light.LightModifierList import org.jetbrains.annotations.NonNls -import org.jetbrains.kotlin.asJava.classes.* import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade import org.jetbrains.kotlin.asJava.classes.lazyPub import org.jetbrains.kotlin.asJava.elements.* import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName -import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.idea.KotlinLanguage import org.jetbrains.kotlin.idea.asJava.classes.createField import org.jetbrains.kotlin.idea.asJava.classes.createMethods -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext import org.jetbrains.kotlin.idea.frontend.api.scopes.KtDeclarationScope import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtKotlinPropertySymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFileSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithDeclarations import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.KtSymbolWithVisibility import org.jetbrains.kotlin.load.java.structure.LightClassOriginKind @@ -52,7 +48,7 @@ class FirLightClassForFacade( private val fileSymbols by lazyPub { files.map { ktFile -> - analyze(ktFile) { + analyse(ktFile) { ktFile.getFileSymbol() } } diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt index 198333df673..0aa4ae30ed7 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/asJava/classes/firLightClassUtils.kt @@ -17,7 +17,7 @@ import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.symbols.StandardClassIds import org.jetbrains.kotlin.idea.asJava.* import org.jetbrains.kotlin.idea.frontend.api.HackToForceAllowRunningAnalyzeOnEDT -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.fir.analyzeWithSymbolAsContext import org.jetbrains.kotlin.idea.frontend.api.hackyAllowRunningOnEdt import org.jetbrains.kotlin.idea.frontend.api.symbols.* @@ -57,7 +57,7 @@ fun createFirLightClassNoCache(classOrObject: KtClassOrObject): KtLightClass? = val anonymousObject = classOrObject.parent as? KtObjectLiteralExpression if (anonymousObject != null) { - return analyze(anonymousObject) { + return analyse(anonymousObject) { FirLightAnonymousClassForSymbol(anonymousObject.getAnonymousObjectSymbol(), anonymousObject.manager) } } @@ -67,7 +67,7 @@ fun createFirLightClassNoCache(classOrObject: KtClassOrObject): KtLightClass? = classOrObject.hasModifier(KtTokens.INLINE_KEYWORD) -> return null //TODO else -> { - analyze(classOrObject) { + analyse(classOrObject) { when (val symbol = classOrObject.getClassOrObjectSymbol()) { is KtAnonymousObjectSymbol -> FirLightAnonymousClassForSymbol(symbol, classOrObject.manager) is KtNamedClassOrObjectSymbol -> when (symbol.classKind) { @@ -333,11 +333,11 @@ internal fun KtSymbolWithMembers.createInnerClasses(manager: PsiManager): List { check(ref is AbstractKtReference<*>) { "reference should be AbstractKtReference, but was ${ref::class}" } return runInPossiblyEdtThread { val resolveToPsiElements = try { - analyze(ref.expression) { ref.getResolvedToPsi(this) } + analyse(ref.expression) { ref.getResolvedToPsi(this) } } catch (e: Throwable) { if (e is ControlFlowException) throw e throw KtReferenceResolveException(ref, e) diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/AbstractSymbolByFqNameTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/AbstractSymbolByFqNameTest.kt index 7a144ca3b12..0a65c72b6bb 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/AbstractSymbolByFqNameTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/AbstractSymbolByFqNameTest.kt @@ -23,7 +23,7 @@ abstract class AbstractSymbolByFqNameTest : KotlinLightCodeInsightFixtureTestCas val symbolData = SymbolByFqName.getSymbolDataFromFile(Paths.get(path)) val renderedSymbols = executeOnPooledThreadInReadAction { - analyze(fakeKtFile) { + analyse(fakeKtFile) { val symbols = createSymbols(symbolData) symbols.map { DebugSymbolRenderer.render(it) } } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractExpectedExpressionTypeTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractExpectedExpressionTypeTest.kt index a6e22a9b354..8a7838a84a8 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractExpectedExpressionTypeTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractExpectedExpressionTypeTest.kt @@ -6,18 +6,12 @@ package org.jetbrains.kotlin.idea.frontend.api.components import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.PsiComment import com.intellij.psi.util.parentOfType -import junit.framework.Assert import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtReturnExpression -import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType -import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.uitls.IgnoreTests import java.io.File @@ -33,7 +27,7 @@ abstract class AbstractExpectedExpressionTypeTest : KotlinLightCodeInsightFixtur ?: error("No element was found at caret or no is present in the test file") val actualExpectedTypeText: String? = executeOnPooledThreadInReadAction { - analyze(ktFile) { + analyse(ktFile) { expressionAtCaret.getExpectedType()?.asStringForDebugging() } } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractHLExpressionTypeTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractHLExpressionTypeTest.kt index 8a5de39743a..c091ddf642b 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractHLExpressionTypeTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractHLExpressionTypeTest.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.idea.frontend.api.components import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.test.framework.AbstractKtIdeaTest import org.jetbrains.kotlin.idea.test.framework.TestFileStructure import org.jetbrains.kotlin.idea.test.framework.TestStructureExpectedDataBlock @@ -20,7 +20,7 @@ abstract class AbstractHLExpressionTypeTest : AbstractKtIdeaTest() { val expression = fileStructure.mainFile.selectedExpression as KtExpression? ?: error("Selected expression was not provided") val type = executeOnPooledThreadInReadAction { - analyze(expression) { expression.getKtType().render() } + analyse(expression) { expression.getKtType().render() } } val actual = TestStructureRenderer.render( fileStructure, diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt index 459ebdabe25..ab8367209f6 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt @@ -9,7 +9,7 @@ import com.intellij.psi.util.parentOfType import com.intellij.psi.util.parentsOfType import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSyntheticJavaPropertySymbol @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.test.KotlinTestUtils abstract class AbstractOverriddenDeclarationProviderTest : AbstractKtIdeaTest() { override fun doTestByFileStructure(fileStructure: TestFileStructure) { val signatures = executeOnPooledThreadInReadAction { - analyze(fileStructure.mainKtFile) { + analyse(fileStructure.mainKtFile) { val symbol = getElementOfTypeAtCaret().getSymbol() as KtCallableSymbol val allOverriddenSymbols = symbol.getAllOverriddenSymbols().map { renderSignature(it) } val directlyOverriddenSymbols = symbol.getDirectlyOverriddenSymbols().map { renderSignature(it) } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractReturnExpressionTargetTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractReturnExpressionTargetTest.kt index 64d7b6b8c4c..4765983201c 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractReturnExpressionTargetTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/components/AbstractReturnExpressionTargetTest.kt @@ -10,10 +10,8 @@ import com.intellij.psi.PsiComment import com.intellij.psi.util.parentOfType import junit.framework.Assert import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.util.application.executeOnPooledThread -import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtReturnExpression @@ -34,8 +32,8 @@ abstract class AbstractReturnExpressionTargetTest : KotlinLightCodeInsightFixtur val expectedReturnTarget = ktFile.getExpectedReturnTarget() val actualReturnTargetPsi: KtDeclaration? = executeOnPooledThreadInReadAction { - analyze(ktFile) { - val actualReturnTargetSymbol = ktReturnExpressionAtCaret.getReturnTargetSymbol() ?: return@analyze null + analyse(ktFile) { + val actualReturnTargetSymbol = ktReturnExpressionAtCaret.getReturnTargetSymbol() ?: return@analyse null actualReturnTargetSymbol.psi as KtDeclaration } } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt index 3964098ef59..9fac96d8586 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/fir/AbstractResolveCallTest.kt @@ -12,7 +12,7 @@ import com.intellij.testFramework.LightCodeInsightTestCase import org.jetbrains.kotlin.idea.addExternalTestFiles import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.calls.KtCall import org.jetbrains.kotlin.idea.frontend.api.calls.KtErrorCallTarget import org.jetbrains.kotlin.idea.frontend.api.calls.KtSuccessCallTarget @@ -45,7 +45,7 @@ abstract class AbstractResolveCallTest : @Suppress("DEPRECATION") LightCodeInsig } val actualText = executeOnPooledThreadInReadAction { - val callInfos = analyze(file as KtFile) { + val callInfos = analyse(file as KtFile) { elements.map { resolveCall(it) } } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/scopes/AbstractFileScopeTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/scopes/AbstractFileScopeTest.kt index 43508cd439f..395f54953df 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/scopes/AbstractFileScopeTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/scopes/AbstractFileScopeTest.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.idea.frontend.api.scopes import com.intellij.openapi.util.io.FileUtil import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.symbols.DebugSymbolRenderer import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtFile @@ -20,7 +20,7 @@ abstract class AbstractFileScopeTest : KotlinLightCodeInsightFixtureTestCase() { val ktFile = myFixture.configureByText("file.kt", FileUtil.loadFile(File(path))) as KtFile val actual = executeOnPooledThreadInReadAction { - analyze(ktFile) { + analyse(ktFile) { val symbol = ktFile.getFileSymbol() val scope = symbol.getFileScope() diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt index 98fce406e89..240bc186f5b 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt @@ -14,23 +14,20 @@ import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProvider -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSessionProvider import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol -import org.jetbrains.kotlin.idea.frontend.api.fir.utils.EntityWasGarbageCollectedException import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType import org.jetbrains.kotlin.trackers.KotlinOutOfBlockModificationTrackerFactory -import sun.management.HotSpotDiagnostic import java.io.File import java.lang.management.ManagementFactory import java.nio.file.Path import java.nio.file.Paths import java.text.SimpleDateFormat import java.util.* -import kotlin.io.path.absolute abstract class AbstractMemoryLeakInSymbolsTest : KotlinLightCodeInsightFixtureTestCase() { override fun isFirPlugin() = true @@ -39,7 +36,7 @@ abstract class AbstractMemoryLeakInSymbolsTest : KotlinLightCodeInsightFixtureTe val testDataFile = File(path) val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile val symbols = executeOnPooledThreadInReadAction { - analyze(ktFile) { + analyse(ktFile) { ktFile.collectDescendantsOfType().map { it.getSymbol() } } } @@ -67,7 +64,7 @@ abstract class AbstractMemoryLeakInSymbolsTest : KotlinLightCodeInsightFixtureTe (project.service() as KotlinFirOutOfBlockModificationTrackerFactory).incrementModificationsCount() project.service().incModificationCount() (project.service() as KtFirAnalysisSessionProvider).clearCaches() - executeOnPooledThreadInReadAction { analyze(ktFile) {} } + executeOnPooledThreadInReadAction { analyse(ktFile) {} } } private fun KtSymbol.hasNoFirElementLeak(): LeakCheckResult { diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt index 7af01d14f71..d4f9891257e 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/frontend/api/types/KtTypeRendererTest.kt @@ -7,11 +7,9 @@ package org.jetbrains.kotlin.idea.frontend.api.types import com.intellij.testFramework.LightProjectDescriptor import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.analyze -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeRendererOptions import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtFunction @@ -31,7 +29,7 @@ class KtTypeRendererTest : KotlinLightCodeInsightFixtureTestCase() { val fakeKtFile = myFixture.configureByText("file.kt", "fun ${typeArgumentsRendered}foo(): $type = 1") as KtFile val property = fakeKtFile.declarations.single() as KtFunction val renderedType = executeOnPooledThreadInReadAction { - analyze(fakeKtFile) { + analyse(fakeKtFile) { val ktType = property.getReturnKtType() ktType.render(rendererOptions) } @@ -47,7 +45,7 @@ class KtTypeRendererTest : KotlinLightCodeInsightFixtureTestCase() { val fakeKtFile = myFixture.configureByText("file.kt", "val a = $expression") as KtFile val property = fakeKtFile.declarations.single() as KtProperty val renderedType = executeOnPooledThreadInReadAction { - analyze(fakeKtFile) { + analyse(fakeKtFile) { val ktType = property.initializer?.getKtType() ?: error("fake property should have initializer") ktType.render(rendererOptions) diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/testUtils.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/testUtils.kt index 15dcbaaabd1..b332d467731 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/testUtils.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/testUtils.kt @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.idea.util.application.runWriteAction import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.DuplicatedFirSourceElementsException import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.analyze +import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.psi.KtElement import java.io.File @@ -22,7 +22,7 @@ fun executeOnPooledThreadInReadAction(action: () -> R): R = inline fun analyseOnPooledThreadInReadAction(context: KtElement, crossinline action: KtAnalysisSession.() -> R): R = executeOnPooledThreadInReadAction { - analyze(context) { action() } + analyse(context) { action() } }