Rename Deprecation to DeprecationInfo

This commit is contained in:
Dmitriy Novozhilov
2021-08-30 12:00:15 +03:00
parent 5d31f0f032
commit 69c3831865
24 changed files with 91 additions and 92 deletions
@@ -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
@@ -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
@@ -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> {}