Files
kotlin/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField.kt
Alexander Udalov daab3db062 Add WITH_RUNTIME and WITH_REFLECT directives to box tests
Currently all tests in boxWithStdlib/ run with both runtime and reflection
included; eventually they'll be merged into box/ using these directives
2016-03-03 16:11:21 +03:00

33 lines
468 B
Kotlin
Vendored

// 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"
}