From ab88d4956753f80b3d406f012d6e85c47ea9509b Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 9 Sep 2015 16:23:27 +0300 Subject: [PATCH] Drop deprecated stuff --- .../src/kotlin/deprecated/Deprecated.kt | 106 ---------------- .../src/kotlin/deprecated/DeprecatedArrays.kt | 41 ------- .../src/kotlin/deprecated/DeprecatedJVM.kt | 44 ------- .../kotlin/deprecated/DeprecatedStrings.kt | 113 ------------------ 4 files changed, 304 deletions(-) delete mode 100644 libraries/stdlib/src/kotlin/deprecated/Deprecated.kt delete mode 100644 libraries/stdlib/src/kotlin/deprecated/DeprecatedArrays.kt delete mode 100644 libraries/stdlib/src/kotlin/deprecated/DeprecatedJVM.kt delete mode 100644 libraries/stdlib/src/kotlin/deprecated/DeprecatedStrings.kt diff --git a/libraries/stdlib/src/kotlin/deprecated/Deprecated.kt b/libraries/stdlib/src/kotlin/deprecated/Deprecated.kt deleted file mode 100644 index b4c1bed2c89..00000000000 --- a/libraries/stdlib/src/kotlin/deprecated/Deprecated.kt +++ /dev/null @@ -1,106 +0,0 @@ -package kotlin - -import java.util.* - -@Deprecated("Use listOf(...) or arrayListOf(...) instead", ReplaceWith("arrayListOf(*values)")) -public fun arrayList(vararg values: T): ArrayList = arrayListOf(*values) - -@Deprecated("Use setOf(...) or hashSetOf(...) instead", ReplaceWith("hashSetOf(*values)")) -public fun hashSet(vararg values: T): HashSet = hashSetOf(*values) - -@Deprecated("Use mapOf(...) or hashMapOf(...) instead", ReplaceWith("hashMapOf(*values)")) -public fun hashMap(vararg values: Pair): HashMap = hashMapOf(*values) - -@Deprecated("Use listOf(...) or linkedListOf(...) instead", ReplaceWith("linkedListOf(*values)")) -public fun linkedList(vararg values: T): LinkedList = linkedListOf(*values) - -@Deprecated("Use linkedMapOf(...) instead", ReplaceWith("linkedMapOf(*values)")) -public fun linkedMap(vararg values: Pair): LinkedHashMap = linkedMapOf(*values) - -/** Copies all characters into a [[Collection] */ -@Deprecated("Use toList() instead.", ReplaceWith("toList()")) -public fun String.toCollection(): Collection = toCollection(ArrayList(this.length())) - - -/** - * A helper method for creating a [[Runnable]] from a function - */ -@Deprecated("Use SAM constructor: Runnable(...)", ReplaceWith("Runnable(action)")) -public /*inline*/ fun runnable(action: () -> Unit): Runnable = Runnable(action) - -@Deprecated("Use forEachIndexed instead.", ReplaceWith("forEachIndexed(operation)")) -public inline fun List.forEachWithIndex(operation: (Int, T) -> Unit): Unit = forEachIndexed(operation) - -@Deprecated("Function with undefined semantic") -public fun countTo(n: Int): (T) -> Boolean { - var count = 0 - return { ++count; count <= n } -} - -@Deprecated("Use contains() function instead", ReplaceWith("contains(item)")) -public fun Iterable.containsItem(item : T) : Boolean = contains(item) - -@Deprecated("Use sortBy() instead", ReplaceWith("sortedWith(comparator)")) -public fun Iterable.sort(comparator: java.util.Comparator) : List = sortedWith(comparator) - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val Array<*>.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val ByteArray.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val CharArray.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val ShortArray.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val IntArray.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val LongArray.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val FloatArray.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val DoubleArray.size: Int get() = size() - -@Deprecated("Use size() instead", ReplaceWith("size()")) -public val BooleanArray.size: Int get() = size() - -@Deprecated("Use compareValuesBy() instead", ReplaceWith("compareValuesBy(a, b, *functions)")) -public fun compareBy(a: T?, b: T?, vararg functions: (T) -> Comparable<*>?): Int = compareValuesBy(a, b, *functions) - - -/** Returns true if this collection is empty */ -@Deprecated("Use isEmpty() function call instead", ReplaceWith("isEmpty()")) -public val Collection<*>.empty: Boolean - get() = isEmpty() - -/** Returns the size of the collection */ -@Deprecated("Use size() function call instead", ReplaceWith("size()")) -public val Collection<*>.size: Int - get() = size() - - -/** Returns the size of the map */ -@Deprecated("Use size() function call instead", ReplaceWith("size()")) -public val Map<*, *>.size: Int - get() = size() - -/** Returns true if this map is empty */ -@Deprecated("Use isEmpty() function call instead", ReplaceWith("isEmpty()")) -public val Map<*, *>.empty: Boolean - get() = isEmpty() - -/** Returns true if this collection is not empty */ -@Deprecated("Use isNotEmpty() function call instead", ReplaceWith("isNotEmpty()")) -public val Collection<*>.notEmpty: Boolean - get() = isNotEmpty() - -@Deprecated("Use length() instead", ReplaceWith("length()")) -public val CharSequence.length: Int - get() = length() - diff --git a/libraries/stdlib/src/kotlin/deprecated/DeprecatedArrays.kt b/libraries/stdlib/src/kotlin/deprecated/DeprecatedArrays.kt deleted file mode 100644 index 4470410f274..00000000000 --- a/libraries/stdlib/src/kotlin/deprecated/DeprecatedArrays.kt +++ /dev/null @@ -1,41 +0,0 @@ -package kotlin - -// deprecated to be removed after M12 - -@Deprecated("Use arrayOf() instead.", ReplaceWith("arrayOf(*t)")) -inline public fun array(vararg t : T) : Array = arrayOf(*t) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use doubleArrayOf() instead.", ReplaceWith("doubleArrayOf(*content)")) -inline public fun doubleArray(vararg content : Double) : DoubleArray = doubleArrayOf(*content) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use floatArrayOf() instead.", ReplaceWith("floatArrayOf(*content)")) -inline public fun floatArray(vararg content : Float) : FloatArray = floatArrayOf(*content) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use longArrayOf() instead.", ReplaceWith("longArrayOf(*content)")) -inline public fun longArray(vararg content : Long) : LongArray = longArrayOf(*content) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use intArrayOf() instead.", ReplaceWith("intArrayOf(*content)")) -inline public fun intArray(vararg content : Int) : IntArray = intArrayOf(*content) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use charArrayOf() instead.", ReplaceWith("charArrayOf(*content)")) -inline public fun charArray(vararg content : Char) : CharArray = charArrayOf(*content) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use shortArrayOf() instead.", ReplaceWith("shortArrayOf(*content)")) -inline public fun shortArray(vararg content : Short) : ShortArray = shortArrayOf(*content) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use byteArrayOf() instead.", ReplaceWith("byteArrayOf(*content)")) -inline public fun byteArray(vararg content : Byte) : ByteArray = byteArrayOf(*content) - -@Suppress("NOTHING_TO_INLINE") -@Deprecated("Use booleanArrayOf() instead.", ReplaceWith("booleanArrayOf(*content)")) -inline public fun booleanArray(vararg content : Boolean) : BooleanArray = booleanArrayOf(*content) - -@Deprecated("Use toTypedArray() instead.", ReplaceWith("toTypedArray()")) -inline public fun Collection.copyToArray(): Array = toTypedArray() \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/deprecated/DeprecatedJVM.kt b/libraries/stdlib/src/kotlin/deprecated/DeprecatedJVM.kt deleted file mode 100644 index b954df3c89b..00000000000 --- a/libraries/stdlib/src/kotlin/deprecated/DeprecatedJVM.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2010-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package kotlin - -import java.util.* -import java.util.concurrent.Callable - -@Deprecated("Use sortedSetOf(...) instead", ReplaceWith("sortedSetOf(*values)")) -public fun sortedSet(vararg values: T): TreeSet = sortedSetOf(*values) - -@Deprecated("Use sortedSetOf(...) instead", ReplaceWith("sortedSetOf(comparator, *values)")) -public fun sortedSet(comparator: Comparator, vararg values: T): TreeSet = sortedSetOf(comparator, *values) - -@Deprecated("Use sortedMapOf(...) instead", ReplaceWith("sortedMapOf(*values)")) -public fun sortedMap(vararg values: Pair): SortedMap = sortedMapOf(*values) - -/** - * A helper method for creating a [[Callable]] from a function - */ -@Deprecated("Use SAM constructor: Callable(...)", ReplaceWith("Callable(action)", "java.util.concurrent.Callable")) -public /*inline*/ fun callable(action: () -> T): Callable = Callable(action) - -@Deprecated("Use length() instead", ReplaceWith("length()")) -public val String.size: Int - get() = length() - -@Deprecated("Use length() instead", ReplaceWith("length()")) -public val CharSequence.size: Int - get() = length() - diff --git a/libraries/stdlib/src/kotlin/deprecated/DeprecatedStrings.kt b/libraries/stdlib/src/kotlin/deprecated/DeprecatedStrings.kt deleted file mode 100644 index aa5adb09de4..00000000000 --- a/libraries/stdlib/src/kotlin/deprecated/DeprecatedStrings.kt +++ /dev/null @@ -1,113 +0,0 @@ -package kotlin - - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun Array.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun BooleanArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun ByteArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun CharArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun DoubleArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun FloatArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun IntArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun LongArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun ShortArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun Iterable.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)")) -public fun Sequence.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { - return joinToString(separator, prefix, postfix, limit, truncated) -} - - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun Array.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun BooleanArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun ByteArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun CharArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun DoubleArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun FloatArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun IntArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun LongArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun ShortArray.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun Iterable.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -} - -@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)")) -public fun Sequence.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit { - joinTo(buffer, separator, prefix, postfix, limit, truncated) -}