Files
kotlin-fork/compiler/testData/codegen/boxAgainstJava/notNullAssertions/delegation.kt
T
Mikhail Zarechenskiy 5c5635ce20 Fix codegen & bytecode tests after unifying exceptions in JVM backend
See KT-22275 for details
2020-01-20 16:36:03 +03:00

32 lines
563 B
Kotlin
Vendored

// FILE: delegation.kt
interface Tr {
fun foo(): String
}
class DelegateTo : Delegation.ReturnNull(), Tr {
override fun foo() = super<Delegation.ReturnNull>.foo()
}
class DelegateFrom : Tr by DelegateTo()
fun box(): String {
try {
DelegateFrom().foo()
return "Fail: should have been an exception"
}
catch(e: NullPointerException) {
return "OK"
}
}
// FILE: Delegation.java
public class Delegation {
public static class ReturnNull {
public String foo() {
return null;
}
}
}