[analysis] remove redundant OptIn annotations

This commit is contained in:
Dmitry Gridin
2022-08-12 21:28:32 +02:00
parent 8dbdea39da
commit c9e9ee90a3
20 changed files with 0 additions and 26 deletions
@@ -40,7 +40,6 @@ abstract class AbstractDiagnosticsDataClassRenderer : DiagnosticListRenderer() {
printGeneratedMessage() printGeneratedMessage()
} }
@OptIn(ExperimentalStdlibApi::class)
protected fun collectImports(diagnosticList: HLDiagnosticList): Collection<String> = buildSet { protected fun collectImports(diagnosticList: HLDiagnosticList): Collection<String> = buildSet {
addAll(defaultImports) addAll(defaultImports)
for (diagnostic in diagnosticList.diagnostics) { for (diagnostic in diagnosticList.diagnostics) {
@@ -53,7 +53,6 @@ object KtDiagnosticClassImplementationRenderer : AbstractDiagnosticsDataClassRen
println(",") println(",")
} }
@OptIn(ExperimentalStdlibApi::class)
override fun collectImportsForDiagnosticParameter(diagnosticParameter: HLDiagnosticParameter): Collection<String> = buildSet { override fun collectImportsForDiagnosticParameter(diagnosticParameter: HLDiagnosticParameter): Collection<String> = buildSet {
diagnosticParameter.type.collectClassNamesTo(this) diagnosticParameter.type.collectClassNamesTo(this)
} }
@@ -46,7 +46,6 @@ object KtDiagnosticClassRenderer : AbstractDiagnosticsDataClassRenderer() {
} }
} }
@OptIn(ExperimentalStdlibApi::class)
override fun collectImportsForDiagnosticParameter(diagnosticParameter: HLDiagnosticParameter): Collection<String> = buildSet { override fun collectImportsForDiagnosticParameter(diagnosticParameter: HLDiagnosticParameter): Collection<String> = buildSet {
diagnosticParameter.type.collectClassNamesTo(this) diagnosticParameter.type.collectClassNamesTo(this)
} }
@@ -612,7 +612,6 @@ internal class KtFirCallResolver(
) )
} }
@OptIn(SymbolInternals::class)
private fun getOperationPartiallyAppliedSymbolsForIncOrDecOperation( private fun getOperationPartiallyAppliedSymbolsForIncOrDecOperation(
fir: FirFunctionCall, fir: FirFunctionCall,
arrayAccessExpression: KtArrayAccessExpression, arrayAccessExpression: KtArrayAccessExpression,
@@ -705,7 +704,6 @@ internal class KtFirCallResolver(
) )
} }
@OptIn(SymbolInternals::class)
private fun FirExpression.toKtReceiverValue(): KtReceiverValue? { private fun FirExpression.toKtReceiverValue(): KtReceiverValue? {
val psi = psi val psi = psi
return when (this) { return when (this) {
@@ -738,18 +736,14 @@ internal class KtFirCallResolver(
} }
} }
@OptIn(SymbolInternals::class)
private fun FirCallableSymbol<*>.toKtSignature(): KtCallableSignature<KtCallableSymbol> = private fun FirCallableSymbol<*>.toKtSignature(): KtCallableSignature<KtCallableSymbol> =
firSymbolBuilder.callableBuilder.buildCallableSignature(this) firSymbolBuilder.callableBuilder.buildCallableSignature(this)
@OptIn(SymbolInternals::class)
private fun FirClassLikeSymbol<*>.toKtSymbol(): KtClassLikeSymbol = firSymbolBuilder.classifierBuilder.buildClassLikeSymbol(this) private fun FirClassLikeSymbol<*>.toKtSymbol(): KtClassLikeSymbol = firSymbolBuilder.classifierBuilder.buildClassLikeSymbol(this)
@OptIn(SymbolInternals::class)
private fun FirNamedFunctionSymbol.toKtSignature(): KtFunctionLikeSignature<KtFunctionSymbol> = private fun FirNamedFunctionSymbol.toKtSignature(): KtFunctionLikeSignature<KtFunctionSymbol> =
firSymbolBuilder.functionLikeBuilder.buildFunctionSignature(this) firSymbolBuilder.functionLikeBuilder.buildFunctionSignature(this)
@OptIn(SymbolInternals::class)
private fun FirVariableSymbol<*>.toKtSignature(): KtVariableLikeSignature<KtVariableLikeSymbol> = private fun FirVariableSymbol<*>.toKtSignature(): KtVariableLikeSignature<KtVariableLikeSymbol> =
firSymbolBuilder.variableLikeBuilder.buildVariableLikeSignature(this) firSymbolBuilder.variableLikeBuilder.buildVariableLikeSignature(this)
@@ -210,7 +210,6 @@ private class FirShorteningContext(val analysisSession: KtFirAnalysisSession) {
return element return element
} }
@OptIn(ExperimentalStdlibApi::class)
fun findScopesAtPosition( fun findScopesAtPosition(
position: KtElement, position: KtElement,
newImports: List<FqName>, newImports: List<FqName>,
@@ -207,7 +207,6 @@ internal class KtFirScopeProvider(
val nonLocalScopes = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.scope }.distinct() val nonLocalScopes = towerDataContext.nonLocalTowerDataElements.mapNotNull { it.scope }.distinct()
val firLocalScopes = towerDataContext.localScopes val firLocalScopes = towerDataContext.localScopes
@OptIn(ExperimentalStdlibApi::class)
val allKtScopes = buildList<KtScope> { val allKtScopes = buildList<KtScope> {
implicitReceiverScopes.mapTo(this, ::convertToKtScope) implicitReceiverScopes.mapTo(this, ::convertToKtScope)
nonLocalScopes.mapTo(this, ::convertToKtScope) nonLocalScopes.mapTo(this, ::convertToKtScope)
@@ -394,7 +394,6 @@ internal object FirReferenceResolveHelper {
return listOf(symbolBuilder.buildSymbol(fir.symbol)) return listOf(symbolBuilder.buildSymbol(fir.symbol))
} }
@OptIn(ExperimentalStdlibApi::class)
private fun getSymbolsByResolvedImport( private fun getSymbolsByResolvedImport(
expression: KtSimpleNameExpression, expression: KtSimpleNameExpression,
builder: KtSymbolByFirBuilder, builder: KtSymbolByFirBuilder,
@@ -47,7 +47,6 @@ internal class KtFirStarImportingScope(
override fun getConstructors(): Sequence<KtConstructorSymbol> = withValidityAssertion { emptySequence() } override fun getConstructors(): Sequence<KtConstructorSymbol> = withValidityAssertion { emptySequence() }
// todo cache? // todo cache?
@OptIn(ExperimentalStdlibApi::class)
override fun getPossibleCallableNames(): Set<Name> = withValidityAssertion { override fun getPossibleCallableNames(): Set<Name> = withValidityAssertion {
imports.flatMapTo(hashSetOf()) { import: Import -> imports.flatMapTo(hashSetOf()) { import: Import ->
if (import.relativeClassName == null) { // top level callable if (import.relativeClassName == null) { // top level callable
@@ -30,7 +30,6 @@ object AnalysisApiLibraryBaseTestServiceRegistrar : AnalysisApiTestServiceRegist
override fun registerProjectServices(project: MockProject, testServices: TestServices) { override fun registerProjectServices(project: MockProject, testServices: TestServices) {
} }
@OptIn(TestInfrastructureInternals::class)
override fun registerApplicationServices(application: MockApplication, testServices: TestServices) { override fun registerApplicationServices(application: MockApplication, testServices: TestServices) {
application.apply { application.apply {
registerService(ClsKotlinBinaryClassCache::class.java) registerService(ClsKotlinBinaryClassCache::class.java)
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.analysis.api.*
import org.jetbrains.kotlin.analysis.providers.createProjectWideOutOfBlockModificationTracker import org.jetbrains.kotlin.analysis.providers.createProjectWideOutOfBlockModificationTracker
import kotlin.reflect.KClass import kotlin.reflect.KClass
@OptIn(KtAllowAnalysisOnEdt::class)
public class KtReadActionConfinementLifetimeToken(project: Project) : KtLifetimeToken() { public class KtReadActionConfinementLifetimeToken(project: Project) : KtLifetimeToken() {
private val modificationTracker = project.createProjectWideOutOfBlockModificationTracker() private val modificationTracker = project.createProjectWideOutOfBlockModificationTracker()
private val onCreatedTimeStamp = modificationTracker.modificationCount private val onCreatedTimeStamp = modificationTracker.modificationCount
@@ -30,7 +30,6 @@ import java.io.File
import java.nio.file.Path import java.nio.file.Path
import java.nio.file.Paths import java.nio.file.Paths
@OptIn(ExperimentalStdlibApi::class)
abstract class KtModuleByCompilerConfiguration( abstract class KtModuleByCompilerConfiguration(
val project: Project, val project: Project,
val testModule: TestModule, val testModule: TestModule,
@@ -66,7 +66,6 @@ object KtMainModuleFactoryForSourceModules : KtMainModuleFactory {
} }
object TestModuleStructureFactory { object TestModuleStructureFactory {
@OptIn(TestInfrastructureInternals::class)
fun createProjectStructureByTestStructure( fun createProjectStructureByTestStructure(
moduleStructure: TestModuleStructure, moduleStructure: TestModuleStructure,
testServices: TestServices, testServices: TestServices,
@@ -97,7 +97,6 @@ object KtDeclarationAndFirDeclarationEqualityChecker {
return true return true
} }
@OptIn(ExperimentalStdlibApi::class)
private fun FirTypeRef.renderTypeAsKotlinType(isVararg: Boolean = false): String { private fun FirTypeRef.renderTypeAsKotlinType(isVararg: Boolean = false): String {
val rendered = when (this) { val rendered = when (this) {
is FirResolvedTypeRef -> type.renderTypeAsKotlinType() is FirResolvedTypeRef -> type.renderTypeAsKotlinType()
@@ -147,7 +146,6 @@ object KtDeclarationAndFirDeclarationEqualityChecker {
return "kotlin.Array<out $this>" return "kotlin.Array<out $this>"
} }
@OptIn(ExperimentalStdlibApi::class)
private val classIdToName: Map<String, String> = buildList<Pair<String, String>> { private val classIdToName: Map<String, String> = buildList<Pair<String, String>> {
StandardClassIds.primitiveArrayTypeByElementType.mapTo(this) { (classId, arrayClassId) -> StandardClassIds.primitiveArrayTypeByElementType.mapTo(this) { (classId, arrayClassId) ->
classId.asString().replace('/', '.') to arrayClassId.asString().replace('/', '.') classId.asString().replace('/', '.') to arrayClassId.asString().replace('/', '.')
@@ -57,7 +57,6 @@ internal class FileStructure private constructor(
?: error("FileStructureElement for was not defined for \n${declaration.getElementTextInContext()}") ?: error("FileStructureElement for was not defined for \n${declaration.getElementTextInContext()}")
} }
@OptIn(ExperimentalStdlibApi::class)
fun getAllDiagnosticsForFile(diagnosticCheckerFilter: DiagnosticCheckerFilter): Collection<KtPsiDiagnostic> { fun getAllDiagnosticsForFile(diagnosticCheckerFilter: DiagnosticCheckerFilter): Collection<KtPsiDiagnostic> {
val structureElements = getAllStructureElements() val structureElements = getAllStructureElements()
@@ -189,7 +189,6 @@ internal open class FirElementsRecorder : FirVisitor<Unit, MutableMap<KtElement,
} }
companion object { companion object {
@OptIn(ExperimentalStdlibApi::class)
fun recordElementsFrom(firElement: FirElement, recorder: FirElementsRecorder): Map<KtElement, FirElement> = fun recordElementsFrom(firElement: FirElement, recorder: FirElementsRecorder): Map<KtElement, FirElement> =
buildMap { firElement.accept(recorder, this) } buildMap { firElement.accept(recorder, this) }
} }
@@ -24,7 +24,6 @@ class LLFirBuiltinSymbolProvider(
moduleData: FirModuleData, moduleData: FirModuleData,
kotlinScopeProvider: FirKotlinScopeProvider kotlinScopeProvider: FirKotlinScopeProvider
) : FirBuiltinSymbolProvider(session, moduleData, kotlinScopeProvider) { ) : FirBuiltinSymbolProvider(session, moduleData, kotlinScopeProvider) {
@OptIn(ExperimentalStdlibApi::class)
private val functionsCache = session.firCachesFactory.createCache { callableId: CallableId -> private val functionsCache = session.firCachesFactory.createCache { callableId: CallableId ->
buildList { buildList {
getTopLevelFunctionSymbolsToByPackageFragments(this, callableId.packageName, callableId.callableName) getTopLevelFunctionSymbolsToByPackageFragments(this, callableId.packageName, callableId.callableName)
@@ -10,7 +10,6 @@ import org.jetbrains.kotlin.analysis.project.structure.KtModule
import org.jetbrains.kotlin.fir.BuiltinTypes import org.jetbrains.kotlin.fir.BuiltinTypes
import org.jetbrains.kotlin.fir.PrivateSessionConstructor import org.jetbrains.kotlin.fir.PrivateSessionConstructor
@OptIn(PrivateSessionConstructor::class)
class LLFirBuiltinsAndCloneableSession @PrivateSessionConstructor constructor( class LLFirBuiltinsAndCloneableSession @PrivateSessionConstructor constructor(
override val ktModule: KtModule, override val ktModule: KtModule,
project: Project, project: Project,
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.fir.PrivateSessionConstructor
/** /**
* [org.jetbrains.kotlin.fir.FirSession] responsible for all libraries analysing module transitively depends on * [org.jetbrains.kotlin.fir.FirSession] responsible for all libraries analysing module transitively depends on
*/ */
@OptIn(PrivateSessionConstructor::class)
internal class LLFirLibrarySession @PrivateSessionConstructor constructor( internal class LLFirLibrarySession @PrivateSessionConstructor constructor(
override val ktModule: KtModule, override val ktModule: KtModule,
project: Project, project: Project,
@@ -114,7 +114,6 @@ private class LLFirSessionsCache {
return newMappings to result return newMappings to result
} }
@OptIn(ExperimentalStdlibApi::class)
private fun getSessions(): Map<KtModule, LLFirSession> = buildMap { private fun getSessions(): Map<KtModule, LLFirSession> = buildMap {
val sessions = mappings.values val sessions = mappings.values
val wasSessionInvalidated = sessions.associateWithTo(hashMapOf()) { false } val wasSessionInvalidated = sessions.associateWithTo(hashMapOf()) { false }
@@ -92,7 +92,6 @@ abstract class AbstractFileStructureTest : AbstractLowLevelApiSingleFileTest() {
return session.moduleComponents.fileStructureCache.getFileStructure(this) return session.moduleComponents.fileStructureCache.getFileStructure(this)
} }
@OptIn(ExperimentalStdlibApi::class)
private fun FileStructure.getAllStructureElements(ktFile: KtFile): Collection<FileStructureElement> = buildSet { private fun FileStructure.getAllStructureElements(ktFile: KtFile): Collection<FileStructureElement> = buildSet {
ktFile.forEachDescendantOfType<KtElement> { ktElement -> ktFile.forEachDescendantOfType<KtElement> { ktElement ->
add(getStructureElementFor(ktElement)) add(getStructureElementFor(ktElement))