Annotations have now retention of "RUNTIME" by default. Java retention is generated as given by kotlin annotation. Annotation rendering changed.
Annotation arguments with default values are rendered as ... if renderDefaultAnnotationArguments is true. Tests: java retention does not taken into account by Descriptor comparator. Java retentinon changed to kotlin retention in some tests + one new test with java retention added. More accurate tests for intentions in byte code (visibility controlled).
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
// KT-5665
|
||||
|
||||
import java.lang.annotation.*
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class First
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class First
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Second(val value: String)
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Second(val value: String)
|
||||
|
||||
enum class E {
|
||||
@First
|
||||
|
||||
+1
-3
@@ -1,10 +1,8 @@
|
||||
import java.lang.annotation.*
|
||||
import java.lang.reflect.Method
|
||||
import kotlin.reflect.jvm.java
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(val x: String)
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: String)
|
||||
|
||||
fun foo0(block: () -> Unit) = block.javaClass
|
||||
fun foo1(block: (String) -> Unit) = block.javaClass
|
||||
|
||||
+1
-3
@@ -1,8 +1,6 @@
|
||||
import java.lang.annotation.*
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(val x: Int)
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(val x: Int)
|
||||
class A {
|
||||
Ann(1) fun foo(x: Int, y: Int = 2, z: Int) {}
|
||||
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
import kotlin.reflect.KClass
|
||||
import kotlin.reflect.jvm.java
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(
|
||||
val i: Int = 1,
|
||||
val s: String = "a",
|
||||
val a: Ann2 = Ann2(),
|
||||
|
||||
+1
-4
@@ -1,7 +1,4 @@
|
||||
import java.lang.annotation.*
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class First
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class First
|
||||
|
||||
class MyClass() {
|
||||
public var x: String by Delegate()
|
||||
|
||||
Vendored
+1
-5
@@ -1,6 +1,3 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Ann(Foo.i, Foo.s, Foo.f, Foo.d, Foo.l, Foo.b, Foo.bool, Foo.c, Foo.str) class MyClass
|
||||
|
||||
fun box(): String {
|
||||
@@ -18,8 +15,7 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(
|
||||
val i: Int,
|
||||
val s: Short,
|
||||
val f: Float,
|
||||
|
||||
+1
-5
@@ -1,6 +1,3 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Ann(i, s, f, d, l, b, bool, c, str) class MyClass
|
||||
|
||||
fun box(): String {
|
||||
@@ -18,8 +15,7 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(
|
||||
val i: Int,
|
||||
val s: Short,
|
||||
val f: Float,
|
||||
|
||||
+1
-5
@@ -1,6 +1,3 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Ann(A.B.i) class MyClass
|
||||
|
||||
fun box(): String {
|
||||
@@ -10,8 +7,7 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(val i: Int)
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(val i: Int)
|
||||
|
||||
class A {
|
||||
class B {
|
||||
|
||||
+1
-5
@@ -1,8 +1,4 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(
|
||||
val b: Byte,
|
||||
val s: Short,
|
||||
val i: Int,
|
||||
|
||||
Vendored
+1
-5
@@ -1,6 +1,3 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Ann(i) class MyClass
|
||||
|
||||
fun box(): String {
|
||||
@@ -10,8 +7,7 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(val i: Int)
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(val i: Int)
|
||||
|
||||
val i2: Int = 1
|
||||
val i: Int = i2
|
||||
|
||||
+1
-5
@@ -1,8 +1,4 @@
|
||||
import java.lang.annotation.Retention
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
Retention(RetentionPolicy.RUNTIME)
|
||||
annotation class Ann(vararg val p: Int)
|
||||
annotation(retention = AnnotationRetention.RUNTIME) class Ann(vararg val p: Int)
|
||||
|
||||
Ann() class MyClass1
|
||||
Ann(1) class MyClass2
|
||||
|
||||
Reference in New Issue
Block a user