Migrate UseExperimental->OptIn in project sources

This commit is contained in:
Alexander Udalov
2020-01-28 15:35:42 +01:00
parent 125b39d9be
commit 795d6ab407
164 changed files with 213 additions and 211 deletions
@@ -5,7 +5,7 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("SequenceBuilderKt")
@file:UseExperimental(ExperimentalTypeInference::class)
@file:OptIn(ExperimentalTypeInference::class)
package kotlin.coroutines.experimental
@@ -3,8 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:UseExperimental(ExperimentalTime::class)
@file:OptIn(ExperimentalTime::class)
package kotlin.jdk8.time.test
import kotlin.random.Random
@@ -6,7 +6,7 @@
package kotlin.collections
@UseExperimental(ExperimentalUnsignedTypes::class)
@OptIn(ExperimentalUnsignedTypes::class)
@SinceKotlin("1.3")
@kotlin.js.JsName("contentDeepHashCodeImpl")
internal fun <T> Array<out T>.contentDeepHashCodeImpl(): Int {
@@ -46,7 +46,7 @@ public actual class StringBuilder actual constructor(content: String) : Appendab
return this
}
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
actual override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder = this.appendRange(value, startIndex, endIndex)
/**
@@ -6,7 +6,7 @@
package kotlin.text
/** Returns the negative [size] if [throwOnMalformed] is false, throws [CharacterCodingException] otherwise. */
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
private fun malformed(size: Int, index: Int, throwOnMalformed: Boolean): Int {
if (throwOnMalformed) throw CharacterCodingException("Malformed sequence starting at ${index - 1}")
return -size
@@ -67,7 +67,7 @@ public inline fun <C, R> C.ifEmpty(defaultValue: () -> R): R where C : Array<*>,
if (isEmpty()) defaultValue() else this
@UseExperimental(ExperimentalUnsignedTypes::class)
@OptIn(ExperimentalUnsignedTypes::class)
@SinceKotlin("1.3")
@PublishedApi
@kotlin.jvm.JvmName("contentDeepEquals")
@@ -120,7 +120,7 @@ internal fun <T> Array<out T>.contentDeepToStringImpl(): String {
}
}
@UseExperimental(ExperimentalUnsignedTypes::class)
@OptIn(ExperimentalUnsignedTypes::class)
private fun <T> Array<out T>.contentDeepToStringInternal(result: StringBuilder, processed: MutableList<Array<*>>) {
if (this in processed) {
result.append("[...]")
@@ -5,7 +5,7 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("CollectionsKt")
@file:UseExperimental(kotlin.experimental.ExperimentalTypeInference::class)
@file:OptIn(kotlin.experimental.ExperimentalTypeInference::class)
package kotlin.collections
@@ -5,7 +5,7 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("MapsKt")
@file:UseExperimental(kotlin.experimental.ExperimentalTypeInference::class)
@file:OptIn(kotlin.experimental.ExperimentalTypeInference::class)
package kotlin.collections
@@ -5,7 +5,7 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("SequencesKt")
@file:UseExperimental(ExperimentalTypeInference::class)
@file:OptIn(ExperimentalTypeInference::class)
package kotlin.sequences
@@ -5,7 +5,7 @@
@file:kotlin.jvm.JvmMultifileClass
@file:kotlin.jvm.JvmName("SetsKt")
@file:UseExperimental(kotlin.experimental.ExperimentalTypeInference::class)
@file:OptIn(kotlin.experimental.ExperimentalTypeInference::class)
package kotlin.collections
+1 -1
View File
@@ -338,7 +338,7 @@ public fun Random.nextLong(range: LongRange): Long = when {
internal expect fun defaultPlatformRandom(): Random
internal expect fun doubleFromParts(hi26: Int, low27: Int): Double
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
internal fun fastLog2(value: Int): Int = 31 - value.countLeadingZeroBits()
/** Takes upper [bitCount] bits (0..32) from this number. */
+2 -2
View File
@@ -438,7 +438,7 @@ public fun String.substringAfterLast(delimiter: String, missingDelimiterValue: S
* @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.
*/
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
public fun CharSequence.replaceRange(startIndex: Int, endIndex: Int, replacement: CharSequence): CharSequence {
if (endIndex < startIndex)
throw IndexOutOfBoundsException("End index ($endIndex) is less than start index ($startIndex).")
@@ -484,7 +484,7 @@ public inline fun String.replaceRange(range: IntRange, replacement: CharSequence
*
* [endIndex] is not included in the removed part.
*/
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
public fun CharSequence.removeRange(startIndex: Int, endIndex: Int): CharSequence {
if (endIndex < startIndex)
throw IndexOutOfBoundsException("End index ($endIndex) is less than start index ($startIndex).")
+2 -2
View File
@@ -7,7 +7,7 @@ package kotlin.time
import kotlin.math.abs
@UseExperimental(ExperimentalTime::class)
@OptIn(ExperimentalTime::class)
private inline val storageUnit get() = DurationUnit.NANOSECONDS
/**
@@ -302,7 +302,7 @@ public inline class Duration internal constructor(internal val value: Double) :
*
* @sample samples.time.Durations.toIsoString
*/
@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
public fun toIsoString(): String = buildString {
if (isNegative()) append('-')
append("PT")
+2 -2
View File
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:UseExperimental(ExperimentalTime::class)
@file:OptIn(ExperimentalTime::class)
package test.time
import test.numbers.assertAlmostEquals
@@ -398,4 +398,4 @@ class DurationTest {
test(Duration.INFINITE, "Infinity")
}
}
}
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:UseExperimental(ExperimentalTime::class)
@file:OptIn(ExperimentalTime::class)
package test.time
import kotlin.test.*
@@ -44,4 +44,4 @@ class DurationUnitTest {
}
}
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:UseExperimental(ExperimentalTime::class)
@file:OptIn(ExperimentalTime::class)
package test.time
import kotlin.random.Random
@@ -68,4 +68,4 @@ class MeasureTimeTest {
assertEquals(expectedResult, result)
assertEquals(result.nanoseconds, elapsed2)
}
}
}
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:UseExperimental(ExperimentalTime::class)
@file:OptIn(ExperimentalTime::class)
package test.time
import kotlin.test.*
@@ -59,4 +59,4 @@ class TestTimeSourceTest {
timeSource += 1.9.nanoseconds
assertEquals(1.nanoseconds, mark.elapsedNow())
}
}
}
+3 -2
View File
@@ -2,7 +2,8 @@
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:UseExperimental(ExperimentalTime::class)
@file:OptIn(ExperimentalTime::class)
package test.time
import kotlin.test.*
@@ -50,4 +51,4 @@ class TimeMarkTest {
markPast1.assertHasPassed(true)
}
}
}
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:UseExperimental(ExperimentalUnsignedTypes::class)
@file:OptIn(ExperimentalUnsignedTypes::class)
package kotlin.internal
// (a - b) mod c
@@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@file:kotlin.jvm.JvmName("UnsignedKt")
@file:UseExperimental(ExperimentalUnsignedTypes::class)
@file:OptIn(ExperimentalUnsignedTypes::class)
package kotlin
@PublishedApi