Files
kotlin/compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inLocalVariableInitializer.kt
Dmitry Petrov e308dd02d8 Add box tests for new nullability assertions
(cherry picked from commit 0a84c3f)
2017-10-24 16:03:23 +03:00

31 lines
512 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// STRICT_JAVA_NULLABILITY_ASSERTIONS
// FILE: box.kt
fun box(): String {
try {
J().test()
return "Fail: should throw"
}
catch (e: Throwable) {
return "OK"
}
}
// FILE: test.kt
fun withAssertion(j: J) {
val x = j.nullString()
}
// FILE: J.java
import org.jetbrains.annotations.NotNull;
public class J {
public @NotNull String nullString() {
return null;
}
public void test() {
TestKt.withAssertion(this);
}
}