Deprecate PropertyMetadata, use KProperty<*> for delegated properties instead
This commit is contained in:
+17
-15
@@ -1,33 +1,35 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
class CustomDelegate {
|
||||
operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name
|
||||
operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {}
|
||||
operator fun get(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
operator fun set(thisRef: Any?, prop: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
class OkDelegate {
|
||||
operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name
|
||||
operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {}
|
||||
operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
class CustomDelegate2 {
|
||||
operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name
|
||||
operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {}
|
||||
operator fun get(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
operator fun set(thisRef: Any?, prop: KProperty<*>, value: String) {}
|
||||
|
||||
operator fun getValue(thisRef: Any?, prop: PropertyMetadata): Int = 5
|
||||
operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) {}
|
||||
operator fun getValue(thisRef: Any?, prop: KProperty<*>): Int = 5
|
||||
operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: Int) {}
|
||||
}
|
||||
|
||||
class CustomDelegate3 {
|
||||
operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name
|
||||
operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {}
|
||||
operator fun get(thisRef: Any?, prop: KProperty<*>): String = prop.name
|
||||
operator fun set(thisRef: Any?, prop: KProperty<*>, value: String) {}
|
||||
}
|
||||
|
||||
operator fun OkDelegate.get(thisRef: Any?, prop: PropertyMetadata): Int = 4
|
||||
operator fun OkDelegate.set(thisRef: Any?, prop: PropertyMetadata, value: Int) {}
|
||||
operator fun OkDelegate.get(thisRef: Any?, prop: <!DEPRECATION!>PropertyMetadata<!>): Int = 4
|
||||
operator fun OkDelegate.set(thisRef: Any?, prop: <!DEPRECATION!>PropertyMetadata<!>, value: Int) {}
|
||||
|
||||
operator fun CustomDelegate3.getValue(thisRef: Any?, prop: PropertyMetadata): Int = 4
|
||||
operator fun CustomDelegate3.setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) {}
|
||||
operator fun CustomDelegate3.getValue(thisRef: Any?, prop: <!DEPRECATION!>PropertyMetadata<!>): Int = 4
|
||||
operator fun CustomDelegate3.setValue(thisRef: Any?, prop: <!DEPRECATION!>PropertyMetadata<!>, value: Int) {}
|
||||
|
||||
class Example {
|
||||
|
||||
@@ -48,4 +50,4 @@ class Example {
|
||||
fun requireString(s: String) {}
|
||||
fun requireInt(n: Int) {}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user