Files
kotlin-fork/compiler/testData/codegen/box/reflection/call/cannotCallEnumConstructor.kt
T
2020-03-18 17:09:35 +03:00

20 lines
352 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.jvm.isAccessible
enum class E
fun box(): String {
try {
val c = E::class.constructors.single()
c.isAccessible = true
c.call()
return "Fail: constructing an enum class should not be allowed"
}
catch (e: Throwable) {
return "OK"
}
}