mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
30 lines
499 B
Kotlin
Vendored
30 lines
499 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
|
|
annotation class NoArg
|
|
|
|
class Simple(val a: String)
|
|
|
|
@NoArg
|
|
class Test(val a: String) {
|
|
val x = 5
|
|
val y: Simple? = Simple("Hello, world!")
|
|
}
|
|
|
|
fun box(): String {
|
|
try {
|
|
val test = Test::class.java.newInstance()
|
|
|
|
if (test.x != 0) {
|
|
return "Bad 5"
|
|
}
|
|
|
|
if (test.y != null) {
|
|
return "Bad Hello, world!"
|
|
}
|
|
|
|
return "OK"
|
|
} catch (e: Throwable) {
|
|
e.printStackTrace()
|
|
return "Fail"
|
|
}
|
|
} |