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
Vendored
+6
-7
@@ -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"
|
||||
}
|
||||
|
||||
+8
-3
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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 {
|
||||
|
||||
+2
-1
@@ -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) {}
|
||||
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user