Files
kotlin-fork/compiler/testData/codegen/box/javaInterop/notNullAssertions/paramAssertionMessage.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

29 lines
586 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: Test.java
public class Test {
public static void callFoo() {
new A().foo(null);
}
}
// FILE: Test.kt
class A {
fun foo(s: String) {}
}
fun box(): String {
try {
Test.callFoo()
return "Fail 1"
} catch (e: NullPointerException) {
if (e.message != "Parameter specified as non-null is null: method A.foo, parameter s") {
return "Fail 2 (message: ${e.message})"
}
} catch (e: Throwable) {
return "Fail 3 (exception class: ${e::class.simpleName})"
}
return "OK"
}