Files
kotlin/compiler/testData/codegen/box/reflection/call/cannotCallEnumConstructor.kt
2016-11-09 21:41:12 +03:00

21 lines
413 B
Kotlin
Vendored

// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// WITH_REFLECT
import kotlin.reflect.jvm.*
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"
}
}