f01e633f8b
It affects the `is IrGetField` check in TypeOperatorLowering.computeNotNullAssertionText, which leads to missing NPE messages when accessing backing fields of public properties. #KT-64615
30 lines
661 B
Kotlin
Vendored
30 lines
661 B
Kotlin
Vendored
// !LANGUAGE: +NoSourceCodeInNotNullAssertionExceptions
|
|
// TARGET_BACKEND: JVM
|
|
// FILE: test.kt
|
|
|
|
val publicProperty = J().s()
|
|
private val privateProperty = J().s()
|
|
|
|
fun f(x: String) = "Fail 1"
|
|
|
|
fun box(): String {
|
|
try {
|
|
f(publicProperty)
|
|
} catch (e: NullPointerException) {
|
|
if (e.message != "publicProperty must not be null") return "Fail 2: ${e.message}"
|
|
}
|
|
|
|
try {
|
|
f(privateProperty)
|
|
} catch (e: NullPointerException) {
|
|
if (e.message != "privateProperty must not be null") return "Fail 3: ${e.message}"
|
|
}
|
|
|
|
return "OK"
|
|
}
|
|
|
|
// FILE: J.java
|
|
public class J {
|
|
public final String s() { return null; }
|
|
}
|