Generate get-targeted annotations on annotation constructor parameters

This change would also make NotNull annotations to be generated on
non-primitive annotation methods, but we skip this deliberately because
annotation methods never return null on JVM anyway

 #KT-25287 Fixed
This commit is contained in:
Alexander Udalov
2018-07-05 14:21:49 +02:00
committed by Ilya Gorbunov
parent 9df949c039
commit dc1f4c7d5b
7 changed files with 51 additions and 13 deletions
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
import kotlin.test.assertEquals
annotation class Name(val value: String)
annotation class Anno(
@get:Name("O") val o: String,
@get:Name("K") val k: String
)
fun box(): String {
val ms = Anno::class.java.declaredMethods
return (ms.single { it.name == "o" }.annotations.single() as Name).value +
(ms.single { it.name == "k" }.annotations.single() as Name).value
}