Files
kotlin-fork/compiler/testData/codegen/boxWithStdlib/reflection/mapping/syntheticFields.kt
T
Alexander Udalov a4732b442d Don't create KClass and KPackage instances in <clinit>
This proved to be a fragile technique, which probably doesn't even improve
performance in most cases but has lots of unexpected problems: unconditional
initialization of reflection classes, increasing the size of the bytecode, bugs
with <clinit> in annotations on JVM 6, inability to support conversion of a
class from Kotlin to Java without recompiling clients which use it
reflectively, etc.
2015-10-11 17:10:35 +03:00

15 lines
296 B
Kotlin
Vendored

import kotlin.reflect.jvm.kotlin
enum class A {
// There's a synthetic field "$VALUES" here
}
fun box(): String {
for (field in javaClass<A>().getDeclaredFields()) {
val prop = field.kotlin
if (prop != null) return "Fail, property found: $prop"
}
return "OK"
}