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
@@ -99,7 +99,6 @@ public actual inline fun Float.Companion.fromBits(bits: Int): Float =
* Counts the number of set bits in the binary representation of this [Int] number.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Int.countOneBits(): Int {
// Hacker's Delight 5-1 algorithm
var v = this
@@ -115,7 +114,6 @@ public actual 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)
@kotlin.internal.InlineOnly
public actual inline fun Int.countLeadingZeroBits(): Int = nativeClz32(this)
@@ -123,7 +121,6 @@ public actual inline fun Int.countLeadingZeroBits(): Int = nativeClz32(this)
* 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 actual fun Int.countTrailingZeroBits(): Int =
// Hacker's Delight 5-4 algorithm for expressing countTrailingZeroBits with countLeadingZeroBits
Int.SIZE_BITS - (this or -this).inv().countLeadingZeroBits()
@@ -133,7 +130,6 @@ public actual fun Int.countTrailingZeroBits(): Int =
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Int.takeHighestOneBit(): Int =
if (this == 0) 0 else 1.shl(Int.SIZE_BITS - 1 - countLeadingZeroBits())
@@ -142,7 +138,6 @@ public actual fun Int.takeHighestOneBit(): Int =
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Int.takeLowestOneBit(): Int =
// Hacker's Delight 2-1 algorithm for isolating rightmost 1-bit
this and -this
@@ -183,7 +178,6 @@ public actual 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 actual fun Long.countOneBits(): Int =
high.countOneBits() + low.countOneBits()
@@ -191,7 +185,6 @@ public actual 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 actual fun Long.countLeadingZeroBits(): Int =
when (val high = this.high) {
0 -> Int.SIZE_BITS + low.countLeadingZeroBits()
@@ -202,7 +195,6 @@ public actual 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 actual fun Long.countTrailingZeroBits(): Int =
when (val low = this.low) {
0 -> Int.SIZE_BITS + high.countTrailingZeroBits()
@@ -214,7 +206,6 @@ public actual fun Long.countTrailingZeroBits(): Int =
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Long.takeHighestOneBit(): Long =
when (val high = this.high) {
0 -> Long(low.takeHighestOneBit(), 0)
@@ -226,7 +217,6 @@ public actual fun Long.takeHighestOneBit(): Long =
* or zero, if this number is zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun Long.takeLowestOneBit(): Long =
when (val low = this.low) {
0 -> Long(0, high.takeLowestOneBit())
@@ -9,7 +9,6 @@ package kotlin.text
* The exception thrown when a character encoding or decoding error occurs.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual open class CharacterCodingException(message: String?) : Exception(message) {
actual constructor() : this(null)
}
@@ -160,7 +160,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Characters are appended in order, starting at the index 0.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun append(value: CharArray): StringBuilder {
string += value.concatToString()
return this
@@ -199,7 +198,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* thus calling this method has no effect on the further performance of operations.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun ensureCapacity(minimumCapacity: Int) {
}
@@ -209,7 +207,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun indexOf(string: String): Int = this.string.asDynamic().indexOf(string)
/**
@@ -219,7 +216,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun indexOf(string: String, startIndex: Int): Int = this.string.asDynamic().indexOf(string, startIndex)
/**
@@ -229,7 +225,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun lastIndexOf(string: String): Int = this.string.asDynamic().lastIndexOf(string)
/**
@@ -239,7 +234,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun lastIndexOf(string: String, startIndex: Int): Int {
if (string.isEmpty() && startIndex < 0) return -1
return this.string.asDynamic().lastIndexOf(string, startIndex)
@@ -254,7 +248,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun insert(index: Int, value: Boolean): StringBuilder {
AbstractList.checkPositionIndex(index, length)
@@ -334,7 +327,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun insert(index: Int, value: Char): StringBuilder {
AbstractList.checkPositionIndex(index, length)
@@ -350,7 +342,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun insert(index: Int, value: CharArray): StringBuilder {
AbstractList.checkPositionIndex(index, length)
@@ -369,7 +360,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun insert(index: Int, value: CharSequence?): StringBuilder {
AbstractList.checkPositionIndex(index, length)
@@ -386,7 +376,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun insert(index: Int, value: Any?): StringBuilder {
AbstractList.checkPositionIndex(index, length)
@@ -402,7 +391,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun insert(index: Int, value: String?): StringBuilder {
AbstractList.checkPositionIndex(index, length)
@@ -423,7 +411,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun setLength(newLength: Int) {
if (newLength < 0) {
throw IllegalArgumentException("Negative new length: $newLength.")
@@ -444,7 +431,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun substring(startIndex: Int): String {
AbstractList.checkPositionIndex(startIndex, length)
@@ -457,7 +443,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @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)
actual fun substring(startIndex: Int, endIndex: Int): String {
AbstractList.checkBoundsIndexes(startIndex, endIndex, length)
@@ -474,7 +459,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* In Kotlin/JS implementation of StringBuilder the size of the backing storage is always equal to the length of the string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
actual fun trimToSize() {
}
@@ -497,7 +481,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public operator fun set(index: Int, value: Char) {
AbstractList.checkElementIndex(index, length)
@@ -514,7 +497,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @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 fun setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder {
checkReplaceRange(startIndex, endIndex, length)
@@ -541,7 +523,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun deleteAt(index: Int): StringBuilder {
AbstractList.checkElementIndex(index, length)
@@ -558,7 +539,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @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 fun deleteRange(startIndex: Int, endIndex: Int): StringBuilder {
checkReplaceRange(startIndex, endIndex, length)
@@ -579,7 +559,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* or when that index is out of the [destination] array indices range.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) {
AbstractList.checkBoundsIndexes(startIndex, endIndex, length)
AbstractList.checkBoundsIndexes(destinationOffset, destinationOffset + endIndex - startIndex, destination.size)
@@ -602,7 +581,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @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 fun appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
string += value.concatToString(startIndex, endIndex)
return this
@@ -618,7 +596,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @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 appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {
val stringCsq = value.toString()
AbstractList.checkBoundsIndexes(startIndex, endIndex, stringCsq.length)
@@ -641,7 +618,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
AbstractList.checkPositionIndex(index, this.length)
@@ -663,7 +639,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {
AbstractList.checkPositionIndex(index, length)
@@ -691,7 +666,6 @@ public actual inline fun StringBuilder.clear(): StringBuilder = this.clear()
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline operator fun StringBuilder.set(index: Int, value: Char) = this.set(index, value)
@@ -705,7 +679,6 @@ public actual inline operator fun StringBuilder.set(index: Int, value: Char) = t
* @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)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder =
this.setRange(startIndex, endIndex, value)
@@ -720,7 +693,6 @@ public actual inline fun StringBuilder.setRange(startIndex: Int, endIndex: Int,
* @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline fun StringBuilder.deleteAt(index: Int): StringBuilder = this.deleteAt(index)
@@ -733,7 +705,6 @@ public actual inline fun StringBuilder.deleteAt(index: Int): StringBuilder = thi
* @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)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder = this.deleteRange(startIndex, endIndex)
@@ -750,7 +721,6 @@ public actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: In
* or when that index is out of the [destination] array indices range.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE", "ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) =
this.toCharArray(destination, destinationOffset, startIndex, endIndex)
@@ -767,7 +737,6 @@ public actual inline fun StringBuilder.toCharArray(destination: CharArray, desti
* @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)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder =
this.appendRange(value, startIndex, endIndex)
@@ -782,7 +751,6 @@ public actual inline fun StringBuilder.appendRange(value: CharArray, startIndex:
* @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)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder =
this.appendRange(value, startIndex, endIndex)
@@ -801,7 +769,6 @@ public actual inline fun StringBuilder.appendRange(value: CharSequence, startInd
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder =
this.insertRange(index, value, startIndex, endIndex)
@@ -820,7 +787,6 @@ public actual inline fun StringBuilder.insertRange(index: Int, value: CharArray,
* @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("EXTENSION_SHADOWED_BY_MEMBER", "NOTHING_TO_INLINE")
public actual inline fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder =
this.insertRange(index, value, startIndex, endIndex)
@@ -44,7 +44,6 @@ public actual fun String(chars: CharArray, offset: Int, length: Int): String {
* Concatenates characters in this [CharArray] into a String.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun CharArray.concatToString(): String {
var result = ""
for (char in this) {
@@ -63,7 +62,6 @@ public actual fun CharArray.concatToString(): String {
* @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int = this.size): String {
AbstractList.checkBoundsIndexes(startIndex, endIndex, this.size)
@@ -78,7 +76,6 @@ public actual fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int =
* Returns a [CharArray] containing characters of this string.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun String.toCharArray(): CharArray {
return CharArray(length) { get(it) }
}
@@ -93,7 +90,6 @@ public actual fun String.toCharArray(): CharArray {
* @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun String.toCharArray(startIndex: Int = 0, endIndex: Int = this.length): CharArray {
AbstractList.checkBoundsIndexes(startIndex, endIndex, length)
@@ -136,7 +132,6 @@ public actual fun String.toCharArray(
* Malformed byte sequences are replaced by the replacement char `\uFFFD`.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun ByteArray.decodeToString(): String {
return decodeUtf8(this, 0, size, false)
}
@@ -153,7 +148,6 @@ public actual fun ByteArray.decodeToString(): String {
* @throws CharacterCodingException if the byte array contains malformed UTF-8 byte sequence and [throwOnInvalidSequence] is true.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun ByteArray.decodeToString(
startIndex: Int = 0,
@@ -170,7 +164,6 @@ public actual fun ByteArray.decodeToString(
* Any malformed char sequence is replaced by the replacement byte sequence.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public actual fun String.encodeToByteArray(): ByteArray {
return encodeUtf8(this, 0, length, false)
}
@@ -187,7 +180,6 @@ public actual fun String.encodeToByteArray(): ByteArray {
* @throws CharacterCodingException if this string contains malformed char sequence and [throwOnInvalidSequence] is true.
*/
@SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")
public actual fun String.encodeToByteArray(
startIndex: Int = 0,