mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
21 lines
283 B
Kotlin
Vendored
21 lines
283 B
Kotlin
Vendored
// FILE: Sub.java
|
|
|
|
class Super {
|
|
void safeInvoke(Runnable r) {
|
|
if (r != null) r.run();
|
|
}
|
|
}
|
|
|
|
class Sub extends Super {
|
|
}
|
|
|
|
// FILE: 1.kt
|
|
|
|
fun box(): String {
|
|
var r = "FAIL"
|
|
val sub = Sub()
|
|
sub.safeInvoke(null)
|
|
sub.safeInvoke { r = "OK" }
|
|
return r
|
|
}
|