JVM_IR KT-24258 fix NPE message for delegated properties

This commit is contained in:
Dmitry Petrov
2020-12-23 17:19:02 +03:00
committed by TeamCityServer
parent ad8bed078f
commit 4e261cc358
11 changed files with 175 additions and 23 deletions
@@ -0,0 +1,28 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WITH_RUNTIME
// FILE: kt24258.kt
val lazyNullString: String by lazy { J.nullString() }
fun testLazyNullString() {
try {
val s: String = lazyNullString
throw Exception("'val s: String = lazyNullString' should throw NullPointerException")
} catch (e: NullPointerException) {
}
}
fun box(): String {
testLazyNullString()
return "OK"
}
// FILE: J.java
public class J {
public static String nullString() {
return null;
}
}
@@ -0,0 +1,30 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: kt24258nn.kt
val lazyNotNullString: String by lazy { J.nullNotNullString() }
fun testLazyNullNotNullString() {
try {
val s: String = lazyNotNullString
throw Exception("'val s: String = lazyNotNullString' should throw NullPointerException")
} catch (e: NullPointerException) {
}
}
fun box(): String {
testLazyNullNotNullString()
return "OK"
}
// FILE: J.java
import org.jetbrains.annotations.NotNull;
public class J {
@NotNull
public static String nullNotNullString() {
return null;
}
}