Files
kotlin/compiler/testData/codegen/box/reflection/properties/overrideKotlinPropertyByJavaMethod.kt
Ilya Matveev a5e4e0284e Mute some box tests for native backend
This patch mutes the following test categories:
   * Tests with java dependencies (System class,
     java stdlib, jvm-oriented annotations etc).
   * Coroutines tests.
   * Reflection tests.
   * Tests with an inheritance from the standard
     collections.
2017-03-10 19:59:37 +03:00

43 lines
849 B
Kotlin
Vendored

// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS, NATIVE
// WITH_REFLECT
// FILE: J.java
public class J implements K {
private String foo;
@Override
public String getFoo() {
return foo;
}
@Override
public void setFoo(String s) {
foo = s;
}
}
// FILE: K.kt
import kotlin.test.assertEquals
import kotlin.reflect.KParameter
interface K {
var foo: String
}
fun box(): String {
val p = J::foo
assertEquals("foo", p.name)
if (p.parameters.size != 1) return "Should have only 1 parameter"
if (p.parameters.single().kind != KParameter.Kind.INSTANCE) return "Should have an instance parameter"
if (J::class.members.none { it == p }) return "No foo in members"
val j = J()
p.setter.call(j, "OK")
return p.getter.call(j)
}