Files
kotlin-fork/compiler/testData/codegen/box/throws/delegationAndThrows_1_3.kt
T
2020-11-23 19:36:10 +03:00

24 lines
462 B
Kotlin
Vendored

// !LANGUAGE: -DoNotGenerateThrowsForDelegatedKotlinMembers
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: A.kt
import java.io.IOException
interface A {
@Throws(IOException::class)
fun foo()
}
// FILE: B.kt
class B(a: A) : A by a
fun box(): String {
val method = B::class.java.declaredMethods.single { it.name == B::foo.name }
if (method.exceptionTypes.size != 1)
return "Fail: ${method.exceptionTypes.toList()}"
return "OK"
}