Clean up WasExperimental annotation from declarations with SinceKotlin<=1.4

Since it is not possible to use -api-version < 1.4, this annotation has no effect
This commit is contained in:
Ilya Gorbunov
2023-11-07 15:07:42 +01:00
committed by Space Team
parent 081e1de5af
commit 9ccce52915
33 changed files with 3 additions and 464 deletions
@@ -14,7 +14,6 @@ package kotlin.collections
* It also implements [MutableList] interface and supports efficient get/set operations by index.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public class ArrayDeque<E> : AbstractMutableList<E> {
private var head: Int = 0
private var elementData: Array<Any?>
@@ -242,28 +242,24 @@ public inline fun <T> MutableList<T>.remove(index: Int): T = removeAt(index)
* Removes the first element from this mutable list and returns that removed element, or throws [NoSuchElementException] if this list is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun <T> MutableList<T>.removeFirst(): T = if (isEmpty()) throw NoSuchElementException("List is empty.") else removeAt(0)
/**
* Removes the first element from this mutable list and returns that removed element, or returns `null` if this list is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun <T> MutableList<T>.removeFirstOrNull(): T? = if (isEmpty()) null else removeAt(0)
/**
* Removes the last element from this mutable list and returns that removed element, or throws [NoSuchElementException] if this list is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun <T> MutableList<T>.removeLast(): T = if (isEmpty()) throw NoSuchElementException("List is empty.") else removeAt(lastIndex)
/**
* Removes the last element from this mutable list and returns that removed element, or returns `null` if this list is empty.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun <T> MutableList<T>.removeLastOrNull(): T? = if (isEmpty()) null else removeAt(lastIndex)
/**
@@ -20,7 +20,6 @@ import kotlin.internal.LowPriorityInOverloadResolution
* @see [KClass.safeCast]
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@LowPriorityInOverloadResolution
fun <T : Any> KClass<T>.cast(value: Any?): T {
if (!isInstance(value)) throw ClassCastException("Value cannot be cast to $qualifiedOrSimpleName")
@@ -40,7 +39,6 @@ internal expect val KClass<*>.qualifiedOrSimpleName: String?
* @see [KClass.cast]
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@LowPriorityInOverloadResolution
fun <T : Any> KClass<T>.safeCast(value: Any?): T? {
return if (isInstance(value)) value as T else null
@@ -49,7 +49,6 @@ expect interface Appendable {
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun <T : Appendable> T.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): T {
@Suppress("UNCHECKED_CAST")
return append(value, startIndex, endIndex) as T
@@ -9,5 +9,4 @@ package kotlin.text
* The exception thrown when a character encoding or decoding error occurs.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect open class CharacterCodingException() : Exception
@@ -129,7 +129,6 @@ expect class StringBuilder : Appendable, CharSequence {
* Characters are appended in order, starting at the index 0.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun append(value: CharArray): StringBuilder
/**
@@ -157,7 +156,6 @@ expect class StringBuilder : Appendable, CharSequence {
* Otherwise, this method takes no action and simply returns.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun ensureCapacity(minimumCapacity: Int)
/**
@@ -166,7 +164,6 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun indexOf(string: String): Int
/**
@@ -176,7 +173,6 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun indexOf(string: String, startIndex: Int): Int
/**
@@ -186,7 +182,6 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun lastIndexOf(string: String): Int
/**
@@ -196,7 +191,6 @@ expect class StringBuilder : Appendable, CharSequence {
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun lastIndexOf(string: String, startIndex: Int): Int
/**
@@ -208,7 +202,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun insert(index: Int, value: Boolean): StringBuilder
/**
@@ -283,7 +276,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun insert(index: Int, value: Char): StringBuilder
/**
@@ -294,7 +286,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun insert(index: Int, value: CharArray): StringBuilder
/**
@@ -308,7 +299,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun insert(index: Int, value: CharSequence?): StringBuilder
/**
@@ -320,7 +310,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun insert(index: Int, value: Any?): StringBuilder
/**
@@ -331,7 +320,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun insert(index: Int, value: String?): StringBuilder
/**
@@ -346,7 +334,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun setLength(newLength: Int)
/**
@@ -355,7 +342,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun substring(startIndex: Int): String
/**
@@ -364,7 +350,6 @@ expect class StringBuilder : Appendable, CharSequence {
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun substring(startIndex: Int, endIndex: Int): String
/**
@@ -375,7 +360,6 @@ expect class StringBuilder : Appendable, CharSequence {
* Calling this method may, but is not required to, affect the value of the [capacity] property.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
fun trimToSize()
}
@@ -394,7 +378,6 @@ public expect fun StringBuilder.clear(): StringBuilder
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect operator fun StringBuilder.set(index: Int, value: Char)
/**
@@ -407,7 +390,6 @@ public expect operator fun StringBuilder.set(index: Int, value: Char)
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [startIndex] is less than zero, greater than the length of this string builder, or `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder
/**
@@ -420,7 +402,6 @@ public expect fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value:
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.deleteAt(index: Int): StringBuilder
/**
@@ -432,7 +413,6 @@ public expect fun StringBuilder.deleteAt(index: Int): StringBuilder
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] is out of range of this string builder indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder
/**
@@ -448,7 +428,6 @@ public expect fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): Str
* or when that index is out of the [destination] array indices range.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length)
/**
@@ -463,7 +442,6 @@ public expect fun StringBuilder.toCharArray(destination: CharArray, destinationO
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder
/**
@@ -476,7 +454,6 @@ public expect fun StringBuilder.appendRange(value: CharArray, startIndex: Int, e
* @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder
/**
@@ -493,7 +470,6 @@ public expect fun StringBuilder.appendRange(value: CharSequence, startIndex: Int
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder
/**
@@ -510,7 +486,6 @@ public expect fun StringBuilder.insertRange(index: Int, value: CharArray, startI
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
@@ -11,21 +11,18 @@ package kotlin
* Counts the number of set bits in the binary representation of this [Int] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Int.countOneBits(): Int
/**
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Int] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Int.countLeadingZeroBits(): Int
/**
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Int] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Int.countTrailingZeroBits(): Int
/**
@@ -33,7 +30,6 @@ public expect fun Int.countTrailingZeroBits(): Int
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Int.takeHighestOneBit(): Int
/**
@@ -41,7 +37,6 @@ public expect fun Int.takeHighestOneBit(): Int
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Int.takeLowestOneBit(): Int
/**
@@ -78,21 +73,18 @@ public expect fun Int.rotateRight(bitCount: Int): Int
* Counts the number of set bits in the binary representation of this [Long] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Long.countOneBits(): Int
/**
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Long] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Long.countLeadingZeroBits(): Int
/**
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Long.countTrailingZeroBits(): Int
/**
@@ -100,7 +92,6 @@ public expect fun Long.countTrailingZeroBits(): Int
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Long.takeHighestOneBit(): Long
/**
@@ -108,7 +99,6 @@ public expect fun Long.takeHighestOneBit(): Long
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public expect fun Long.takeLowestOneBit(): Long
/**
@@ -143,7 +133,6 @@ public expect fun Long.rotateRight(bitCount: Int): Long
* Counts the number of set bits in the binary representation of this [Byte] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Byte.countOneBits(): Int = (toInt() and 0xFF).countOneBits()
@@ -151,7 +140,6 @@ public inline fun Byte.countOneBits(): Int = (toInt() and 0xFF).countOneBits()
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Byte] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Byte.countLeadingZeroBits(): Int = (toInt() and 0xFF).countLeadingZeroBits() - (Int.SIZE_BITS - Byte.SIZE_BITS)
@@ -159,7 +147,6 @@ public inline fun Byte.countLeadingZeroBits(): Int = (toInt() and 0xFF).countLea
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Byte] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Byte.countTrailingZeroBits(): Int = (toInt() or 0x100).countTrailingZeroBits()
@@ -168,7 +155,6 @@ public inline fun Byte.countTrailingZeroBits(): Int = (toInt() or 0x100).countTr
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Byte.takeHighestOneBit(): Byte = (toInt() and 0xFF).takeHighestOneBit().toByte()
@@ -177,7 +163,6 @@ public inline fun Byte.takeHighestOneBit(): Byte = (toInt() and 0xFF).takeHighes
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Byte.takeLowestOneBit(): Byte = toInt().takeLowestOneBit().toByte()
@@ -216,7 +201,6 @@ public fun Byte.rotateRight(bitCount: Int): Byte =
* Counts the number of set bits in the binary representation of this [Short] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Short.countOneBits(): Int = (toInt() and 0xFFFF).countOneBits()
@@ -224,7 +208,6 @@ public inline fun Short.countOneBits(): Int = (toInt() and 0xFFFF).countOneBits(
* Counts the number of consecutive most significant bits that are zero in the binary representation of this [Short] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Short.countLeadingZeroBits(): Int =
(toInt() and 0xFFFF).countLeadingZeroBits() - (Int.SIZE_BITS - Short.SIZE_BITS)
@@ -233,7 +216,6 @@ public inline fun Short.countLeadingZeroBits(): Int =
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Short] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Short.countTrailingZeroBits(): Int = (toInt() or 0x10000).countTrailingZeroBits()
@@ -242,7 +224,6 @@ public inline fun Short.countTrailingZeroBits(): Int = (toInt() or 0x10000).coun
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Short.takeHighestOneBit(): Short = (toInt() and 0xFFFF).takeHighestOneBit().toShort()
@@ -251,7 +232,6 @@ public inline fun Short.takeHighestOneBit(): Short = (toInt() and 0xFFFF).takeHi
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@kotlin.internal.InlineOnly
public inline fun Short.takeLowestOneBit(): Short = toInt().takeLowestOneBit().toShort()