Call getMethod/getDeclaredMethod depending on visibility

This commit is contained in:
Alexander Udalov
2015-04-01 19:09:22 +03:00
parent 0202217135
commit 715641fb0d
4 changed files with 31 additions and 14 deletions
@@ -0,0 +1,16 @@
import kotlin.reflect.jvm.*
class K<in T : String> {
private var t: T
get() = "OK" as T
set(value) {}
fun run(): String {
val p = ::t
p.accessible = true
p.set(this, "" as T)
return p.get(this)
}
}
fun box() = K<String>().run()