From b7a50b333e2f5642b4f59230d60d368e0da63fc4 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Tue, 1 Dec 2015 20:35:46 +0300 Subject: [PATCH] Better replacement for containsAll, removeAll, retainAll with incompatible types. --- .../src/kotlin/collections/MutableCollections.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/stdlib/src/kotlin/collections/MutableCollections.kt b/libraries/stdlib/src/kotlin/collections/MutableCollections.kt index e2ceb079ee9..395adea3622 100644 --- a/libraries/stdlib/src/kotlin/collections/MutableCollections.kt +++ b/libraries/stdlib/src/kotlin/collections/MutableCollections.kt @@ -13,10 +13,10 @@ import java.util.* public fun <@kotlin.internal.OnlyInputTypes T> Collection.containsAll(elements: Collection): Boolean = this.containsAll(elements) @Suppress("NOTHING_TO_INLINE") -@Deprecated("Collections have incompatible types. Upcast either to Collection if you're sure.", ReplaceWith("containsAll(elements as Collection)")) +@Deprecated("Collections have incompatible types. Upcast either to Collection if you're sure.", ReplaceWith("containsAll(elements)")) public inline fun Collection<*>.containsAllRaw(elements: Collection): Boolean = containsAll(elements) -@Deprecated("Collections have incompatible types. Upcast either to Collection if you're sure.", ReplaceWith("containsAll(elements as Collection)")) +@Deprecated("Collections have incompatible types. Upcast either to Collection if you're sure.", ReplaceWith("containsAll(elements)")) @kotlin.jvm.JvmName("containsAllOfAny") @kotlin.internal.LowPriorityInOverloadResolution public fun Collection.containsAll(elements: Collection): Boolean = containsAll(elements) @@ -50,10 +50,10 @@ public fun MutableCollection.remove(element: T): Boolean = remove(ele public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.removeAll(elements: Collection): Boolean = (this as MutableCollection).removeAll(elements) @Suppress("NOTHING_TO_INLINE") -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("removeAll(elements as Collection)")) +@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("removeAll(elements)")) public inline fun MutableCollection.removeAllRaw(elements: Collection): Boolean = removeAll(elements) -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("removeAll(elements as Collection)")) +@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("removeAll(elements)")) @kotlin.jvm.JvmName("removeAllOfAny") @kotlin.internal.LowPriorityInOverloadResolution public fun MutableCollection.removeAll(elements: Collection): Boolean = removeAll(elements) @@ -68,10 +68,10 @@ public fun MutableCollection.removeAll(elements: Collection): Boole public fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.retainAll(elements: Collection): Boolean = (this as MutableCollection).retainAll(elements) @Suppress("NOTHING_TO_INLINE") -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("retainAll(elements as Collection)")) +@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("retainAll(elements)")) public inline fun MutableCollection.retainAllRaw(elements: Collection): Boolean = retainAll(elements) -@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("retainAll(elements as Collection)")) +@Deprecated("Collections have incompatible types. Upcast elements to Collection if you're sure.", ReplaceWith("retainAll(elements)")) @kotlin.jvm.JvmName("retainAllOfAny") @kotlin.internal.LowPriorityInOverloadResolution public fun MutableCollection.retainAll(elements: Collection): Boolean = retainAll(elements as Collection)