Files
kotlin-fork/compiler/testData/codegen/box/properties/javaPropertyBoxedGetter.kt
T
Ivan Kylchik 574aa0affe [FIR] Fix synthetic property is not var due to Nullable on parameter
Synthetic property is var when it have setter. The latter is set up
in property when its parameter type is equal to getter return type. In
case of using @Nullable, parameter type of setter is not equal to
return type of getter, because the latter is flexible type. So to fix
this verification should occur using not null types

#KT-39076 Fixed
2020-07-06 17:52:37 +03:00

33 lines
549 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: JavaClass.java
public class JavaClass {
private Boolean value;
public Boolean isValue() {
return value;
}
public void setValue(boolean value) {
this.value = value;
}
}
// FILE: kotlin.kt
fun box(): String {
val javaClass = JavaClass()
if (javaClass.isValue != null) return "fail 1"
javaClass.isValue = false
if (javaClass.isValue != false) return "fail 2"
javaClass.isValue = true
if (javaClass.isValue != true) return "fail 3"
return "OK"
}