Get rid of deprecated annotations and modifiers in stdlib (besides JS)
This commit is contained in:
@@ -266,7 +266,7 @@ public fun ShortArray.copyOf(): ShortArray {
|
||||
/**
|
||||
* Returns new array which is a copy of the original array.
|
||||
*/
|
||||
platformName("mutableCopyOf")
|
||||
@JvmName("mutableCopyOf")
|
||||
public fun <T> Array<T>.copyOf(): Array<T> {
|
||||
return Arrays.copyOf(this, size())
|
||||
}
|
||||
@@ -408,7 +408,7 @@ public fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray {
|
||||
/**
|
||||
* Returns new array which is a copy of range of original array.
|
||||
*/
|
||||
platformName("mutableCopyOfRange")
|
||||
@JvmName("mutableCopyOfRange")
|
||||
public fun <T> Array<T>.copyOfRange(fromIndex: Int, toIndex: Int): Array<T> {
|
||||
return Arrays.copyOfRange(this, fromIndex, toIndex)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ import kotlin.jvm.internal.Intrinsic
|
||||
/**
|
||||
* Creates an input stream for reading data from this byte array.
|
||||
*/
|
||||
deprecated("Use inputStream() method instead.", ReplaceWith("this.inputStream()"))
|
||||
@Deprecated("Use inputStream() method instead.", ReplaceWith("this.inputStream()"))
|
||||
public val ByteArray.inputStream : ByteArrayInputStream
|
||||
get() = inputStream()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package kotlin
|
||||
|
||||
deprecated("This exception is no longer thrown by any standard library classes and is going to be removed")
|
||||
@Deprecated("This exception is no longer thrown by any standard library classes and is going to be removed")
|
||||
public class EmptyIterableException(private val it: Iterable<*>) : RuntimeException("$it is empty")
|
||||
|
||||
deprecated("This exception is no longer thrown by any standard library classes and is going to be removed")
|
||||
@Deprecated("This exception is no longer thrown by any standard library classes and is going to be removed")
|
||||
public class DuplicateKeyException(message : String = "Duplicate keys detected") : RuntimeException(message)
|
||||
@@ -100,7 +100,7 @@ public val Collection<*>.indices: IntRange
|
||||
/**
|
||||
* Returns an [IntRange] that starts with zero and ends at the value of this number but does not include it.
|
||||
*/
|
||||
deprecated("Use 0..n-1 range instead.", ReplaceWith("0..this - 1"))
|
||||
@Deprecated("Use 0..n-1 range instead.", ReplaceWith("0..this - 1"))
|
||||
public val Int.indices: IntRange
|
||||
get() = 0..this - 1
|
||||
|
||||
@@ -217,7 +217,7 @@ public fun <T> List<T>.binarySearch(element: T, comparator: Comparator<in T>, fr
|
||||
*
|
||||
* If the list contains multiple elements with the specified [key], there is no guarantee which one will be found.
|
||||
*/
|
||||
public inline fun <T, K : Comparable<K>> List<T>.binarySearchBy(key: K?, fromIndex: Int = 0, toIndex: Int = size(), inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> K?): Int =
|
||||
public inline fun <T, K : Comparable<K>> List<T>.binarySearchBy(key: K?, fromIndex: Int = 0, toIndex: Int = size(), crossinline selector: (T) -> K?): Int =
|
||||
binarySearch(fromIndex, toIndex) { compareValues(selector(it), key) }
|
||||
|
||||
// do not introduce this overload --- too rare
|
||||
|
||||
@@ -37,7 +37,7 @@ public fun <K, V> Map<K, V>.withDefault(default: (key: K) -> V): Map<K, V> =
|
||||
*
|
||||
* When this map already have an implicit default value provided with a former call to [withDefault], it is being replaced by this call.
|
||||
*/
|
||||
platformName("withDefaultMutable")
|
||||
@platformName("withDefaultMutable")
|
||||
public fun <K, V> MutableMap<K, V>.withDefault(default: (key: K) -> V): MutableMap<K, V> =
|
||||
when (this) {
|
||||
is MutableMapWithDefault -> this.map.withDefault(default)
|
||||
|
||||
@@ -17,7 +17,7 @@ public fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = put(key, value)
|
||||
* getOrPut is not supported on [ConcurrentMap] since it cannot be implemented correctly in terms of concurrency.
|
||||
* Use [concurrentGetOrPut] instead, or cast this to a [MutableMap] if you want to sacrifice the concurrent-safety.
|
||||
*/
|
||||
deprecated("Use concurrentGetOrPut instead or cast this map to MutableMap.")
|
||||
@Deprecated("Use concurrentGetOrPut instead or cast this map to MutableMap.")
|
||||
public inline fun <K, V> ConcurrentMap<K, V>.getOrPut(key: K, defaultValue: () -> V): Nothing =
|
||||
throw UnsupportedOperationException("getOrPut is not supported on ConcurrentMap.")
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package kotlin
|
||||
|
||||
import java.util.ArrayList
|
||||
import kotlin.platform.platformName
|
||||
|
||||
/**
|
||||
* Returns a single list of all elements from all collections in the given collection.
|
||||
|
||||
@@ -47,6 +47,6 @@ public fun <T> List<T>.asReversed(): List<T> = ReversedListReadOnly(this)
|
||||
* Returns a reversed mutable view of the original mutable List.
|
||||
* All changes made in the original list will be reflected in the reversed one and vice versa.
|
||||
*/
|
||||
platformName("asReversedMutable")
|
||||
@platformName("asReversedMutable")
|
||||
public fun <T> MutableList<T>.asReversed(): MutableList<T> = ReversedList(this)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public fun <T> Iterator<T>.asSequence(): Sequence<T> {
|
||||
return iteratorSequence.constrainOnce()
|
||||
}
|
||||
|
||||
deprecated("Use asSequence() instead.", ReplaceWith("asSequence()"))
|
||||
@Deprecated("Use asSequence() instead.", ReplaceWith("asSequence()"))
|
||||
public fun <T> Iterator<T>.sequence(): Sequence<T> = asSequence()
|
||||
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ public inline fun <T> ReentrantReadWriteLock.write(action: () -> T): T {
|
||||
*
|
||||
* @return the return value of the action.
|
||||
*/
|
||||
deprecated("Use CountDownLatch(Int) instead and await it manually.")
|
||||
@Deprecated("Use CountDownLatch(Int) instead and await it manually.")
|
||||
public fun <T> Int.latch(operation: CountDownLatch.() -> T): T {
|
||||
val latch = CountDownLatch(this)
|
||||
val result = latch.operation()
|
||||
|
||||
@@ -12,7 +12,7 @@ public val currentThread: Thread
|
||||
* Exposes the name of this thread as a property.
|
||||
*/
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("name"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("name"))
|
||||
public var Thread.name: String
|
||||
get() = getName()
|
||||
set(value) {
|
||||
@@ -23,7 +23,7 @@ public var Thread.name: String
|
||||
* Exposes the daemon flag of this thread as a property.
|
||||
* The Java Virtual Machine exits when the only threads running are all daemon threads.
|
||||
*/
|
||||
deprecated("Use synthetic extension property isDaemon instead.", ReplaceWith("this.isDaemon"))
|
||||
@Deprecated("Use synthetic extension property isDaemon instead.", ReplaceWith("this.isDaemon"))
|
||||
public var Thread.daemon: Boolean
|
||||
get() = isDaemon()
|
||||
set(value) {
|
||||
@@ -33,7 +33,7 @@ public var Thread.daemon: Boolean
|
||||
/**
|
||||
* Exposes the alive state of this thread as a property.
|
||||
*/
|
||||
deprecated("Use synthetic extension property isAlive instead.", ReplaceWith("this.isAlive"))
|
||||
@Deprecated("Use synthetic extension property isAlive instead.", ReplaceWith("this.isAlive"))
|
||||
public val Thread.alive: Boolean
|
||||
get() = isAlive()
|
||||
|
||||
@@ -41,7 +41,7 @@ public val Thread.alive: Boolean
|
||||
* Exposes the priority of this thread as a property.
|
||||
*/
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("priority"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("priority"))
|
||||
public var Thread.priority: Int
|
||||
get() = getPriority()
|
||||
set(value) {
|
||||
@@ -52,7 +52,7 @@ public var Thread.priority: Int
|
||||
* Exposes the context class loader of this thread as a property.
|
||||
*/
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("contextClassLoader"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("contextClassLoader"))
|
||||
public var Thread.contextClassLoader: ClassLoader?
|
||||
get() = getContextClassLoader()
|
||||
set(value) {
|
||||
@@ -108,7 +108,7 @@ public inline fun <T: Any> ThreadLocal<T>.getOrSet(default: () -> T): T {
|
||||
* Allows you to use the executor as a function to
|
||||
* execute the given block on the [Executor].
|
||||
*/
|
||||
deprecated("Use Executor.execute(Runnable) instead.") // do not specify ReplaceWith("execute(action)") due to KT-8597
|
||||
@Deprecated("Use Executor.execute(Runnable) instead.") // do not specify ReplaceWith("execute(action)") due to KT-8597
|
||||
public fun Executor.invoke(action: () -> Unit) {
|
||||
execute(action)
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public fun Executor.invoke(action: () -> Unit) {
|
||||
* Allows you to use the executor service as a function to
|
||||
* execute the given block on the [ExecutorService].
|
||||
*/
|
||||
deprecated("Use ExecutorService.submit(Callable) instead.") // do not specify ReplaceWith("submit(action)") due to KT-8597
|
||||
@Deprecated("Use ExecutorService.submit(Callable) instead.") // do not specify ReplaceWith("submit(action)") due to KT-8597
|
||||
public fun <T> ExecutorService.invoke(action: () -> T): Future<T> {
|
||||
return submit(action)
|
||||
}
|
||||
|
||||
@@ -2,105 +2,105 @@ package kotlin
|
||||
|
||||
import java.util.*
|
||||
|
||||
deprecated("Use listOf(...) or arrayListOf(...) instead", ReplaceWith("arrayListOf(*values)"))
|
||||
@Deprecated("Use listOf(...) or arrayListOf(...) instead", ReplaceWith("arrayListOf(*values)"))
|
||||
public fun arrayList<T>(vararg values: T): ArrayList<T> = arrayListOf(*values)
|
||||
|
||||
deprecated("Use setOf(...) or hashSetOf(...) instead", ReplaceWith("hashSetOf(*values)"))
|
||||
@Deprecated("Use setOf(...) or hashSetOf(...) instead", ReplaceWith("hashSetOf(*values)"))
|
||||
public fun hashSet<T>(vararg values: T): HashSet<T> = hashSetOf(*values)
|
||||
|
||||
deprecated("Use mapOf(...) or hashMapOf(...) instead", ReplaceWith("hashMapOf(*values)"))
|
||||
@Deprecated("Use mapOf(...) or hashMapOf(...) instead", ReplaceWith("hashMapOf(*values)"))
|
||||
public fun <K, V> hashMap(vararg values: Pair<K, V>): HashMap<K, V> = hashMapOf(*values)
|
||||
|
||||
deprecated("Use listOf(...) or linkedListOf(...) instead", ReplaceWith("linkedListOf(*values)"))
|
||||
@Deprecated("Use listOf(...) or linkedListOf(...) instead", ReplaceWith("linkedListOf(*values)"))
|
||||
public fun linkedList<T>(vararg values: T): LinkedList<T> = linkedListOf(*values)
|
||||
|
||||
deprecated("Use linkedMapOf(...) instead", ReplaceWith("linkedMapOf(*values)"))
|
||||
@Deprecated("Use linkedMapOf(...) instead", ReplaceWith("linkedMapOf(*values)"))
|
||||
public fun <K, V> linkedMap(vararg values: Pair<K, V>): LinkedHashMap<K, V> = linkedMapOf(*values)
|
||||
|
||||
/** Copies all characters into a [[Collection] */
|
||||
deprecated("Use toList() instead.", ReplaceWith("toList()"))
|
||||
@Deprecated("Use toList() instead.", ReplaceWith("toList()"))
|
||||
public fun String.toCollection(): Collection<Char> = toCollection(ArrayList<Char>(this.length()))
|
||||
|
||||
|
||||
/**
|
||||
* A helper method for creating a [[Runnable]] from a function
|
||||
*/
|
||||
deprecated("Use SAM constructor: Runnable(...)", ReplaceWith("Runnable(action)"))
|
||||
@Deprecated("Use SAM constructor: Runnable(...)", ReplaceWith("Runnable(action)"))
|
||||
public /*inline*/ fun runnable(action: () -> Unit): Runnable = Runnable(action)
|
||||
|
||||
deprecated("Use forEachIndexed instead.", ReplaceWith("forEachIndexed(operation)"))
|
||||
@Deprecated("Use forEachIndexed instead.", ReplaceWith("forEachIndexed(operation)"))
|
||||
public inline fun <T> List<T>.forEachWithIndex(operation: (Int, T) -> Unit): Unit = forEachIndexed(operation)
|
||||
|
||||
deprecated("Function with undefined semantic")
|
||||
@Deprecated("Function with undefined semantic")
|
||||
public fun <T> countTo(n: Int): (T) -> Boolean {
|
||||
var count = 0
|
||||
return { ++count; count <= n }
|
||||
}
|
||||
|
||||
deprecated("Use contains() function instead", ReplaceWith("contains(item)"))
|
||||
@Deprecated("Use contains() function instead", ReplaceWith("contains(item)"))
|
||||
public fun <T> Iterable<T>.containsItem(item : T) : Boolean = contains(item)
|
||||
|
||||
deprecated("Use sortBy() instead", ReplaceWith("sortedWith(comparator)"))
|
||||
@Deprecated("Use sortBy() instead", ReplaceWith("sortedWith(comparator)"))
|
||||
public fun <T> Iterable<T>.sort(comparator: java.util.Comparator<T>) : List<T> = sortedWith(comparator)
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val Array<*>.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val ByteArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val CharArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val ShortArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val IntArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val LongArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val FloatArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val DoubleArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
@Deprecated("Use size() instead", ReplaceWith("size()"))
|
||||
public val BooleanArray.size: Int get() = size()
|
||||
|
||||
deprecated("Use compareValuesBy() instead", ReplaceWith("compareValuesBy(a, b, *functions)"))
|
||||
@Deprecated("Use compareValuesBy() instead", ReplaceWith("compareValuesBy(a, b, *functions)"))
|
||||
public fun <T : Any> 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()"))
|
||||
@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()"))
|
||||
@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()"))
|
||||
@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()"))
|
||||
@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()"))
|
||||
@Deprecated("Use isNotEmpty() function call instead", ReplaceWith("isNotEmpty()"))
|
||||
public val Collection<*>.notEmpty: Boolean
|
||||
get() = isNotEmpty()
|
||||
|
||||
deprecated("Use length() instead", ReplaceWith("length()"))
|
||||
@Deprecated("Use length() instead", ReplaceWith("length()"))
|
||||
public val CharSequence.length: Int
|
||||
get() = length()
|
||||
|
||||
|
||||
@@ -2,40 +2,40 @@ package kotlin
|
||||
|
||||
// deprecated to be removed after M12
|
||||
|
||||
deprecated("Use arrayOf() instead.", ReplaceWith("arrayOf(*t)"))
|
||||
@Deprecated("Use arrayOf() instead.", ReplaceWith("arrayOf(*t)"))
|
||||
inline public fun <reified T> array(vararg t : T) : Array<T> = arrayOf(*t)
|
||||
|
||||
suppress("NOTHING_TO_INLINE")
|
||||
deprecated("Use doubleArrayOf() instead.", ReplaceWith("doubleArrayOf(*content)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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()"))
|
||||
@Deprecated("Use toTypedArray() instead.", ReplaceWith("toTypedArray()"))
|
||||
inline public fun <reified T> Collection<T>.copyToArray(): Array<T> = toTypedArray()
|
||||
@@ -19,26 +19,26 @@ package kotlin
|
||||
import java.util.*
|
||||
import java.util.concurrent.Callable
|
||||
|
||||
deprecated("Use sortedSetOf(...) instead", ReplaceWith("sortedSetOf(*values)"))
|
||||
@Deprecated("Use sortedSetOf(...) instead", ReplaceWith("sortedSetOf(*values)"))
|
||||
public fun sortedSet<T>(vararg values: T): TreeSet<T> = sortedSetOf(*values)
|
||||
|
||||
deprecated("Use sortedSetOf(...) instead", ReplaceWith("sortedSetOf(comparator, *values)"))
|
||||
@Deprecated("Use sortedSetOf(...) instead", ReplaceWith("sortedSetOf(comparator, *values)"))
|
||||
public fun sortedSet<T>(comparator: Comparator<T>, vararg values: T): TreeSet<T> = sortedSetOf(comparator, *values)
|
||||
|
||||
deprecated("Use sortedMapOf(...) instead", ReplaceWith("sortedMapOf(*values)"))
|
||||
@Deprecated("Use sortedMapOf(...) instead", ReplaceWith("sortedMapOf(*values)"))
|
||||
public fun <K, V> sortedMap(vararg values: Pair<K, V>): SortedMap<K, V> = sortedMapOf(*values)
|
||||
|
||||
/**
|
||||
* A helper method for creating a [[Callable]] from a function
|
||||
*/
|
||||
deprecated("Use SAM constructor: Callable(...)", ReplaceWith("Callable(action)", "java.util.concurrent.Callable"))
|
||||
@Deprecated("Use SAM constructor: Callable(...)", ReplaceWith("Callable(action)", "java.util.concurrent.Callable"))
|
||||
public /*inline*/ fun <T> callable(action: () -> T): Callable<T> = Callable(action)
|
||||
|
||||
deprecated("Use length() instead", ReplaceWith("length()"))
|
||||
@Deprecated("Use length() instead", ReplaceWith("length()"))
|
||||
public val String.size: Int
|
||||
get() = length()
|
||||
|
||||
deprecated("Use length() instead", ReplaceWith("length()"))
|
||||
@Deprecated("Use length() instead", ReplaceWith("length()"))
|
||||
public val CharSequence.size: Int
|
||||
get() = length()
|
||||
|
||||
|
||||
@@ -1,113 +1,113 @@
|
||||
package kotlin
|
||||
|
||||
|
||||
deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)"))
|
||||
@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)"))
|
||||
public fun <T> Array<out T>.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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)"))
|
||||
public fun <T> Iterable<T>.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)"))
|
||||
@Deprecated("Use joinToString() instead", ReplaceWith("joinToString(separator, prefix, postfix, limit, truncated)"))
|
||||
public fun <T> Sequence<T>.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)"))
|
||||
@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)"))
|
||||
public fun <T> Array<out T>.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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@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)"))
|
||||
@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)"))
|
||||
public fun <T> Iterable<T>.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)"))
|
||||
@Deprecated("Use joinTo() instead", ReplaceWith("joinTo(buffer, separator, prefix, postfix, limit, truncated)"))
|
||||
public fun <T> Sequence<T>.appendString(buffer: Appendable, separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): Unit {
|
||||
joinTo(buffer, separator, prefix, postfix, limit, truncated)
|
||||
}
|
||||
|
||||
@@ -10,14 +10,14 @@ import java.lang.IndexOutOfBoundsException
|
||||
|
||||
// Properties
|
||||
|
||||
deprecated("use textContent directly instead")
|
||||
@Deprecated("use textContent directly instead")
|
||||
public var Node.text: String
|
||||
get() = textContent ?: ""
|
||||
set(value) {
|
||||
textContent = value
|
||||
}
|
||||
|
||||
deprecated("You shouldn't use it as setter will drop all elements and get may return not exactly content user can expect")
|
||||
@Deprecated("You shouldn't use it as setter will drop all elements and get may return not exactly content user can expect")
|
||||
public var Element.childrenText: String
|
||||
get() {
|
||||
val buffer = StringBuilder()
|
||||
@@ -101,7 +101,7 @@ public fun Document?.elements(namespaceUri: String, localName: String): List<Ele
|
||||
}
|
||||
|
||||
public fun NodeList?.asList() : List<Node> = if (this == null) emptyList() else NodeListAsList(this)
|
||||
deprecated("use asList instead", ReplaceWith("asList()"))
|
||||
@Deprecated("use asList instead", ReplaceWith("asList()"))
|
||||
public fun NodeList?.toList(): List<Node> = asList()
|
||||
|
||||
public fun NodeList?.toElementList(): List<Element> {
|
||||
@@ -268,7 +268,7 @@ private class PreviousSiblings(private var node: Node) : Iterable<Node> {
|
||||
}
|
||||
|
||||
/** Returns true if this node is a Text node or a CDATA node */
|
||||
deprecated("use property isText instead", ReplaceWith("isText"))
|
||||
@Deprecated("use property isText instead", ReplaceWith("isText"))
|
||||
public fun Node.isText() : Boolean = isText
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,12 +6,12 @@ import org.w3c.dom.events.MouseEvent
|
||||
|
||||
// JavaScript style properties for JVM : TODO could auto-generate these
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("bubbles"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("bubbles"))
|
||||
public val Event.bubbles: Boolean
|
||||
get() = getBubbles()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("cancelable"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("cancelable"))
|
||||
public val Event.cancelable: Boolean
|
||||
get() = getCancelable()
|
||||
|
||||
@@ -19,17 +19,17 @@ public val Event.getCurrentTarget: EventTarget?
|
||||
get() = getCurrentTarget()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("eventPhase"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("eventPhase"))
|
||||
public val Event.eventPhase: Short
|
||||
get() = getEventPhase()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("target"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("target"))
|
||||
public val Event.target: EventTarget?
|
||||
get() = getTarget()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("timeStamp"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("timeStamp"))
|
||||
public val Event.timeStamp: Long
|
||||
get() = getTimeStamp()
|
||||
|
||||
@@ -39,51 +39,51 @@ public val Event.eventType: String
|
||||
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("altKey"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("altKey"))
|
||||
public val MouseEvent.altKey: Boolean
|
||||
get() = getAltKey()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("button"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("button"))
|
||||
public val MouseEvent.button: Short
|
||||
get() = getButton()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("clientX"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("clientX"))
|
||||
public val MouseEvent.clientX: Int
|
||||
get() = getClientX()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("clientY"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("clientY"))
|
||||
public val MouseEvent.clientY: Int
|
||||
get() = getClientY()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("ctrlKey"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("ctrlKey"))
|
||||
public val MouseEvent.ctrlKey: Boolean
|
||||
get() = getCtrlKey()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("metaKey"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("metaKey"))
|
||||
public val MouseEvent.metaKey: Boolean
|
||||
get() = getMetaKey()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("relatedTarget"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("relatedTarget"))
|
||||
public val MouseEvent.relatedTarget: EventTarget?
|
||||
get() = getRelatedTarget()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("screenX"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("screenX"))
|
||||
public val MouseEvent.screenX: Int
|
||||
get() = getScreenX()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("screenY"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("screenY"))
|
||||
public val MouseEvent.screenY: Int
|
||||
get() = getScreenY()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("shiftKey"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("shiftKey"))
|
||||
public val MouseEvent.shiftKey: Boolean
|
||||
get() = getShiftKey()
|
||||
|
||||
@@ -20,80 +20,80 @@ import javax.xml.transform.dom.DOMSource
|
||||
import javax.xml.transform.stream.StreamResult
|
||||
|
||||
// JavaScript style properties - TODO could auto-generate these
|
||||
@deprecated("Use getNodeName()", ReplaceWith("getNodeName() ?: \"\""))
|
||||
@Deprecated("Use getNodeName()", ReplaceWith("getNodeName() ?: \"\""))
|
||||
public val Node.nodeName: String
|
||||
get() = getNodeName() ?: ""
|
||||
|
||||
@deprecated("Use getNodeValue()", ReplaceWith("getNodeValue() ?: \"\""))
|
||||
@Deprecated("Use getNodeValue()", ReplaceWith("getNodeValue() ?: \"\""))
|
||||
public val Node.nodeValue: String
|
||||
get() = getNodeValue() ?: ""
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("nodeType"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("nodeType"))
|
||||
public val Node.nodeType: Short
|
||||
get() = getNodeType()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("parentNode"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("parentNode"))
|
||||
public val Node.parentNode: Node?
|
||||
get() = getParentNode()
|
||||
|
||||
@deprecated("Use getChildNodes()", ReplaceWith("getChildNodes()!!"))
|
||||
@Deprecated("Use getChildNodes()", ReplaceWith("getChildNodes()!!"))
|
||||
public val Node.childNodes: NodeList
|
||||
get() = getChildNodes()!!
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("firstChild"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("firstChild"))
|
||||
public val Node.firstChild: Node?
|
||||
get() = getFirstChild()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("lastChild"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("lastChild"))
|
||||
public val Node.lastChild: Node?
|
||||
get() = getLastChild()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("nextSibling"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("nextSibling"))
|
||||
public val Node.nextSibling: Node?
|
||||
get() = getNextSibling()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("previousSibling"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("previousSibling"))
|
||||
public val Node.previousSibling: Node?
|
||||
get() = getPreviousSibling()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("attributes"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("attributes"))
|
||||
public val Node.attributes: NamedNodeMap?
|
||||
get() = getAttributes()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("ownerDocument"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("ownerDocument"))
|
||||
public val Node.ownerDocument: Document?
|
||||
get() = getOwnerDocument()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("documentElement"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("documentElement"))
|
||||
public val Document.documentElement: Element?
|
||||
get() = this.getDocumentElement()
|
||||
|
||||
@deprecated("Use getNamespaceURI()", ReplaceWith("getNamespaceURI() ?: \"\""))
|
||||
@Deprecated("Use getNamespaceURI()", ReplaceWith("getNamespaceURI() ?: \"\""))
|
||||
public val Node.namespaceURI: String
|
||||
get() = getNamespaceURI() ?: ""
|
||||
|
||||
@deprecated("Use getPrefix()", ReplaceWith("getPrefix() ?: \"\""))
|
||||
@Deprecated("Use getPrefix()", ReplaceWith("getPrefix() ?: \"\""))
|
||||
public val Node.prefix: String
|
||||
get() = getPrefix() ?: ""
|
||||
|
||||
@deprecated("Use getLocalName()", ReplaceWith("getLocalName() ?: \"\""))
|
||||
@Deprecated("Use getLocalName()", ReplaceWith("getLocalName() ?: \"\""))
|
||||
public val Node.localName: String
|
||||
get() = getLocalName() ?: ""
|
||||
|
||||
@deprecated("Use getBaseURI", ReplaceWith("getBaseURI() ?: \"\""))
|
||||
@Deprecated("Use getBaseURI", ReplaceWith("getBaseURI() ?: \"\""))
|
||||
public val Node.baseURI: String
|
||||
get() = getBaseURI() ?: ""
|
||||
|
||||
@deprecated("Use getTextContent()/setTextContent()")
|
||||
@Deprecated("Use getTextContent()/setTextContent()")
|
||||
public var Node.textContent: String
|
||||
get() = getTextContent() ?: ""
|
||||
set(value) {
|
||||
@@ -101,32 +101,32 @@ public var Node.textContent: String
|
||||
}
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
public val DOMStringList.length: Int
|
||||
get() = this.getLength()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
public val NameList.length: Int
|
||||
get() = this.getLength()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
public val DOMImplementationList.length: Int
|
||||
get() = this.getLength()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
public val NodeList.length: Int
|
||||
get() = this.getLength()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
public val CharacterData.length: Int
|
||||
get() = this.getLength()
|
||||
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("length"))
|
||||
public val NamedNodeMap.length: Int
|
||||
get() = this.getLength()
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.nio.charset.CharsetEncoder
|
||||
import java.util.NoSuchElementException
|
||||
|
||||
/** Returns an [Iterator] of bytes in this input stream. */
|
||||
deprecated("It's not recommended to iterate through input stream bytes")
|
||||
@Deprecated("It's not recommended to iterate through input stream bytes")
|
||||
public fun InputStream.iterator(): ByteIterator =
|
||||
object : ByteIterator() {
|
||||
|
||||
|
||||
@@ -250,10 +250,10 @@ public inline fun <T> Reader.useLines(block: (Sequence<String>) -> T): T =
|
||||
*/
|
||||
public fun BufferedReader.lineSequence(): Sequence<String> = LinesSequence(this).constrainOnce()
|
||||
|
||||
deprecated("Use lineSequence() instead to avoid conflict with JDK8 lines() method.", ReplaceWith("lineSequence()"))
|
||||
@Deprecated("Use lineSequence() instead to avoid conflict with JDK8 lines() method.", ReplaceWith("lineSequence()"))
|
||||
public fun BufferedReader.lines(): Sequence<String> = lineSequence()
|
||||
|
||||
deprecated("Use lineSequence() function which returns Sequence<String>")
|
||||
@Deprecated("Use lineSequence() function which returns Sequence<String>")
|
||||
public fun BufferedReader.lineIterator(): Iterator<String> = lineSequence().iterator()
|
||||
|
||||
private class LinesSequence(private val reader: BufferedReader) : Sequence<String> {
|
||||
|
||||
@@ -153,8 +153,7 @@ public class FileTreeWalk(private val start: File,
|
||||
})
|
||||
}
|
||||
|
||||
tailRecursive
|
||||
private fun gotoNext(): File? {
|
||||
tailrec private fun gotoNext(): File? {
|
||||
if (end) {
|
||||
// We are already at the end
|
||||
return null
|
||||
@@ -284,7 +283,7 @@ public fun File.walkBottomUp(): FileTreeWalk = walk(FileWalkDirection.BOTTOM_UP)
|
||||
*
|
||||
* @param function the function to call on each file.
|
||||
*/
|
||||
deprecated("It's recommended to use walkTopDown() / walkBottomUp()")
|
||||
@Deprecated("It's recommended to use walkTopDown() / walkBottomUp()")
|
||||
public fun File.recurse(function: (File) -> Unit): Unit {
|
||||
walkTopDown().forEach { function(it) }
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public val File.directory: File
|
||||
/**
|
||||
* Returns parent of this abstract path name, or `null` if it has no parent.
|
||||
*/
|
||||
@deprecated("Use parentFile", ReplaceWith("parentFile"))
|
||||
@Deprecated("Use parentFile", ReplaceWith("parentFile"))
|
||||
public val File.parent: File?
|
||||
get() = parentFile
|
||||
|
||||
@@ -59,7 +59,7 @@ public val File.parent: File?
|
||||
* Returns the canonical path of this file.
|
||||
*/
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("canonicalPath"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("canonicalPath"))
|
||||
public val File.canonicalPath: String
|
||||
get() = getCanonicalPath()
|
||||
|
||||
@@ -67,7 +67,7 @@ public val File.canonicalPath: String
|
||||
* Returns the file name.
|
||||
*/
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("name"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("name"))
|
||||
public val File.name: String
|
||||
get() = getName()
|
||||
|
||||
@@ -75,7 +75,7 @@ public val File.name: String
|
||||
* Returns the file path.
|
||||
*/
|
||||
@HiddenDeclaration
|
||||
@deprecated("Is replaced with automatic synthetic extension", ReplaceWith("path"))
|
||||
@Deprecated("Is replaced with automatic synthetic extension", ReplaceWith("path"))
|
||||
public val File.path: String
|
||||
get() = getPath()
|
||||
|
||||
@@ -178,7 +178,7 @@ public fun File.relativeTo(base: File): String {
|
||||
* If this file matches the [descendant] directory or does not belong to it,
|
||||
* then an empty string will be returned.
|
||||
*/
|
||||
deprecated("Use relativeTo() function instead")
|
||||
@Deprecated("Use relativeTo() function instead")
|
||||
public fun File.relativePath(descendant: File): String {
|
||||
val prefix = directory.canonicalPath
|
||||
val answer = descendant.canonicalPath
|
||||
|
||||
@@ -55,7 +55,7 @@ public annotation class JvmName(public val name: String)
|
||||
/**
|
||||
* Instructs the Kotlin compiler to generate a multifile class with this file as one o
|
||||
*/
|
||||
target(AnnotationTarget.FILE)
|
||||
@Target(AnnotationTarget.FILE)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MustBeDocumented
|
||||
public annotation class JvmMultifileClass
|
||||
|
||||
@@ -21,11 +21,11 @@ import kotlin.annotation.AnnotationTarget.*
|
||||
@Target(FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MustBeDocumented
|
||||
@deprecated("Use kotlin.jvm.JvmName instead", ReplaceWith("kotlin.jvm.JvmName"))
|
||||
@Deprecated("Use kotlin.jvm.platformName instead", ReplaceWith("kotlin.jvm.platformName"))
|
||||
public annotation class platformName(public val name: String)
|
||||
|
||||
@Target(FUNCTION, PROPERTY, PROPERTY_GETTER, PROPERTY_SETTER)
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
@MustBeDocumented
|
||||
@deprecated("Use kotlin.jvm.JvmStatic instead", ReplaceWith("kotlin.jvm.JvmStatic"))
|
||||
@Deprecated("Use kotlin.jvm.JvmStatic instead", ReplaceWith("kotlin.jvm.JvmStatic"))
|
||||
public annotation class platformStatic
|
||||
|
||||
@@ -19,7 +19,7 @@ public object Delegates {
|
||||
* specified block of code. Supports lazy initialization semantics for properties.
|
||||
* @param initializer the function that returns the value of the property.
|
||||
*/
|
||||
deprecated("Use lazy {} instead in kotlin package", ReplaceWith("kotlin.lazy(LazyThreadSafetyMode.NONE, initializer)"))
|
||||
@Deprecated("Use lazy {} instead in kotlin package", ReplaceWith("kotlin.lazy(LazyThreadSafetyMode.NONE, initializer)"))
|
||||
public fun lazy<T>(initializer: () -> T): ReadOnlyProperty<Any?, T> = LazyVal(initializer)
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ public object Delegates {
|
||||
* the property delegate object itself is used as a lock.
|
||||
* @param initializer the function that returns the value of the property.
|
||||
*/
|
||||
deprecated("Use lazy(lock) {} instead in kotlin package", ReplaceWith("lazy(lock, initializer)"))
|
||||
@Deprecated("Use lazy(lock) {} instead in kotlin package", ReplaceWith("lazy(lock, initializer)"))
|
||||
public fun blockingLazy<T>(lock: Any?, initializer: () -> T): ReadOnlyProperty<Any?, T> = BlockingLazyVal(lock, initializer)
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ public object Delegates {
|
||||
* The property delegate object itself is used as a lock.
|
||||
* @param initializer the function that returns the value of the property.
|
||||
*/
|
||||
deprecated("Use lazy {} instead in kotlin package", ReplaceWith("kotlin.lazy(initializer)"))
|
||||
@Deprecated("Use lazy {} instead in kotlin package", ReplaceWith("kotlin.lazy(initializer)"))
|
||||
public fun blockingLazy<T>(initializer: () -> T): ReadOnlyProperty<Any?, T> = BlockingLazyVal(null, initializer)
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ public object Delegates {
|
||||
* @param onChange the callback which is called after the change of the property is made. The value of the property
|
||||
* has already been changed when this callback is invoked.
|
||||
*/
|
||||
public inline fun observable<T>(initialValue: T, inlineOptions(InlineOption.ONLY_LOCAL_RETURN) onChange: (property: PropertyMetadata, oldValue: T, newValue: T) -> Unit):
|
||||
public inline fun observable<T>(initialValue: T, crossinline onChange: (property: PropertyMetadata, oldValue: T, newValue: T) -> Unit):
|
||||
ReadWriteProperty<Any?, T> = object : ObservableProperty<T>(initialValue) {
|
||||
override fun afterChange(property: PropertyMetadata, oldValue: T, newValue: T) = onChange(property, oldValue, newValue)
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public object Delegates {
|
||||
* If the callback returns `true` the value of the property is being set to the new value,
|
||||
* and if the callback returns `false` the new value is discarded and the property remains its old value.
|
||||
*/
|
||||
public inline fun vetoable<T>(initialValue: T, inlineOptions(InlineOption.ONLY_LOCAL_RETURN) onChange: (property: PropertyMetadata, oldValue: T, newValue: T) -> Boolean):
|
||||
public inline fun vetoable<T>(initialValue: T, crossinline onChange: (property: PropertyMetadata, oldValue: T, newValue: T) -> Boolean):
|
||||
ReadWriteProperty<Any?, T> = object : ObservableProperty<T>(initialValue) {
|
||||
override fun beforeChange(property: PropertyMetadata, oldValue: T, newValue: T): Boolean = onChange(property, oldValue, newValue)
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public object Delegates {
|
||||
* as a key.
|
||||
* @param map the map where the property values are stored.
|
||||
*/
|
||||
deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map"))
|
||||
@Deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map"))
|
||||
public fun mapVar<T>(map: MutableMap<in String, Any?>): ReadWriteProperty<Any?, T> {
|
||||
return FixedMapVar<Any?, String, T>(map, propertyNameSelector, throwKeyNotFound)
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public object Delegates {
|
||||
* as a key.
|
||||
* @param map the map where the property values are stored.
|
||||
*/
|
||||
deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map"))
|
||||
@Deprecated("Delegate property to the map itself without creating a wrapper.", ReplaceWith("map"))
|
||||
public fun mapVal<T>(map: Map<in String, Any?>): ReadOnlyProperty<Any?, T> {
|
||||
return FixedMapVal<Any?, String, T>(map, propertyNameSelector, throwKeyNotFound)
|
||||
}
|
||||
@@ -125,7 +125,7 @@ private class NotNullVar<T: Any>() : ReadWriteProperty<Any?, T> {
|
||||
}
|
||||
|
||||
|
||||
deprecated("Use Delegates.vetoable() instead or construct implementation of abstract ObservableProperty", ReplaceWith("Delegates.vetoable(initialValue, onChange)"))
|
||||
@Deprecated("Use Delegates.vetoable() instead or construct implementation of abstract ObservableProperty", ReplaceWith("Delegates.vetoable(initialValue, onChange)"))
|
||||
public fun ObservableProperty<T>(initialValue: T, onChange: (property: PropertyMetadata, oldValue: T, newValue: T) -> Boolean): ObservableProperty<T> =
|
||||
object : ObservableProperty<T>(initialValue) {
|
||||
override fun beforeChange(property: PropertyMetadata, oldValue: T, newValue: T): Boolean = onChange(property, oldValue, newValue)
|
||||
@@ -189,7 +189,7 @@ private class LazyVal<T>(private val initializer: () -> T) : ReadOnlyProperty<An
|
||||
|
||||
private class BlockingLazyVal<T>(lock: Any?, private val initializer: () -> T) : ReadOnlyProperty<Any?, T> {
|
||||
private val lock = lock ?: this
|
||||
private volatile var value: Any? = null
|
||||
@volatile private var value: Any? = null
|
||||
|
||||
public override fun get(thisRef: Any?, property: PropertyMetadata): T {
|
||||
val _v1 = value
|
||||
@@ -215,9 +215,9 @@ private class BlockingLazyVal<T>(lock: Any?, private val initializer: () -> T) :
|
||||
* Exception thrown by the default implementation of property delegates which store values in a map
|
||||
* when the map does not contain the corresponding key.
|
||||
*/
|
||||
deprecated("Do not throw or catch this exception, use NoSuchElementException instead.")
|
||||
@Deprecated("Do not throw or catch this exception, use NoSuchElementException instead.")
|
||||
public class KeyMissingException
|
||||
deprecated("Throw NoSuchElementException instead.", ReplaceWith("NoSuchElementException(message)"))
|
||||
@Deprecated("Throw NoSuchElementException instead.", ReplaceWith("NoSuchElementException(message)"))
|
||||
constructor(message: String): NoSuchElementException(message)
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public fun <V> Map<in String, *>.get(thisRef: Any?, property: PropertyMetadata):
|
||||
*
|
||||
* @throws NoSuchElementException when the map doesn't contain value for the property name and doesn't provide an implicit default (see [withDefault]).
|
||||
*/
|
||||
platformName("getVar")
|
||||
@platformName("getVar")
|
||||
public fun <V> MutableMap<in String, in V>.get(thisRef: Any?, property: PropertyMetadata): V = getOrImplicitDefault(property.name) as V
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ package kotlin.properties
|
||||
import java.util.HashMap
|
||||
import java.util.ArrayList
|
||||
|
||||
deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
@Deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
public class ChangeEvent(
|
||||
public val source: Any,
|
||||
public val name: String,
|
||||
@@ -13,7 +13,7 @@ public class ChangeEvent(
|
||||
override fun toString(): String = "ChangeEvent($name, $oldValue, $newValue)"
|
||||
}
|
||||
|
||||
deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
@Deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
public interface ChangeListener {
|
||||
public fun onPropertyChange(event: ChangeEvent): Unit
|
||||
}
|
||||
@@ -23,7 +23,7 @@ public interface ChangeListener {
|
||||
* updates for easier binding to user interfaces, undo/redo command stacks and
|
||||
* change tracking mechanisms for persistence or distributed change notifications.
|
||||
*/
|
||||
deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
@Deprecated("This class is part of an old, incomplete and suboptimal design of change notifications and is going to be removed")
|
||||
public abstract class ChangeSupport {
|
||||
private var allListeners: MutableList<ChangeListener>? = null
|
||||
private var nameListeners: MutableMap<String, MutableList<ChangeListener>>? = null
|
||||
|
||||
@@ -5,11 +5,11 @@ package kotlin.test
|
||||
|
||||
|
||||
/** Asserts that the given [block] returns `false`. */
|
||||
@deprecated("Use assertFalse instead.", ReplaceWith("assertFalse(message, block)"))
|
||||
@Deprecated("Use assertFalse instead.", ReplaceWith("assertFalse(message, block)"))
|
||||
public fun assertNot(message: String, block: () -> Boolean): Unit = assertFalse(message, block)
|
||||
|
||||
/** Asserts that the given [block] returns `false`. */
|
||||
@deprecated("Use assertFalse instead.", ReplaceWith("assertFalse(null, block)"))
|
||||
@Deprecated("Use assertFalse instead.", ReplaceWith("assertFalse(null, block)"))
|
||||
public fun assertNot(block: () -> Boolean): Unit = assertFalse(block = block)
|
||||
|
||||
/** Asserts that the given [block] returns `true`. */
|
||||
@@ -72,7 +72,7 @@ public fun <T> expect(expected: T, message: String?, block: () -> T) {
|
||||
assertEquals(expected, block(), message)
|
||||
}
|
||||
|
||||
@deprecated("Use assertFails instead.", ReplaceWith("assertFails(block)"))
|
||||
@Deprecated("Use assertFails instead.", ReplaceWith("assertFails(block)"))
|
||||
public fun fails(block: () -> Unit): Throwable? = assertFails(block)
|
||||
|
||||
/** Asserts that given function [block] fails by throwing an exception. */
|
||||
|
||||
@@ -3,7 +3,7 @@ package kotlin.test
|
||||
import java.util.ServiceLoader
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
@deprecated("Use assertFailsWith instead.", ReplaceWith("assertFailsWith(exceptionClass, block)"))
|
||||
@Deprecated("Use assertFailsWith instead.", ReplaceWith("assertFailsWith(exceptionClass, block)"))
|
||||
public fun <T: Throwable> failsWith(exceptionClass: Class<T>, block: ()-> Any): T = assertFailsWith(exceptionClass, { block() })
|
||||
|
||||
/** Asserts that a [block] fails with a specific exception being thrown. */
|
||||
@@ -32,7 +32,7 @@ public fun <T: Throwable> assertFailsWith(exceptionClass: KClass<T>, message: St
|
||||
/** Asserts that a [block] fails with a specific exception of type [T] being thrown.
|
||||
* Since inline method doesn't allow to trace where it was invoked, it is required to pass a [message] to distinguish this method call from others.
|
||||
*/
|
||||
public inline fun <reified T: Throwable> assertFailsWith(message: String, @noinline block: () -> Unit): T = assertFailsWith(T::class.java, message, block)
|
||||
public inline fun <reified T: Throwable> assertFailsWith(message: String, noinline block: () -> Unit): T = assertFailsWith(T::class.java, message, block)
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -58,10 +58,10 @@ public fun Char.isJavaIdentifierPart(): Boolean = Character.isJavaIdentifierPart
|
||||
*/
|
||||
public fun Char.isJavaIdentifierStart(): Boolean = Character.isJavaIdentifierStart(this)
|
||||
|
||||
deprecated("Please use Char.isJavaIdentifierStart() instead")
|
||||
@Deprecated("Please use Char.isJavaIdentifierStart() instead")
|
||||
public fun Char.isJavaLetter(): Boolean = Character.isJavaLetter(this)
|
||||
|
||||
deprecated("Please use Char.isJavaIdentifierPart() instead")
|
||||
@Deprecated("Please use Char.isJavaIdentifierPart() instead")
|
||||
public fun Char.isJavaLetterOrDigit(): Boolean = Character.isJavaLetterOrDigit(this)
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,38 +12,38 @@ public object Charsets {
|
||||
/**
|
||||
* Eight-bit UCS Transformation Format.
|
||||
*/
|
||||
platformStatic
|
||||
@platformStatic
|
||||
public val UTF_8: Charset = Charset.forName("UTF-8")
|
||||
|
||||
/**
|
||||
* Sixteen-bit UCS Transformation Format, byte order identified by an
|
||||
* optional byte-order mark.
|
||||
*/
|
||||
platformStatic
|
||||
@platformStatic
|
||||
public val UTF_16: Charset = Charset.forName("UTF-16")
|
||||
|
||||
/**
|
||||
* Sixteen-bit UCS Transformation Format, big-endian byte order.
|
||||
*/
|
||||
platformStatic
|
||||
@platformStatic
|
||||
public val UTF_16BE: Charset = Charset.forName("UTF-16BE")
|
||||
|
||||
/**
|
||||
* Sixteen-bit UCS Transformation Format, little-endian byte order.
|
||||
*/
|
||||
platformStatic
|
||||
@platformStatic
|
||||
public val UTF_16LE: Charset = Charset.forName("UTF-16LE")
|
||||
|
||||
/**
|
||||
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
|
||||
* Unicode character set.
|
||||
*/
|
||||
platformStatic
|
||||
@platformStatic
|
||||
public val US_ASCII: Charset = Charset.forName("US-ASCII")
|
||||
|
||||
/**
|
||||
* ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1.
|
||||
*/
|
||||
platformStatic
|
||||
@platformStatic
|
||||
public val ISO_8859_1: Charset = Charset.forName("ISO-8859-1")
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import kotlin.text.MatchResult
|
||||
import kotlin.text.Regex
|
||||
|
||||
/** Returns the string with leading and trailing text matching the given string removed */
|
||||
deprecated("Use removeSurrounding(text, text) or removePrefix(text).removeSuffix(text)")
|
||||
@Deprecated("Use removeSurrounding(text, text) or removePrefix(text).removeSuffix(text)")
|
||||
public fun String.trim(text: String): String = removePrefix(text).removeSuffix(text)
|
||||
|
||||
/** Returns the string with the prefix and postfix text trimmed */
|
||||
deprecated("Use removeSurrounding(prefix, suffix) or removePrefix(prefix).removeSuffix(suffix)")
|
||||
@Deprecated("Use removeSurrounding(prefix, suffix) or removePrefix(prefix).removeSuffix(suffix)")
|
||||
public fun String.trim(prefix: String, postfix: String): String = removePrefix(prefix).removeSuffix(postfix)
|
||||
|
||||
/**
|
||||
@@ -79,10 +79,10 @@ public fun String.trimStart(vararg chars: Char): String = trimStart { it in char
|
||||
*/
|
||||
public fun String.trimEnd(vararg chars: Char): String = trimEnd { it in chars }
|
||||
|
||||
deprecated("Use removePrefix() instead", ReplaceWith("removePrefix(prefix)"))
|
||||
@Deprecated("Use removePrefix() instead", ReplaceWith("removePrefix(prefix)"))
|
||||
public fun String.trimLeading(prefix: String): String = removePrefix(prefix)
|
||||
|
||||
deprecated("Use removeSuffix() instead", ReplaceWith("removeSuffix(postfix)"))
|
||||
@Deprecated("Use removeSuffix() instead", ReplaceWith("removeSuffix(postfix)"))
|
||||
public fun String.trimTrailing(postfix: String): String = removeSuffix(postfix)
|
||||
|
||||
/**
|
||||
@@ -95,7 +95,7 @@ public fun String.trim(): String = trim { it.isWhitespace() }
|
||||
*/
|
||||
public fun String.trimStart(): String = trimStart { it.isWhitespace() }
|
||||
|
||||
deprecated("Use trimStart instead.", ReplaceWith("trimStart()"))
|
||||
@Deprecated("Use trimStart instead.", ReplaceWith("trimStart()"))
|
||||
public fun String.trimLeading(): String = trimStart { it.isWhitespace() }
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ public fun String.trimLeading(): String = trimStart { it.isWhitespace() }
|
||||
*/
|
||||
public fun String.trimEnd(): String = trimEnd { it.isWhitespace() }
|
||||
|
||||
deprecated("Use trimEnd instead.", ReplaceWith("trimEnd()"))
|
||||
@Deprecated("Use trimEnd instead.", ReplaceWith("trimEnd()"))
|
||||
public fun String.trimTrailing(): String = trimEnd { it.isWhitespace() }
|
||||
|
||||
/**
|
||||
@@ -149,8 +149,8 @@ public fun String.padEnd(length: Int, padChar: Char = ' '): String {
|
||||
}
|
||||
|
||||
/** Returns `true` if the string is not `null` and not empty */
|
||||
deprecated("Use !isNullOrEmpty() or isNullOrEmpty().not() for nullable strings.", ReplaceWith("this != null && this.isNotEmpty()"))
|
||||
platformName("isNotEmptyNullable")
|
||||
@Deprecated("Use !isNullOrEmpty() or isNullOrEmpty().not() for nullable strings.", ReplaceWith("this != null && this.isNotEmpty()"))
|
||||
@platformName("isNotEmptyNullable")
|
||||
public fun String?.isNotEmpty(): Boolean = this != null && this.length() > 0
|
||||
|
||||
/**
|
||||
@@ -738,7 +738,7 @@ public fun String.indexOf(char: Char, startIndex: Int = 0, ignoreCase: Boolean =
|
||||
* @param ignoreCase `true` to ignore character case when matching a string. By default `false`.
|
||||
* @returns An index of the first occurrence of [string] or -1 if none is found.
|
||||
*/
|
||||
kotlin.jvm.jvmOverloads
|
||||
@kotlin.jvm.jvmOverloads
|
||||
public fun String.indexOf(string: String, startIndex: Int = 0, ignoreCase: Boolean = false): Int {
|
||||
return if (ignoreCase)
|
||||
indexOfAny(listOf(string), startIndex, ignoreCase)
|
||||
@@ -920,7 +920,7 @@ public fun String.splitToSequence(vararg delimiters: String, ignoreCase: Boolean
|
||||
public fun String.split(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): List<String> =
|
||||
splitToSequence(*delimiters, ignoreCase = ignoreCase, limit = limit).toList()
|
||||
|
||||
deprecated("Use split(delimiters) instead.", ReplaceWith("split(*delimiters, ignoreCase = ignoreCase, limit = limit)"))
|
||||
@Deprecated("Use split(delimiters) instead.", ReplaceWith("split(*delimiters, ignoreCase = ignoreCase, limit = limit)"))
|
||||
public fun String.splitBy(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): List<String> =
|
||||
splitToSequence(*delimiters, ignoreCase = ignoreCase, limit = limit).toList()
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ private fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = (this a
|
||||
/**
|
||||
* Compares this string to another string, ignoring case considerations.
|
||||
*/
|
||||
deprecated("Use equals(anotherString, ignoreCase = true) instead", ReplaceWith("equals(anotherString, ignoreCase = true)"))
|
||||
@Deprecated("Use equals(anotherString, ignoreCase = true) instead", ReplaceWith("equals(anotherString, ignoreCase = true)"))
|
||||
public fun String.equalsIgnoreCase(anotherString: String): Boolean = equals(anotherString, ignoreCase = true)
|
||||
|
||||
/**
|
||||
@@ -82,14 +82,14 @@ public fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: B
|
||||
return if (index < 0) this else this.replaceRange(index, index + oldValue.length(), newValue)
|
||||
}
|
||||
|
||||
deprecated("Use String.replaceFirst instead.", ReplaceWith("replaceFirst(oldValue, newValue, ignoreCase = ignoreCase)"))
|
||||
@Deprecated("Use String.replaceFirst instead.", ReplaceWith("replaceFirst(oldValue, newValue, ignoreCase = ignoreCase)"))
|
||||
public fun String.replaceFirstLiteral(oldValue: String, newValue: String, ignoreCase: Boolean = false): String = replaceFirst(oldValue, newValue, ignoreCase = ignoreCase)
|
||||
|
||||
/**
|
||||
* Returns a new string obtained by replacing each substring of this string that matches the given regular expression
|
||||
* with the given [replacement].
|
||||
*/
|
||||
deprecated("Use String.replace(Regex, String) instead. You can convert regex parameter with .toRegex() extension function.", ReplaceWith("replace(regex.toRegex(), replacement)"))
|
||||
@Deprecated("Use String.replace(Regex, String) instead. You can convert regex parameter with .toRegex() extension function.", ReplaceWith("replace(regex.toRegex(), replacement)"))
|
||||
public fun String.replaceAll(regex: String, replacement: String): String = (this as java.lang.String).replaceAll(regex, replacement)
|
||||
|
||||
/**
|
||||
@@ -272,7 +272,7 @@ public fun String.codePointCount(beginIndex: Int, endIndex: Int): Int = (this as
|
||||
/**
|
||||
* Compares two strings lexicographically, ignoring case differences.
|
||||
*/
|
||||
deprecated("Use compareTo with true passed to ignoreCase parameter.", ReplaceWith("compareTo(str, ignoreCase = true)"))
|
||||
@Deprecated("Use compareTo with true passed to ignoreCase parameter.", ReplaceWith("compareTo(str, ignoreCase = true)"))
|
||||
public fun String.compareToIgnoreCase(str: String): Int = (this as java.lang.String).compareToIgnoreCase(str)
|
||||
|
||||
/**
|
||||
@@ -323,7 +323,7 @@ public fun String.isBlank(): Boolean = length() == 0 || all { it.isWhitespace()
|
||||
/**
|
||||
* Returns `true` if this string matches the given regular expression.
|
||||
*/
|
||||
deprecated("Use String.matches(Regex) instead. You can convert regex parameter with .toRegex() extension function.", ReplaceWith("matches(regex.toRegex())"))
|
||||
@Deprecated("Use String.matches(Regex) instead. You can convert regex parameter with .toRegex() extension function.", ReplaceWith("matches(regex.toRegex())"))
|
||||
public fun String.matches(regex: String): Boolean = (this as java.lang.String).matches(regex)
|
||||
|
||||
/**
|
||||
@@ -339,7 +339,7 @@ public fun String.offsetByCodePoints(index: Int, codePointOffset: Int): Int = (t
|
||||
* @param ooffset the start offset in the other string of the substring to compare.
|
||||
* @param len the length of the substring to compare.
|
||||
*/
|
||||
deprecated("Use regionMatches overload with ignoreCase as optional last parameter.", ReplaceWith("regionMatches(toffset, other, ooffset, len, ignoreCase)"))
|
||||
@Deprecated("Use regionMatches overload with ignoreCase as optional last parameter.", ReplaceWith("regionMatches(toffset, other, ooffset, len, ignoreCase)"))
|
||||
public fun String.regionMatches(ignoreCase: Boolean, toffset: Int, other: String, ooffset: Int, len: Int): Boolean = (this as java.lang.String).regionMatches(ignoreCase, toffset, other, ooffset, len)
|
||||
|
||||
/**
|
||||
@@ -423,13 +423,13 @@ public fun String.toByteArray(charset: String): ByteArray = (this as java.lang.S
|
||||
*/
|
||||
public fun String.toByteArray(charset: Charset = Charsets.UTF_8): ByteArray = (this as java.lang.String).getBytes(charset)
|
||||
|
||||
deprecated("Use toByteArray() instead to emphasize copy behaviour", ReplaceWith("toByteArray()"))
|
||||
@Deprecated("Use toByteArray() instead to emphasize copy behaviour", ReplaceWith("toByteArray()"))
|
||||
public fun String.getBytes(): ByteArray = (this as java.lang.String).getBytes()
|
||||
|
||||
deprecated("Use toByteArray(charset) instead to emphasize copy behaviour", ReplaceWith("toByteArray(charset)"))
|
||||
@Deprecated("Use toByteArray(charset) instead to emphasize copy behaviour", ReplaceWith("toByteArray(charset)"))
|
||||
public fun String.getBytes(charset: Charset): ByteArray = (this as java.lang.String).getBytes(charset)
|
||||
|
||||
deprecated("Use toByteArray(charset) instead to emphasize copy behaviour", ReplaceWith("toByteArray(charset)"))
|
||||
@Deprecated("Use toByteArray(charset) instead to emphasize copy behaviour", ReplaceWith("toByteArray(charset)"))
|
||||
public fun String.getBytes(charset: String): ByteArray = (this as java.lang.String).getBytes(charset)
|
||||
|
||||
/**
|
||||
@@ -519,7 +519,7 @@ public inline fun <T : Appendable> String.takeWhileTo(result: T, predicate: (Cha
|
||||
* Replaces every [regexp] occurence in the text with the value returned by the given function [body] that
|
||||
* takes a [MatchResult].
|
||||
*/
|
||||
deprecated("Use String.replace(Regex, (MatchResult)->String) instead. You can convert regex parameter with .toRegex() extension function.")
|
||||
@Deprecated("Use String.replace(Regex, (MatchResult)->String) instead. You can convert regex parameter with .toRegex() extension function.")
|
||||
public fun String.replaceAll(regexp: String, body: (java.util.regex.MatchResult) -> String): String {
|
||||
val sb = StringBuilder(this.length())
|
||||
val p = regexp.toPattern()
|
||||
|
||||
@@ -108,7 +108,7 @@ public class Regex internal constructor(private val nativePattern: Pattern) {
|
||||
/** The set of options that were used to create this regular expression. */
|
||||
public val options: Set<RegexOption> = fromInt(nativePattern.flags(), RegexOption.values())
|
||||
|
||||
deprecated("To get the Matcher from java.util.regex.Pattern use toPattern to convert string to Pattern, or migrate to Regex API")
|
||||
@Deprecated("To get the Matcher from java.util.regex.Pattern use toPattern to convert string to Pattern, or migrate to Regex API")
|
||||
public fun matcher(input: CharSequence): Matcher = nativePattern.matcher(input)
|
||||
|
||||
/** Indicates whether the regular expression matches the entire [input]. */
|
||||
|
||||
@@ -3,7 +3,7 @@ package kotlin
|
||||
|
||||
private object _Assertions
|
||||
|
||||
deprecated("Must be public to make assert() inlinable")
|
||||
@Deprecated("Must be public to make assert() inlinable")
|
||||
public val ASSERTIONS_ENABLED: Boolean = _Assertions.javaClass.desiredAssertionStatus()
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ public fun assert(value: Boolean) {
|
||||
* Throws an [AssertionError] with an optional [message] if the [value] is false
|
||||
* and runtime assertions have been enabled on the JVM using the *-ea* JVM option.
|
||||
*/
|
||||
@deprecated("Use assert with lazy message instead.", ReplaceWith("assert(value) { message }"))
|
||||
@Deprecated("Use assert with lazy message instead.", ReplaceWith("assert(value) { message }"))
|
||||
public fun assert(value: Boolean, message: Any = "Assertion failed") {
|
||||
if (ASSERTIONS_ENABLED) {
|
||||
if (!value) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package kotlin
|
||||
/**
|
||||
* Executes the given function [body] the number of times equal to the value of this integer.
|
||||
*/
|
||||
deprecated("Use repeat(n) { body } instead.")
|
||||
@Deprecated("Use repeat(n) { body } instead.")
|
||||
public inline fun Int.times(body : () -> Unit) {
|
||||
var count = this;
|
||||
while (count > 0) {
|
||||
|
||||
@@ -37,7 +37,7 @@ public val <T: Any> T.javaClass : Class<T>
|
||||
* Returns the Java class for the specified type.
|
||||
*/
|
||||
@Intrinsic("kotlin.javaClass.function")
|
||||
@deprecated("Use the class reference and .java extension property instead: MyClass::class.java", ReplaceWith("T::class.java"))
|
||||
@Deprecated("Use the class reference and .java extension property instead: MyClass::class.java", ReplaceWith("T::class.java"))
|
||||
public fun <reified T: Any> javaClass(): Class<T> = T::class.java
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ private object UNINITIALIZED_VALUE
|
||||
|
||||
private open class LazyImpl<out T>(initializer: () -> T) : Lazy<T>(), Serializable {
|
||||
private var initializer: (() -> T)? = initializer
|
||||
private volatile var _value: Any? = UNINITIALIZED_VALUE
|
||||
@volatile private var _value: Any? = UNINITIALIZED_VALUE
|
||||
protected open val lock: Any
|
||||
get() = this
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import kotlin.platform.platformName
|
||||
* objects. As soon as the [Comparable] instances returned by a function for [a] and [b] values do not
|
||||
* compare as equal, the result of that comparison is returned.
|
||||
*/
|
||||
deprecated("Use selector functions accepting nullable T as a receiver.")
|
||||
@Deprecated("Use selector functions accepting nullable T as a receiver.")
|
||||
public fun <T : Any> compareValuesBy(a: T?, b: T?, vararg functions: (T) -> Comparable<*>?): Int {
|
||||
require(functions.size() > 0)
|
||||
if (a === b) return 0
|
||||
@@ -47,7 +47,7 @@ public fun <T : Any> compareValuesBy(a: T?, b: T?, vararg functions: (T) -> Comp
|
||||
* compare as equal, the result of that comparison is returned.
|
||||
*/
|
||||
// TODO: Remove platformName after M13
|
||||
platformName("compareValuesByNullable")
|
||||
@platformName("compareValuesByNullable")
|
||||
public fun <T> compareValuesBy(a: T, b: T, vararg selectors: (T) -> Comparable<*>?): Int {
|
||||
require(selectors.size() > 0)
|
||||
for (fn in selectors) {
|
||||
@@ -82,7 +82,7 @@ public inline fun <T, K> compareValuesBy(a: T, b: T, comparator: Comparator<in K
|
||||
///**
|
||||
// * Compares two values using the specified [comparator].
|
||||
// */
|
||||
//@suppress("NOTHING_TO_INLINE")
|
||||
//@Suppress("NOTHING_TO_INLINE")
|
||||
//public inline fun <T> compareValuesWith(a: T, b: T, comparator: Comparator<T>): Int = comparator.compare(a, b)
|
||||
//
|
||||
|
||||
@@ -113,13 +113,13 @@ public fun <T> compareBy(vararg selectors: (T) -> Comparable<*>?): Comparator<T>
|
||||
/**
|
||||
* Creates a comparator using the sequence of functions to calculate a result of comparison.
|
||||
*/
|
||||
deprecated("Use compareBy() instead", ReplaceWith("compareBy(*functions)"))
|
||||
@Deprecated("Use compareBy() instead", ReplaceWith("compareBy(*functions)"))
|
||||
public fun <T> comparator(vararg functions: (T) -> Comparable<*>?): Comparator<T> = compareBy(*functions)
|
||||
|
||||
/**
|
||||
* Creates a comparator using the function to transform value to a [Comparable] instance for comparison.
|
||||
*/
|
||||
inline public fun <T> compareBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
inline public fun <T> compareBy(crossinline selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int = compareValuesBy(a, b, selector)
|
||||
}
|
||||
@@ -129,7 +129,7 @@ inline public fun <T> compareBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) se
|
||||
* Creates a comparator using the [selector] function to transform values being compared and then applying
|
||||
* the specified [comparator] to compare transformed values.
|
||||
*/
|
||||
inline public fun <T, K> compareBy(comparator: Comparator<in K>, inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> K): Comparator<T> {
|
||||
inline public fun <T, K> compareBy(comparator: Comparator<in K>, crossinline selector: (T) -> K): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int = compareValuesBy(a, b, comparator, selector)
|
||||
}
|
||||
@@ -138,7 +138,7 @@ inline public fun <T, K> compareBy(comparator: Comparator<in K>, inlineOptions(I
|
||||
/**
|
||||
* Creates a descending comparator using the function to transform value to a [Comparable] instance for comparison.
|
||||
*/
|
||||
inline public fun <T> compareByDescending(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
inline public fun <T> compareByDescending(crossinline selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int = compareValuesBy(b, a, selector)
|
||||
}
|
||||
@@ -150,7 +150,7 @@ inline public fun <T> compareByDescending(inlineOptions(InlineOption.ONLY_LOCAL_
|
||||
*
|
||||
* Note that an order of [comparator] is reversed by this wrapper.
|
||||
*/
|
||||
inline public fun <T, K> compareByDescending(comparator: Comparator<in K>, inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> K): Comparator<T> {
|
||||
inline public fun <T, K> compareByDescending(comparator: Comparator<in K>, crossinline selector: (T) -> K): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int = compareValuesBy(b, a, comparator, selector)
|
||||
}
|
||||
@@ -160,7 +160,7 @@ inline public fun <T, K> compareByDescending(comparator: Comparator<in K>, inlin
|
||||
* Creates a comparator comparing values after the primary comparator defined them equal. It uses
|
||||
* the function to transform value to a [Comparable] instance for comparison.
|
||||
*/
|
||||
inline public fun <T> Comparator<T>.thenBy(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
inline public fun <T> Comparator<T>.thenBy(crossinline selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int {
|
||||
val previousCompare = this@thenBy.compare(a, b)
|
||||
@@ -173,7 +173,7 @@ inline public fun <T> Comparator<T>.thenBy(inlineOptions(InlineOption.ONLY_LOCAL
|
||||
* Creates a comparator comparing values after the primary comparator defined them equal. It uses
|
||||
* the [selector] function to transform values and then compares them with the given [comparator].
|
||||
*/
|
||||
inline public fun <T, K> Comparator<T>.thenBy(comparator: Comparator<in K>, inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> K): Comparator<T> {
|
||||
inline public fun <T, K> Comparator<T>.thenBy(comparator: Comparator<in K>, crossinline selector: (T) -> K): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int {
|
||||
val previousCompare = this@thenBy.compare(a, b)
|
||||
@@ -186,7 +186,7 @@ inline public fun <T, K> Comparator<T>.thenBy(comparator: Comparator<in K>, inli
|
||||
* Creates a descending comparator using the primary comparator and
|
||||
* the function to transform value to a [Comparable] instance for comparison.
|
||||
*/
|
||||
inline public fun <T> Comparator<T>.thenByDescending(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
inline public fun <T> Comparator<T>.thenByDescending(crossinline selector: (T) -> Comparable<*>?): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int {
|
||||
val previousCompare = this@thenByDescending.compare(a, b)
|
||||
@@ -199,7 +199,7 @@ inline public fun <T> Comparator<T>.thenByDescending(inlineOptions(InlineOption.
|
||||
* Creates a descending comparator comparing values after the primary comparator defined them equal. It uses
|
||||
* the [selector] function to transform values and then compares them with the given [comparator].
|
||||
*/
|
||||
inline public fun <T, K> Comparator<T>.thenByDescending(comparator: Comparator<in K>, inlineOptions(InlineOption.ONLY_LOCAL_RETURN) selector: (T) -> K): Comparator<T> {
|
||||
inline public fun <T, K> Comparator<T>.thenByDescending(comparator: Comparator<in K>, crossinline selector: (T) -> K): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int {
|
||||
val previousCompare = this@thenByDescending.compare(a, b)
|
||||
@@ -212,7 +212,7 @@ inline public fun <T, K> Comparator<T>.thenByDescending(comparator: Comparator<i
|
||||
/**
|
||||
* Creates a comparator using the function to calculate a result of comparison.
|
||||
*/
|
||||
inline public fun <T> comparator(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) comparison: (T, T) -> Int): Comparator<T> {
|
||||
inline public fun <T> comparator(crossinline comparison: (T, T) -> Int): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int = comparison(a, b)
|
||||
}
|
||||
@@ -221,7 +221,7 @@ inline public fun <T> comparator(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) c
|
||||
/**
|
||||
* Creates a comparator using the primary comparator and function to calculate a result of comparison.
|
||||
*/
|
||||
inline public fun <T> Comparator<T>.thenComparator(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) comparison: (T, T) -> Int): Comparator<T> {
|
||||
inline public fun <T> Comparator<T>.thenComparator(crossinline comparison: (T, T) -> Int): Comparator<T> {
|
||||
return object : Comparator<T> {
|
||||
public override fun compare(a: T, b: T): Int {
|
||||
val previousCompare = this@thenComparator.compare(a, b)
|
||||
|
||||
@@ -14,7 +14,7 @@ public fun require(value: Boolean): Unit = require(value) { "Failed requirement"
|
||||
*
|
||||
* @sample test.collections.PreconditionsTest.failingRequireWithMessage
|
||||
*/
|
||||
@deprecated("Use require with lazy message instead.", ReplaceWith("require(value) { message }"))
|
||||
@Deprecated("Use require with lazy message instead.", ReplaceWith("require(value) { message }"))
|
||||
public fun require(value: Boolean, message: Any = "Failed requirement"): Unit {
|
||||
if (!value) {
|
||||
throw IllegalArgumentException(message.toString())
|
||||
@@ -44,7 +44,7 @@ public fun <T:Any> requireNotNull(value: T?): T = requireNotNull(value) { "Requi
|
||||
*
|
||||
* @sample test.collections.PreconditionsTest.requireNotNull
|
||||
*/
|
||||
@deprecated("Use requireNotNull with lazy message instead.", ReplaceWith("requireNotNull(value) { message }"))
|
||||
@Deprecated("Use requireNotNull with lazy message instead.", ReplaceWith("requireNotNull(value) { message }"))
|
||||
public fun <T:Any> requireNotNull(value: T?, message: Any = "Required value was null"): T {
|
||||
if (value == null) {
|
||||
throw IllegalArgumentException(message.toString())
|
||||
@@ -78,7 +78,7 @@ public fun check(value: Boolean): Unit = check(value) { "Check failed" }
|
||||
*
|
||||
* @sample test.collections.PreconditionsTest.failingCheckWithMessage
|
||||
*/
|
||||
@deprecated("Use check with lazy message instead.", ReplaceWith("check(value) { message }"))
|
||||
@Deprecated("Use check with lazy message instead.", ReplaceWith("check(value) { message }"))
|
||||
public fun check(value: Boolean, message: Any = "Check failed"): Unit {
|
||||
if (!value) {
|
||||
throw IllegalStateException(message.toString())
|
||||
@@ -109,7 +109,7 @@ public fun <T:Any> checkNotNull(value: T?): T = checkNotNull(value) { "Required
|
||||
*
|
||||
* @sample test.collections.PreconditionsTest.checkNotNull
|
||||
*/
|
||||
@deprecated("Use checkNotNull with lazy message instead.", ReplaceWith("checkNotNull(value) { message }"))
|
||||
@Deprecated("Use checkNotNull with lazy message instead.", ReplaceWith("checkNotNull(value) { message }"))
|
||||
public fun <T:Any> checkNotNull(value: T?, message: Any = "Required value was null"): T {
|
||||
if (value == null) {
|
||||
throw IllegalStateException(message.toString())
|
||||
|
||||
Reference in New Issue
Block a user