c357967c2c
Introduce MetadataSource as a way to store the original descriptor for any element (before any lowerings) and maintain it until the end of the codegen where it's used in generating the metadata. Note that JVM signatures written to the metadata are formed from the _resulting_ generated elements, not by mapping the original descriptors. Some corner cases are not supported yet, namely properties declared in companion objects, synthetic methods for property annotations, JvmPackageName, etc. #KT-29119 Fixed
30 lines
650 B
Kotlin
Vendored
30 lines
650 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// WITH_REFLECT
|
|
package test
|
|
|
|
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("@test.Anno\\(uglyJvmName=\"?OK\"?\\)".toRegex().matches(f.toString()))
|
|
assertEquals("OK", (f as Anno).value)
|
|
|
|
val b = ::bar.annotations.single()
|
|
assertEquals("@test.Meta(anno=$f)", b.toString())
|
|
assertEquals("OK", (b as Meta).anno.value)
|
|
|
|
return "OK"
|
|
}
|