Deprecate PropertyMetadata, use KProperty<*> for delegated properties instead

This commit is contained in:
Alexander Udalov
2015-10-12 21:42:18 +03:00
parent 3c74f48f91
commit ec1b4776fe
145 changed files with 536 additions and 379 deletions
@@ -1,5 +1,7 @@
package baz
import kotlin.reflect.KProperty
class A(outer: Outer) {
var i: String by + getMyConcreteProperty()
var d: String by getMyConcreteProperty() - 1
@@ -21,12 +23,12 @@ fun getMyConcreteProperty() = MyProperty<Any?, String>()
class MyProperty<R, T> {
operator fun getValue(thisRef: R, desc: PropertyMetadata): T {
operator fun getValue(thisRef: R, desc: KProperty<*>): T {
println("get $thisRef ${desc.name}")
return null as T
}
operator fun setValue(thisRef: R, desc: PropertyMetadata, value: T) {
operator fun setValue(thisRef: R, desc: KProperty<*>, value: T) {
println("set $thisRef ${desc.name} $value")
}
}
@@ -47,4 +49,4 @@ interface Outer {
}
// -----------------
fun println(a: Any?) = a
fun println(a: Any?) = a