Files
kotlin/compiler/testData/codegen/box/javaInterop/notNullAssertions/enhancedNullability/inMemberPropertyInitializer.kt
2017-10-25 12:30:32 +03:00

31 lines
500 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
class C {
val withAssertion = J().nullString()
}
// FILE: J.java
import org.jetbrains.annotations.NotNull;
public class J {
public @NotNull String nullString() {
return null;
}
public Object test() {
return new C();
}
}