Fix OVERRIDE_DEPRECATION warnings in project code

This commit is contained in:
Dmitriy Novozhilov
2021-08-30 12:31:11 +03:00
parent 69c3831865
commit d46e2dd749
34 changed files with 70 additions and 33 deletions
@@ -72,7 +72,7 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
server.scheduleShutdown(graceful) server.scheduleShutdown(graceful)
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun remoteCompile( override fun remoteCompile(
sessionId: Int, sessionId: Int,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -84,7 +84,7 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
operationsTracer: RemoteOperationsTracer? operationsTracer: RemoteOperationsTracer?
) = deprecated() ) = deprecated()
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun remoteIncrementalCompile( override fun remoteIncrementalCompile(
sessionId: Int, sessionId: Int,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -123,7 +123,7 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
server.clearJarCache() server.clearJarCache()
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun leaseReplSession( override fun leaseReplSession(
aliveFlagPath: String?, aliveFlagPath: String?,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -143,14 +143,17 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
server.releaseReplSession(sessionId) server.releaseReplSession(sessionId)
} }
@Deprecated("The usages should be replaced with `replCheck` method", ReplaceWith("replCheck"))
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine) = deprecated() override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine) = deprecated()
@Deprecated("The usages should be replaced with `replCompile` method", ReplaceWith("replCompile"))
override fun remoteReplLineCompile( override fun remoteReplLineCompile(
sessionId: Int, sessionId: Int,
codeLine: ReplCodeLine, codeLine: ReplCodeLine,
history: List<ReplCodeLine>? history: List<ReplCodeLine>?
) = deprecated() ) = deprecated()
@Deprecated("Evaluation on daemon is not supported")
override fun remoteReplLineEval( override fun remoteReplLineEval(
sessionId: Int, sessionId: Int,
codeLine: ReplCodeLine, codeLine: ReplCodeLine,
@@ -232,4 +235,4 @@ class CompileServiceRMIWrapper(val server: CompileServiceServerSide, daemonOptio
} }
fun CompileServiceServerSide.toRMIServer(daemonOptions: DaemonOptions, compilerId: CompilerId) = fun CompileServiceServerSide.toRMIServer(daemonOptions: DaemonOptions, compilerId: CompilerId) =
CompileServiceRMIWrapper(this, daemonOptions, compilerId) CompileServiceRMIWrapper(this, daemonOptions, compilerId)
@@ -23,7 +23,7 @@ class CompileServiceClientRMIWrapper(
private fun reportNotImplemented(): Nothing = throw IllegalStateException("Unexpected call to deprecated method") private fun reportNotImplemented(): Nothing = throw IllegalStateException("Unexpected call to deprecated method")
// deprecated methods : // deprecated methods :
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun remoteCompile( override fun remoteCompile(
sessionId: Int, sessionId: Int,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -37,7 +37,7 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented() reportNotImplemented()
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun remoteIncrementalCompile( override fun remoteIncrementalCompile(
sessionId: Int, sessionId: Int,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -51,7 +51,7 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented() reportNotImplemented()
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun leaseReplSession( override fun leaseReplSession(
aliveFlagPath: String?, aliveFlagPath: String?,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -69,12 +69,12 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented() reportNotImplemented()
} }
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> { override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> {
reportNotImplemented() reportNotImplemented()
} }
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun remoteReplLineCompile( override fun remoteReplLineCompile(
sessionId: Int, sessionId: Int,
codeLine: ReplCodeLine, codeLine: ReplCodeLine,
@@ -83,7 +83,7 @@ class CompileServiceClientRMIWrapper(
reportNotImplemented() reportNotImplemented()
} }
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun remoteReplLineEval( override fun remoteReplLineEval(
sessionId: Int, sessionId: Int,
codeLine: ReplCodeLine, codeLine: ReplCodeLine,
@@ -208,4 +208,4 @@ class CompileServiceClientRMIWrapper(
fun CompileServiceAsync.toRMI() = when (this) { fun CompileServiceAsync.toRMI() = when (this) {
is CompileServiceAsyncWrapper -> this.rmiCompileService is CompileServiceAsyncWrapper -> this.rmiCompileService
else -> CompileServiceClientRMIWrapper(this) else -> CompileServiceClientRMIWrapper(this)
} }
@@ -724,7 +724,7 @@ class CompileServiceImpl(
CompileService.CallResult.Good(res) CompileService.CallResult.Good(res)
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun remoteCompile( override fun remoteCompile(
sessionId: Int, sessionId: Int,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -750,7 +750,7 @@ class CompileServiceImpl(
} }
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun remoteIncrementalCompile( override fun remoteIncrementalCompile(
sessionId: Int, sessionId: Int,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -804,6 +804,7 @@ class CompileServiceImpl(
getICReporter = { a, b, c -> getBuildReporter(a, b!!, c)} getICReporter = { a, b, c -> getBuildReporter(a, b!!, c)}
) )
@Deprecated("The usages should be replaced with other `leaseReplSession` method", ReplaceWith("leaseReplSession"))
override fun leaseReplSession( override fun leaseReplSession(
aliveFlagPath: String?, aliveFlagPath: String?,
targetPlatform: CompileService.TargetPlatform, targetPlatform: CompileService.TargetPlatform,
@@ -842,7 +843,7 @@ class CompileServiceImpl(
// TODO: add more checks (e.g. is it a repl session) // TODO: add more checks (e.g. is it a repl session)
override fun releaseReplSession(sessionId: Int): CompileService.CallResult<Nothing> = releaseCompileSession(sessionId) override fun releaseReplSession(sessionId: Int): CompileService.CallResult<Nothing> = releaseCompileSession(sessionId)
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> = override fun remoteReplLineCheck(sessionId: Int, codeLine: ReplCodeLine): CompileService.CallResult<ReplCheckResult> =
ifAlive(minAliveness = Aliveness.Alive) { ifAlive(minAliveness = Aliveness.Alive) {
withValidRepl(sessionId) { withValidRepl(sessionId) {
@@ -882,7 +883,7 @@ class CompileServiceImpl(
return builder.build() return builder.build()
} }
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun remoteReplLineCompile( override fun remoteReplLineCompile(
sessionId: Int, sessionId: Int,
codeLine: ReplCodeLine, codeLine: ReplCodeLine,
@@ -895,7 +896,7 @@ class CompileServiceImpl(
} }
} }
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun remoteReplLineEval( override fun remoteReplLineEval(
sessionId: Int, sessionId: Int,
codeLine: ReplCodeLine, codeLine: ReplCodeLine,
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.diagnostics.WhenMissingCase import org.jetbrains.kotlin.diagnostics.WhenMissingCase
import org.jetbrains.kotlin.fir.FirModuleData import org.jetbrains.kotlin.fir.FirModuleData
import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.FirSourceElement
import org.jetbrains.kotlin.fir.analysis.diagnostics.SourceElementPositioningStrategies
import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction
import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
@@ -62,6 +62,7 @@ class IncrementalPackageFragmentProvider(
override fun isEmpty(fqName: FqName): Boolean = !fqNameToPackageFragment.containsKey(fqName) override fun isEmpty(fqName: FqName): Boolean = !fqNameToPackageFragment.containsKey(fqName)
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> { override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> {
return listOfNotNull(fqNameToPackageFragment[fqName]) return listOfNotNull(fqNameToPackageFragment[fqName])
} }
@@ -86,6 +86,7 @@ class OptionalAnnotationPackageFragmentProvider(
override fun isEmpty(fqName: FqName): Boolean = override fun isEmpty(fqName: FqName): Boolean =
!packages.containsKey(fqName) !packages.containsKey(fqName)
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> = override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> =
packages[fqName]?.let(::listOf).orEmpty() packages[fqName]?.let(::listOf).orEmpty()
@@ -241,7 +241,7 @@ private class DelegatingPackageFragmentProvider<M : ModuleInfo>(
) : PackageFragmentProviderOptimized { ) : PackageFragmentProviderOptimized {
private val syntheticFilePackages = moduleContent.syntheticFiles.map { it.packageFqName }.toSet() private val syntheticFilePackages = moduleContent.syntheticFiles.map { it.packageFqName }.toSet()
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> { override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> {
if (certainlyDoesNotExist(fqName)) return emptyList() if (certainlyDoesNotExist(fqName)) return emptyList()
@@ -11,6 +11,7 @@ class TargetedAnnotations(
) : Annotations { ) : Annotations {
override fun isEmpty(): Boolean = standardAnnotations.isEmpty() && targetedAnnotations.isEmpty() override fun isEmpty(): Boolean = standardAnnotations.isEmpty() && targetedAnnotations.isEmpty()
@Deprecated("This method should only be used in frontend where we split annotations according to their use-site targets.")
override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> = targetedAnnotations override fun getUseSiteTargetedAnnotations(): List<AnnotationWithTarget> = targetedAnnotations
override fun iterator(): Iterator<AnnotationDescriptor> = standardAnnotations.iterator() override fun iterator(): Iterator<AnnotationDescriptor> = standardAnnotations.iterator()
@@ -48,6 +48,7 @@ data class CompilerVersionImpl(
override val major: Int, override val major: Int,
override val minor: Int, override val minor: Int,
override val maintenance: Int, override val maintenance: Int,
@Deprecated("Milestone is deprecated in favour to MetaVersion's M1 and M2")
override val milestone: Int = -1, override val milestone: Int = -1,
override val build: Int = -1 override val build: Int = -1
) : CompilerVersion { ) : CompilerVersion {
@@ -41,6 +41,7 @@ class LazyJavaPackageFragmentProvider(
} }
} }
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName) = listOfNotNull(getPackageFragment(fqName)) override fun getPackageFragments(fqName: FqName) = listOfNotNull(getPackageFragment(fqName))
override fun collectPackageFragments(fqName: FqName, packageFragments: MutableCollection<PackageFragmentDescriptor>) = override fun collectPackageFragments(fqName: FqName, packageFragments: MutableCollection<PackageFragmentDescriptor>) =
@@ -26,6 +26,7 @@ interface PackageFragmentProvider {
fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName>
object Empty : PackageFragmentProvider { object Empty : PackageFragmentProvider {
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName) = emptyList<PackageFragmentDescriptor>() override fun getPackageFragments(fqName: FqName) = emptyList<PackageFragmentDescriptor>()
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean) = emptySet<FqName>() override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean) = emptySet<FqName>()
@@ -29,6 +29,7 @@ class PackageFragmentProviderImpl(
override fun isEmpty(fqName: FqName): Boolean = override fun isEmpty(fqName: FqName): Boolean =
this.packageFragments.none { it.fqName == fqName } this.packageFragments.none { it.fqName == fqName }
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> = override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> =
packageFragments.filter { it.fqName == fqName } packageFragments.filter { it.fqName == fqName }
@@ -108,7 +108,7 @@ class CompositeAnnotations(
override fun findAnnotation(fqName: FqName) = delegates.asSequence().mapNotNull { it.findAnnotation(fqName) }.firstOrNull() override fun findAnnotation(fqName: FqName) = delegates.asSequence().mapNotNull { it.findAnnotation(fqName) }.firstOrNull()
@Suppress("DEPRECATION", "OverridingDeprecatedMember") @Suppress("DEPRECATION", "OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun getUseSiteTargetedAnnotations() = delegates.flatMap { it.getUseSiteTargetedAnnotations() } override fun getUseSiteTargetedAnnotations() = delegates.flatMap { it.getUseSiteTargetedAnnotations() }
override fun iterator() = delegates.asSequence().flatMap { it.asSequence() }.iterator() override fun iterator() = delegates.asSequence().flatMap { it.asSequence() }.iterator()
@@ -32,6 +32,7 @@ class CompositePackageFragmentProvider(// can be modified from outside
} }
} }
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> { override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> {
val result = ArrayList<PackageFragmentDescriptor>() val result = ArrayList<PackageFragmentDescriptor>()
for (provider in providers) { for (provider in providers) {
@@ -52,6 +52,7 @@ abstract class AbstractDeserializedPackageFragmentProvider(
return descriptor == null return descriptor == null
} }
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> = listOfNotNull(fragments(fqName)) override fun getPackageFragments(fqName: FqName): List<PackageFragmentDescriptor> = listOfNotNull(fragments(fqName))
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> = emptySet() override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): Collection<FqName> = emptySet()
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.psi.psiUtil.createSmartPointer
public class KtPsiBasedSymbolPointer<S : KtSymbol>(private val psiPointer: SmartPsiElementPointer<out KtDeclaration>) : public class KtPsiBasedSymbolPointer<S : KtSymbol>(private val psiPointer: SmartPsiElementPointer<out KtDeclaration>) :
KtSymbolPointer<S>() { KtSymbolPointer<S>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
override fun restoreSymbol(analysisSession: KtAnalysisSession): S? { override fun restoreSymbol(analysisSession: KtAnalysisSession): S? {
val psi = psiPointer.element ?: return null val psi = psiPointer.element ?: return null
@@ -33,4 +34,4 @@ public class KtPsiBasedSymbolPointer<S : KtSymbol>(private val psiPointer: Smart
return KtPsiBasedSymbolPointer(psi.createSmartPointer()) return KtPsiBasedSymbolPointer(psi.createSmartPointer())
} }
} }
} }
@@ -35,5 +35,6 @@ public abstract class KtSymbolPointer<out S : KtSymbol> {
public inline fun <S : KtSymbol> symbolPointer(crossinline getSymbol: (KtAnalysisSession) -> S?): KtSymbolPointer<S> = public inline fun <S : KtSymbol> symbolPointer(crossinline getSymbol: (KtAnalysisSession) -> S?): KtSymbolPointer<S> =
object : KtSymbolPointer<S>() { object : KtSymbolPointer<S>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
override fun restoreSymbol(analysisSession: KtAnalysisSession): S? = getSymbol(analysisSession) override fun restoreSymbol(analysisSession: KtAnalysisSession): S? = getSymbol(analysisSession)
} }
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
internal class KtFirBackingFieldSymbolPointer( internal class KtFirBackingFieldSymbolPointer(
private val propertySymbolPointer: KtSymbolPointer<KtKotlinPropertySymbol>, private val propertySymbolPointer: KtSymbolPointer<KtKotlinPropertySymbol>,
) : KtSymbolPointer<KtBackingFieldSymbol>() { ) : KtSymbolPointer<KtBackingFieldSymbol>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
override fun restoreSymbol(analysisSession: KtAnalysisSession): KtBackingFieldSymbol? { override fun restoreSymbol(analysisSession: KtAnalysisSession): KtBackingFieldSymbol? {
require(analysisSession is KtFirAnalysisSession) require(analysisSession is KtFirAnalysisSession)
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@@ -12,8 +12,9 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.ClassId
class KtFirClassOrObjectInLibrarySymbolPointer(private val classId: ClassId) : KtSymbolPointer<KtNamedClassOrObjectSymbol>() { class KtFirClassOrObjectInLibrarySymbolPointer(private val classId: ClassId) : KtSymbolPointer<KtNamedClassOrObjectSymbol>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
override fun restoreSymbol(analysisSession: KtAnalysisSession): KtNamedClassOrObjectSymbol? { override fun restoreSymbol(analysisSession: KtAnalysisSession): KtNamedClassOrObjectSymbol? {
require(analysisSession is KtFirAnalysisSession) require(analysisSession is KtFirAnalysisSession)
return analysisSession.firSymbolBuilder.classifierBuilder.buildClassLikeSymbolByClassId(classId) as? KtNamedClassOrObjectSymbol return analysisSession.firSymbolBuilder.classifierBuilder.buildClassLikeSymbolByClassId(classId) as? KtNamedClassOrObjectSymbol
} }
} }
@@ -23,6 +23,7 @@ internal class KtFirEnumEntrySymbolPointer(
private val ownerClassId: ClassId, private val ownerClassId: ClassId,
private val name: Name private val name: Name
) : KtSymbolPointer<KtEnumEntrySymbol>() { ) : KtSymbolPointer<KtEnumEntrySymbol>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
override fun restoreSymbol(analysisSession: KtAnalysisSession): KtEnumEntrySymbol? { override fun restoreSymbol(analysisSession: KtAnalysisSession): KtEnumEntrySymbol? {
require(analysisSession is KtFirAnalysisSession) require(analysisSession is KtFirAnalysisSession)
val enumClass = getEnumClass(analysisSession, ownerClassId) val enumClass = getEnumClass(analysisSession, ownerClassId)
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.name.ClassId
internal abstract class KtFirMemberSymbolPointer<S : KtSymbol>( internal abstract class KtFirMemberSymbolPointer<S : KtSymbol>(
private val ownerClassId: ClassId, private val ownerClassId: ClassId,
) : KtSymbolPointer<S>() { ) : KtSymbolPointer<S>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
final override fun restoreSymbol(analysisSession: KtAnalysisSession): S? { final override fun restoreSymbol(analysisSession: KtAnalysisSession): S? {
require(analysisSession is KtFirAnalysisSession) require(analysisSession is KtFirAnalysisSession)
val owner = analysisSession.getClassLikeSymbol(ownerClassId) as? FirRegularClass val owner = analysisSession.getClassLikeSymbol(ownerClassId) as? FirRegularClass
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.name.ClassId
internal class KtFirSamConstructorSymbolPointer( internal class KtFirSamConstructorSymbolPointer(
private val ownerClassId: ClassId, private val ownerClassId: ClassId,
) : KtSymbolPointer<KtSamConstructorSymbol>() { ) : KtSymbolPointer<KtSamConstructorSymbol>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
override fun restoreSymbol(analysisSession: KtAnalysisSession): KtSamConstructorSymbol? { override fun restoreSymbol(analysisSession: KtAnalysisSession): KtSamConstructorSymbol? {
require(analysisSession is KtFirAnalysisSession) require(analysisSession is KtFirAnalysisSession)
val owner = analysisSession.getClassLikeSymbol(ownerClassId) as? FirRegularClass ?: return null val owner = analysisSession.getClassLikeSymbol(ownerClassId) as? FirRegularClass ?: return null
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.name.CallableId
internal abstract class KtTopLevelCallableSymbolPointer<S : KtCallableSymbol>( internal abstract class KtTopLevelCallableSymbolPointer<S : KtCallableSymbol>(
private val callableId: CallableId private val callableId: CallableId
) : KtSymbolPointer<S>() { ) : KtSymbolPointer<S>() {
@Deprecated("Consider using org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession.restoreSymbol")
final override fun restoreSymbol(analysisSession: KtAnalysisSession): S? { final override fun restoreSymbol(analysisSession: KtAnalysisSession): S? {
require(analysisSession is KtFirAnalysisSession) require(analysisSession is KtFirAnalysisSession)
val candidates = analysisSession.getCallableSymbols(callableId) val candidates = analysisSession.getCallableSymbols(callableId)
@@ -121,6 +121,7 @@ abstract class KonanArtifactTask: KonanTargetableTask(), KonanArtifactSpec {
val konanSoftwareComponent = config.mainVariant val konanSoftwareComponent = config.mainVariant
val variantName = "${artifactNameWithoutSuffix}_${target.name}" val variantName = "${artifactNameWithoutSuffix}_${target.name}"
val context = DefaultUsageContext(object:UsageContext { val context = DefaultUsageContext(object:UsageContext {
@Suppress("OVERRIDE_DEPRECATION")
override fun getUsage(): Usage = linkUsage override fun getUsage(): Usage = linkUsage
override fun getName(): String = "${variantName}Link" override fun getName(): String = "${variantName}Link"
override fun getCapabilities(): MutableSet<out Capability> = mutableSetOf() override fun getCapabilities(): MutableSet<out Capability> = mutableSetOf()
@@ -42,6 +42,7 @@ public class ExampleCommandLineProcessor : CommandLineProcessor {
override val pluginId: String = EXAMPLE_PLUGIN_ID override val pluginId: String = EXAMPLE_PLUGIN_ID
override val pluginOptions: Collection<CliOption> = listOf(EXAMPLE_OPTION, EXAMPLE_LEGACY_OPTION) override val pluginOptions: Collection<CliOption> = listOf(EXAMPLE_OPTION, EXAMPLE_LEGACY_OPTION)
@Deprecated("Implement processOption(option: AbstractCliOption, value: String, configuration: CompilerConfiguration) instead.")
override fun processOption(option: CliOption, value: String, configuration: CompilerConfiguration) { override fun processOption(option: CliOption, value: String, configuration: CompilerConfiguration) {
when (option) { when (option) {
EXAMPLE_OPTION -> configuration.put(ExampleConfigurationKeys.EXAMPLE_KEY, value) EXAMPLE_OPTION -> configuration.put(ExampleConfigurationKeys.EXAMPLE_KEY, value)
@@ -23,5 +23,6 @@ interface LanguageSettingsBuilder : LanguageSettings {
fun optIn(annotationName: String) fun optIn(annotationName: String)
@Deprecated("Unsupported and will be removed in next major releases", replaceWith = ReplaceWith("optInAnnotationsInUse"))
override val experimentalAnnotationsInUse: Set<String> override val experimentalAnnotationsInUse: Set<String>
} }
@@ -38,6 +38,8 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
} }
private var includeRuntimeField: kotlin.Boolean? = null private var includeRuntimeField: kotlin.Boolean? = null
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.ERROR)
override var includeRuntime: kotlin.Boolean override var includeRuntime: kotlin.Boolean
get() = includeRuntimeField ?: false get() = includeRuntimeField ?: false
set(value) { set(value) {
@@ -51,6 +53,7 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
javaParametersField = value javaParametersField = value
} }
@Deprecated(message = "This option is not working well with Gradle caching and will be removed in the future.", level = DeprecationLevel.WARNING)
override var jdkHome: kotlin.String? = null override var jdkHome: kotlin.String? = null
internal var jvmTargetField: kotlin.String? = null internal var jvmTargetField: kotlin.String? = null
@@ -70,6 +73,8 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
} }
private var noReflectField: kotlin.Boolean? = null private var noReflectField: kotlin.Boolean? = null
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.ERROR)
override var noReflect: kotlin.Boolean override var noReflect: kotlin.Boolean
get() = noReflectField ?: true get() = noReflectField ?: true
set(value) { set(value) {
@@ -77,6 +82,8 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
} }
private var noStdlibField: kotlin.Boolean? = null private var noStdlibField: kotlin.Boolean? = null
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.ERROR)
override var noStdlib: kotlin.Boolean override var noStdlib: kotlin.Boolean
get() = noStdlibField ?: true get() = noStdlibField ?: true
set(value) { set(value) {
@@ -84,6 +91,8 @@ internal abstract class KotlinJvmOptionsBase : org.jetbrains.kotlin.gradle.dsl.K
} }
private var useIRField: kotlin.Boolean? = null private var useIRField: kotlin.Boolean? = null
@Deprecated(message = "This option has no effect and will be removed in a future release.", level = DeprecationLevel.WARNING)
override var useIR: kotlin.Boolean override var useIR: kotlin.Boolean
get() = useIRField ?: false get() = useIRField ?: false
set(value) { set(value) {
@@ -139,6 +139,7 @@ class AndroidSyntheticPackageFragmentProvider(
override fun isEmpty(fqName: FqName): Boolean = !packages.containsKey(fqName) override fun isEmpty(fqName: FqName): Boolean = !packages.containsKey(fqName)
@Deprecated("for usages use #packageFragments(FqName) at final point, for impl use #collectPackageFragments(FqName, MutableCollection<PackageFragmentDescriptor>)")
override fun getPackageFragments(fqName: FqName) = listOfNotNull(packages[fqName]?.invoke()) override fun getPackageFragments(fqName: FqName) = listOfNotNull(packages[fqName]?.invoke())
override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): List<FqName> { override fun getSubPackagesOf(fqName: FqName, nameFilter: (Name) -> Boolean): List<FqName> {
@@ -146,4 +147,4 @@ class AndroidSyntheticPackageFragmentProvider(
.filter { (k, _) -> !k.isRoot && k.parent() == fqName } .filter { (k, _) -> !k.isRoot && k.parent() == fqName }
.mapTo(mutableListOf()) { it.key } .mapTo(mutableListOf()) { it.key }
} }
} }
@@ -76,6 +76,7 @@ abstract class KotlinScriptDefinitionAdapterFromNewAPIBase : KotlinScriptDefinit
?.map { (k, v) -> k to getScriptingClass(v).starProjectedType }.orEmpty() ?.map { (k, v) -> k to getScriptingClass(v).starProjectedType }.orEmpty()
} }
@Deprecated("temporary workaround for missing functionality, will be replaced by the new API soon")
override val additionalCompilerArguments: List<String> override val additionalCompilerArguments: List<String>
get() = scriptCompilationConfiguration[ScriptCompilationConfiguration.compilerOptions] get() = scriptCompilationConfiguration[ScriptCompilationConfiguration.compilerOptions]
.orEmpty() .orEmpty()
@@ -78,7 +78,7 @@ abstract class LazyScriptDefinitionProvider : ScriptDefinitionProvider {
cachedDefinitions.firstOrNull { it.isScript(script) } cachedDefinitions.firstOrNull { it.isScript(script) }
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun findScriptDefinition(fileName: String): KotlinScriptDefinition? = override fun findScriptDefinition(fileName: String): KotlinScriptDefinition? =
if (nonScriptId(fileName)) { if (nonScriptId(fileName)) {
null null
@@ -91,7 +91,7 @@ abstract class LazyScriptDefinitionProvider : ScriptDefinitionProvider {
override fun getKnownFilenameExtensions(): Sequence<String> = override fun getKnownFilenameExtensions(): Sequence<String> =
cachedDefinitions.map { it.fileExtension } cachedDefinitions.map { it.fileExtension }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override fun getDefaultScriptDefinition(): KotlinScriptDefinition = getDefaultDefinition().legacyDefinition override fun getDefaultScriptDefinition(): KotlinScriptDefinition = getDefaultDefinition().legacyDefinition
companion object { companion object {
@@ -61,7 +61,7 @@ abstract class ScriptDefinition : UserDataHolderBase() {
return "ScriptDefinition($name)" return "ScriptDefinition($name)"
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
open class FromLegacy( open class FromLegacy(
override val hostConfiguration: ScriptingHostConfiguration, override val hostConfiguration: ScriptingHostConfiguration,
override val legacyDefinition: KotlinScriptDefinition, override val legacyDefinition: KotlinScriptDefinition,
@@ -127,7 +127,7 @@ abstract class ScriptDefinition : UserDataHolderBase() {
abstract class FromConfigurationsBase() : ScriptDefinition() { abstract class FromConfigurationsBase() : ScriptDefinition() {
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
override val legacyDefinition by lazy { override val legacyDefinition by lazy {
KotlinScriptDefinitionAdapterFromNewAPI( KotlinScriptDefinitionAdapterFromNewAPI(
compilationConfiguration, compilationConfiguration,
@@ -220,4 +220,4 @@ abstract class ScriptDefinition : UserDataHolderBase() {
override val isDefault = true override val isDefault = true
} }
} }
} }
@@ -133,6 +133,7 @@ open class KotlinScriptDefinitionFromAnnotatedTemplate(
override val annotationsForSamWithReceivers: List<String> override val annotationsForSamWithReceivers: List<String>
get() = samWithReceiverAnnotations ?: super.annotationsForSamWithReceivers get() = samWithReceiverAnnotations ?: super.annotationsForSamWithReceivers
@Deprecated("temporary workaround for missing functionality, will be replaced by the new API soon")
override val additionalCompilerArguments: Iterable<String>? by lazy(LazyThreadSafetyMode.PUBLICATION) { override val additionalCompilerArguments: Iterable<String>? by lazy(LazyThreadSafetyMode.PUBLICATION) {
takeUnlessError { takeUnlessError {
template.annotations.firstIsInstanceOrNull<kotlin.script.templates.ScriptTemplateAdditionalCompilerArguments>()?.let { template.annotations.firstIsInstanceOrNull<kotlin.script.templates.ScriptTemplateAdditionalCompilerArguments>()?.let {
@@ -148,7 +148,7 @@ abstract class ScriptCompilationConfigurationWrapper(val script: SourceCode) {
override val importedScripts: List<SourceCode> override val importedScripts: List<SourceCode>
get() = configuration?.get(ScriptCompilationConfiguration.importScripts).orEmpty() get() = configuration?.get(ScriptCompilationConfiguration.importScripts).orEmpty()
@Suppress("OverridingDeprecatedMember") @Suppress("OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override val legacyDependencies: ScriptDependencies? override val legacyDependencies: ScriptDependencies?
get() = configuration?.toDependencies(dependenciesClassPath) get() = configuration?.toDependencies(dependenciesClassPath)
@@ -162,7 +162,7 @@ abstract class ScriptCompilationConfigurationWrapper(val script: SourceCode) {
} }
} }
@Suppress("OverridingDeprecatedMember", "DEPRECATION") @Suppress("OverridingDeprecatedMember", "DEPRECATION", "OVERRIDE_DEPRECATION")
class FromLegacy( class FromLegacy(
script: SourceCode, script: SourceCode,
override val legacyDependencies: ScriptDependencies?, override val legacyDependencies: ScriptDependencies?,
@@ -419,4 +419,4 @@ private fun Document.offsetToPosition(offset: Int): SourceCode.Position {
val line = getLineNumber(offset) val line = getLineNumber(offset)
val column = offset - getLineStartOffset(line) val column = offset - getLineStartOffset(line)
return SourceCode.Position(line + 1, column + 1, offset) return SourceCode.Position(line + 1, column + 1, offset)
} }
@@ -108,6 +108,6 @@ private class TestScriptDefinitionSource(val counter: AtomicInteger, val defGens
} }
private class TestCliScriptDefinitionProvider(private val standardDef: ScriptDefinition) : CliScriptDefinitionProvider() { private class TestCliScriptDefinitionProvider(private val standardDef: ScriptDefinition) : CliScriptDefinitionProvider() {
@Suppress("DEPRECATION", "OverridingDeprecatedMember") @Suppress("DEPRECATION", "OverridingDeprecatedMember", "OVERRIDE_DEPRECATION")
override fun getDefaultScriptDefinition(): KotlinScriptDefinition = standardDef.legacyDefinition override fun getDefaultScriptDefinition(): KotlinScriptDefinition = standardDef.legacyDefinition
} }