diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index a5ddacb7a94..7056b234b0e 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -283,7 +283,7 @@ public interface Comparable { public abstract fun compareTo(/*0*/ other: T): kotlin.Int } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.annotation(mustBeDocumented = true) public final class Deprecated : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class Deprecated : kotlin.Annotation { /*primary*/ public constructor Deprecated(/*0*/ value: kotlin.String, /*1*/ replaceWith: kotlin.ReplaceWith = ...) internal final val replaceWith: kotlin.ReplaceWith internal final fun (): kotlin.ReplaceWith @@ -435,7 +435,7 @@ public abstract class Enum> : kotlin.Comparable { } } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.annotation(mustBeDocumented = true) public final class Extension : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE}) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class Extension : kotlin.Annotation { /*primary*/ public constructor Extension() } @@ -587,7 +587,7 @@ public interface FloatingPointConstants { public interface Function { } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.CONSTRUCTOR}) kotlin.annotation.annotation(mustBeDocumented = true, retention = AnnotationRetention.BINARY) public final class HiddenDeclaration : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.CONSTRUCTOR}) kotlin.annotation.Retention(value = AnnotationRetention.BINARY) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class HiddenDeclaration : kotlin.Annotation { /*primary*/ public constructor HiddenDeclaration() } @@ -1092,7 +1092,7 @@ public interface Range> { public open fun isEmpty(): kotlin.Boolean } -kotlin.annotation.target(allowedTargets = {}) kotlin.annotation.annotation(mustBeDocumented = true, retention = AnnotationRetention.BINARY) public final class ReplaceWith : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {}) kotlin.annotation.Retention(value = AnnotationRetention.BINARY) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class ReplaceWith : kotlin.Annotation { /*primary*/ public constructor ReplaceWith(/*0*/ expression: kotlin.String, /*1*/ vararg imports: kotlin.String /*kotlin.Array*/) internal final val expression: kotlin.String internal final fun (): kotlin.String @@ -1251,7 +1251,7 @@ public final class String : kotlin.Comparable, kotlin.CharSequenc } } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.EXPRESSION, AnnotationTarget.FILE}) kotlin.annotation.annotation(retention = AnnotationRetention.SOURCE) public final class Suppress : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.EXPRESSION, AnnotationTarget.FILE}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.annotation() public final class Suppress : kotlin.Annotation { /*primary*/ public constructor Suppress(/*0*/ vararg names: kotlin.String /*kotlin.Array*/) internal final val names: kotlin.Array internal final fun (): kotlin.Array @@ -1268,34 +1268,34 @@ public object Unit { /*primary*/ private constructor Unit() } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER}) kotlin.annotation.annotation(mustBeDocumented = true) public final class data : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.CLASSIFIER}) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class data : kotlin.Annotation { /*primary*/ public constructor data() } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER}) kotlin.annotation.annotation(mustBeDocumented = true, retention = AnnotationRetention.SOURCE) public final class external : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class external : kotlin.Annotation { /*primary*/ public constructor external() } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) kotlin.annotation.annotation(mustBeDocumented = true, retention = AnnotationRetention.RUNTIME) public final class inline : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY}) kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class inline : kotlin.Annotation { /*primary*/ public constructor inline(/*0*/ strategy: kotlin.InlineStrategy = ...) public final val strategy: kotlin.InlineStrategy public final fun (): kotlin.InlineStrategy } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.annotation(mustBeDocumented = true, retention = AnnotationRetention.RUNTIME) public final class inlineOptions : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class inlineOptions : kotlin.Annotation { /*primary*/ public constructor inlineOptions(/*0*/ vararg value: kotlin.InlineOption /*kotlin.Array*/) internal final val value: kotlin.Array internal final fun (): kotlin.Array } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.annotation(mustBeDocumented = true, retention = AnnotationRetention.RUNTIME) public final class noinline : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class noinline : kotlin.Annotation { /*primary*/ public constructor noinline() } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION}) kotlin.annotation.annotation(retention = AnnotationRetention.SOURCE) public final class tailRecursive : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.annotation() public final class tailRecursive : kotlin.Annotation { /*primary*/ public constructor tailRecursive() } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION}) kotlin.annotation.annotation(retention = AnnotationRetention.SOURCE) public final class tailrec : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.FUNCTION}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.annotation() public final class tailrec : kotlin.Annotation { /*primary*/ public constructor tailrec() } diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt index 0146526a3a7..70dc0a231d4 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaNegativePropertyAsAnnotationParameter.kt @@ -12,7 +12,8 @@ fun box(): String { return "OK" } -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val i: Int, val s: Short, val f: Float, diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt index cb542bcd213..7748dea6bc7 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyAsAnnotationParameter.kt @@ -17,7 +17,8 @@ fun box(): String { return "OK" } -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val i: Int, val s: Short, val f: Float, diff --git a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt index 4e621be9447..d862b7582f0 100644 --- a/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt +++ b/compiler/testData/codegen/boxAgainstJava/annotations/javaPropertyWithIntInitializer.kt @@ -13,7 +13,8 @@ fun box(): String { return "OK" } -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val i: Int, val s: Short, val f: Float, diff --git a/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/annotatedSamFunExpression.kt b/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/annotatedSamFunExpression.kt index 901267de6f0..383fa532fca 100644 --- a/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/annotatedSamFunExpression.kt +++ b/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/annotatedSamFunExpression.kt @@ -1,7 +1,8 @@ import java.lang.reflect.Method import kotlin.test.assertEquals -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) fun testMethod(method: Method, name: String) { assertEquals("OK", method.getAnnotation(javaClass()).x, "On method of test named `$name`") diff --git a/compiler/testData/codegen/boxWithJava/annotatedSamLambda/annotatedSamLambda.kt b/compiler/testData/codegen/boxWithJava/annotatedSamLambda/annotatedSamLambda.kt index f6b65be8dd1..2d5a08ee0f8 100644 --- a/compiler/testData/codegen/boxWithJava/annotatedSamLambda/annotatedSamLambda.kt +++ b/compiler/testData/codegen/boxWithJava/annotatedSamLambda/annotatedSamLambda.kt @@ -2,7 +2,8 @@ import java.lang.reflect.Method import kotlin.test.assertEquals target(AnnotationTarget.EXPRESSION) -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) fun testMethod(method: Method, name: String) { assertEquals("OK", method.getAnnotation(javaClass()).x, "On method of test named `$name`") diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/array.kt b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/array.kt index f4f88aa7c14..d68150a96f8 100644 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/array.kt +++ b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/array.kt @@ -1,7 +1,7 @@ import kotlin.reflect.KClass -annotation(retention = AnnotationRetention.RUNTIME) -class Ann(val args: Array>) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val args: Array>) fun box(): String { val args = javaClass().getAnnotation(javaClass()).args diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/basic.kt b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/basic.kt index c346d5ec59c..22246eff3e5 100644 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/basic.kt +++ b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/basic.kt @@ -1,7 +1,7 @@ import kotlin.reflect.KClass -annotation(retention = AnnotationRetention.RUNTIME) -class Ann(val arg: KClass<*>) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val arg: KClass<*>) fun box(): String { val argName = javaClass().getAnnotation(javaClass()).arg.simpleName ?: "fail 1" diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/vararg.kt b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/vararg.kt index cf39dfd67ca..fd773c8c1fa 100644 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/vararg.kt +++ b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/vararg.kt @@ -1,7 +1,7 @@ import kotlin.reflect.KClass -annotation(retention = AnnotationRetention.RUNTIME) -class Ann(vararg val args: KClass<*>) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(vararg val args: KClass<*>) fun box(): String { val args = javaClass().getAnnotation(javaClass()).args diff --git a/compiler/testData/codegen/boxWithJava/platformStatic/annotations/simpleClassObject.kt b/compiler/testData/codegen/boxWithJava/platformStatic/annotations/simpleClassObject.kt index 50de5103e0f..bd7485e98bd 100644 --- a/compiler/testData/codegen/boxWithJava/platformStatic/annotations/simpleClassObject.kt +++ b/compiler/testData/codegen/boxWithJava/platformStatic/annotations/simpleClassObject.kt @@ -1,6 +1,7 @@ import kotlin.jvm.JvmStatic -annotation(retention = AnnotationRetention.RUNTIME) class testAnnotation +@Retention(AnnotationRetention.RUNTIME) +annotation class testAnnotation class A { diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/annotatedEnumEntry.kt b/compiler/testData/codegen/boxWithStdlib/annotations/annotatedEnumEntry.kt index 5c1584eb905..9d63220ea8c 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/annotatedEnumEntry.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/annotatedEnumEntry.kt @@ -1,8 +1,10 @@ // KT-5665 -annotation(retention = AnnotationRetention.RUNTIME) class First +@Retention(AnnotationRetention.RUNTIME) +annotation class First -annotation(retention = AnnotationRetention.RUNTIME) class Second(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Second(val value: String) enum class E { @First diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/funExpression.kt b/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/funExpression.kt index 88b910a9698..177073ae854 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/funExpression.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/funExpression.kt @@ -1,7 +1,8 @@ import java.lang.reflect.Method import kotlin.test.assertEquals -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) fun foo0(block: () -> Unit) = block.javaClass fun foo1(block: (String) -> Unit) = block.javaClass diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/lambda.kt b/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/lambda.kt index 17a63ab835d..1bcb5019add 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/lambda.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/annotatedLambda/lambda.kt @@ -2,7 +2,8 @@ import java.lang.reflect.Method import kotlin.test.assertEquals target(AnnotationTarget.EXPRESSION) -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: String) fun foo0(block: () -> Unit) = block.javaClass diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/annotationsOnDefault.kt b/compiler/testData/codegen/boxWithStdlib/annotations/annotationsOnDefault.kt index 6179a2439ea..ed788ce7dde 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/annotationsOnDefault.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/annotationsOnDefault.kt @@ -1,6 +1,7 @@ import kotlin.test.assertEquals -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: Int) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val x: Int) class A { Ann(1) fun foo(x: Int, y: Int = 2, z: Int) {} diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/defaultParameterValues.kt b/compiler/testData/codegen/boxWithStdlib/annotations/defaultParameterValues.kt index f66f5d16f25..c5c879420e4 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/defaultParameterValues.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/defaultParameterValues.kt @@ -1,6 +1,7 @@ import kotlin.reflect.KClass -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val i: Int = 1, val s: String = "a", val a: Ann2 = Ann2(), diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/delegatedPropertySetter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/delegatedPropertySetter.kt index 34356bf7a12..ad90d9fad42 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/delegatedPropertySetter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/delegatedPropertySetter.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class First +@Retention(AnnotationRetention.RUNTIME) +annotation class First class MyClass() { public var x: String by Delegate() diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt index 835385e0b5e..1d32bb96180 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinPropertyFromClassObjectAsParameter.kt @@ -15,7 +15,8 @@ fun box(): String { return "OK" } -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val i: Int, val s: Short, val f: Float, diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt index eaaafbf3f6e..ab688eff539 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/kotlinTopLevelPropertyAsParameter.kt @@ -15,7 +15,8 @@ fun box(): String { return "OK" } -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val i: Int, val s: Short, val f: Float, diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt index d7dd3805275..cb99d7fc4f2 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/nestedClassPropertyAsParameter.kt @@ -7,7 +7,8 @@ fun box(): String { return "OK" } -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val i: Int) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val i: Int) class A { class B { diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt b/compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt index 6469958ea93..7a10d8d0a73 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/parameterWithPrimitiveType.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val b: Byte, val s: Short, val i: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt index 268155c7a59..0f8c9a00474 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/propertyWithPropertyInInitializerAsParameter.kt @@ -7,7 +7,8 @@ fun box(): String { return "OK" } -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val i: Int) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val i: Int) val i2: Int = 1 val i: Int = i2 diff --git a/compiler/testData/codegen/boxWithStdlib/annotations/varargInAnnotationParameter.kt b/compiler/testData/codegen/boxWithStdlib/annotations/varargInAnnotationParameter.kt index ed2fe14f038..ffa4269295e 100644 --- a/compiler/testData/codegen/boxWithStdlib/annotations/varargInAnnotationParameter.kt +++ b/compiler/testData/codegen/boxWithStdlib/annotations/varargInAnnotationParameter.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann(vararg val p: Int) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(vararg val p: Int) Ann() class MyClass1 Ann(1) class MyClass2 diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/char.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/char.kt index 6fe0644ffe4..4b510bd5cc7 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/char.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/char.kt @@ -1,6 +1,7 @@ package test -annotation(retention = AnnotationRetention.RUNTIME) class Ann(val c1: Int) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val c1: Int) Ann('a' - 'a') class MyClass diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/divide.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/divide.kt index 1273569707b..6d2b09999b8 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/divide.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/divide.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val b: Byte, val s: Short, val i: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/infixCallBinary.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/infixCallBinary.kt index 52666d81d24..2f4ae485cf4 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/infixCallBinary.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/infixCallBinary.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Int, val p2: Int, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/intrincics.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/intrincics.kt index 07cbc06acb8..76cfb64934b 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/intrincics.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/intrincics.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Int, val p2: Short, val p3: Byte, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/maxValue.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/maxValue.kt index 7ec02fad346..e15daaef4a7 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/maxValue.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/maxValue.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Int, val p2: Int, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueByte.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueByte.kt index 11e6517a39e..dcbae9cc72c 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueByte.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueByte.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Int, val p2: Byte, val p4: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueInt.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueInt.kt index 2b81c8bac02..ea6ebe878b9 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueInt.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/maxValueInt.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Int, val p2: Int, val p4: Long, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/miltiply.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/miltiply.kt index 5125caa4557..f8c474f721b 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/miltiply.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/miltiply.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Byte, val p2: Short, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/minus.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/minus.kt index baeeab6de9f..85da590d855 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/minus.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/minus.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Byte, val p2: Short, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/mod.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/mod.kt index 64ba6b944ea..be245c245ac 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/mod.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/mod.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Byte, val p2: Short, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/paranthesized.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/paranthesized.kt index f9815c6940b..8410ec34dcf 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/paranthesized.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/paranthesized.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Byte, val p2: Short, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/plus.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/plus.kt index bfa000dfe76..188bc1b5544 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/plus.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/plus.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Byte, val p2: Short, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt index 2be9ecb8298..8b6600de754 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/simpleCallBinary.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Int, val p2: Int, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt index a40663c2e87..fe5195ce31e 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryMinus.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Byte, val p2: Short, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt index b330439042e..9146f996839 100644 --- a/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt +++ b/compiler/testData/codegen/boxWithStdlib/evaluate/unaryPlus.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val p1: Byte, val p2: Short, val p3: Int, diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/annotationRetentionAnnotation.kt b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/annotationRetentionAnnotation.kt index 298a96cd594..c6226b3f986 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/annotationRetentionAnnotation.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/annotationRetentionAnnotation.kt @@ -1,15 +1,14 @@ import kotlin.test.assertEquals -annotation(retention = AnnotationRetention.RUNTIME) class Anno +@Retention(AnnotationRetention.RUNTIME) +annotation class Anno fun box(): String { val a = Anno::class.annotations -/* - // TODO: support kotlin.annotation.annotation + if (a.size() != 1) return "Fail 1: $a" - val ann = a.single() as? annotation ?: return "Fail 2: ${a.single()}" - assertEquals(AnnotationRetention.RUNTIME, ann.retention) -*/ - assert(a.isEmpty()) + val ann = a.single() as? Retention ?: return "Fail 2: ${a.single()}" + assertEquals(AnnotationRetention.RUNTIME, ann.value) + return "OK" } diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/retentions.kt b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/retentions.kt index a2d14b57ed6..a52a0c41b97 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/retentions.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/retentions.kt @@ -1,8 +1,13 @@ import kotlin.test.assertEquals -annotation(retention = AnnotationRetention.SOURCE) class SourceAnno -annotation(retention = AnnotationRetention.BINARY) class BinaryAnno -annotation(retention = AnnotationRetention.RUNTIME) class RuntimeAnno +@Retention(AnnotationRetention.SOURCE) +annotation class SourceAnno + +@Retention(AnnotationRetention.BINARY) +annotation class BinaryAnno + +@Retention(AnnotationRetention.RUNTIME) +annotation class RuntimeAnno @SourceAnno @BinaryAnno diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleClassAnnotation.kt b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleClassAnnotation.kt index 1e0104741fc..5361cb11d9f 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleClassAnnotation.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleClassAnnotation.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Simple(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) @Simple("OK") class A diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleFunAnnotation.kt b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleFunAnnotation.kt index 2295a82366c..c8a7e9d7cc2 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleFunAnnotation.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleFunAnnotation.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Simple(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) @Simple("OK") fun box(): String { diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleParamAnnotation.kt b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleParamAnnotation.kt index fba54d761cb..e1235966775 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleParamAnnotation.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleParamAnnotation.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Simple(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) fun test(@Simple("OK") x: Int) {} diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleValAnnotation.kt b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleValAnnotation.kt index 4f5f416817b..7ca1861cd71 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleValAnnotation.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/annotations/simpleValAnnotation.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class Simple(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class Simple(val value: String) @property:Simple("OK") val foo: Int = 0 diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt index 05fc8d82bed..d2fcad3577b 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/array.kt @@ -1,7 +1,7 @@ import kotlin.reflect.KClass -annotation(retention = AnnotationRetention.RUNTIME) -class Ann(val args: Array>) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val args: Array>) class O class K diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/basic.kt b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/basic.kt index 16039ba0f60..c8cdfade719 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/basic.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/basic.kt @@ -1,7 +1,7 @@ import kotlin.reflect.KClass -annotation(retention = AnnotationRetention.RUNTIME) -class Ann(val arg: KClass<*>) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(val arg: KClass<*>) class OK diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/vararg.kt b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/vararg.kt index 41d79e7c693..bf68266a768 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/vararg.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/kClassInAnnotation/vararg.kt @@ -1,7 +1,7 @@ import kotlin.reflect.KClass -annotation(retention = AnnotationRetention.RUNTIME) -class Ann(vararg val args: KClass<*>) +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann(vararg val args: KClass<*>) class O class K diff --git a/compiler/testData/codegen/boxWithStdlib/regressions/kt1932.kt b/compiler/testData/codegen/boxWithStdlib/regressions/kt1932.kt index b5d58877650..4918a560d36 100644 --- a/compiler/testData/codegen/boxWithStdlib/regressions/kt1932.kt +++ b/compiler/testData/codegen/boxWithStdlib/regressions/kt1932.kt @@ -1,6 +1,7 @@ import java.lang.annotation.Annotation -annotation(retention = AnnotationRetention.RUNTIME) class foo(val name : String) +@Retention(AnnotationRetention.RUNTIME) +annotation class foo(val name : String) class Test() { foo("OK") fun hello(input : String) { diff --git a/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyClass.kt b/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyClass.kt index 6e2e89a7c8d..68de7e48fb4 100644 --- a/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyClass.kt +++ b/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyClass.kt @@ -1,6 +1,7 @@ Ann class MyClass -annotation(retention = AnnotationRetention.BINARY) class Ann +@Retention(AnnotationRetention.BINARY) +annotation class Ann // 1 @LAnn;() // 1 invisible diff --git a/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyRuntime.kt b/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyRuntime.kt index 08c29cd3766..7844342b6f7 100644 --- a/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyRuntime.kt +++ b/compiler/testData/codegen/bytecodeText/annotationRetentionPolicyRuntime.kt @@ -1,6 +1,7 @@ Ann class MyClass -annotation(retention = AnnotationRetention.RUNTIME) class Ann +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann // 1 @LAnn;() // 0 invisible diff --git a/compiler/testData/codegen/bytecodeText/annotationRetentionPolicySource.kt b/compiler/testData/codegen/bytecodeText/annotationRetentionPolicySource.kt index 7260c31a09b..2c55e0526e6 100644 --- a/compiler/testData/codegen/bytecodeText/annotationRetentionPolicySource.kt +++ b/compiler/testData/codegen/bytecodeText/annotationRetentionPolicySource.kt @@ -1,5 +1,6 @@ Ann class MyClass -annotation(retention = AnnotationRetention.SOURCE) class Ann +@Retention(AnnotationRetention.SOURCE) +annotation class Ann // 0 @LAnn;() \ No newline at end of file diff --git a/compiler/testData/codegen/properties/syntheticMethod/inClass.kt b/compiler/testData/codegen/properties/syntheticMethod/inClass.kt index c050fdabadc..9f0b73b7e06 100644 --- a/compiler/testData/codegen/properties/syntheticMethod/inClass.kt +++ b/compiler/testData/codegen/properties/syntheticMethod/inClass.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class SomeAnnotation(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class SomeAnnotation(val value: String) class A { @SomeAnnotation("OK") val property: Int diff --git a/compiler/testData/codegen/properties/syntheticMethod/inTrait.kt b/compiler/testData/codegen/properties/syntheticMethod/inTrait.kt index 20006213ee7..17f9b9a95bd 100644 --- a/compiler/testData/codegen/properties/syntheticMethod/inTrait.kt +++ b/compiler/testData/codegen/properties/syntheticMethod/inTrait.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class SomeAnnotation(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class SomeAnnotation(val value: String) interface T { @SomeAnnotation("OK") val property: Int diff --git a/compiler/testData/codegen/properties/syntheticMethod/topLevel.kt b/compiler/testData/codegen/properties/syntheticMethod/topLevel.kt index c5948fc87dd..f18feb4bea3 100644 --- a/compiler/testData/codegen/properties/syntheticMethod/topLevel.kt +++ b/compiler/testData/codegen/properties/syntheticMethod/topLevel.kt @@ -1,4 +1,5 @@ -annotation(retention = AnnotationRetention.RUNTIME) class SomeAnnotation(val value: String) +@Retention(AnnotationRetention.RUNTIME) +annotation class SomeAnnotation(val value: String) @SomeAnnotation("OK") val property: Int get() = 42 diff --git a/compiler/testData/compileKotlinAgainstKotlin/AnnotationInTrait.A.kt b/compiler/testData/compileKotlinAgainstKotlin/AnnotationInTrait.A.kt index 199cf2d375f..663ecf71ce3 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/AnnotationInTrait.A.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/AnnotationInTrait.A.kt @@ -1,6 +1,7 @@ package a -annotation(retention = AnnotationRetention.RUNTIME) class Ann +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann interface Tr { Ann diff --git a/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt b/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt index dc9584be3c9..19a48ee856f 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/InlinedConstants.A.kt @@ -11,4 +11,5 @@ public val c: Char = '\u03c0' // pi symbol public val str: String = ":)" -public annotation(retention = AnnotationRetention.RUNTIME) class AnnotationClass(public val value: String) \ No newline at end of file +@Retention(AnnotationRetention.RUNTIME) +public annotation class AnnotationClass(public val value: String) \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.B.kt b/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.B.kt index 86274b17551..c1136d8f499 100644 --- a/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.B.kt +++ b/compiler/testData/compileKotlinAgainstKotlin/KotlinPropertyAsAnnotationParameter.B.kt @@ -6,7 +6,8 @@ class MyClass1 Ann(i2, s2, f2, d2, l2, b2, bool2, c2, str2) class MyClass2 -annotation(retention = AnnotationRetention.RUNTIME) class Ann( +@Retention(AnnotationRetention.RUNTIME) +annotation class Ann( val i: Int, val s: Short, val f: Float, diff --git a/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.kt b/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.kt index 97a73fa058d..e738fe8a346 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.kt @@ -1,5 +1,7 @@ target(AnnotationTarget.EXPRESSION) -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class Ann(val x: Int = 1) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class Ann(val x: Int = 1) inline fun bar(block: () -> Int): Int = block() diff --git a/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.txt b/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.txt index 11d1f4a3584..e69ac74f8cc 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.txt +++ b/compiler/testData/diagnostics/tests/annotations/annotationsOnLambdaAsCallArgument.txt @@ -3,7 +3,7 @@ package kotlin.inline() internal fun bar(/*0*/ block: () -> kotlin.Int): kotlin.Int internal fun foo(): kotlin.Unit -kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class Ann : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ x: kotlin.Int = ...) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.kt b/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.kt index 05d5e8e06bd..5997402d13e 100644 --- a/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.kt +++ b/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.kt @@ -2,7 +2,9 @@ target(AnnotationTarget.TYPE, AnnotationTarget.CLASSIFIER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.EXPRESSION, AnnotationTarget.PROPERTY) -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class Ann(val x: Int = 6) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class Ann(val x: Int = 6) @Ann(1) @Ann(2) @Ann(3) @private class A @Ann constructor() { @Ann(x = 5) fun foo() { diff --git a/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.txt b/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.txt index 6f36da78368..e8b3a011ac3 100644 --- a/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.txt +++ b/compiler/testData/diagnostics/tests/annotations/atAnnotationResolve.txt @@ -10,7 +10,7 @@ Ann(x = 1) Ann(x = 2) Ann(x = 3) private final class A { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASSIFIER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.EXPRESSION, AnnotationTarget.PROPERTY}) kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class Ann : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.TYPE, AnnotationTarget.CLASSIFIER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.EXPRESSION, AnnotationTarget.PROPERTY}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ x: kotlin.Int = ...) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/annotations/options/documented.kt b/compiler/testData/diagnostics/tests/annotations/options/documented.kt index 3c57f8a8983..b6012429caa 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/documented.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/documented.kt @@ -1,4 +1,5 @@ -annotation(mustBeDocumented = true) class DocAnn +@MustBeDocumented +annotation class DocAnn annotation class NotDocAnn diff --git a/compiler/testData/diagnostics/tests/annotations/options/documented.txt b/compiler/testData/diagnostics/tests/annotations/options/documented.txt index affb7a9d5b4..99bd4d9567e 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/documented.txt +++ b/compiler/testData/diagnostics/tests/annotations/options/documented.txt @@ -1,6 +1,6 @@ package -kotlin.annotation.annotation(mustBeDocumented = true) internal final class DocAnn : kotlin.Annotation { +kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() internal final class DocAnn : kotlin.Annotation { public constructor DocAnn() 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/annotations/options/repeatable.kt b/compiler/testData/diagnostics/tests/annotations/options/repeatable.kt index 2a810fa49f5..6aaf91bfa0e 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/repeatable.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/repeatable.kt @@ -1,12 +1,21 @@ -annotation(repeatable = true) class repann +@Repeatable +annotation class repann -annotation(retention = AnnotationRetention.SOURCE, repeatable = true) class repann1(val x: Int) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class repann1(val x: Int) -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class repann2(val f: Boolean) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class repann2(val f: Boolean) -annotation(repeatable = true, retention = AnnotationRetention.BINARY) class binrepann +@Retention(AnnotationRetention.BINARY) +@Repeatable +annotation class binrepann -target(AnnotationTarget.EXPRESSION) annotation(repeatable = true) class repexpr +target(AnnotationTarget.EXPRESSION) +@Repeatable +annotation class repexpr repann repann class DoubleAnnotated diff --git a/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt b/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt index 99133ef03b1..85a9fd565fa 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt +++ b/compiler/testData/diagnostics/tests/annotations/options/repeatable.txt @@ -30,21 +30,21 @@ repann1(x = 1) repann1(x = 2) repann1(x = 3) internal final class TripleAnnotate public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.BINARY) internal final class binrepann : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.BINARY) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class binrepann : kotlin.Annotation { public constructor binrepann() 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.annotation.annotation(repeatable = true) internal final class repann : kotlin.Annotation { +kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class repann : kotlin.Annotation { public constructor repann() 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.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class repann1 : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class repann1 : kotlin.Annotation { public constructor repann1(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -52,7 +52,7 @@ kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention. public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class repann2 : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class repann2 : kotlin.Annotation { public constructor repann2(/*0*/ f: kotlin.Boolean) internal final val f: kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -60,7 +60,7 @@ kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention. public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation(repeatable = true) internal final class repexpr : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class repexpr : kotlin.Annotation { public constructor repexpr() 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/annotations/options/retention.kt b/compiler/testData/diagnostics/tests/annotations/options/retention.kt index b2faff44864..74a9f80f8a9 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/retention.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/retention.kt @@ -1,3 +1,4 @@ -annotation(AnnotationRetention.SOURCE) class sourceann +@Retention(AnnotationRetention.SOURCE) +annotation class sourceann sourceann class AnnotatedAtSource diff --git a/compiler/testData/diagnostics/tests/annotations/options/retention.txt b/compiler/testData/diagnostics/tests/annotations/options/retention.txt index b96dea2f173..9199578f75d 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/retention.txt +++ b/compiler/testData/diagnostics/tests/annotations/options/retention.txt @@ -7,7 +7,7 @@ sourceann() internal final class AnnotatedAtSource { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation(retention = AnnotationRetention.SOURCE) internal final class sourceann : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.annotation() internal final class sourceann : kotlin.Annotation { public constructor sourceann() 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/annotations/options/unrepeatable.kt b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.kt index 88cc0fed1ee..3a36e88c335 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.kt @@ -1,4 +1,4 @@ -annotation(repeatable = false) class unrepann(val x: Int) +annotation class unrepann(val x: Int) annotation class ann(val y: Int) diff --git a/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt index 6a5637df7ae..46577d01af5 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt +++ b/compiler/testData/diagnostics/tests/annotations/options/unrepeatable.txt @@ -31,7 +31,7 @@ kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin. public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation(repeatable = false) internal final class unrepann : kotlin.Annotation { +kotlin.annotation.annotation() internal final class unrepann : kotlin.Annotation { public constructor unrepann(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt index 091e3ab315b..f66fb0e012e 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.kt @@ -1,4 +1,6 @@ -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class RepeatableAnn +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class RepeatableAnn annotation class Ann public class A(@param:Ann @Ann val x: Int, @param: RepeatableAnn @Ann val y: Int) { diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.txt index c77b6b63d06..24fdfd31103 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.txt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/repeatable.txt @@ -20,7 +20,7 @@ kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class RepeatableAnn : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class RepeatableAnn : kotlin.Annotation { public constructor RepeatableAnn() 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/resolve/resolveAnnotatedLambdaArgument.kt b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.kt index ffe432f687d..7c999935f11 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.kt +++ b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.kt @@ -1,6 +1,8 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER target(AnnotationTarget.EXPRESSION) -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class Ann +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class Ann fun bar(block: (T) -> Int) {} diff --git a/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.txt b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.txt index 1f6f151de58..ec5da6c8fb0 100644 --- a/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.txt +++ b/compiler/testData/diagnostics/tests/resolve/resolveAnnotatedLambdaArgument.txt @@ -3,7 +3,7 @@ package internal fun bar(/*0*/ block: (T) -> kotlin.Int): kotlin.Unit internal fun foo(): kotlin.Unit -kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class Ann : kotlin.Annotation { +kotlin.annotation.target(allowedTargets = {AnnotationTarget.EXPRESSION}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public constructor Ann() 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/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt index 93de3014354..7dff030aedf 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.kt @@ -1,4 +1,6 @@ -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class Ann(val i: IntArray) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class Ann(val i: IntArray) Ann(intArrayOf(i)) Ann(intArrayOf(i2)) @@ -13,7 +15,9 @@ val i3 = foo() fun foo(): Int = 1 -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class AnnAnn(val i: Array) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class AnnAnn(val i: Array) AnnAnn(arrayOf(Ann(intArrayOf(1)))) AnnAnn(arrayOf(iAnn)) class TestAnn diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt index 4350a8870fa..3d1e0bc61d3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/array.txt @@ -6,7 +6,7 @@ internal val i3: kotlin.Int internal val iAnn: Ann internal fun foo(): kotlin.Int -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class Ann : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ i: kotlin.IntArray) internal final val i: kotlin.IntArray public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -14,7 +14,7 @@ kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention. public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class AnnAnn : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class AnnAnn : kotlin.Annotation { public constructor AnnAnn(/*0*/ i: kotlin.Array) internal final val i: kotlin.Array public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt index 3f76190ce7a..01d62ca00eb 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt @@ -1,4 +1,6 @@ -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class Ann(val i: Int) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class Ann(val i: Int) annotation class AnnIA(val ia: IntArray) annotation class AnnSA(val sa: Array) diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt index c5ba3c47812..cacabcbdf05 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.txt @@ -6,7 +6,7 @@ internal val ia: kotlin.IntArray internal val sa: kotlin.Array internal fun foo(): kotlin.Int -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class Ann : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ i: kotlin.Int) internal final val i: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt index 1c1510307b2..131b87fe0f8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.kt @@ -1,4 +1,6 @@ -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class Ann(vararg val i: Int) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class Ann(vararg val i: Int) Ann(i) Ann(i2) @@ -16,7 +18,9 @@ val i3 = foo() fun foo(): Int = 1 -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class AnnAnn(vararg val i: Ann) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class AnnAnn(vararg val i: Ann) AnnAnn(*arrayOf(Ann(1))) AnnAnn(*arrayOf(iAnn)) class TestAnn diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt index 71e4bd9f2f0..e9507fa946d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/vararg.txt @@ -6,7 +6,7 @@ internal val i3: kotlin.Int internal val iAnn: Ann internal fun foo(): kotlin.Int -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class Ann : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class Ann : kotlin.Annotation { public constructor Ann(/*0*/ vararg i: kotlin.Int /*kotlin.IntArray*/) internal final val i: kotlin.IntArray public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -14,7 +14,7 @@ kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention. public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -kotlin.annotation.annotation(repeatable = true, retention = AnnotationRetention.SOURCE) internal final class AnnAnn : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.Repeatable() kotlin.annotation.annotation() internal final class AnnAnn : kotlin.Annotation { public constructor AnnAnn(/*0*/ vararg i: Ann /*kotlin.Array*/) internal final val i: kotlin.Array public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.kt b/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.kt index bd9b66be01f..6fe7e51c922 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.kt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.kt @@ -2,4 +2,5 @@ //SKIP_IN_RUNTIME_TEST package test -annotation(retention = AnnotationRetention.RUNTIME) class Anno +@Retention(AnnotationRetention.RUNTIME) +annotation class Anno diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.txt index 8159335fcc1..25ba45cb0a6 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classes/Retention.txt @@ -1,5 +1,5 @@ package test -kotlin.annotation.annotation(retention = AnnotationRetention.RUNTIME) internal final class Anno : kotlin.Annotation { +kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) kotlin.annotation.annotation() internal final class Anno : kotlin.Annotation { /*primary*/ public constructor Anno() } diff --git a/core/builtins/src/kotlin/Annotations.kt b/core/builtins/src/kotlin/Annotations.kt index a9638a37b5d..1062d8ad5ba 100644 --- a/core/builtins/src/kotlin/Annotations.kt +++ b/core/builtins/src/kotlin/Annotations.kt @@ -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 diff --git a/core/builtins/src/kotlin/Inline.kt b/core/builtins/src/kotlin/Inline.kt index dfefa0e8124..5a14c6f6910 100644 --- a/core/builtins/src/kotlin/Inline.kt +++ b/core/builtins/src/kotlin/Inline.kt @@ -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 diff --git a/core/builtins/src/kotlin/annotation/Annotations.kt b/core/builtins/src/kotlin/annotation/Annotations.kt index 44e6b9a7ef9..1b4c35ed93e 100644 --- a/core/builtins/src/kotlin/annotation/Annotations.kt +++ b/core/builtins/src/kotlin/annotation/Annotations.kt @@ -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. diff --git a/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt b/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt index c4c78666f59..b34e0bb1c1a 100644 --- a/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt +++ b/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt @@ -35,4 +35,6 @@ package kotlin.jvm * MyList().add(null) // Ok */ target(AnnotationTarget.CLASSIFIER) -public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class PurelyImplements(public val value: String) +@Retention(AnnotationRetention.RUNTIME) +@MustBeDocumented +public annotation class PurelyImplements(public val value: String) diff --git a/core/runtime.jvm/src/kotlin/jvm/internal/Intrinsic.kt b/core/runtime.jvm/src/kotlin/jvm/internal/Intrinsic.kt index bc6e47b4316..6d2abb4b699 100644 --- a/core/runtime.jvm/src/kotlin/jvm/internal/Intrinsic.kt +++ b/core/runtime.jvm/src/kotlin/jvm/internal/Intrinsic.kt @@ -16,7 +16,6 @@ package kotlin.jvm.internal -import java.lang.annotation.* - target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) -public annotation(retention = AnnotationRetention.RUNTIME) class Intrinsic(val value: String) +@Retention(AnnotationRetention.RUNTIME) +public annotation class Intrinsic(val value: String) diff --git a/idea/idea-completion/testData/basic/common/annotations/AnnotationArguments.kt b/idea/idea-completion/testData/basic/common/annotations/AnnotationArguments.kt deleted file mode 100644 index c978d07c743..00000000000 --- a/idea/idea-completion/testData/basic/common/annotations/AnnotationArguments.kt +++ /dev/null @@ -1,4 +0,0 @@ -annotation() class Annotated - -// EXIST: retention -// EXIST: repeatable diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JSBasicCompletionTestGenerated.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JSBasicCompletionTestGenerated.java index 7b3f8e16987..1cb8493cbe1 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JSBasicCompletionTestGenerated.java +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JSBasicCompletionTestGenerated.java @@ -717,12 +717,6 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes doTest(fileName); } - @TestMetadata("AnnotationArguments.kt") - public void testAnnotationArguments() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/annotations/AnnotationArguments.kt"); - doTest(fileName); - } - @TestMetadata("AnnotationTarget.kt") public void testAnnotationTarget() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/annotations/AnnotationTarget.kt"); diff --git a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java index 9273e58f646..690c92a8909 100644 --- a/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java +++ b/idea/idea-completion/tests/org/jetbrains/kotlin/idea/completion/test/JvmBasicCompletionTestGenerated.java @@ -717,12 +717,6 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT doTest(fileName); } - @TestMetadata("AnnotationArguments.kt") - public void testAnnotationArguments() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/annotations/AnnotationArguments.kt"); - doTest(fileName); - } - @TestMetadata("AnnotationTarget.kt") public void testAnnotationTarget() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/idea-completion/testData/basic/common/annotations/AnnotationTarget.kt"); diff --git a/idea/testData/checker/AnnotationOnFile.kt b/idea/testData/checker/AnnotationOnFile.kt index 065868b9713..8a5547b25ac 100644 --- a/idea/testData/checker/AnnotationOnFile.kt +++ b/idea/testData/checker/AnnotationOnFile.kt @@ -20,4 +20,6 @@ val BAZ = "baz" val N = 0 target(AnnotationTarget.FILE) -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class myAnnotation(val i: Int, val s: String) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class myAnnotation(val i: Int, val s: String) diff --git a/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt b/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt index 663fa536008..5fa02937843 100644 --- a/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt +++ b/idea/testData/decompiler/stubBuilder/Annotations/Annotations.kt @@ -32,6 +32,8 @@ annotation class a target(AnnotationTarget.PROPERTY, AnnotationTarget.FUNCTION, AnnotationTarget.CLASSIFIER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.TYPE) -annotation(repeatable = true, retention = AnnotationRetention.SOURCE) class b(val e: E) +@Retention(AnnotationRetention.SOURCE) +@Repeatable +annotation class b(val e: E) enum class E { E1, E2 } \ No newline at end of file diff --git a/js/js.libraries/src/core/annotationsJVM.kt b/js/js.libraries/src/core/annotationsJVM.kt index 577affd6b1e..a56e6095ced 100644 --- a/js/js.libraries/src/core/annotationsJVM.kt +++ b/js/js.libraries/src/core/annotationsJVM.kt @@ -18,4 +18,5 @@ package kotlin.jvm // is used in common generated code in stdlib target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR) -internal annotation(retention = AnnotationRetention.SOURCE) class jvmOverloads +@Retention(AnnotationRetention.SOURCE) +internal annotation class jvmOverloads diff --git a/js/js.libraries/src/core/concurrent.kt b/js/js.libraries/src/core/concurrent.kt index 28e6ccb0cdd..a8df2933db5 100644 --- a/js/js.libraries/src/core/concurrent.kt +++ b/js/js.libraries/src/core/concurrent.kt @@ -25,10 +25,12 @@ import kotlin.InlineOption.ONLY_LOCAL_RETURN native target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) -public annotation(retention = AnnotationRetention.SOURCE) class volatile +@Retention(AnnotationRetention.SOURCE) +public annotation class volatile native target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) -public annotation(retention = AnnotationRetention.SOURCE) class synchronized +@Retention(AnnotationRetention.SOURCE) +public annotation class synchronized public inline fun synchronized(lock: Any, @inlineOptions(ONLY_LOCAL_RETURN) block: () -> R): R = block() diff --git a/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt b/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt index 377573a5580..b5d2ec16123 100644 --- a/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt +++ b/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt @@ -23,14 +23,18 @@ import kotlin.annotation.AnnotationTarget.* * are immediately made visible to other threads. */ target(FIELD) -public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Volatile +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented +public annotation class Volatile /** * Marks the JVM backing field of the annotated property as `transient`, meaning that it is not * part of the default serialized form of the object. */ target(FIELD) -public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Transient +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented +public annotation class Transient /** * Marks the JVM method generated from the annotated function as `strictfp`, meaning that the precision @@ -38,7 +42,9 @@ public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = tru * achieve better portability. */ target(FUNCTION, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER, CLASSIFIER) -public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Strictfp +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented +public annotation class Strictfp /** * Marks the JVM method generated from the annotated function as `synchronized`, meaning that the method @@ -46,12 +52,16 @@ public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = tru * for static methods, the class) on which the method is defined. */ target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER) -public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class Synchronized +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented +public annotation class Synchronized /** * Marks the JVM method generated from the annotated function as `native`, meaning that it's not implemented * in Java but rather in a different language (for example, in C/C++ using JNI). */ target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER) +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented @deprecated("Use kotlin.external instead", ReplaceWith("kotlin.external")) -public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class native +public annotation class native diff --git a/libraries/stdlib/src/kotlin/jvm/JvmPlatformAnnotations.kt b/libraries/stdlib/src/kotlin/jvm/JvmPlatformAnnotations.kt index fad9a943de5..7155fb9c55b 100644 --- a/libraries/stdlib/src/kotlin/jvm/JvmPlatformAnnotations.kt +++ b/libraries/stdlib/src/kotlin/jvm/JvmPlatformAnnotations.kt @@ -23,7 +23,9 @@ package kotlin.jvm * takes N-1 parameters (all but the last one that takes a default value), the second takes N-2 parameters, and so on. */ target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR) -public annotation(retention = AnnotationRetention.BINARY, mustBeDocumented = true) class JvmOverloads +@Retention(AnnotationRetention.BINARY) +@MustBeDocumented +public annotation class JvmOverloads /** @@ -32,7 +34,9 @@ public annotation(retention = AnnotationRetention.BINARY, mustBeDocumented = tru * for more information. */ target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) -public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class JvmStatic +@Retention(AnnotationRetention.RUNTIME) +@MustBeDocumented +public annotation class JvmStatic /** * Specifies the name for the Java class or method @@ -42,10 +46,14 @@ public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = tr * @property name the name of the element. */ target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) -public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class JvmName(public val name: String) +@Retention(AnnotationRetention.RUNTIME) +@MustBeDocumented +public annotation class JvmName(public val name: String) /** * Instructs the Kotlin compiler to generate a public backing field for this property. */ target(AnnotationTarget.FIELD) -public annotation(retention = AnnotationRetention.SOURCE, mustBeDocumented = true) class publicField \ No newline at end of file +@Retention(AnnotationRetention.SOURCE) +@MustBeDocumented +public annotation class publicField \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/platform/annotations.kt b/libraries/stdlib/src/kotlin/platform/annotations.kt index 5ed2adb7323..e182a2060eb 100644 --- a/libraries/stdlib/src/kotlin/platform/annotations.kt +++ b/libraries/stdlib/src/kotlin/platform/annotations.kt @@ -19,9 +19,13 @@ package kotlin.platform import kotlin.annotation.AnnotationTarget.* target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER) -deprecated("Use kotlin.jvm.JvmName instead", ReplaceWith("kotlin.jvm.JvmName")) -public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class platformName(public val name: String) +@Retention(AnnotationRetention.RUNTIME) +@MustBeDocumented +@deprecated("Use kotlin.jvm.JvmName instead", ReplaceWith("kotlin.jvm.JvmName")) +public annotation class platformName(public val name: String) target(FUNCTION, PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER) -deprecated("Use kotlin.jvm.JvmStatic instead", ReplaceWith("kotlin.jvm.JvmStatic")) -public annotation(retention = AnnotationRetention.RUNTIME, mustBeDocumented = true) class platformStatic +@Retention(AnnotationRetention.RUNTIME) +@MustBeDocumented +@deprecated("Use kotlin.jvm.JvmStatic instead", ReplaceWith("kotlin.jvm.JvmStatic")) +public annotation class platformStatic diff --git a/libraries/stdlib/src/kotlin/util/JLangJVM.kt b/libraries/stdlib/src/kotlin/util/JLangJVM.kt index c45f9ca3b4e..450a6522b65 100644 --- a/libraries/stdlib/src/kotlin/util/JLangJVM.kt +++ b/libraries/stdlib/src/kotlin/util/JLangJVM.kt @@ -22,7 +22,8 @@ import kotlin.reflect.KClass * * @property exceptionClasses the list of checked exception classes that may be thrown by the function. */ -public annotation(retention = AnnotationRetention.SOURCE) class Throws(public vararg val exceptionClasses: KClass) +@Retention(AnnotationRetention.SOURCE) +public annotation class Throws(public vararg val exceptionClasses: KClass) /** * Returns the runtime Java class of this object. diff --git a/libraries/stdlib/test/AnnotationsTest.kt b/libraries/stdlib/test/AnnotationsTest.kt index 6b97066a9bb..8fbb3ca3251 100644 --- a/libraries/stdlib/test/AnnotationsTest.kt +++ b/libraries/stdlib/test/AnnotationsTest.kt @@ -4,7 +4,8 @@ import kotlin.* import kotlin.test.assertTrue import org.junit.Test as test -annotation(retention = AnnotationRetention.RUNTIME) class MyAnno +@Retention(AnnotationRetention.RUNTIME) +annotation class MyAnno @MyAnno @java.lang.Deprecated diff --git a/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotationInSameFile.kt b/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotationInSameFile.kt index 238f42450cc..4729fcedb22 100644 --- a/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotationInSameFile.kt +++ b/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotationInSameFile.kt @@ -1,6 +1,7 @@ package org.test -public annotation(retention = AnnotationRetention.BINARY) class SomeAnnotation +@Retention(AnnotationRetention.BINARY) +public annotation class SomeAnnotation SomeAnnotation public class SomeClass { diff --git a/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotations.txt b/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotations.txt index 6e5a0ae00c6..a971b549dee 100644 --- a/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotations.txt +++ b/plugins/annotation-collector/testData/collectToFile/annotationInSameFile/annotations.txt @@ -1,6 +1,8 @@ -a java.lang.annotation.Retention 0 +a kotlin.annotation.Retention 0 p org.test 0 c 0 0/SomeAnnotation -a org.test.SomeAnnotation 1 -c 1 0/SomeClass -m 1 0/SomeClass annotatedFunction +a java.lang.annotation.Retention 1 +c 1 0/SomeAnnotation +a org.test.SomeAnnotation 2 +c 2 0/SomeClass +m 2 0/SomeClass annotatedFunction