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