Files
kotlin-fork/compiler/testData/codegen/box/reflection/properties/noConflictOnKotlinGetterAndJavaField.kt
T
Mikhail Glukhikh 23e7468e57 [FIR2IR] Cache Java field-based properties more correctly #KT-42805 Fixed
Before this commit, we cached such IR properties by FIR property
which was created by Java field each time when we referenced it.
This led to signature clashes. Now we cache such IR properties
directly by associated FIR field.
2020-10-22 13:05:00 +03:00

35 lines
492 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_REFLECT
// FILE: J.java
public class J {
public String foo = "";
}
// FILE: K.kt
import kotlin.test.*
class K : J() {
fun getFoo(): String = "K"
}
fun box(): String {
val j = J()
val x = J::foo
x.set(j, "J")
assertEquals("J", x.get(j))
val k = K()
val y = K::foo
y.set(k, "K")
assertEquals("K", y.get(k))
assertEquals("K", x.get(k))
val z = K::getFoo
assertEquals("K", z.invoke(k))
return "OK"
}