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 34b197ae087..8547f6e2f4b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/Deprecation.kt @@ -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? { 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 f25634d90e9..da30270f106 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/deprecation/DeprecationResolver.kt @@ -186,14 +186,12 @@ class DeprecationResolver( } private fun DeclarationDescriptor.addDeprecationIfPresent(result: MutableList) { - 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) { diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.fir.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.fir.kt index 69b7c21d0c6..ba5f1b9383e 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.fir.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.fir.kt @@ -1,42 +1,42 @@ @Deprecated("", ReplaceWith("")) -@DeprecatedSinceKotlin("", warningSince = "1.0", errorSince = "1.1", hiddenSince = "1.2") +@DeprecatedSinceKotlin(warningSince = "1.0", errorSince = "1.1", hiddenSince = "1.2") fun good() {} -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() class Clazz @Deprecated("", level = DeprecationLevel.WARNING) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooWarning() {} @Deprecated("", ReplaceWith(""), DeprecationLevel.WARNING) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooDefaultWarning() {} @Deprecated("", level = DeprecationLevel.ERROR) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooError() {} @Deprecated("", level = DeprecationLevel.HIDDEN) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooHidden() {} @Deprecated("") -@DeprecatedSinceKotlin("", warningSince = "1.1", errorSince = "1.0") +@DeprecatedSinceKotlin(warningSince = "1.1", errorSince = "1.0") fun fooWarningIsGreater1() {} @Deprecated("") -@DeprecatedSinceKotlin("", warningSince = "1.1", hiddenSince = "1.0") +@DeprecatedSinceKotlin(warningSince = "1.1", hiddenSince = "1.0") fun fooWarningIsGreater2() {} @Deprecated("") -@DeprecatedSinceKotlin("", warningSince = "1.1", errorSince = "1.3", hiddenSince = "1.2") +@DeprecatedSinceKotlin(warningSince = "1.1", errorSince = "1.3", hiddenSince = "1.2") fun fooErrorIsGreater() {} @Deprecated("") -@DeprecatedSinceKotlin("", ReplaceWith(""), "1.2", "1.1", "1.1") +@DeprecatedSinceKotlin("1.2", "1.1", "1.1") fun fooDefault() {} @Deprecated("") -@DeprecatedSinceKotlin("", ReplaceWith(""), "1.1", "1.1", "1.1") -fun fooEqual() {} \ No newline at end of file +@DeprecatedSinceKotlin("1.1", "1.1", "1.1") +fun fooEqual() {} diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt index 3bba894274d..7c0e43d8094 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.kt @@ -1,42 +1,42 @@ @Deprecated("", ReplaceWith("")) -@DeprecatedSinceKotlin("", warningSince = "1.0", errorSince = "1.1", hiddenSince = "1.2") +@DeprecatedSinceKotlin(warningSince = "1.0", errorSince = "1.1", hiddenSince = "1.2") fun good() {} -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() class Clazz @Deprecated("", level = DeprecationLevel.WARNING) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooWarning() {} @Deprecated("", ReplaceWith(""), DeprecationLevel.WARNING) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooDefaultWarning() {} @Deprecated("", level = DeprecationLevel.ERROR) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooError() {} @Deprecated("", level = DeprecationLevel.HIDDEN) -@DeprecatedSinceKotlin("") +@DeprecatedSinceKotlin() fun fooHidden() {} @Deprecated("") -@DeprecatedSinceKotlin("", warningSince = "1.1", errorSince = "1.0") +@DeprecatedSinceKotlin(warningSince = "1.1", errorSince = "1.0") fun fooWarningIsGreater1() {} @Deprecated("") -@DeprecatedSinceKotlin("", warningSince = "1.1", hiddenSince = "1.0") +@DeprecatedSinceKotlin(warningSince = "1.1", hiddenSince = "1.0") fun fooWarningIsGreater2() {} @Deprecated("") -@DeprecatedSinceKotlin("", warningSince = "1.1", errorSince = "1.3", hiddenSince = "1.2") +@DeprecatedSinceKotlin(warningSince = "1.1", errorSince = "1.3", hiddenSince = "1.2") fun fooErrorIsGreater() {} @Deprecated("") -@DeprecatedSinceKotlin("", ReplaceWith(""), "1.2", "1.1", "1.1") +@DeprecatedSinceKotlin("1.2", "1.1", "1.1") fun fooDefault() {} @Deprecated("") -@DeprecatedSinceKotlin("", ReplaceWith(""), "1.1", "1.1", "1.1") +@DeprecatedSinceKotlin("1.1", "1.1", "1.1") fun fooEqual() {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.txt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.txt index 2a36c37d296..896c37046a0 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.txt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinDeclaration.txt @@ -1,17 +1,17 @@ package -@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.1", hiddenSince = "1.1", message = "", replaceWith = kotlin.ReplaceWith(expression = "", imports = {}), warningSince = "1.2") public fun fooDefault(): kotlin.Unit -@kotlin.Deprecated(level = DeprecationLevel.WARNING, message = "", replaceWith = kotlin.ReplaceWith(expression = "", imports = {})) @kotlin.DeprecatedSinceKotlin(message = "") public fun fooDefaultWarning(): kotlin.Unit -@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.1", hiddenSince = "1.1", message = "", replaceWith = kotlin.ReplaceWith(expression = "", imports = {}), warningSince = "1.1") public fun fooEqual(): kotlin.Unit -@kotlin.Deprecated(level = DeprecationLevel.ERROR, message = "") @kotlin.DeprecatedSinceKotlin(message = "") public fun fooError(): kotlin.Unit -@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.3", hiddenSince = "1.2", message = "", warningSince = "1.1") public fun fooErrorIsGreater(): kotlin.Unit -@kotlin.Deprecated(level = DeprecationLevel.HIDDEN, message = "") @kotlin.DeprecatedSinceKotlin(message = "") public fun fooHidden(): kotlin.Unit -@kotlin.Deprecated(level = DeprecationLevel.WARNING, message = "") @kotlin.DeprecatedSinceKotlin(message = "") public fun fooWarning(): kotlin.Unit -@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.0", message = "", warningSince = "1.1") public fun fooWarningIsGreater1(): kotlin.Unit -@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.0", message = "", warningSince = "1.1") public fun fooWarningIsGreater2(): kotlin.Unit -@kotlin.Deprecated(message = "", replaceWith = kotlin.ReplaceWith(expression = "", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.1", hiddenSince = "1.2", message = "", warningSince = "1.0") public fun good(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.1", hiddenSince = "1.1", warningSince = "1.2") public fun fooDefault(): kotlin.Unit +@kotlin.Deprecated(level = DeprecationLevel.WARNING, message = "", replaceWith = kotlin.ReplaceWith(expression = "", imports = {})) @kotlin.DeprecatedSinceKotlin public fun fooDefaultWarning(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.1", hiddenSince = "1.1", warningSince = "1.1") public fun fooEqual(): kotlin.Unit +@kotlin.Deprecated(level = DeprecationLevel.ERROR, message = "") @kotlin.DeprecatedSinceKotlin public fun fooError(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.3", hiddenSince = "1.2", warningSince = "1.1") public fun fooErrorIsGreater(): kotlin.Unit +@kotlin.Deprecated(level = DeprecationLevel.HIDDEN, message = "") @kotlin.DeprecatedSinceKotlin public fun fooHidden(): kotlin.Unit +@kotlin.Deprecated(level = DeprecationLevel.WARNING, message = "") @kotlin.DeprecatedSinceKotlin public fun fooWarning(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.0", warningSince = "1.1") public fun fooWarningIsGreater1(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.0", warningSince = "1.1") public fun fooWarningIsGreater2(): kotlin.Unit +@kotlin.Deprecated(message = "", replaceWith = kotlin.ReplaceWith(expression = "", imports = {})) @kotlin.DeprecatedSinceKotlin(errorSince = "1.1", hiddenSince = "1.2", warningSince = "1.0") public fun good(): kotlin.Unit -@kotlin.DeprecatedSinceKotlin(message = "") public final class Clazz { +@kotlin.DeprecatedSinceKotlin public final class Clazz { public constructor Clazz() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.fir.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.fir.kt index 7fbeabf6a5e..0d2f4b117d1 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.fir.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.fir.kt @@ -1,27 +1,33 @@ // !API_VERSION: 1.3 +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.3") class ClassCur +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.3") fun funCur() {} +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.3") val valCur = Unit +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.4") class ClassNext +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.4") fun funNext() {} +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.4") val valNext = Unit fun usage() { - ClassCur() - funCur() - valCur + ClassCur() + funCur() + valCur ClassNext() funNext() diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt index 7fbeabf6a5e..2d12106eff3 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.kt @@ -1,20 +1,26 @@ // !API_VERSION: 1.3 +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.3") class ClassCur +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.3") fun funCur() {} +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.3") val valCur = Unit +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.4") class ClassNext +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.4") fun funNext() {} +@Deprecated("") @DeprecatedSinceKotlin("", errorSince = "1.4") val valNext = Unit diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.txt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.txt index 1e458887acf..dd341c6ae11 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.txt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/error.txt @@ -1,19 +1,19 @@ package -@kotlin.DeprecatedSinceKotlin(errorSince = "1.3", message = "") public val valCur: kotlin.Unit -@kotlin.DeprecatedSinceKotlin(errorSince = "1.4", message = "") public val valNext: kotlin.Unit -@kotlin.DeprecatedSinceKotlin(errorSince = "1.3", message = "") public fun funCur(): kotlin.Unit -@kotlin.DeprecatedSinceKotlin(errorSince = "1.4", message = "") public fun funNext(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.3", warningSince = "") public val valCur: kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.4", warningSince = "") public val valNext: kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.3", warningSince = "") public fun funCur(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.4", warningSince = "") public fun funNext(): kotlin.Unit public fun usage(): kotlin.Unit -@kotlin.DeprecatedSinceKotlin(errorSince = "1.3", message = "") public final class ClassCur { +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.3", warningSince = "") public final class ClassCur { public constructor ClassCur() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -@kotlin.DeprecatedSinceKotlin(errorSince = "1.4", message = "") public final class ClassNext { +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(errorSince = "1.4", warningSince = "") public final class ClassNext { public constructor ClassNext() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt index 27c21f92b44..8e67095d182 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt @@ -1,27 +1,33 @@ // !API_VERSION: 1.3 +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.3") class ClassCur +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.3") fun funCur() {} +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.3") val valCur = Unit +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.4") class ClassNext +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.4") fun funNext() {} +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.4") val valNext = Unit fun usage() { - ClassCur() - funCur() - valCur + ClassCur() + funCur() + valCur ClassNext() funNext() diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt index 27c21f92b44..61de0f1c504 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.kt @@ -1,20 +1,26 @@ // !API_VERSION: 1.3 +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.3") class ClassCur +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.3") fun funCur() {} +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.3") val valCur = Unit +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.4") class ClassNext +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.4") fun funNext() {} +@Deprecated("") @DeprecatedSinceKotlin("", hiddenSince = "1.4") val valNext = Unit diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.txt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.txt index 4d90a846206..6f3aecdd66a 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.txt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.txt @@ -1,19 +1,19 @@ package -@kotlin.DeprecatedSinceKotlin(hiddenSince = "1.3", message = "") public val valCur: kotlin.Unit -@kotlin.DeprecatedSinceKotlin(hiddenSince = "1.4", message = "") public val valNext: kotlin.Unit -@kotlin.DeprecatedSinceKotlin(hiddenSince = "1.3", message = "") public fun funCur(): kotlin.Unit -@kotlin.DeprecatedSinceKotlin(hiddenSince = "1.4", message = "") public fun funNext(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.3", warningSince = "") public val valCur: kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.4", warningSince = "") public val valNext: kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.3", warningSince = "") public fun funCur(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.4", warningSince = "") public fun funNext(): kotlin.Unit public fun usage(): kotlin.Unit -@kotlin.DeprecatedSinceKotlin(hiddenSince = "1.3", message = "") public final class ClassCur { +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.3", warningSince = "") public final class ClassCur { public constructor ClassCur() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -@kotlin.DeprecatedSinceKotlin(hiddenSince = "1.4", message = "") public final class ClassNext { +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(hiddenSince = "1.4", warningSince = "") public final class ClassNext { public constructor ClassNext() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.fir.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.fir.kt index 1fd556775bf..b5a0d86117c 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.fir.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.fir.kt @@ -1,27 +1,33 @@ // !API_VERSION: 1.3 -@DeprecatedSinceKotlin("", warningSince = "1.3") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.3") class ClassCur -@DeprecatedSinceKotlin("", warningSince = "1.3") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.3") fun funCur() {} -@DeprecatedSinceKotlin("", warningSince = "1.3") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.3") val valCur = Unit -@DeprecatedSinceKotlin("", warningSince = "1.4") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.4") class ClassNext -@DeprecatedSinceKotlin("", warningSince = "1.4") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.4") fun funNext() {} -@DeprecatedSinceKotlin("", warningSince = "1.4") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.4") val valNext = Unit fun usage() { - ClassCur() - funCur() - valCur + ClassCur() + funCur() + valCur ClassNext() funNext() diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt index 1fd556775bf..9c1cd30fa7a 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.kt @@ -1,21 +1,27 @@ // !API_VERSION: 1.3 -@DeprecatedSinceKotlin("", warningSince = "1.3") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.3") class ClassCur -@DeprecatedSinceKotlin("", warningSince = "1.3") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.3") fun funCur() {} -@DeprecatedSinceKotlin("", warningSince = "1.3") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.3") val valCur = Unit -@DeprecatedSinceKotlin("", warningSince = "1.4") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.4") class ClassNext -@DeprecatedSinceKotlin("", warningSince = "1.4") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.4") fun funNext() {} -@DeprecatedSinceKotlin("", warningSince = "1.4") +@Deprecated("") +@DeprecatedSinceKotlin(warningSince = "1.4") val valNext = Unit fun usage() { diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.txt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.txt index 0837a112476..5e8931324f7 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.txt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/warning.txt @@ -1,19 +1,19 @@ package -@kotlin.DeprecatedSinceKotlin(message = "", warningSince = "1.3") public val valCur: kotlin.Unit -@kotlin.DeprecatedSinceKotlin(message = "", warningSince = "1.4") public val valNext: kotlin.Unit -@kotlin.DeprecatedSinceKotlin(message = "", warningSince = "1.3") public fun funCur(): kotlin.Unit -@kotlin.DeprecatedSinceKotlin(message = "", warningSince = "1.4") public fun funNext(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(warningSince = "1.3") public val valCur: kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(warningSince = "1.4") public val valNext: kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(warningSince = "1.3") public fun funCur(): kotlin.Unit +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(warningSince = "1.4") public fun funNext(): kotlin.Unit public fun usage(): kotlin.Unit -@kotlin.DeprecatedSinceKotlin(message = "", warningSince = "1.3") public final class ClassCur { +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(warningSince = "1.3") public final class ClassCur { public constructor ClassCur() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -@kotlin.DeprecatedSinceKotlin(message = "", warningSince = "1.4") public final class ClassNext { +@kotlin.Deprecated(message = "") @kotlin.DeprecatedSinceKotlin(warningSince = "1.4") public final class ClassNext { public constructor ClassNext() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/core/builtins/src/kotlin/Annotations.kt b/core/builtins/src/kotlin/Annotations.kt index 4890646e580..d858c9dac71 100644 --- a/core/builtins/src/kotlin/Annotations.kt +++ b/core/builtins/src/kotlin/Annotations.kt @@ -45,9 +45,6 @@ public annotation class Deprecated( * the usage will be marked as an error (as with [DeprecationLevel.ERROR]), otherwise if the API version is greater or equal * than [warningSince], the usage will be marked as a warning (as with [DeprecationLevel.WARNING]), otherwise the annotation is ignored. * - * @property message the message explaining the deprecation and recommending an alternative API to use. - * @property replaceWith if present, specifies a code fragment which should be used as a replacement for - * the deprecated API usage. * @property warningSince the version, since which this deprecation should be reported as a warning. * @property errorSince the version, since which this deprecation should be reported as a error. * @property hiddenSince the version, since which the annotated declaration should not be available in code. @@ -56,8 +53,6 @@ public annotation class Deprecated( @MustBeDocumented @SinceKotlin("1.3") public annotation class DeprecatedSinceKotlin( - val message: String, - val replaceWith: ReplaceWith = ReplaceWith(""), val warningSince: String = "", val errorSince: String = "", val hiddenSince: String = ""