Remove message and replaceWith parameters from DeprecatedSinceKotlin

This commit is contained in:
Mikhail Zarechenskiy
2020-06-17 18:52:59 +03:00
parent 60c51476f2
commit 158013ef3a
15 changed files with 118 additions and 89 deletions
@@ -5,7 +5,6 @@
package org.jetbrains.kotlin.resolve.deprecation
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.LanguageVersionSettings
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
@@ -59,16 +58,17 @@ internal sealed class DeprecatedByAnnotation(
companion object {
fun create(
annotation: AnnotationDescriptor,
deprecatedAnnotation: AnnotationDescriptor,
deprecatedSinceKotlinAnnotation: AnnotationDescriptor?,
target: DeclarationDescriptor,
propagatesToOverrides: Boolean,
apiVersion: ApiVersion
): DeprecatedByAnnotation? {
if (annotation.fqName == KotlinBuiltIns.FQ_NAMES.deprecatedSinceKotlin) {
val level = computeLevelForDeprecatedSinceKotlin(annotation, apiVersion) ?: return null
return DeprecatedSince(annotation, target, propagatesToOverrides, level)
if (deprecatedSinceKotlinAnnotation != null) {
val level = computeLevelForDeprecatedSinceKotlin(deprecatedSinceKotlinAnnotation, apiVersion) ?: return null
return DeprecatedSince(deprecatedAnnotation, target, propagatesToOverrides, level)
}
return StandardDeprecated(annotation, target, propagatesToOverrides)
return StandardDeprecated(deprecatedAnnotation, target, propagatesToOverrides)
}
private fun computeLevelForDeprecatedSinceKotlin(annotation: AnnotationDescriptor, apiVersion: ApiVersion): DeprecationLevelValue? {
@@ -186,14 +186,12 @@ class DeprecationResolver(
}
private fun DeclarationDescriptor.addDeprecationIfPresent(result: MutableList<Deprecation>) {
val annotation = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecated)
?: annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecatedSinceKotlin)
?: annotations.findAnnotation(JAVA_DEPRECATED)
val annotation = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecated) ?: annotations.findAnnotation(JAVA_DEPRECATED)
if (annotation != null) {
val deprecatedByAnnotation =
DeprecatedByAnnotation.create(
annotation, this,
deprecationSettings.propagatedToOverrides(annotation),
annotation, annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.deprecatedSinceKotlin),
this, deprecationSettings.propagatedToOverrides(annotation),
languageVersionSettings.apiVersion
)
if (deprecatedByAnnotation != null) {