Remove redundant @OptIn

This commit is contained in:
Abduqodiri Qurbonzoda
2021-04-12 15:44:52 +03:00
parent f253b1fb15
commit 3a8d1c4b5e
10 changed files with 1 additions and 17 deletions
@@ -571,7 +571,6 @@ public fun CPointer<IntVar>.toKStringFromUtf32(): String {
* *
* Malformed byte sequences are replaced by the replacement char `\uFFFD`. * Malformed byte sequences are replaced by the replacement char `\uFFFD`.
*/ */
@OptIn(ExperimentalStdlibApi::class)
@SinceKotlin("1.3") @SinceKotlin("1.3")
public fun ByteArray.toKString() : String { public fun ByteArray.toKString() : String {
val realEndIndex = realEndIndex(this, 0, this.size) val realEndIndex = realEndIndex(this, 0, this.size)
@@ -590,7 +589,6 @@ public fun ByteArray.toKString() : String {
* @throws IllegalArgumentException if [startIndex] is greater than [endIndex]. * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].
* @throws CharacterCodingException if the byte array contains malformed UTF-8 byte sequence and [throwOnInvalidSequence] is true. * @throws CharacterCodingException if the byte array contains malformed UTF-8 byte sequence and [throwOnInvalidSequence] is true.
*/ */
@OptIn(ExperimentalStdlibApi::class)
@SinceKotlin("1.3") @SinceKotlin("1.3")
public fun ByteArray.toKString( public fun ByteArray.toKString(
startIndex: Int = 0, startIndex: Int = 0,
@@ -141,7 +141,6 @@ actual class ArrayList<E> private constructor(
array = array.copyOfUninitializedElements(length) array = array.copyOfUninitializedElements(length)
} }
@OptIn(ExperimentalStdlibApi::class)
final actual fun ensureCapacity(minCapacity: Int) { final actual fun ensureCapacity(minCapacity: Int) {
if (backing != null) throw IllegalStateException() // just in case somebody casts subList to ArrayList if (backing != null) throw IllegalStateException() // just in case somebody casts subList to ArrayList
if (minCapacity > array.size) { if (minCapacity > array.size) {
@@ -470,10 +470,8 @@ actual class HashMap<K, V> private constructor(
private const val INITIAL_MAX_PROBE_DISTANCE = 2 private const val INITIAL_MAX_PROBE_DISTANCE = 2
private const val TOMBSTONE = -1 private const val TOMBSTONE = -1
@OptIn(ExperimentalStdlibApi::class)
private fun computeHashSize(capacity: Int): Int = (capacity.coerceAtLeast(1) * 3).takeHighestOneBit() private fun computeHashSize(capacity: Int): Int = (capacity.coerceAtLeast(1) * 3).takeHighestOneBit()
@OptIn(ExperimentalStdlibApi::class)
private fun computeShift(hashSize: Int): Int = hashSize.countLeadingZeroBits() + 1 private fun computeShift(hashSize: Int): Int = hashSize.countLeadingZeroBits() + 1
} }
@@ -108,7 +108,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
@SinceKotlin("1.4") @SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class) @WasExperimental(ExperimentalStdlibApi::class)
actual fun append(value: CharArray): StringBuilder { actual fun append(value: CharArray): StringBuilder {
@OptIn(ExperimentalStdlibApi::class)
string += value.concatToString() string += value.concatToString()
return this return this
} }
@@ -238,7 +237,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
actual fun insert(index: Int, value: CharArray): StringBuilder { actual fun insert(index: Int, value: CharArray): StringBuilder {
AbstractList.checkPositionIndex(index, length) AbstractList.checkPositionIndex(index, length)
@OptIn(ExperimentalStdlibApi::class)
string = string.substring(0, index) + value.concatToString() + string.substring(index) string = string.substring(0, index) + value.concatToString() + string.substring(index)
return this return this
} }
@@ -492,7 +490,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
@SinceKotlin("1.4") @SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class) @WasExperimental(ExperimentalStdlibApi::class)
public fun appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder { public fun appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
@OptIn(ExperimentalStdlibApi::class)
string += value.concatToString(startIndex, endIndex) string += value.concatToString(startIndex, endIndex)
return this return this
} }
@@ -534,7 +531,6 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
public fun insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder { public fun insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {
AbstractList.checkPositionIndex(index, this.length) AbstractList.checkPositionIndex(index, this.length)
@OptIn(ExperimentalStdlibApi::class)
string = string.substring(0, index) + value.concatToString(startIndex, endIndex) + string.substring(index) string = string.substring(0, index) + value.concatToString(startIndex, endIndex) + string.substring(index)
return this return this
} }
@@ -6,7 +6,6 @@
package kotlin.text package kotlin.text
/** Returns the negative [size] if [throwOnMalformed] is false, throws [CharacterCodingException] otherwise. */ /** Returns the negative [size] if [throwOnMalformed] is false, throws [CharacterCodingException] otherwise. */
@OptIn(ExperimentalStdlibApi::class)
private fun malformed(size: Int, index: Int, throwOnMalformed: Boolean): Int { private fun malformed(size: Int, index: Int, throwOnMalformed: Boolean): Int {
if (throwOnMalformed) throw CharacterCodingException("Malformed sequence starting at ${index - 1}") if (throwOnMalformed) throw CharacterCodingException("Malformed sequence starting at ${index - 1}")
return -size return -size
@@ -436,10 +436,8 @@ internal class MapBuilder<K, V> private constructor(
private const val INITIAL_MAX_PROBE_DISTANCE = 2 private const val INITIAL_MAX_PROBE_DISTANCE = 2
private const val TOMBSTONE = -1 private const val TOMBSTONE = -1
@OptIn(ExperimentalStdlibApi::class)
private fun computeHashSize(capacity: Int): Int = (capacity.coerceAtLeast(1) * 3).takeHighestOneBit() private fun computeHashSize(capacity: Int): Int = (capacity.coerceAtLeast(1) * 3).takeHighestOneBit()
@OptIn(ExperimentalStdlibApi::class)
private fun computeShift(hashSize: Int): Int = hashSize.countLeadingZeroBits() + 1 private fun computeShift(hashSize: Int): Int = hashSize.countLeadingZeroBits() + 1
} }
@@ -140,7 +140,7 @@ public fun <T> Sequence<T>.shuffled(random: Random): Sequence<T> = sequence<T> {
val buffer = toMutableList() val buffer = toMutableList()
while (buffer.isNotEmpty()) { while (buffer.isNotEmpty()) {
val j = random.nextInt(buffer.size) val j = random.nextInt(buffer.size)
val last = @OptIn(ExperimentalStdlibApi::class) buffer.removeLast() val last = buffer.removeLast()
val value = if (j < buffer.size) buffer.set(j, last) else last val value = if (j < buffer.size) buffer.set(j, last) else last
yield(value) yield(value)
} }
@@ -369,7 +369,6 @@ public fun Random.nextLong(range: LongRange): Long = when {
internal expect fun defaultPlatformRandom(): Random internal expect fun defaultPlatformRandom(): Random
internal expect fun doubleFromParts(hi26: Int, low27: Int): Double internal expect fun doubleFromParts(hi26: Int, low27: Int): Double
@OptIn(ExperimentalStdlibApi::class)
internal fun fastLog2(value: Int): Int = 31 - value.countLeadingZeroBits() internal fun fastLog2(value: Int): Int = 31 - value.countLeadingZeroBits()
/** Takes upper [bitCount] bits (0..32) from this number. */ /** Takes upper [bitCount] bits (0..32) from this number. */
@@ -500,7 +500,6 @@ public fun String.substringAfterLast(delimiter: String, missingDelimiterValue: S
* @param startIndex the index of the first character to be replaced. * @param startIndex the index of the first character to be replaced.
* @param endIndex the index of the first character after the replacement to keep in the string. * @param endIndex the index of the first character after the replacement to keep in the string.
*/ */
@OptIn(ExperimentalStdlibApi::class)
public fun CharSequence.replaceRange(startIndex: Int, endIndex: Int, replacement: CharSequence): CharSequence { public fun CharSequence.replaceRange(startIndex: Int, endIndex: Int, replacement: CharSequence): CharSequence {
if (endIndex < startIndex) if (endIndex < startIndex)
throw IndexOutOfBoundsException("End index ($endIndex) is less than start index ($startIndex).") throw IndexOutOfBoundsException("End index ($endIndex) is less than start index ($startIndex).")
@@ -546,7 +545,6 @@ public inline fun String.replaceRange(range: IntRange, replacement: CharSequence
* *
* [endIndex] is not included in the removed part. * [endIndex] is not included in the removed part.
*/ */
@OptIn(ExperimentalStdlibApi::class)
public fun CharSequence.removeRange(startIndex: Int, endIndex: Int): CharSequence { public fun CharSequence.removeRange(startIndex: Int, endIndex: Int): CharSequence {
if (endIndex < startIndex) if (endIndex < startIndex)
throw IndexOutOfBoundsException("End index ($endIndex) is less than start index ($startIndex).") throw IndexOutOfBoundsException("End index ($endIndex) is less than start index ($startIndex).")
@@ -725,7 +725,6 @@ public value class Duration internal constructor(private val rawValue: Long) : C
* *
* @sample samples.time.Durations.toIsoString * @sample samples.time.Durations.toIsoString
*/ */
@OptIn(ExperimentalStdlibApi::class)
public fun toIsoString(): String = buildString { public fun toIsoString(): String = buildString {
if (isNegative()) append('-') if (isNegative()) append('-')
append("PT") append("PT")