JVM_IR: Add null-checks in SAM wrapper constructors (KT-50108)
This commit is contained in:
committed by
Alexander Udalov
parent
7f531d8426
commit
0da23198e6
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user