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
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
|
||||
+2
-1
@@ -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) {}
|
||||
|
||||
|
||||
+2
-1
@@ -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(),
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class First
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class First
|
||||
|
||||
class MyClass() {
|
||||
public var x: String by Delegate()
|
||||
|
||||
Vendored
+2
-1
@@ -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,
|
||||
|
||||
+2
-1
@@ -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,
|
||||
|
||||
+2
-1
@@ -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 {
|
||||
|
||||
+2
-1
@@ -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,
|
||||
|
||||
Vendored
+2
-1
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
+2
-1
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
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
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
annotation(retention = AnnotationRetention.RUNTIME)
|
||||
class Ann(val args: Array<KClass<*>>)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class Ann(val args: Array<KClass<*>>)
|
||||
|
||||
class O
|
||||
class K
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user