Skip to content

Commit 493b0a6

Browse files
committed
Promote MainScope and CoroutineScope.cancel to stable API
1 parent e79bc62 commit 493b0a6

File tree

4 files changed

+2
-10
lines changed

4 files changed

+2
-10
lines changed

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

+2-7
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ public operator fun CoroutineScope.plus(context: CoroutineContext): CoroutineSco
9292
* `val scope = MainScope() + CoroutineName("MyActivity")`.
9393
*/
9494
@Suppress("FunctionName")
95-
@ExperimentalCoroutinesApi // Experimental since 1.1.0, tentatively until 1.2.0
9695
public fun MainScope(): CoroutineScope = ContextScope(SupervisorJob() + Dispatchers.Main)
9796

9897
/**
@@ -199,12 +198,8 @@ public fun CoroutineScope(context: CoroutineContext): CoroutineScope =
199198
/**
200199
* Cancels this scope, including its job and all its children.
201200
* Throws [IllegalStateException] if the scope does not have a job in it.
202-
*
203-
* This API is experimental in order to investigate possible clashes with other cancellation mechanisms.
204-
*/
205-
@Suppress("NOTHING_TO_INLINE")
206-
@ExperimentalCoroutinesApi // Experimental and inline since 1.1.0, tentatively until 1.2.0
207-
public inline fun CoroutineScope.cancel() {
201+
**/
202+
public fun CoroutineScope.cancel() {
208203
val job = coroutineContext[Job] ?: error("Scope cannot be cancelled because it does not have a job: $this")
209204
job.cancel()
210205
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public abstract class MainCoroutineDispatcher : CoroutineDispatcher() {
3131
* }
3232
* // Do context-independent logic such as logging
3333
* }
34-
*
3534
* ```
3635
*
3736
* Method may throw [UnsupportedOperationException] if immediate dispatching is not supported by current dispatcher,

kotlinx-coroutines-test/src/internal/MainTestDispatcher.kt

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ internal class TestMainDispatcher(private val mainFactory: MainDispatcherFactory
2828
@Suppress("INVISIBLE_MEMBER")
2929
private val delay: Delay get() = delegate as? Delay ?: DefaultDelay
3030

31-
@ExperimentalCoroutinesApi
3231
override val immediate: MainCoroutineDispatcher
3332
get() = (delegate as? MainCoroutineDispatcher)?.immediate ?: this
3433

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

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public sealed class HandlerDispatcher : MainCoroutineDispatcher(), Delay {
4040
* }
4141
* // Do context-independent logic such as logging
4242
* }
43-
*
4443
* ```
4544
*/
4645
public abstract override val immediate: HandlerDispatcher

0 commit comments

Comments
 (0)