annotation() now has no arguments. Syntax migration to Retention / Repeatable / MustBeDocumented combination
Deprecated test for annotation(params) completion deleted. A lot of tests changed.
This commit is contained in:
committed by
Mikhail Glukhikh
parent
86f35acf9e
commit
eab288bdd7
@@ -27,7 +27,8 @@ import kotlin.annotation.AnnotationTarget.*
|
||||
* for more information.
|
||||
*/
|
||||
target(CLASSIFIER)
|
||||
public annotation(mustBeDocumented = true) class data
|
||||
@MustBeDocumented
|
||||
public annotation class data
|
||||
|
||||
/**
|
||||
* Marks the annotated class, function, property, variable or parameter as deprecated.
|
||||
@@ -37,7 +38,8 @@ public annotation(mustBeDocumented = true) class data
|
||||
*/
|
||||
target(CLASSIFIER, FUNCTION, PROPERTY, ANNOTATION_CLASS, CONSTRUCTOR, PROPERTY_SETTER, PROPERTY_GETTER,
|
||||
LOCAL_VARIABLE, VALUE_PARAMETER)
|
||||
public annotation(mustBeDocumented = true) class Deprecated(val value: String, val replaceWith: ReplaceWith = ReplaceWith(""))
|
||||
@MustBeDocumented
|
||||
public annotation class Deprecated(val value: String, val replaceWith: ReplaceWith = ReplaceWith(""))
|
||||
|
||||
/**
|
||||
* Specifies a code fragment that can be used to replace a deprecated function, property or class. Tools such
|
||||
@@ -53,13 +55,16 @@ public annotation(mustBeDocumented = true) class Deprecated(val value: String, v
|
||||
* replacement expression to be resolved correctly.
|
||||
*/
|
||||
target()
|
||||
public annotation(retention = BINARY, mustBeDocumented = true) class ReplaceWith(val expression: String, vararg val imports: String)
|
||||
@Retention(BINARY)
|
||||
@MustBeDocumented
|
||||
public annotation class ReplaceWith(val expression: String, vararg val imports: String)
|
||||
|
||||
/**
|
||||
* Signifies that the annotated functional type represents an extension function.
|
||||
*/
|
||||
target(TYPE)
|
||||
public annotation(mustBeDocumented = true) class Extension
|
||||
@MustBeDocumented
|
||||
public annotation class Extension
|
||||
|
||||
/**
|
||||
* Suppresses the given compilation warnings in the annotated element.
|
||||
@@ -67,7 +72,8 @@ public annotation(mustBeDocumented = true) class Extension
|
||||
*/
|
||||
target(CLASSIFIER, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER,
|
||||
CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, EXPRESSION, FILE)
|
||||
public annotation(retention = SOURCE) class Suppress(vararg val names: String)
|
||||
@Retention(SOURCE)
|
||||
public annotation class Suppress(vararg val names: String)
|
||||
|
||||
/**
|
||||
* Enables the tail call optimization for the annotated function. If the annotated function
|
||||
@@ -77,10 +83,12 @@ public annotation(retention = SOURCE) class Suppress(vararg val names: String)
|
||||
*/
|
||||
target(FUNCTION)
|
||||
// @deprecated("Use kotlin.tailrec instead", ReplaceWith("kotlin.tailrec"))
|
||||
public annotation(retention = SOURCE) class tailRecursive
|
||||
@Retention(SOURCE)
|
||||
public annotation class tailRecursive
|
||||
|
||||
target(FUNCTION)
|
||||
public annotation(retention = SOURCE) class tailrec
|
||||
@Retention(SOURCE)
|
||||
public annotation class tailrec
|
||||
|
||||
/**
|
||||
* Hides the annotated function, property or constructor from the overload resolution,
|
||||
@@ -88,12 +96,15 @@ public annotation(retention = SOURCE) class tailrec
|
||||
* to retain binary compatibility with the code compiled against it before.
|
||||
*/
|
||||
target(FUNCTION, PROPERTY, CONSTRUCTOR)
|
||||
annotation(retention = BINARY, mustBeDocumented = true)
|
||||
public class HiddenDeclaration
|
||||
@Retention(BINARY)
|
||||
@MustBeDocumented
|
||||
public annotation class HiddenDeclaration
|
||||
|
||||
/**
|
||||
* Marks annotated function as `external`, meaning that it's not implemented
|
||||
* in Kotlin but rather in a different language (for example, in C/C++ using JNI or JavaScript).
|
||||
*/
|
||||
target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class external
|
||||
@Retention(SOURCE)
|
||||
@MustBeDocumented
|
||||
public annotation class external
|
||||
|
||||
@@ -21,7 +21,9 @@ package kotlin
|
||||
* function literals passed as arguments for this parameter.
|
||||
*/
|
||||
target(AnnotationTarget.VALUE_PARAMETER)
|
||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class noinline
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MustBeDocumented
|
||||
public annotation class noinline
|
||||
|
||||
/**
|
||||
* Enables inlining of the annotated function and the function literals that it takes as parameters into the
|
||||
@@ -35,7 +37,9 @@ public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = tr
|
||||
* @see inlineOptions
|
||||
*/
|
||||
target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY)
|
||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class inline(public val strategy: InlineStrategy = InlineStrategy.AS_FUNCTION)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MustBeDocumented
|
||||
public annotation class inline(public val strategy: InlineStrategy = InlineStrategy.AS_FUNCTION)
|
||||
|
||||
/**
|
||||
* Specifies the strategy for code generation for an inline function.
|
||||
@@ -64,7 +68,9 @@ public enum class InlineStrategy {
|
||||
* @property value the inlining options selected for the annotated function parameter.
|
||||
*/
|
||||
target(AnnotationTarget.VALUE_PARAMETER)
|
||||
public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class inlineOptions(vararg val value: InlineOption)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MustBeDocumented
|
||||
public annotation class inlineOptions(vararg val value: InlineOption)
|
||||
|
||||
/**
|
||||
* Specifies the control flow statements which are allowed to be used for non-local control flow transfer in a lambda
|
||||
|
||||
@@ -73,22 +73,17 @@ public enum class AnnotationRetention {
|
||||
* @property allowedTargets list of allowed annotation targets
|
||||
*/
|
||||
target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
public annotation(mustBeDocumented = true) class target(vararg val allowedTargets: AnnotationTarget)
|
||||
@MustBeDocumented
|
||||
public annotation class target(vararg val allowedTargets: AnnotationTarget)
|
||||
|
||||
/**
|
||||
* This special meta-annotation is used to declare an annotation and to set its base properties.
|
||||
* This special meta-annotation is used to declare an annotation.
|
||||
* So a class in Kotlin is an annotation if and only if it has the "annotation" meta-annotation.
|
||||
*
|
||||
* @property retention determines whether the annotation is stored in binary output and visible for reflection. By default, both are true.
|
||||
* @property repeatable true if annotation is repeatable (applicable twice or more on a single code element), otherwise false (default)
|
||||
* @property mustBeDocumented true if annotation is a part of public API and therefore must be documented, otherwise false (default)
|
||||
*/
|
||||
target(AnnotationTarget.ANNOTATION_CLASS)
|
||||
public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class annotation (
|
||||
val retention: AnnotationRetention = AnnotationRetention.RUNTIME,
|
||||
val repeatable: Boolean = false,
|
||||
val mustBeDocumented: Boolean = false
|
||||
)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@MustBeDocumented
|
||||
public annotation class annotation
|
||||
|
||||
/**
|
||||
* This meta-annotation determines whether an annotation is stored in binary output and visible for reflection. By default, both are true.
|
||||
|
||||
Reference in New Issue
Block a user