Synchronize common builtin annotation changes to K/N
- DeprecatedSinceKotlin - TYPE_PARAMETER target for Suppress (cherry picked from commit 6b4aabe0f7a67362068c80ea0d3cf4a45850104a)
This commit is contained in:
committed by
Vasily Levchenko
parent
b054a40b0f
commit
2002146152
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
@@ -38,6 +38,27 @@ public annotation class Deprecated(
|
||||
val level: DeprecationLevel = DeprecationLevel.WARNING
|
||||
)
|
||||
|
||||
/**
|
||||
* Marks the annotated declaration as deprecated. In contrast to [Deprecated], severity of the reported diagnostic is not a constant value,
|
||||
* but differs depending on the API version of the usage (the value of the `-api-version` argument when compiling the module where
|
||||
* the usage is located). If the API version is greater or equal than [hiddenSince], the declaration will not be accessible from the code
|
||||
* (as if it was deprecated with level [DeprecationLevel.HIDDEN]), otherwise if the API version is greater or equal than [errorSince],
|
||||
* 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 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.
|
||||
*/
|
||||
@Target(CLASS, FUNCTION, PROPERTY, ANNOTATION_CLASS, CONSTRUCTOR, PROPERTY_SETTER, PROPERTY_GETTER, TYPEALIAS)
|
||||
@MustBeDocumented
|
||||
@SinceKotlin("1.4")
|
||||
public annotation class DeprecatedSinceKotlin(
|
||||
val warningSince: String = "",
|
||||
val errorSince: String = "",
|
||||
val hiddenSince: String = ""
|
||||
)
|
||||
|
||||
/**
|
||||
* Specifies a code fragment that can be used to replace a deprecated function, property or class. Tools such
|
||||
* as IDEs can automatically apply the replacements specified through this annotation.
|
||||
@@ -89,7 +110,7 @@ public annotation class ParameterName(val name: String)
|
||||
* Suppresses the given compilation warnings in the annotated element.
|
||||
* @property names names of the compiler diagnostics to suppress.
|
||||
*/
|
||||
@Target(CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER,
|
||||
@Target(CLASS, ANNOTATION_CLASS, TYPE_PARAMETER, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER,
|
||||
CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, EXPRESSION, FILE, TYPEALIAS)
|
||||
@Retention(SOURCE)
|
||||
public annotation class Suppress(vararg val names: String)
|
||||
|
||||
Reference in New Issue
Block a user