diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt index 045241b2986..d9e1e0b9727 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt @@ -28,7 +28,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible import org.jetbrains.kotlin.types.Variance import kotlin.properties.PropertyDelegateProvider @@ -242,7 +242,7 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") { val OVERRIDE_DEPRECATION by warning(PositioningStrategy.DECLARATION_NAME) { parameter("overridenSymbol") - parameter("deprecationInfo") + parameter("deprecationInfo") } val ANNOTATION_ON_SUPERCLASS by deprecationError(LanguageFeature.ProhibitUseSiteTargetAnnotationsOnSuperTypes) diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index e90348becfc..27e4507459e 100644 --- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -21,7 +21,6 @@ import org.jetbrains.kotlin.descriptors.Visibility import org.jetbrains.kotlin.diagnostics.WhenMissingCase import org.jetbrains.kotlin.fir.FirModuleData 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.expressions.FirExpression import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol @@ -83,7 +82,7 @@ import org.jetbrains.kotlin.psi.KtWhenCondition import org.jetbrains.kotlin.psi.KtWhenEntry import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible import org.jetbrains.kotlin.types.Variance @@ -222,7 +221,7 @@ object FirErrors { val DEPRECATED_SINCE_KOTLIN_WITHOUT_DEPRECATED by error0(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) val DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL by error0(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) val DEPRECATED_SINCE_KOTLIN_OUTSIDE_KOTLIN_SUBPACKAGE by error0(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED) - val OVERRIDE_DEPRECATION by warning2, Deprecation>(SourceElementPositioningStrategies.DECLARATION_NAME) + val OVERRIDE_DEPRECATION by warning2, DeprecationInfo>(SourceElementPositioningStrategies.DECLARATION_NAME) val ANNOTATION_ON_SUPERCLASS by deprecationError0(ProhibitUseSiteTargetAnnotationsOnSuperTypes) val RESTRICTED_RETENTION_FOR_EXPRESSION_ANNOTATION by deprecationError0(RestrictRetentionForExpressionAnnotations) val WRONG_ANNOTATION_TARGET by error1() diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecatedQualifierChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecatedQualifierChecker.kt index f1ee45a7f42..468e14e17b6 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecatedQualifierChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecatedQualifierChecker.kt @@ -14,11 +14,11 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol object FirDeprecatedQualifierChecker : FirResolvedQualifierChecker() { override fun check(expression: FirResolvedQualifier, context: CheckerContext, reporter: DiagnosticReporter) { expression.nonFatalDiagnostics.filterIsInstance().forEach { diagnostic -> - FirDeprecationChecker.reportDeprecation(diagnostic.source, diagnostic.candidateSymbol, diagnostic.deprecation, reporter, context) + FirDeprecationChecker.reportDeprecation(diagnostic.source, diagnostic.candidateSymbol, diagnostic.deprecationInfo, reporter, context) } if (expression.resolvedToCompanionObject) { val companionSymbol = (expression.symbol as? FirRegularClassSymbol)?.companionObjectSymbol ?: return FirDeprecationChecker.reportDeprecationIfNeeded(expression.source, companionSymbol, null, context, reporter) } } -} \ No newline at end of file +} diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecationChecker.kt index 16e463def9b..6f68144adc7 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirDeprecationChecker.kt @@ -5,7 +5,7 @@ package org.jetbrains.kotlin.fir.analysis.checkers.expression -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.FirFakeSourceElementKind @@ -54,22 +54,22 @@ object FirDeprecationChecker : FirBasicExpressionChecker() { internal fun reportDeprecation( source: FirSourceElement?, referencedSymbol: FirBasedSymbol<*>, - deprecation: Deprecation, + deprecationInfo: DeprecationInfo, reporter: DiagnosticReporter, context: CheckerContext ) { - val diagnostic = when (deprecation.deprecationLevel) { + val diagnostic = when (deprecationInfo.deprecationLevel) { DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> FirErrors.DEPRECATION_ERROR DeprecationLevelValue.WARNING -> FirErrors.DEPRECATION } - reporter.reportOn(source, diagnostic, referencedSymbol, deprecation.message ?: "", context) + reporter.reportOn(source, diagnostic, referencedSymbol, deprecationInfo.message ?: "", context) } private fun getWorstDeprecation( callSite: FirElement?, symbol: FirBasedSymbol<*>, context: CheckerContext - ): Deprecation? { + ): DeprecationInfo? { val deprecationInfos = listOfNotNull( symbol.getDeprecation(callSite), symbol.safeAs() diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecationUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecationUtils.kt index bd7bad8c4de..7a488a9a548 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecationUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecationUtils.kt @@ -7,7 +7,7 @@ package org.jetbrains.kotlin.fir.declarations import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.config.ApiVersion -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.FirAnnotationContainer @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassLikeSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.deprecation.SimpleDeprecation +import org.jetbrains.kotlin.resolve.deprecation.SimpleDeprecationInfo import org.jetbrains.kotlin.utils.addIfNotNull import org.jetbrains.kotlin.utils.addToStdlib.safeAs @@ -33,8 +33,8 @@ private val LEVEL_NAME = Name.identifier("level") private val JAVA_ORIGINS = setOf(FirDeclarationOrigin.Java, FirDeclarationOrigin.Enhancement) -fun FirBasedSymbol<*>.getDeprecation(callSite: FirElement?): Deprecation? { - val deprecationInfos = mutableListOf() +fun FirBasedSymbol<*>.getDeprecation(callSite: FirElement?): DeprecationInfo? { + val deprecationInfos = mutableListOf() when (this) { is FirPropertySymbol -> if (callSite is FirVariableAssignment) { @@ -53,7 +53,7 @@ fun FirBasedSymbol<*>.getDeprecation(callSite: FirElement?): Deprecation? { } fun FirAnnotationContainer.getDeprecationInfos(currentVersion: ApiVersion): DeprecationsPerUseSite { - val deprecationByUseSite = mutableMapOf() + val deprecationByUseSite = mutableMapOf() val fromJava = JAVA_ORIGINS.contains(this.safeAs()?.origin) annotations.extractDeprecationInfoPerUseSite(currentVersion, fromJava).toMap(deprecationByUseSite) @@ -70,7 +70,7 @@ fun getDeprecationsFromAccessors( setter: FirFunction?, currentVersion: ApiVersion ): DeprecationsPerUseSite { - val perUseSite = buildMap { + val perUseSite = buildMap { setter?.getDeprecationInfos(currentVersion)?.all?.let { put(AnnotationUseSiteTarget.PROPERTY_SETTER, it) } getter?.getDeprecationInfos(currentVersion)?.all?.let { put(AnnotationUseSiteTarget.PROPERTY_GETTER, it) } } @@ -84,7 +84,7 @@ fun List.getDeprecationInfosFromAnnotations(currentVersion: A fun FirBasedSymbol<*>.getDeprecationForCallSite( vararg sites: AnnotationUseSiteTarget -): Deprecation? { +): DeprecationInfo? { val deprecations = when (this) { is FirCallableSymbol<*> -> deprecation is FirClassLikeSymbol<*> -> deprecation @@ -109,7 +109,7 @@ private fun FirAnnotationCall.getDeprecationLevel(): DeprecationLevelValue? { private fun List.extractDeprecationInfoPerUseSite( currentVersion: ApiVersion, fromJava: Boolean -): List> { +): List> { val annotations = getAnnotationsByFqName(StandardNames.FqNames.deprecated).map { it to false } + getAnnotationsByFqName(JAVA_DEPRECATED).map { it to true } return annotations.mapNotNull { (deprecated, fromJavaAnnotation) -> @@ -127,7 +127,7 @@ private fun List.extractDeprecationInfoPerUseSite( appliedLevel?.let { val inheritable = !fromJavaAnnotation && !fromJava - deprecated.useSiteTarget to SimpleDeprecation(it, inheritable, deprecated.getStringArgument(MESSAGE_NAME)) + deprecated.useSiteTarget to SimpleDeprecationInfo(it, inheritable, deprecated.getStringArgument(MESSAGE_NAME)) } } } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt index cb634c8df10..b1005f1bc65 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/diagnostics/FirDiagnostics.kt @@ -6,7 +6,7 @@ package org.jetbrains.kotlin.fir.resolve.diagnostics import kotlinx.collections.immutable.ImmutableList -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration import org.jetbrains.kotlin.fir.declarations.FirVariable @@ -197,9 +197,9 @@ class ConeUnsupportedDynamicType : ConeUnsupported("Dynamic types are not suppor class ConeDeprecated( val source: FirSourceElement?, override val candidateSymbol: FirBasedSymbol<*>, - val deprecation: Deprecation + val deprecationInfo: DeprecationInfo ) : ConeDiagnosticWithSingleCandidate { - override val reason: String get() = "Deprecated: ${deprecation.message}" + override val reason: String get() = "Deprecated: ${deprecationInfo.message}" } class ConeLocalVariableNoTypeOrInitializer(val variable: FirVariable) : ConeDiagnostic { diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt index d7ce2daa9fd..33f67c5f165 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/declarations/deprecations.kt @@ -1,6 +1,6 @@ package org.jetbrains.kotlin.fir.declarations -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.utils.keysToMap import org.jetbrains.kotlin.utils.keysToMapExceptNulls @@ -12,10 +12,10 @@ import org.jetbrains.kotlin.utils.keysToMapExceptNulls class DeprecationsPerUseSite( - val all: Deprecation?, - val bySpecificSite: Map? + val all: DeprecationInfo?, + val bySpecificSite: Map? ) { - fun forUseSite(vararg sites: AnnotationUseSiteTarget): Deprecation? { + fun forUseSite(vararg sites: AnnotationUseSiteTarget): DeprecationInfo? { if (bySpecificSite != null) { for (site in sites) { bySpecificSite[site]?.let { return it } @@ -68,11 +68,11 @@ class DeprecationsPerUseSite( else "org.jetbrains.kotlin.fir.declarations.DeprecationInfoForUseSites(all=$all, bySpecificSite=$bySpecificSite)" companion object { - fun fromMap(perUseSite: Map): DeprecationsPerUseSite { + fun fromMap(perUseSite: Map): DeprecationsPerUseSite { if (perUseSite.isEmpty()) return EmptyDeprecationsPerUseSite @Suppress("UNCHECKED_CAST") - val specificCallSite = perUseSite.filterKeys { it != null } as Map + val specificCallSite = perUseSite.filterKeys { it != null } as Map return DeprecationsPerUseSite( perUseSite[null], specificCallSite.takeIf { it.isNotEmpty() } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/BadInheritedJavaSignaturesChecker.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/BadInheritedJavaSignaturesChecker.kt index 4b5de39eb8c..869c359cc6f 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/BadInheritedJavaSignaturesChecker.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/BadInheritedJavaSignaturesChecker.kt @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.diagnostics.Errors -import org.jetbrains.kotlin.load.java.DeprecationCausedByFunctionN +import org.jetbrains.kotlin.load.java.DeprecationCausedByFunctionNInfo import org.jetbrains.kotlin.psi.KtClass import org.jetbrains.kotlin.psi.KtDeclaration import org.jetbrains.kotlin.psi.KtObjectDeclaration @@ -49,6 +49,6 @@ private fun findFirstBadJavaSignatureOverridden(descriptor: DeclarationDescripto if (descriptor !is CallableDescriptor) return null return descriptor.overriddenDescriptors.firstOrNull { - overridden -> overridden.getUserData(DEPRECATED_FUNCTION_KEY) is DeprecationCausedByFunctionN + overridden -> overridden.getUserData(DEPRECATED_FUNCTION_KEY) is DeprecationCausedByFunctionNInfo } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index fe01f4a669a..4bdeb831ac6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -29,7 +29,7 @@ import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData; import org.jetbrains.kotlin.resolve.calls.inference.InferenceErrorData; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.tower.WrongResolutionToClassifier; -import org.jetbrains.kotlin.resolve.deprecation.DescriptorBasedDeprecation; +import org.jetbrains.kotlin.resolve.deprecation.DescriptorBasedDeprecationInfo; import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible; import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData; import org.jetbrains.kotlin.types.KotlinType; @@ -100,7 +100,7 @@ public interface Errors { DiagnosticFactory3> VERSION_REQUIREMENT_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR); // descriptor and deprecation infos are needed only for IDE quickfix for this warning - DiagnosticFactory3> OVERRIDE_DEPRECATION = DiagnosticFactory3.create(WARNING, DECLARATION_NAME); + DiagnosticFactory3> OVERRIDE_DEPRECATION = DiagnosticFactory3.create(WARNING, DECLARATION_NAME); DiagnosticFactory0 DEPRECATED_SINCE_KOTLIN_WITHOUT_DEPRECATED = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt index 2322a444dec..33b503af462 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt @@ -25,7 +25,7 @@ internal sealed class DeprecatedByAnnotation( val annotation: AnnotationDescriptor, override val target: DeclarationDescriptor, override val propagatesToOverrides: Boolean -) : DescriptorBasedDeprecation() { +) : DescriptorBasedDeprecationInfo() { override val message: String? get() = annotation.argumentValue("message")?.safeAs()?.value @@ -111,13 +111,13 @@ internal sealed class DeprecatedByAnnotation( } } -internal data class DeprecatedByOverridden(private val deprecations: Collection) : DescriptorBasedDeprecation() { +internal data class DeprecatedByOverridden(private val deprecations: Collection) : DescriptorBasedDeprecationInfo() { init { assert(deprecations.isNotEmpty()) assert(deprecations.none { it is DeprecatedByOverridden }) } - override val deprecationLevel: DeprecationLevelValue = deprecations.map(DescriptorBasedDeprecation::deprecationLevel).minOrNull()!! + override val deprecationLevel: DeprecationLevelValue = deprecations.map(DescriptorBasedDeprecationInfo::deprecationLevel).minOrNull()!! override val target: DeclarationDescriptor get() = deprecations.first().target @@ -134,8 +134,8 @@ internal data class DeprecatedByOverridden(private val deprecations: Collection< internal data class DeprecatedOperatorMod( val languageVersionSettings: LanguageVersionSettings, - val currentDeprecation: DescriptorBasedDeprecation -) : DescriptorBasedDeprecation() { + val currentDeprecation: DescriptorBasedDeprecationInfo +) : DescriptorBasedDeprecationInfo() { init { assert(shouldWarnAboutDeprecatedModFromBuiltIns(languageVersionSettings)) { "Deprecation created for mod that shouldn't have any deprecations; languageVersionSettings: $languageVersionSettings" @@ -159,7 +159,7 @@ internal data class DeprecatedOperatorMod( internal data class DeprecatedByVersionRequirement( val versionRequirement: VersionRequirement, override val target: DeclarationDescriptor -) : DescriptorBasedDeprecation() { +) : DescriptorBasedDeprecationInfo() { override val deprecationLevel: DeprecationLevelValue get() = when (versionRequirement.level) { DeprecationLevel.WARNING -> WARNING @@ -189,7 +189,7 @@ internal data class DeprecatedByVersionRequirement( internal data class DeprecatedTypealiasByAnnotation( val typeAliasTarget: TypeAliasDescriptor, val nested: DeprecatedByAnnotation -) : DescriptorBasedDeprecation() { +) : DescriptorBasedDeprecationInfo() { override val target get() = typeAliasTarget override val deprecationLevel get() = nested.deprecationLevel override val message get() = nested.message diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationResolver.kt index 81e0c02b47c..1f7c5c8a2aa 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationResolver.kt @@ -58,9 +58,9 @@ class DeprecationResolver( } private data class DeprecationInfo( - val deprecations: List, + val deprecations: List, val hasInheritedDeprecations: Boolean, - val hiddenInheritedDeprecations: List = emptyList() + val hiddenInheritedDeprecations: List = emptyList() ) { companion object { val EMPTY = DeprecationInfo(emptyList(), hasInheritedDeprecations = false, emptyList()) @@ -71,7 +71,7 @@ class DeprecationResolver( descriptor.checkSinceKotlinVersionAccessibility(languageVersionSettings) } - fun getDeprecations(descriptor: DeclarationDescriptor): List = + fun getDeprecations(descriptor: DeclarationDescriptor): List = deprecations(descriptor.original).deprecations @OptIn(ExperimentalContracts::class) @@ -82,7 +82,7 @@ class DeprecationResolver( return deprecations(descriptor.original).hasInheritedDeprecations } - fun getHiddenDeprecationsFromOverriden(descriptor: DeclarationDescriptor): List = + fun getHiddenDeprecationsFromOverriden(descriptor: DeclarationDescriptor): List = deprecations(descriptor.original).hiddenInheritedDeprecations fun isDeprecatedHidden(descriptor: DeclarationDescriptor): Boolean = @@ -130,8 +130,8 @@ class DeprecationResolver( return isDeprecatedHidden(descriptor) } - private fun KotlinType.deprecationsByConstituentTypes(): List = - SmartList().also { deprecations -> + private fun KotlinType.deprecationsByConstituentTypes(): List = + SmartList().also { deprecations -> TypeUtils.contains(this) { type -> type.constructor.declarationDescriptor?.let { deprecations.addAll(getDeprecations(it)) @@ -140,9 +140,9 @@ class DeprecationResolver( } } - private fun deprecationByOverridden(root: CallableMemberDescriptor): DescriptorBasedDeprecation? { + private fun deprecationByOverridden(root: CallableMemberDescriptor): DescriptorBasedDeprecationInfo? { val visited = HashSet() - val deprecations = LinkedHashSet() + val deprecations = LinkedHashSet() var hasUndeprecatedOverridden = false fun traverse(node: CallableMemberDescriptor) { @@ -190,12 +190,12 @@ class DeprecationResolver( // // Also, we don't ignore non-propagating deprecations in case of fake overrides // Because we don't want to depend on the choice of the base descriptor - if (root.kind.isReal && deprecations.none(DescriptorBasedDeprecation::propagatesToOverrides)) return null + if (root.kind.isReal && deprecations.none(DescriptorBasedDeprecationInfo::propagatesToOverrides)) return null return DeprecatedByOverridden(deprecations) } - private fun DeclarationDescriptor.getOwnDeprecations(): List { + private fun DeclarationDescriptor.getOwnDeprecations(): List { // The problem is that declaration `mod` in built-ins has @Deprecated annotation but actually it was deprecated only in version 1.1 if (isBuiltInOperatorMod && !shouldWarnAboutDeprecatedModFromBuiltIns(languageVersionSettings)) { return emptyList() @@ -206,7 +206,7 @@ class DeprecationResolver( return emptyList() } - val result = SmartList() + val result = SmartList() addDeprecationIfPresent(result) @@ -228,7 +228,7 @@ class DeprecationResolver( return result.distinct() } - private fun DeclarationDescriptor.addDeprecationIfPresent(result: MutableList) { + private fun DeclarationDescriptor.addDeprecationIfPresent(result: MutableList) { val annotation = annotations.findAnnotation(StandardNames.FqNames.deprecated) ?: annotations.findAnnotation(JAVA_DEPRECATED) if (annotation != null) { val deprecatedByAnnotation = @@ -269,7 +269,7 @@ class DeprecationResolver( descriptor.valueParameters.singleOrNull()?.type?.let(KotlinBuiltIns::isInt) == true && languageVersionSettings.apiVersion < ApiVersion.KOTLIN_1_3 - private fun getDeprecationFromUserData(target: DeclarationDescriptor): DescriptorBasedDeprecation? = + private fun getDeprecationFromUserData(target: DeclarationDescriptor): DescriptorBasedDeprecationInfo? = target.safeAs()?.getUserData(DEPRECATED_FUNCTION_KEY) private fun getDeprecationByVersionRequirement(target: DeclarationDescriptor): List { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/deprecationUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/deprecationUtil.kt index 693da9a95cc..3b23f6b7ad5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/deprecationUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/deprecationUtil.kt @@ -17,9 +17,9 @@ import org.jetbrains.kotlin.resolve.constants.StringValue import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue.* import org.jetbrains.kotlin.utils.addToStdlib.safeAs -fun DescriptorBasedDeprecation.deprecatedByOverriddenMessage(): String? = (this as? DeprecatedByOverridden)?.additionalMessage() +fun DescriptorBasedDeprecationInfo.deprecatedByOverriddenMessage(): String? = (this as? DeprecatedByOverridden)?.additionalMessage() -fun DescriptorBasedDeprecation.deprecatedByAnnotationReplaceWithExpression(): String? = (this as? DeprecatedByAnnotation)?.replaceWithValue +fun DescriptorBasedDeprecationInfo.deprecatedByAnnotationReplaceWithExpression(): String? = (this as? DeprecatedByAnnotation)?.replaceWithValue // The function extracts value of warningSince/errorSince/hiddenSince from DeprecatedSinceKotlin annotation fun AnnotationDescriptor.getSinceVersion(name: String): ApiVersion? = @@ -39,7 +39,7 @@ fun computeLevelForDeprecatedSinceKotlin(annotation: AnnotationDescriptor, apiVe } internal fun createDeprecationDiagnostic( - element: PsiElement, deprecation: DescriptorBasedDeprecation, languageVersionSettings: LanguageVersionSettings + element: PsiElement, deprecation: DescriptorBasedDeprecationInfo, languageVersionSettings: LanguageVersionSettings ): Diagnostic { val targetOriginal = deprecation.target.original return when (deprecation) { diff --git a/core/compiler.common/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt b/core/compiler.common/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationInfo.kt similarity index 84% rename from core/compiler.common/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt rename to core/compiler.common/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationInfo.kt index 535b22e88aa..de83b0b2e12 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationInfo.kt @@ -5,12 +5,12 @@ package org.jetbrains.kotlin.resolve.deprecation -abstract class Deprecation : Comparable { +abstract class DeprecationInfo : Comparable { abstract val deprecationLevel: DeprecationLevelValue abstract val propagatesToOverrides: Boolean abstract val message: String? - override fun compareTo(other: Deprecation): Int { + override fun compareTo(other: DeprecationInfo): Int { val lr = deprecationLevel.compareTo(other.deprecationLevel) //to prefer inheritable deprecation return if (lr == 0 && !propagatesToOverrides && other.propagatesToOverrides) 1 @@ -18,11 +18,11 @@ abstract class Deprecation : Comparable { } } -data class SimpleDeprecation( +data class SimpleDeprecationInfo( override val deprecationLevel: DeprecationLevelValue, override val propagatesToOverrides: Boolean, override val message: String? -) : Deprecation() +) : DeprecationInfo() /** * This corresponds to [DeprecationLevel] in Kotlin standard library. A symbol annotated with [java.lang.Deprecated] is considered a diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/typeEnhancement/signatureEnhancement.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/typeEnhancement/signatureEnhancement.kt index d8f6963c63a..1670e714487 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/typeEnhancement/signatureEnhancement.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/typeEnhancement/signatureEnhancement.kt @@ -215,7 +215,7 @@ class SignatureEnhancement( ) { val additionalUserData = if (containsFunctionN) - DEPRECATED_FUNCTION_KEY to DeprecationCausedByFunctionN(this) + DEPRECATED_FUNCTION_KEY to DeprecationCausedByFunctionNInfo(this) else null diff --git a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/utils.kt b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/utils.kt index 821a698ac16..c24e78c7219 100644 --- a/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/utils.kt +++ b/core/descriptors.jvm/src/org/jetbrains/kotlin/load/java/utils.kt @@ -20,10 +20,10 @@ import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.descriptors.Visibility -import org.jetbrains.kotlin.resolve.deprecation.DescriptorBasedDeprecation +import org.jetbrains.kotlin.resolve.deprecation.DescriptorBasedDeprecationInfo import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue -class DeprecationCausedByFunctionN(override val target: DeclarationDescriptor) : DescriptorBasedDeprecation() { +class DeprecationCausedByFunctionNInfo(override val target: DeclarationDescriptor) : DescriptorBasedDeprecationInfo() { override val deprecationLevel: DeprecationLevelValue get() = DeprecationLevelValue.ERROR override val message: String diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/deprecation/DescriptorBasedDeprecation.kt b/core/descriptors/src/org/jetbrains/kotlin/resolve/deprecation/DescriptorBasedDeprecationInfo.kt similarity index 83% rename from core/descriptors/src/org/jetbrains/kotlin/resolve/deprecation/DescriptorBasedDeprecation.kt rename to core/descriptors/src/org/jetbrains/kotlin/resolve/deprecation/DescriptorBasedDeprecationInfo.kt index 432822a2e1f..12c9e44191b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/deprecation/DescriptorBasedDeprecation.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/deprecation/DescriptorBasedDeprecationInfo.kt @@ -8,11 +8,11 @@ package org.jetbrains.kotlin.resolve.deprecation import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor -abstract class DescriptorBasedDeprecation : Deprecation() { +abstract class DescriptorBasedDeprecationInfo : DeprecationInfo() { override val propagatesToOverrides: Boolean get() = true abstract val target: DeclarationDescriptor } -val DEPRECATED_FUNCTION_KEY = object : CallableDescriptor.UserDataKey {} +val DEPRECATED_FUNCTION_KEY = object : CallableDescriptor.UserDataKey {} diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolInfoProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolInfoProvider.kt index f2c91ac89ad..fed22d34a61 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolInfoProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/components/KtSymbolInfoProvider.kt @@ -5,40 +5,40 @@ package org.jetbrains.kotlin.idea.frontend.api.components -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.idea.frontend.api.symbols.KtPropertySymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol public abstract class KtSymbolInfoProvider : KtAnalysisSessionComponent() { - public abstract fun getDeprecation(symbol: KtSymbol): Deprecation? - public abstract fun getDeprecation(symbol: KtSymbol, annotationUseSiteTarget: AnnotationUseSiteTarget?): Deprecation? - public abstract fun getGetterDeprecation(symbol: KtPropertySymbol): Deprecation? - public abstract fun getSetterDeprecation(symbol: KtPropertySymbol): Deprecation? + public abstract fun getDeprecation(symbol: KtSymbol): DeprecationInfo? + public abstract fun getDeprecation(symbol: KtSymbol, annotationUseSiteTarget: AnnotationUseSiteTarget?): DeprecationInfo? + public abstract fun getGetterDeprecation(symbol: KtPropertySymbol): DeprecationInfo? + public abstract fun getSetterDeprecation(symbol: KtPropertySymbol): DeprecationInfo? } public interface KtSymbolInfoProviderMixIn : KtAnalysisSessionMixIn { /** * Gets the deprecation status of the given symbol. Returns null if the symbol it not deprecated. */ - public val KtSymbol.deprecationStatus: Deprecation? get() = analysisSession.symbolInfoProvider.getDeprecation(this) + public val KtSymbol.deprecationStatus: DeprecationInfo? get() = analysisSession.symbolInfoProvider.getDeprecation(this) /** * Gets the deprecation status of the given symbol. Returns null if the symbol it not deprecated. */ - public fun KtSymbol.getDeprecationStatus(annotationUseSiteTarget: AnnotationUseSiteTarget?): Deprecation? = + public fun KtSymbol.getDeprecationStatus(annotationUseSiteTarget: AnnotationUseSiteTarget?): DeprecationInfo? = analysisSession.symbolInfoProvider.getDeprecation(this) /** * Gets the deprecation status of the getter of this property symbol. Returns null if the getter it not deprecated. */ - public val KtPropertySymbol.getterDeprecationStatus: Deprecation? + public val KtPropertySymbol.getterDeprecationStatus: DeprecationInfo? get() = analysisSession.symbolInfoProvider.getGetterDeprecation(this) /** * Gets the deprecation status of the setter of this property symbol. Returns null if the setter it not deprecated or the property does * not have a setter. */ - public val KtPropertySymbol.setterDeprecationStatus: Deprecation? + public val KtPropertySymbol.setterDeprecationStatus: DeprecationInfo? get() = analysisSession.symbolInfoProvider.getSetterDeprecation(this) } diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt index ba6e707caba..bf8101762d1 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/symbols/DebugSymbolRenderer.kt @@ -5,7 +5,7 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.components.KtSymbolInfoProviderMixIn import org.jetbrains.kotlin.idea.frontend.api.symbols.markers.* @@ -103,7 +103,7 @@ public object DebugSymbolRenderer { append(INDENT, "psi: ${renderValue(value.psi)}") } is KtTypeAndAnnotations -> "${renderValue(value.annotations)} ${renderValue(value.type)}" - is Deprecation -> value.toString() + is DeprecationInfo -> value.toString() else -> value::class.simpleName!! } diff --git a/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt b/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt index 351695f90d7..39be11d6f36 100644 --- a/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt +++ b/idea/idea-frontend-fir/idea-frontend-fir-generator/src/org/jetbrains/kotlin/idea/frontend/api/fir/generator/HLDiagnosticConverter.kt @@ -31,7 +31,7 @@ import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility import org.jetbrains.kotlin.types.Variance import kotlin.reflect.KClass @@ -337,7 +337,7 @@ private object FirToKtConversionCreator { FqName::class, FirModuleData::class, ExpectActualCompatibility.Incompatible::class, - Deprecation::class, + DeprecationInfo::class, ) private val KType.kClass: KClass<*> diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolInfoProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolInfoProvider.kt index 5befb3a6610..413545b649f 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolInfoProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/components/KtFirSymbolInfoProvider.kt @@ -5,7 +5,7 @@ package org.jetbrains.kotlin.idea.frontend.api.fir.components -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.declarations.getDeprecationForCallSite import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol @@ -22,7 +22,7 @@ internal class KtFirSymbolInfoProvider( override val analysisSession: KtFirAnalysisSession, override val token: ValidityToken, ) : KtSymbolInfoProvider(), KtFirAnalysisSessionComponent { - override fun getDeprecation(symbol: KtSymbol): Deprecation? { + override fun getDeprecation(symbol: KtSymbol): DeprecationInfo? { if (symbol is KtFirBackingFieldSymbol || symbol is KtFirPackageSymbol) return null require(symbol is KtFirSymbol<*>) return symbol.firRef.withFir { @@ -35,7 +35,7 @@ internal class KtFirSymbolInfoProvider( } } - override fun getDeprecation(symbol: KtSymbol, annotationUseSiteTarget: AnnotationUseSiteTarget?): Deprecation? { + override fun getDeprecation(symbol: KtSymbol, annotationUseSiteTarget: AnnotationUseSiteTarget?): DeprecationInfo? { require(symbol is KtFirSymbol<*>) return symbol.firRef.withFir { firDeclaration -> if (annotationUseSiteTarget != null) { @@ -46,14 +46,14 @@ internal class KtFirSymbolInfoProvider( } } - override fun getGetterDeprecation(symbol: KtPropertySymbol): Deprecation? { + override fun getGetterDeprecation(symbol: KtPropertySymbol): DeprecationInfo? { require(symbol is KtFirSymbol<*>) return symbol.firRef.withFir { it.symbol.getDeprecationForCallSite(AnnotationUseSiteTarget.PROPERTY_GETTER, AnnotationUseSiteTarget.PROPERTY) } } - override fun getSetterDeprecation(symbol: KtPropertySymbol): Deprecation? { + override fun getSetterDeprecation(symbol: KtPropertySymbol): DeprecationInfo? { require(symbol is KtFirSymbol<*>) return symbol.firRef.withFir { it.symbol.getDeprecationForCallSite(AnnotationUseSiteTarget.PROPERTY_SETTER, AnnotationUseSiteTarget.PROPERTY) diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt index b241ff49745..ce1d78fb2d4 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnostics.kt @@ -70,7 +70,7 @@ import org.jetbrains.kotlin.psi.KtWhenCondition import org.jetbrains.kotlin.psi.KtWhenEntry import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible import org.jetbrains.kotlin.types.Variance @@ -552,7 +552,7 @@ sealed class KtFirDiagnostic : KtDiagnosticWithPsi { abstract class OverrideDeprecation : KtFirDiagnostic() { override val diagnosticClass get() = OverrideDeprecation::class abstract val overridenSymbol: KtSymbol - abstract val deprecationInfo: org.jetbrains.kotlin.resolve.deprecation.Deprecation + abstract val deprecationInfo: DeprecationInfo } abstract class AnnotationOnSuperclassError : KtFirDiagnostic() { diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt index 52b1bedf6e5..79f0a8abb76 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/diagnostics/KtFirDiagnosticsImpl.kt @@ -72,7 +72,7 @@ import org.jetbrains.kotlin.psi.KtWhenCondition import org.jetbrains.kotlin.psi.KtWhenEntry import org.jetbrains.kotlin.psi.KtWhenExpression import org.jetbrains.kotlin.resolve.ForbiddenNamedArgumentsTarget -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible import org.jetbrains.kotlin.types.Variance @@ -879,7 +879,7 @@ internal class DeprecatedSinceKotlinOutsideKotlinSubpackageImpl( internal class OverrideDeprecationImpl( override val overridenSymbol: KtSymbol, - override val deprecationInfo: org.jetbrains.kotlin.resolve.deprecation.Deprecation, + override val deprecationInfo: DeprecationInfo, firDiagnostic: FirPsiDiagnostic, override val token: ValidityToken, ) : KtFirDiagnostic.OverrideDeprecation(), KtAbstractFirDiagnostic { diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt index 442595603a7..c1378645c01 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportHeaderGenerator.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.resolve.constants.ArrayValue import org.jetbrains.kotlin.resolve.constants.KClassValue -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue import org.jetbrains.kotlin.resolve.descriptorUtil.* import org.jetbrains.kotlin.resolve.scopes.MemberScope @@ -1339,7 +1339,7 @@ internal fun ClassDescriptor.needCompanionObjectProperty(namer: ObjCExportNamer, } -private fun Deprecation.toDeprecationAttribute(): String { +private fun DeprecationInfo.toDeprecationAttribute(): String { val attribute = when (deprecationLevel) { DeprecationLevelValue.WARNING -> "deprecated" DeprecationLevelValue.ERROR, DeprecationLevelValue.HIDDEN -> "unavailable" diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt index aadb3b192a0..85a26093284 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/objcexport/ObjCExportMapper.kt @@ -15,7 +15,7 @@ import org.jetbrains.kotlin.builtins.* import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.incremental.components.NoLookupLocation import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.resolve.deprecation.Deprecation +import org.jetbrains.kotlin.resolve.deprecation.DeprecationInfo import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver import org.jetbrains.kotlin.resolve.descriptorUtil.* @@ -97,7 +97,7 @@ private fun ObjCExportMapper.isHiddenByDeprecation(descriptor: CallableMemberDes return false } -internal fun ObjCExportMapper.getDeprecation(descriptor: DeclarationDescriptor): Deprecation? { +internal fun ObjCExportMapper.getDeprecation(descriptor: DeclarationDescriptor): DeprecationInfo? { deprecationResolver?.getDeprecations(descriptor).orEmpty().maxByOrNull { when (it.deprecationLevel) { DeprecationLevelValue.WARNING -> 1