JVM_IR: Add null-checks in SAM wrapper constructors (KT-50108)

This commit is contained in:
Steven Schäfer
2021-12-08 11:17:58 +01:00
committed by Alexander Udalov
parent 7f531d8426
commit 0da23198e6
7 changed files with 102 additions and 3 deletions
+23
View File
@@ -0,0 +1,23 @@
// TARGET_BACKEND: JVM
// FILE: test.kt
fun interface IFoo {
fun foo(s: String)
}
val foo = IFoo {}
fun box(): String {
try {
J.callWithNull(foo)
return "J.callWithNull(foo) should throw NPE"
} catch (e: NullPointerException) {
return "OK"
}
}
// FILE: J.java
public class J {
public static void callWithNull(IFoo iFoo) {
iFoo.foo(null);
}
}