From 3461837c283af07521759787bf07949d947e7664 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 14 Oct 2015 16:44:51 +0300 Subject: [PATCH] Temporary move std-lib deprecated back to MutableCollections (due to backward compatibility stuff) --- .../kotlin/collections/DeprecatedBuiltins.kt | 63 ------------------- .../kotlin/collections/MutableCollections.kt | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/libraries/stdlib/src/kotlin/collections/DeprecatedBuiltins.kt b/libraries/stdlib/src/kotlin/collections/DeprecatedBuiltins.kt index 3c6838ba513..00f7bf2b948 100644 --- a/libraries/stdlib/src/kotlin/collections/DeprecatedBuiltins.kt +++ b/libraries/stdlib/src/kotlin/collections/DeprecatedBuiltins.kt @@ -18,69 +18,6 @@ package kotlin -@Deprecated("Use property 'size' instead", ReplaceWith("this.size")) -public inline fun Collection<*>.size() = size - -@Deprecated("Use property 'size' instead", ReplaceWith("this.size")) -public inline fun Map<*, *>.size() = size - -@Deprecated("Use property 'key' instead", ReplaceWith("this.key")) -public fun Map.Entry.getKey(): K = key - -@Deprecated("Use property 'value' instead", ReplaceWith("this.value")) -public fun Map.Entry.getValue(): V = value - -@Deprecated("Use 'removeAt' instead", ReplaceWith("this.removeAt(index)")) -public fun MutableList.remove(index: Int): E = removeAt(index) - -@Deprecated("Use explicit cast to MutableCollection instead", ReplaceWith("(this as MutableCollection).remove(o)")) -public fun MutableCollection.remove(o: Any?): Boolean = remove(o as E) - -@Deprecated("Use explicit cast to MutableCollection instead", ReplaceWith("(this as MutableCollection).removeAll(c)")) -public fun MutableCollection.removeAll(c: Collection): Boolean = removeAll(c as Collection) - -@Deprecated("Use explicit cast to MutableCollection instead", ReplaceWith("(this as MutableCollection).retainAll(c)")) -public fun MutableCollection.retainAll(c: Collection): Boolean = retainAll(c as Collection) - -@Deprecated("Use explicit cast to List instead", ReplaceWith("(this as List).indexOf(o)")) -public fun List.indexOf(o: Any?): Int = indexOf(o as E) - -@Deprecated("Use explicit cast to List instead", ReplaceWith("(this as List).lastIndexOf(o)")) -public fun List.lastIndexOf(o: Any?): Int = lastIndexOf(o as E) - -@Deprecated("Use property 'length' instead", ReplaceWith("this.length")) -public fun CharSequence.length(): Int = length - -@Deprecated("Use explicit cast to Map instead", ReplaceWith("(this as Map).get(o)")) -public inline operator fun Map.get(o: Any?): V? = get(o as K) - -@Deprecated("Use explicit cast to Map instead", ReplaceWith("(this as Map).containsKey(o)")) -public inline fun Map.containsKey(o: Any?): Boolean = containsKey(o as K) - -@Deprecated("Use explicit cast to Map instead", ReplaceWith("(this as Map).containsValue(o)")) -public inline fun Map.containsValue(o: Any?): Boolean = containsValue(o as V) - -@Deprecated("Use property 'keys' instead", ReplaceWith("this.keys")) -public inline fun Map.keySet(): Set = keys - -@kotlin.jvm.JvmName("mutableKeys") -@Deprecated("Use property 'keys' instead", ReplaceWith("this.keys")) -public inline fun MutableMap.keySet(): MutableSet = keys - -@Deprecated("Use property 'entries' instead", ReplaceWith("this.entries")) -public inline fun Map.entrySet(): Set> = entries - -@kotlin.jvm.JvmName("mutableEntrySet") -@Deprecated("Use property 'entries' instead", ReplaceWith("this.entries")) -public inline fun MutableMap.entrySet(): MutableSet> = entries - -@Deprecated("Use property 'values' instead", ReplaceWith("this.values")) -public inline fun Map.values(): Collection = values - -@kotlin.jvm.JvmName("mutableValues") -@Deprecated("Use property 'values' instead", ReplaceWith("this.values")) -public inline fun MutableMap.values(): MutableCollection = values - @Deprecated("Use property 'message' instead", ReplaceWith("this.message")) public inline fun Throwable.getMessage(): String? = message diff --git a/libraries/stdlib/src/kotlin/collections/MutableCollections.kt b/libraries/stdlib/src/kotlin/collections/MutableCollections.kt index e80ef670b2d..dd33da542d6 100644 --- a/libraries/stdlib/src/kotlin/collections/MutableCollections.kt +++ b/libraries/stdlib/src/kotlin/collections/MutableCollections.kt @@ -6,6 +6,69 @@ package kotlin @Deprecated("Use operator 'get' instead", ReplaceWith("this[index]")) public fun CharSequence.charAt(index: Int): Char = this[index] +@Deprecated("Use property 'size' instead", ReplaceWith("this.size")) +public inline fun Collection<*>.size() = size + +@Deprecated("Use property 'size' instead", ReplaceWith("this.size")) +public inline fun Map<*, *>.size() = size + +@Deprecated("Use property 'key' instead", ReplaceWith("this.key")) +public fun Map.Entry.getKey(): K = key + +@Deprecated("Use property 'value' instead", ReplaceWith("this.value")) +public fun Map.Entry.getValue(): V = value + +@Deprecated("Use 'removeAt' instead", ReplaceWith("this.removeAt(index)")) +public fun MutableList.remove(index: Int): E = removeAt(index) + +@Deprecated("Use explicit cast to MutableCollection instead", ReplaceWith("(this as MutableCollection).remove(o)")) +public fun MutableCollection.remove(o: Any?): Boolean = remove(o as E) + +@Deprecated("Use explicit cast to MutableCollection instead", ReplaceWith("(this as MutableCollection).removeAll(c)")) +public fun MutableCollection.removeAll(c: Collection): Boolean = removeAll(c as Collection) + +@Deprecated("Use explicit cast to MutableCollection instead", ReplaceWith("(this as MutableCollection).retainAll(c)")) +public fun MutableCollection.retainAll(c: Collection): Boolean = retainAll(c as Collection) + +@Deprecated("Use explicit cast to List instead", ReplaceWith("(this as List).indexOf(o)")) +public fun List.indexOf(o: Any?): Int = indexOf(o as E) + +@Deprecated("Use explicit cast to List instead", ReplaceWith("(this as List).lastIndexOf(o)")) +public fun List.lastIndexOf(o: Any?): Int = lastIndexOf(o as E) + +@Deprecated("Use property 'length' instead", ReplaceWith("this.length")) +public fun CharSequence.length(): Int = length + +@Deprecated("Use explicit cast to Map instead", ReplaceWith("(this as Map).get(o)")) +public inline operator fun Map.get(o: Any?): V? = get(o as K) + +@Deprecated("Use explicit cast to Map instead", ReplaceWith("(this as Map).containsKey(o)")) +public inline fun Map.containsKey(o: Any?): Boolean = containsKey(o as K) + +@Deprecated("Use explicit cast to Map instead", ReplaceWith("(this as Map).containsValue(o)")) +public inline fun Map.containsValue(o: Any?): Boolean = containsValue(o as V) + +@Deprecated("Use property 'keys' instead", ReplaceWith("this.keys")) +public inline fun Map.keySet(): Set = keys + +@kotlin.jvm.JvmName("mutableKeys") +@Deprecated("Use property 'keys' instead", ReplaceWith("this.keys")) +public inline fun MutableMap.keySet(): MutableSet = keys + +@Deprecated("Use property 'entries' instead", ReplaceWith("this.entries")) +public inline fun Map.entrySet(): Set> = entries + +@kotlin.jvm.JvmName("mutableEntrySet") +@Deprecated("Use property 'entries' instead", ReplaceWith("this.entries")) +public inline fun MutableMap.entrySet(): MutableSet> = entries + +@Deprecated("Use property 'values' instead", ReplaceWith("this.values")) +public inline fun Map.values(): Collection = values + +@kotlin.jvm.JvmName("mutableValues") +@Deprecated("Use property 'values' instead", ReplaceWith("this.values")) +public inline fun MutableMap.values(): MutableCollection = values + /** * Adds the specified [element] to this mutable collection. */