Generate proper initialization for possibly nullable SAM wrapper

#KT-18916 Fixed Target versions 1.1.5
This commit is contained in:
Dmitry Petrov
2017-07-10 10:26:41 +03:00
parent b99007961f
commit 8a9707c140
4 changed files with 81 additions and 15 deletions

View File

@@ -0,0 +1,26 @@
// WITH_RUNTIME
// FILE: JFoo.java
import org.jetbrains.annotations.Nullable;
public class JFoo {
public static void foo2(@Nullable Runnable h1, @Nullable Runnable h2) {
if (h2 != null) throw new AssertionError();
h1.run();
}
}
// FILE: Test.kt
fun test() {
var i = 0
JFoo.foo2({ i++ }, null)
}
// @TestKt.class:
// 1 NEW TestKt\$test\$1
// 1 NEW kotlin/jvm/internal/Ref\$IntRef
// 2 NEW
// 1 INVOKESPECIAL TestKt\$test\$1.<init>
// 0 IFNONNULL
// 0 IFNULL
// 1 ACONST_NULL