38fd2b9ed6
In JDK 9, Class.simpleName changed behavior for local/anonymous Kotlin classes (see KT-23072), this is why we now check for both variants of the name in tests. Also, the format of annotation arguments changed a little, where float parameters no longer have the trailing "f", and class literals are rendered with ".class" at the end
30 lines
628 B
Kotlin
Vendored
30 lines
628 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_REFLECT
|
|
|
|
import kotlin.test.assertEquals
|
|
import kotlin.test.assertTrue
|
|
|
|
annotation class Anno(@get:JvmName("uglyJvmName") val value: String)
|
|
|
|
@Anno(value = "OK")
|
|
class Foo
|
|
|
|
|
|
annotation class Meta(val anno: Anno)
|
|
|
|
@Meta(Anno(value = "OK"))
|
|
fun bar() {}
|
|
|
|
|
|
fun box(): String {
|
|
val f = Foo::class.annotations.single()
|
|
assertTrue("@Anno\\(uglyJvmName=\"?OK\"?\\)".toRegex().matches(f.toString()))
|
|
assertEquals("OK", (f as Anno).value)
|
|
|
|
val b = ::bar.annotations.single()
|
|
assertEquals("@Meta(anno=$f)", b.toString())
|
|
assertEquals("OK", (b as Meta).anno.value)
|
|
|
|
return "OK"
|
|
}
|