mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 00:21:32 +00:00
Add some tests on Java property references
This commit is contained in:
3
compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/J.java
vendored
Normal file
3
compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/J.java
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
public class J {
|
||||
public String foo = "";
|
||||
}
|
||||
23
compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/K.kt
vendored
Normal file
23
compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/K.kt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user