From c848ebdc52a618494156bc339a7ad1926e6db159 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Sun, 22 Nov 2015 09:27:23 +0300 Subject: [PATCH] Deprecate complex delegation to map. --- libraries/stdlib/src/kotlin/properties/Delegation.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/stdlib/src/kotlin/properties/Delegation.kt b/libraries/stdlib/src/kotlin/properties/Delegation.kt index 057c8cde922..924c293c148 100644 --- a/libraries/stdlib/src/kotlin/properties/Delegation.kt +++ b/libraries/stdlib/src/kotlin/properties/Delegation.kt @@ -55,6 +55,7 @@ public object Delegates { * @param map the map where the property values are stored. * @param default the function returning the value of the property for a given object if it's missing from the given map. */ + @Deprecated("Complex scenarios of delegation to map are deprecated. Delegate to map itself.") public fun mapVar(map: MutableMap, default: (thisRef: R, propertyName: String) -> T): ReadWriteProperty { return FixedMapVar(map, propertyNameSelector, default) @@ -76,6 +77,7 @@ public object Delegates { * @param map the map where the property values are stored. * @param default the function returning the value of the property for a given object if it's missing from the given map. */ + @Deprecated("Complex scenarios of delegation to map are deprecated. Delegate to map itself.") public fun mapVal(map: Map, default: (thisRef: R, propertyName: String) -> T): ReadOnlyProperty { return FixedMapVal(map, propertyNameSelector, default) @@ -136,6 +138,7 @@ public abstract class ObservableProperty(initialValue: T) : ReadWriteProperty * @param K the type of key in the map. * @param V the type of the property value. */ +@Deprecated("Complex scenarios of delegation to map are deprecated. Delegate to map itself.") public abstract class MapVal() : ReadOnlyProperty { /** * Returns the map used to store the values of the properties of the given object instance. @@ -171,6 +174,7 @@ public abstract class MapVal() : ReadOnlyProperty { * @param K the type of key in the map. * @param V the type of the property value. */ +@Deprecated("Complex scenarios of delegation to map are deprecated. Delegate to map itself.") public abstract class MapVar() : MapVal(), ReadWriteProperty { protected abstract override fun map(ref: T): MutableMap @@ -194,6 +198,7 @@ private val throwKeyNotFound: (Any?, Any?) -> Nothing = {thisRef, key -> throw N * @param key the function to calculate the map key from a property metadata object. * @param default the function returning the value of the property for a given object if it's missing from the given map. */ +@Deprecated("Complex scenarios of delegation to map are deprecated. Delegate to map itself.") public open class FixedMapVal( private val map: Map, private val key: (KProperty<*>) -> K, @@ -219,6 +224,7 @@ public open class FixedMapVal( * @param key the function to calculate the map key from a property metadata object. * @param default the function returning the value of the property for a given object if it's missing from the given map. */ +@Deprecated("Complex scenarios of delegation to map are deprecated. Delegate to map itself.") public open class FixedMapVar( private val map: MutableMap, private val key: (KProperty<*>) -> K,