Rename Deprecation to DeprecationInfo
This commit is contained in:
+2
-2
@@ -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<KtNamedDeclaration>(PositioningStrategy.DECLARATION_NAME) {
|
||||
parameter<Symbol>("overridenSymbol")
|
||||
parameter<Deprecation>("deprecationInfo")
|
||||
parameter<DeprecationInfo>("deprecationInfo")
|
||||
}
|
||||
|
||||
val ANNOTATION_ON_SUPERCLASS by deprecationError<KtAnnotationEntry>(LanguageFeature.ProhibitUseSiteTargetAnnotationsOnSuperTypes)
|
||||
|
||||
+2
-3
@@ -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<PsiElement>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
|
||||
val DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL by error0<PsiElement>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
|
||||
val DEPRECATED_SINCE_KOTLIN_OUTSIDE_KOTLIN_SUBPACKAGE by error0<PsiElement>(SourceElementPositioningStrategies.REFERENCED_NAME_BY_QUALIFIED)
|
||||
val OVERRIDE_DEPRECATION by warning2<KtNamedDeclaration, FirBasedSymbol<*>, Deprecation>(SourceElementPositioningStrategies.DECLARATION_NAME)
|
||||
val OVERRIDE_DEPRECATION by warning2<KtNamedDeclaration, FirBasedSymbol<*>, DeprecationInfo>(SourceElementPositioningStrategies.DECLARATION_NAME)
|
||||
val ANNOTATION_ON_SUPERCLASS by deprecationError0<KtAnnotationEntry>(ProhibitUseSiteTargetAnnotationsOnSuperTypes)
|
||||
val RESTRICTED_RETENTION_FOR_EXPRESSION_ANNOTATION by deprecationError0<PsiElement>(RestrictRetentionForExpressionAnnotations)
|
||||
val WRONG_ANNOTATION_TARGET by error1<KtAnnotationEntry, String>()
|
||||
|
||||
+2
-2
@@ -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<ConeDeprecated>().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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -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<FirConstructorSymbol>()
|
||||
|
||||
@@ -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<Deprecation>()
|
||||
fun FirBasedSymbol<*>.getDeprecation(callSite: FirElement?): DeprecationInfo? {
|
||||
val deprecationInfos = mutableListOf<DeprecationInfo>()
|
||||
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<AnnotationUseSiteTarget?, Deprecation>()
|
||||
val deprecationByUseSite = mutableMapOf<AnnotationUseSiteTarget?, DeprecationInfo>()
|
||||
val fromJava = JAVA_ORIGINS.contains(this.safeAs<FirDeclaration>()?.origin)
|
||||
annotations.extractDeprecationInfoPerUseSite(currentVersion, fromJava).toMap(deprecationByUseSite)
|
||||
|
||||
@@ -70,7 +70,7 @@ fun getDeprecationsFromAccessors(
|
||||
setter: FirFunction?,
|
||||
currentVersion: ApiVersion
|
||||
): DeprecationsPerUseSite {
|
||||
val perUseSite = buildMap<AnnotationUseSiteTarget, Deprecation> {
|
||||
val perUseSite = buildMap<AnnotationUseSiteTarget, DeprecationInfo> {
|
||||
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<FirAnnotationCall>.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<FirAnnotationCall>.extractDeprecationInfoPerUseSite(
|
||||
currentVersion: ApiVersion,
|
||||
fromJava: Boolean
|
||||
): List<Pair<AnnotationUseSiteTarget?, Deprecation>> {
|
||||
): List<Pair<AnnotationUseSiteTarget?, DeprecationInfo>> {
|
||||
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<FirAnnotationCall>.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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -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 {
|
||||
|
||||
@@ -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<AnnotationUseSiteTarget, Deprecation>?
|
||||
val all: DeprecationInfo?,
|
||||
val bySpecificSite: Map<AnnotationUseSiteTarget, DeprecationInfo>?
|
||||
) {
|
||||
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<AnnotationUseSiteTarget?, Deprecation>): DeprecationsPerUseSite {
|
||||
fun fromMap(perUseSite: Map<AnnotationUseSiteTarget?, DeprecationInfo>): DeprecationsPerUseSite {
|
||||
if (perUseSite.isEmpty()) return EmptyDeprecationsPerUseSite
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val specificCallSite = perUseSite.filterKeys { it != null } as Map<AnnotationUseSiteTarget, Deprecation>
|
||||
val specificCallSite = perUseSite.filterKeys { it != null } as Map<AnnotationUseSiteTarget, DeprecationInfo>
|
||||
return DeprecationsPerUseSite(
|
||||
perUseSite[null],
|
||||
specificCallSite.takeIf { it.isNotEmpty() }
|
||||
|
||||
+2
-2
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PsiElement, DeclarationDescriptor, VersionRequirement.Version, Pair<LanguageVersion, String>>
|
||||
VERSION_REQUIREMENT_DEPRECATION_ERROR = DiagnosticFactory3.create(ERROR);
|
||||
// descriptor and deprecation infos are needed only for IDE quickfix for this warning
|
||||
DiagnosticFactory3<KtNamedDeclaration, String, CallableMemberDescriptor, List<DescriptorBasedDeprecation>> OVERRIDE_DEPRECATION = DiagnosticFactory3.create(WARNING, DECLARATION_NAME);
|
||||
DiagnosticFactory3<KtNamedDeclaration, String, CallableMemberDescriptor, List<DescriptorBasedDeprecationInfo>> OVERRIDE_DEPRECATION = DiagnosticFactory3.create(WARNING, DECLARATION_NAME);
|
||||
|
||||
DiagnosticFactory0<PsiElement> DEPRECATED_SINCE_KOTLIN_WITHOUT_DEPRECATED = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> DEPRECATED_SINCE_KOTLIN_WITH_DEPRECATED_LEVEL = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
@@ -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<StringValue>()?.value
|
||||
|
||||
@@ -111,13 +111,13 @@ internal sealed class DeprecatedByAnnotation(
|
||||
}
|
||||
}
|
||||
|
||||
internal data class DeprecatedByOverridden(private val deprecations: Collection<DescriptorBasedDeprecation>) : DescriptorBasedDeprecation() {
|
||||
internal data class DeprecatedByOverridden(private val deprecations: Collection<DescriptorBasedDeprecationInfo>) : 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
|
||||
|
||||
+13
-13
@@ -58,9 +58,9 @@ class DeprecationResolver(
|
||||
}
|
||||
|
||||
private data class DeprecationInfo(
|
||||
val deprecations: List<DescriptorBasedDeprecation>,
|
||||
val deprecations: List<DescriptorBasedDeprecationInfo>,
|
||||
val hasInheritedDeprecations: Boolean,
|
||||
val hiddenInheritedDeprecations: List<DescriptorBasedDeprecation> = emptyList()
|
||||
val hiddenInheritedDeprecations: List<DescriptorBasedDeprecationInfo> = emptyList()
|
||||
) {
|
||||
companion object {
|
||||
val EMPTY = DeprecationInfo(emptyList(), hasInheritedDeprecations = false, emptyList())
|
||||
@@ -71,7 +71,7 @@ class DeprecationResolver(
|
||||
descriptor.checkSinceKotlinVersionAccessibility(languageVersionSettings)
|
||||
}
|
||||
|
||||
fun getDeprecations(descriptor: DeclarationDescriptor): List<DescriptorBasedDeprecation> =
|
||||
fun getDeprecations(descriptor: DeclarationDescriptor): List<DescriptorBasedDeprecationInfo> =
|
||||
deprecations(descriptor.original).deprecations
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
@@ -82,7 +82,7 @@ class DeprecationResolver(
|
||||
return deprecations(descriptor.original).hasInheritedDeprecations
|
||||
}
|
||||
|
||||
fun getHiddenDeprecationsFromOverriden(descriptor: DeclarationDescriptor): List<DescriptorBasedDeprecation> =
|
||||
fun getHiddenDeprecationsFromOverriden(descriptor: DeclarationDescriptor): List<DescriptorBasedDeprecationInfo> =
|
||||
deprecations(descriptor.original).hiddenInheritedDeprecations
|
||||
|
||||
fun isDeprecatedHidden(descriptor: DeclarationDescriptor): Boolean =
|
||||
@@ -130,8 +130,8 @@ class DeprecationResolver(
|
||||
return isDeprecatedHidden(descriptor)
|
||||
}
|
||||
|
||||
private fun KotlinType.deprecationsByConstituentTypes(): List<DescriptorBasedDeprecation> =
|
||||
SmartList<DescriptorBasedDeprecation>().also { deprecations ->
|
||||
private fun KotlinType.deprecationsByConstituentTypes(): List<DescriptorBasedDeprecationInfo> =
|
||||
SmartList<DescriptorBasedDeprecationInfo>().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<CallableMemberDescriptor>()
|
||||
val deprecations = LinkedHashSet<DescriptorBasedDeprecation>()
|
||||
val deprecations = LinkedHashSet<DescriptorBasedDeprecationInfo>()
|
||||
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<DescriptorBasedDeprecation> {
|
||||
private fun DeclarationDescriptor.getOwnDeprecations(): List<DescriptorBasedDeprecationInfo> {
|
||||
// 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<DescriptorBasedDeprecation>()
|
||||
val result = SmartList<DescriptorBasedDeprecationInfo>()
|
||||
|
||||
addDeprecationIfPresent(result)
|
||||
|
||||
@@ -228,7 +228,7 @@ class DeprecationResolver(
|
||||
return result.distinct()
|
||||
}
|
||||
|
||||
private fun DeclarationDescriptor.addDeprecationIfPresent(result: MutableList<DescriptorBasedDeprecation>) {
|
||||
private fun DeclarationDescriptor.addDeprecationIfPresent(result: MutableList<DescriptorBasedDeprecationInfo>) {
|
||||
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<CallableDescriptor>()?.getUserData(DEPRECATED_FUNCTION_KEY)
|
||||
|
||||
private fun getDeprecationByVersionRequirement(target: DeclarationDescriptor): List<DeprecatedByVersionRequirement> {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+4
-4
@@ -5,12 +5,12 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.deprecation
|
||||
|
||||
abstract class Deprecation : Comparable<Deprecation> {
|
||||
abstract class DeprecationInfo : Comparable<DeprecationInfo> {
|
||||
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<Deprecation> {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
+1
-1
@@ -215,7 +215,7 @@ class SignatureEnhancement(
|
||||
) {
|
||||
val additionalUserData =
|
||||
if (containsFunctionN)
|
||||
DEPRECATED_FUNCTION_KEY to DeprecationCausedByFunctionN(this)
|
||||
DEPRECATED_FUNCTION_KEY to DeprecationCausedByFunctionNInfo(this)
|
||||
else
|
||||
null
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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<DescriptorBasedDeprecation> {}
|
||||
val DEPRECATED_FUNCTION_KEY = object : CallableDescriptor.UserDataKey<DescriptorBasedDeprecationInfo> {}
|
||||
+9
-9
@@ -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)
|
||||
}
|
||||
|
||||
+2
-2
@@ -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!!
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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<*>
|
||||
|
||||
+5
-5
@@ -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)
|
||||
|
||||
+2
-2
@@ -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<PSI : PsiElement> : KtDiagnosticWithPsi<PSI> {
|
||||
abstract class OverrideDeprecation : KtFirDiagnostic<KtNamedDeclaration>() {
|
||||
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<KtAnnotationEntry>() {
|
||||
|
||||
+2
-2
@@ -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<KtNamedDeclaration> {
|
||||
|
||||
+2
-2
@@ -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"
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user