Skip to content

Commit a1134f2

Browse files
committed
Revert "Add optins required in Kotlin 1.9"
This reverts commit 6fb30e2.
1 parent 77b630c commit a1134f2

25 files changed

+10
-49
lines changed

benchmarks/src/jmh/kotlin/benchmarks/scheduler/ForkJoinBenchmark.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,8 @@ open class ForkJoinBenchmark : ParametrizedDispatcherBase() {
110110
}
111111
}
112112

113-
class RecursiveAction(
114-
val coefficients: LongArray,
115-
val start: Int,
116-
val end: Int,
117-
@Volatile @OptIn(ExperimentalStdlibApi::class) var result: Double = 0.0,
118-
parent: RecursiveAction? = null
119-
) : CountedCompleter<Double>(parent) {
113+
class RecursiveAction(val coefficients: LongArray, val start: Int, val end: Int, @Volatile var result: Double = 0.0,
114+
parent: RecursiveAction? = null) : CountedCompleter<Double>(parent) {
120115

121116
private var first: ForkJoinTask<Double>? = null
122117
private var second: ForkJoinTask<Double>? = null

benchmarks/src/jmh/kotlin/benchmarks/scheduler/StatefulAwaitsBenchmark.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ open class StatefulAsyncBenchmark : ParametrizedDispatcherBase() {
5757
override var dispatcher: String = "fjp"
5858

5959
@Volatile
60-
@OptIn(ExperimentalStdlibApi::class)
6160
private var state: Array<LongArray>? = null
6261

6362
@Setup

benchmarks/src/jmh/kotlin/benchmarks/tailcall/SimpleChannelBenchmark.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ open class SimpleChannelBenchmark {
1919
private val iterations = 10_000
2020

2121
@Volatile
22-
@OptIn(ExperimentalStdlibApi::class)
2322
private var sink: Int = 0
2423

2524
@Benchmark

docs/topics/shared-mutable-state-and-concurrency.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ suspend fun massiveRun(action: suspend () -> Unit) {
106106
}
107107

108108
//sampleStart
109-
@OptIn(ExperimentalStdlibApi::class)
110-
@Volatile // in Kotlin `volatile` is an annotation
109+
@Volatile // in Kotlin `volatile` is an annotation
111110
var counter = 0
112111

113112
fun main() = runBlocking {

kotlinx-coroutines-core/common/src/EventLoop.common.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ internal abstract class EventLoopImplBase: EventLoopImplPlatform(), Delay {
412412
@JvmField var nanoTime: Long
413413
) : Runnable, Comparable<DelayedTask>, DisposableHandle, ThreadSafeHeapNode, SynchronizedObject() {
414414
@Volatile
415-
@OptIn(ExperimentalStdlibApi::class)
416415
private var _heap: Any? = null // null | ThreadSafeHeap | DISPOSED_TASK
417416

418417
override var heap: ThreadSafeHeap<*>?

kotlinx-coroutines-core/jdk8/src/future/Future.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public suspend fun <T> CompletionStage<T>.await(): T {
180180
}
181181

182182
private class ContinuationHandler<T>(
183-
@Volatile @OptIn(ExperimentalStdlibApi::class) @JvmField var cont: Continuation<T>?
183+
@Volatile @JvmField var cont: Continuation<T>?
184184
) : BiFunction<T?, Throwable?, Unit> {
185185
@Suppress("UNCHECKED_CAST")
186186
override fun apply(result: T?, exception: Throwable?) {

kotlinx-coroutines-core/jvm/src/CoroutineContext.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ internal actual class UndispatchedCoroutine<in T>actual constructor (
213213
* in another.
214214
*/
215215
@Volatile
216-
@OptIn(ExperimentalStdlibApi::class)
217216
private var threadLocalIsSet = false
218217

219218
init {

kotlinx-coroutines-core/jvm/src/DefaultExecutor.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ internal actual object DefaultExecutor : EventLoopImplBase(), Runnable {
4444

4545
@Suppress("ObjectPropertyName")
4646
@Volatile
47-
@OptIn(ExperimentalStdlibApi::class)
4847
private var _thread: Thread? = null
4948

5049
override val thread: Thread
@@ -57,7 +56,6 @@ internal actual object DefaultExecutor : EventLoopImplBase(), Runnable {
5756
private const val SHUTDOWN = 4
5857

5958
@Volatile
60-
@OptIn(ExperimentalStdlibApi::class)
6159
private var debugStatus: Int = FRESH
6260

6361
private val isShutDown: Boolean get() = debugStatus == SHUTDOWN

kotlinx-coroutines-core/jvm/src/internal/ResizableAtomicArray.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import java.util.concurrent.atomic.*
1212
*/
1313
internal class ResizableAtomicArray<T>(initialLength: Int) {
1414
@Volatile
15-
@OptIn(ExperimentalStdlibApi::class)
1615
private var array = AtomicReferenceArray<T>(initialLength)
1716

1817
// for debug output

kotlinx-coroutines-core/jvm/src/scheduling/CoroutineScheduler.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,7 @@ internal class CoroutineScheduler(
596596
}
597597

598598
// guarded by scheduler lock, index in workers array, 0 when not in array (terminated)
599-
@Volatile
600-
@OptIn(ExperimentalStdlibApi::class) // volatile for push/pop operation into parkedWorkersStack
599+
@Volatile // volatile for push/pop operation into parkedWorkersStack
601600
var indexInArray = 0
602601
set(index) {
603602
name = "$schedulerName-worker-${if (index == 0) "TERMINATED" else index.toString()}"
@@ -648,7 +647,6 @@ internal class CoroutineScheduler(
648647
* This reference is set to [NOT_IN_STACK] when worker is physically not in stack.
649648
*/
650649
@Volatile
651-
@OptIn(ExperimentalStdlibApi::class)
652650
var nextParkedWorker: Any? = NOT_IN_STACK
653651

654652
/*

kotlinx-coroutines-core/jvm/test/CancellableContinuationJvmTest.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ class CancellableContinuationJvmTest : TestBase() {
6363

6464
private class BlockingSource {
6565
@Volatile
66-
@OptIn(ExperimentalStdlibApi::class)
6766
private var isCancelled = false
6867

6968
@Volatile
70-
@OptIn(ExperimentalStdlibApi::class)
7169
public var hasSubscriber = false
7270

7371
public fun subscribe() {

kotlinx-coroutines-core/jvm/test/ConcurrentTestUtilities.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ actual fun randomWait() {
1717

1818
private object BlackHole {
1919
@Volatile
20-
@OptIn(ExperimentalStdlibApi::class)
2120
var sink = 1
2221
}
2322

kotlinx-coroutines-core/jvm/test/JobDisposeStressTest.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,13 @@ class JobDisposeStressTest: TestBase() {
1414
private val TEST_DURATION = 3 * stressTestMultiplier // seconds
1515

1616
@Volatile
17-
@OptIn(ExperimentalStdlibApi::class)
1817
private var done = false
1918
@Volatile
20-
@OptIn(ExperimentalStdlibApi::class)
2119
private var job: TestJob? = null
2220
@Volatile
23-
@OptIn(ExperimentalStdlibApi::class)
2421
private var handle: DisposableHandle? = null
2522

2623
@Volatile
27-
@OptIn(ExperimentalStdlibApi::class)
2824
private var exception: Throwable? = null
2925

3026
private fun testThread(name: String, block: () -> Unit): Thread =
@@ -81,4 +77,4 @@ class JobDisposeStressTest: TestBase() {
8177

8278
@Suppress("DEPRECATION_ERROR")
8379
private class TestJob : JobSupport(active = true)
84-
}
80+
}

kotlinx-coroutines-core/jvm/test/JobHandlersUpgradeStressTest.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ class JobHandlersUpgradeStressTest : TestBase() {
2424
private val sink = atomic(0)
2525

2626
@Volatile
27-
@OptIn(ExperimentalStdlibApi::class)
2827
private var done = false
2928

3029
@Volatile
31-
@OptIn(ExperimentalStdlibApi::class)
3230
private var job: Job? = null
3331

3432
internal class State {
@@ -96,4 +94,4 @@ class JobHandlersUpgradeStressTest : TestBase() {
9694
println(" Fired handler ${fired.value} times")
9795

9896
}
99-
}
97+
}

kotlinx-coroutines-core/jvm/test/VirtualTimeSource.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ internal inline fun withVirtualTimeSource(log: PrintStream? = null, block: () ->
2727
private const val NOT_PARKED = -1L
2828

2929
private class ThreadStatus {
30-
@Volatile
31-
@OptIn(ExperimentalStdlibApi::class) @JvmField
30+
@Volatile @JvmField
3231
var parkedTill = NOT_PARKED
33-
@Volatile
34-
@OptIn(ExperimentalStdlibApi::class) @JvmField
32+
@Volatile @JvmField
3533
var permit = false
3634
var registered = 0
3735
override fun toString(): String = "parkedTill = ${TimeUnit.NANOSECONDS.toMillis(parkedTill)} ms, permit = $permit"
@@ -49,11 +47,9 @@ internal class VirtualTimeSource(
4947
private var checkpointNanos: Long = System.nanoTime()
5048

5149
@Volatile
52-
@OptIn(ExperimentalStdlibApi::class)
5350
private var isShutdown = false
5451

5552
@Volatile
56-
@OptIn(ExperimentalStdlibApi::class)
5753
private var time: Long = 0
5854

5955
private var trackedTasks = 0

kotlinx-coroutines-core/jvm/test/channels/ChannelUndeliveredElementSelectOldStressTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class ChannelUndeliveredElementSelectOldStressTest(private val kind: TestChannel
4040
private val receiverDone = Channel<Boolean>(1)
4141

4242
@Volatile
43-
@OptIn(ExperimentalStdlibApi::class)
4443
private var lastReceived = -1L
4544

4645
private var stoppedSender = 0L

kotlinx-coroutines-core/jvm/test/channels/ChannelUndeliveredElementStressTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class ChannelUndeliveredElementStressTest(private val kind: TestChannelKind) : T
4040
private val receiverDone = Channel<Boolean>(1)
4141

4242
@Volatile
43-
@OptIn(ExperimentalStdlibApi::class)
4443
private var lastReceived = -1L
4544

4645
private var stoppedSender = 0L

kotlinx-coroutines-core/jvm/test/flow/CallbackFlowTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class CallbackFlowTest : TestBase() {
1515
private class CallbackApi(val block: (SendChannel<Int>) -> Unit) {
1616
var started = false
1717
@Volatile
18-
@OptIn(ExperimentalStdlibApi::class)
1918
var stopped = false
2019
lateinit var thread: Thread
2120

kotlinx-coroutines-core/jvm/test/guide/example-sync-02.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ suspend fun massiveRun(action: suspend () -> Unit) {
2323
println("Completed ${n * k} actions in $time ms")
2424
}
2525

26-
@OptIn(ExperimentalStdlibApi::class)
27-
@Volatile // in Kotlin `volatile` is an annotation
26+
@Volatile // in Kotlin `volatile` is an annotation
2827
var counter = 0
2928

3029
fun main() = runBlocking {

kotlinx-coroutines-core/jvm/test/scheduling/WorkQueueStressTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class WorkQueueStressTest : TestBase() {
2222
private val producerQueue = WorkQueue()
2323

2424
@Volatile
25-
@OptIn(ExperimentalStdlibApi::class)
2625
private var producerFinished = false
2726

2827
@Before

reactive/kotlinx-coroutines-reactive/src/Publish.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public class PublisherCoroutine<in T>(
7474
private val _nRequested = atomic(0L) // < 0 when closed (CLOSED or SIGNALLED)
7575

7676
@Volatile
77-
@OptIn(ExperimentalStdlibApi::class)
7877
private var cancelled = false // true after Subscription.cancel() is invoked
7978

8079
override val isClosedForSend: Boolean get() = !isActive

reactive/kotlinx-coroutines-reactive/src/ReactiveFlow.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ public class FlowSubscription<T>(
197197
private val requested = atomic(0L)
198198
private val producer = atomic<Continuation<Unit>?>(createInitialContinuation())
199199
@Volatile
200-
@OptIn(ExperimentalStdlibApi::class)
201200
private var cancellationRequested = false
202201

203202
// This code wraps startCoroutineCancellable into continuation

reactive/kotlinx-coroutines-reactor/src/Mono.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ private class MonoCoroutine<in T>(
9797
private val sink: MonoSink<T>
9898
) : AbstractCoroutine<T>(parentContext, false, true), Disposable {
9999
@Volatile
100-
@OptIn(ExperimentalStdlibApi::class)
101100
private var disposed = false
102101

103102
override fun onCompleted(value: T) {

ui/kotlinx-coroutines-android/src/AndroidExceptionPreHandler.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ internal class AndroidExceptionPreHandler :
1313
AbstractCoroutineContextElement(CoroutineExceptionHandler), CoroutineExceptionHandler
1414
{
1515
@Volatile
16-
@OptIn(ExperimentalStdlibApi::class)
1716
private var _preHandler: Any? = this // uninitialized marker
1817

1918
// Reflectively lookup pre-handler.

ui/kotlinx-coroutines-android/src/HandlerDispatcher.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ internal class HandlerContext private constructor(
128128
) : this(handler, name, false)
129129

130130
@Volatile
131-
@OptIn(ExperimentalStdlibApi::class)
132131
private var _immediate: HandlerContext? = if (invokeImmediately) this else null
133132

134133
override val immediate: HandlerContext = _immediate ?:
@@ -177,7 +176,6 @@ internal class HandlerContext private constructor(
177176
override fun hashCode(): Int = System.identityHashCode(handler)
178177
}
179178

180-
@OptIn(ExperimentalStdlibApi::class)
181179
@Volatile
182180
private var choreographer: Choreographer? = null
183181

0 commit comments

Comments
 (0)