Migrate to Kotlin 1.3 coroutines, drop experimental from package
* Features based on version 0.30.0
* Uses Kotlin version 1.3.0-rc-57
* Uses Kotlin/Native version 0.9.2
* Uses AtomicFu 0.11.9-eap13
* Replace SuccessOrFailure with Result
* Replace buildSequence and buildIterator with sequence and iterator
* Apply @BuilderInference on all builders (including extension methods to workaround inference bug)
diff --git a/common/kotlinx-coroutines-core-common/src/AbstractContinuation.kt b/common/kotlinx-coroutines-core-common/src/AbstractContinuation.kt
index 1b93207..0276266 100644
--- a/common/kotlinx-coroutines-core-common/src/AbstractContinuation.kt
+++ b/common/kotlinx-coroutines-core-common/src/AbstractContinuation.kt
@@ -2,12 +2,12 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
private const val UNDECIDED = 0
private const val SUSPENDED = 1
@@ -137,11 +137,8 @@
return getSuccessfulResult(state)
}
- override fun resume(value: T) =
- resumeImpl(value, resumeMode)
-
- override fun resumeWithException(exception: Throwable) =
- resumeImpl(CompletedExceptionally(exception), resumeMode)
+ override fun resumeWith(result: Result<T>) =
+ resumeImpl(result.toState(), resumeMode)
internal fun resumeWithExceptionMode(exception: Throwable, mode: Int) =
resumeImpl(CompletedExceptionally(exception), mode)
diff --git a/common/kotlinx-coroutines-core-common/src/AbstractCoroutine.kt b/common/kotlinx-coroutines-core-common/src/AbstractCoroutine.kt
index 020af59..45888de 100644
--- a/common/kotlinx-coroutines-core-common/src/AbstractCoroutine.kt
+++ b/common/kotlinx-coroutines-core-common/src/AbstractCoroutine.kt
@@ -2,12 +2,12 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.CoroutineStart.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.CoroutineStart.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlin.coroutines.*
/**
* Abstract base class for implementation of coroutines in coroutine builders.
@@ -110,17 +110,10 @@
internal open val defaultResumeMode: Int get() = MODE_ATOMIC_DEFAULT
/**
- * Completes execution of this coroutine normally with the specified [value].
+ * Completes execution of this with coroutine with the specified result.
*/
- public final override fun resume(value: T) {
- makeCompletingOnce(value, defaultResumeMode)
- }
-
- /**
- * Completes execution of this with coroutine exceptionally with the specified [exception].
- */
- public final override fun resumeWithException(exception: Throwable) {
- makeCompletingOnce(CompletedExceptionally(exception), defaultResumeMode)
+ public final override fun resumeWith(result: Result<T>) {
+ makeCompletingOnce(result.toState(), defaultResumeMode)
}
internal final override fun handleOnCompletionException(exception: Throwable) {
diff --git a/common/kotlinx-coroutines-core-common/src/Annotations.kt b/common/kotlinx-coroutines-core-common/src/Annotations.kt
index 7aae365..8747356 100644
--- a/common/kotlinx-coroutines-core-common/src/Annotations.kt
+++ b/common/kotlinx-coroutines-core-common/src/Annotations.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
/**
* Marks declarations that are still **experimental** in coroutines API, which means that the design of the
diff --git a/common/kotlinx-coroutines-core-common/src/Await.kt b/common/kotlinx-coroutines-core-common/src/Await.kt
index e4c199b..baafe1d 100644
--- a/common/kotlinx-coroutines-core-common/src/Await.kt
+++ b/common/kotlinx-coroutines-core-common/src/Await.kt
@@ -2,10 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.internal.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
/**
* Awaits for completion of given deferred values without blocking a thread and resumes normally with the list of values
diff --git a/common/kotlinx-coroutines-core-common/src/Builders.common.kt b/common/kotlinx-coroutines-core-common/src/Builders.common.kt
index 43c8d42..e051246 100644
--- a/common/kotlinx-coroutines-core-common/src/Builders.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/Builders.common.kt
@@ -4,15 +4,17 @@
@file:JvmMultifileClass
@file:JvmName("BuildersKt")
+@file:UseExperimental(ExperimentalTypeInference::class)
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
+import kotlin.experimental.*
// --------------- launch ---------------
@@ -41,6 +43,7 @@
* @param start coroutine start option. The default value is [CoroutineStart.DEFAULT].
* @param block the coroutine code which will be invoked in the context of the provided scope.
**/
+@BuilderInference
public fun CoroutineScope.launch(
context: CoroutineContext = EmptyCoroutineContext,
start: CoroutineStart = CoroutineStart.DEFAULT,
@@ -72,7 +75,7 @@
*/
@Deprecated(
message = "Standalone coroutine builders are deprecated, use extensions on CoroutineScope instead",
- replaceWith = ReplaceWith("GlobalScope.launch(context, start, onCompletion, block)", imports = ["kotlinx.coroutines.experimental.*"])
+ replaceWith = ReplaceWith("GlobalScope.launch(context, start, onCompletion, block)", imports = ["kotlinx.coroutines.*"])
)
public fun launch(
context: CoroutineContext = Dispatchers.Default,
@@ -88,7 +91,7 @@
*/
@Deprecated(
message = "Standalone coroutine builders are deprecated, use extensions on CoroutineScope instead",
- replaceWith = ReplaceWith("GlobalScope.launch(context + parent, start, onCompletion, block)", imports = ["kotlinx.coroutines.experimental.*"])
+ replaceWith = ReplaceWith("GlobalScope.launch(context + parent, start, onCompletion, block)", imports = ["kotlinx.coroutines.*"])
)
public fun launch(
context: CoroutineContext = Dispatchers.Default,
diff --git a/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt b/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt
index fd09eb3..d0bb5a1 100644
--- a/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt
+++ b/common/kotlinx-coroutines-core-common/src/CancellableContinuation.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
// --------------- cancellable continuations ---------------
diff --git a/common/kotlinx-coroutines-core-common/src/CompletableDeferred.kt b/common/kotlinx-coroutines-core-common/src/CompletableDeferred.kt
index dd66847..664332b 100644
--- a/common/kotlinx-coroutines-core-common/src/CompletableDeferred.kt
+++ b/common/kotlinx-coroutines-core-common/src/CompletableDeferred.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.selects.*
/**
* A [Deferred] that can be completed via public functions [complete] or [cancel][Job.cancel].
diff --git a/common/kotlinx-coroutines-core-common/src/CompletedExceptionally.kt b/common/kotlinx-coroutines-core-common/src/CompletedExceptionally.kt
index 414d2d9..1998ddc 100644
--- a/common/kotlinx-coroutines-core-common/src/CompletedExceptionally.kt
+++ b/common/kotlinx-coroutines-core-common/src/CompletedExceptionally.kt
@@ -2,10 +2,16 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
+
+/**
+ * @suppress **This is unstable API and it is subject to change.**
+ */
+public fun <T> Result<T>.toState(): Any? =
+ if (isSuccess) getOrThrow() else CompletedExceptionally(exceptionOrNull()!!) // todo: need to do it better
/**
* Class for an internal state of a job that was cancelled (completed exceptionally).
diff --git a/common/kotlinx-coroutines-core-common/src/CompletionHandler.common.kt b/common/kotlinx-coroutines-core-common/src/CompletionHandler.common.kt
index 89f6a97..a916784 100644
--- a/common/kotlinx-coroutines-core-common/src/CompletionHandler.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/CompletionHandler.common.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
+import kotlinx.coroutines.internal.*
/**
* Handler for [Job.invokeOnCompletion] and [CancellableContinuation.invokeOnCancellation].
diff --git a/common/kotlinx-coroutines-core-common/src/CoroutineContext.common.kt b/common/kotlinx-coroutines-core-common/src/CoroutineContext.common.kt
index 5545599..fbe1778 100644
--- a/common/kotlinx-coroutines-core-common/src/CoroutineContext.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/CoroutineContext.common.kt
@@ -2,10 +2,14 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+@file:UseExperimental(ExperimentalTypeInference::class)
-import kotlin.coroutines.experimental.*
+package kotlinx.coroutines
+import kotlin.coroutines.*
+import kotlin.experimental.*
+
+@BuilderInference
public expect fun CoroutineScope.newCoroutineContext(context: CoroutineContext): CoroutineContext
/**
@@ -16,7 +20,7 @@
@Deprecated(
message = "Use Dispatchers.Default",
replaceWith = ReplaceWith("Dispatchers.Default",
- imports = ["kotlinx.coroutines.experimental.Dispatchers"]))
+ imports = ["kotlinx.coroutines.Dispatchers"]))
public expect val DefaultDispatcher: CoroutineDispatcher
internal expect fun createDefaultDispatcher(): CoroutineDispatcher
diff --git a/common/kotlinx-coroutines-core-common/src/CoroutineDispatcher.kt b/common/kotlinx-coroutines-core-common/src/CoroutineDispatcher.kt
index 2940f8d..2ec2520 100644
--- a/common/kotlinx-coroutines-core-common/src/CoroutineDispatcher.kt
+++ b/common/kotlinx-coroutines-core-common/src/CoroutineDispatcher.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
+import kotlin.coroutines.*
/**
* Base class that shall be extended by all coroutine dispatcher implementations.
diff --git a/common/kotlinx-coroutines-core-common/src/CoroutineExceptionHandler.kt b/common/kotlinx-coroutines-core-common/src/CoroutineExceptionHandler.kt
index 31ba34b..575857a 100644
--- a/common/kotlinx-coroutines-core-common/src/CoroutineExceptionHandler.kt
+++ b/common/kotlinx-coroutines-core-common/src/CoroutineExceptionHandler.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
internal expect fun handleCoroutineExceptionImpl(context: CoroutineContext, exception: Throwable)
diff --git a/common/kotlinx-coroutines-core-common/src/CoroutineName.kt b/common/kotlinx-coroutines-core-common/src/CoroutineName.kt
index 521ccbe..4a7e9ea 100644
--- a/common/kotlinx-coroutines-core-common/src/CoroutineName.kt
+++ b/common/kotlinx-coroutines-core-common/src/CoroutineName.kt
@@ -2,9 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
+import kotlin.coroutines.AbstractCoroutineContextElement
+import kotlin.coroutines.CoroutineContext
/**
* User-specified name of coroutine. This name is used in debugging mode.
diff --git a/common/kotlinx-coroutines-core-common/src/CoroutineScope.kt b/common/kotlinx-coroutines-core-common/src/CoroutineScope.kt
index 96f0ea1..ee51086 100644
--- a/common/kotlinx-coroutines-core-common/src/CoroutineScope.kt
+++ b/common/kotlinx-coroutines-core-common/src/CoroutineScope.kt
@@ -2,12 +2,15 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+@file:UseExperimental(ExperimentalTypeInference::class)
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+package kotlinx.coroutines
+
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlin.coroutines.intrinsics.*
+import kotlin.coroutines.*
+import kotlin.experimental.*
/**
* Defines a scope for new coroutines. Every coroutine builder
@@ -70,8 +73,8 @@
*
* This property is a shortcut for `coroutineContext.isActive` in the scope when
* [CoroutineScope] is available.
- * See [coroutineContext][kotlin.coroutines.experimental.coroutineContext],
- * [isActive][kotlinx.coroutines.experimental.isActive] and [Job.isActive].
+ * See [coroutineContext][kotlin.coroutines.coroutineContext],
+ * [isActive][kotlinx.coroutines.isActive] and [Job.isActive].
*
* @suppress **Deprecated**: Deprecated in favor of top-level extension property
*/
@@ -91,6 +94,7 @@
*
* This is a shorthand for `CoroutineScope(thisScope + context)`.
*/
+@BuilderInference
public operator fun CoroutineScope.plus(context: CoroutineContext): CoroutineScope =
ContextScope(coroutineContext + context)
@@ -106,10 +110,11 @@
*
* This property is a shortcut for `coroutineContext.isActive` in the scope when
* [CoroutineScope] is available.
- * See [coroutineContext][kotlin.coroutines.experimental.coroutineContext],
- * [isActive][kotlinx.coroutines.experimental.isActive] and [Job.isActive].
+ * See [coroutineContext][kotlin.coroutines.coroutineContext],
+ * [isActive][kotlinx.coroutines.isActive] and [Job.isActive].
*/
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
+@BuilderInference
public val CoroutineScope.isActive: Boolean
get() = coroutineContext[Job]?.isActive ?: true
diff --git a/common/kotlinx-coroutines-core-common/src/CoroutineStart.kt b/common/kotlinx-coroutines-core-common/src/CoroutineStart.kt
index add2341..edf5f7c 100644
--- a/common/kotlinx-coroutines-core-common/src/CoroutineStart.kt
+++ b/common/kotlinx-coroutines-core-common/src/CoroutineStart.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.CoroutineStart.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.CoroutineStart.*
+import kotlinx.coroutines.intrinsics.*
+import kotlin.coroutines.*
/**
* Defines start options for coroutines builders.
diff --git a/common/kotlinx-coroutines-core-common/src/Debug.common.kt b/common/kotlinx-coroutines-core-common/src/Debug.common.kt
index ad20c1d..92dd552 100644
--- a/common/kotlinx-coroutines-core-common/src/Debug.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/Debug.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
internal expect val Any.hexAddress: String
internal expect val Any.classSimpleName: String
diff --git a/common/kotlinx-coroutines-core-common/src/Deferred.kt b/common/kotlinx-coroutines-core-common/src/Deferred.kt
index b4681a5..b7cbc26 100644
--- a/common/kotlinx-coroutines-core-common/src/Deferred.kt
+++ b/common/kotlinx-coroutines-core-common/src/Deferred.kt
@@ -2,11 +2,14 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+@file:UseExperimental(ExperimentalTypeInference::class)
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
+package kotlinx.coroutines
+
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
+import kotlin.experimental.*
/**
* Deferred value is a non-blocking cancellable future — it is a [Job] that has a result.
@@ -27,7 +30,7 @@
* Such a deferred can be be made _active_ by invoking [start], [join], or [await].
*
* A deferred value is a [Job]. A job in the
- * [coroutineContext](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines.experimental/coroutine-context.html)
+ * [coroutineContext](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/coroutine-context.html)
* of [async][CoroutineScope.async] builder represents the coroutine itself.
*
* All functions on this interface and on all interfaces derived from it are **thread-safe** and can
@@ -99,6 +102,7 @@
/**
* @suppress **Deprecated**: onCompletion parameter is deprecated.
*/
+@BuilderInference
@Deprecated("onCompletion parameter is deprecated")
public fun <T> CoroutineScope.async(
context: CoroutineContext = EmptyCoroutineContext,
@@ -114,7 +118,7 @@
*/
@Deprecated(
message = "Standalone coroutine builders are deprecated, use extensions on CoroutineScope instead",
- replaceWith = ReplaceWith("GlobalScope.async(context, start, onCompletion, block)", imports = ["kotlinx.coroutines.experimental.*"])
+ replaceWith = ReplaceWith("GlobalScope.async(context, start, onCompletion, block)", imports = ["kotlinx.coroutines.*"])
)
public fun <T> async(
context: CoroutineContext = Dispatchers.Default,
@@ -130,7 +134,7 @@
*/
@Deprecated(
message = "Standalone coroutine builders are deprecated, use extensions on CoroutineScope instead",
- replaceWith = ReplaceWith("GlobalScope.async(context + parent, start, onCompletion, block)", imports = ["kotlinx.coroutines.experimental.*"])
+ replaceWith = ReplaceWith("GlobalScope.async(context + parent, start, onCompletion, block)", imports = ["kotlinx.coroutines.*"])
)
public fun <T> async(
context: CoroutineContext = Dispatchers.Default,
diff --git a/common/kotlinx-coroutines-core-common/src/Delay.kt b/common/kotlinx-coroutines-core-common/src/Delay.kt
index 9f2db58..75e83c2 100644
--- a/common/kotlinx-coroutines-core-common/src/Delay.kt
+++ b/common/kotlinx-coroutines-core-common/src/Delay.kt
@@ -2,18 +2,18 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.selects.*
-import kotlinx.coroutines.experimental.timeunit.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.selects.*
+import kotlinx.coroutines.timeunit.*
+import kotlin.coroutines.*
/**
* This dispatcher _feature_ is implemented by [CoroutineDispatcher] implementations that natively support
* scheduled execution of tasks.
*
* Implementation of this interface affects operation of
- * [delay][kotlinx.coroutines.experimental.delay] and [withTimeout] functions.
+ * [delay][kotlinx.coroutines.delay] and [withTimeout] functions.
*
* @suppress **This an internal API and should not be used from general code.**
*/
@@ -49,7 +49,7 @@
* [continuation] when the code is already executing in the appropriate thread:
*
* ```kotlin
- * with(continuation) { resumeUndispatched(Unit) }
+ * with(continuation) { resumeUndispatchedWith(Unit) }
* ```
*/
fun scheduleResumeAfterDelay(timeMillis: Long, continuation: CancellableContinuation<Unit>)
diff --git a/common/kotlinx-coroutines-core-common/src/Dispatched.kt b/common/kotlinx-coroutines-core-common/src/Dispatched.kt
index 83eed65..3f69f9d 100644
--- a/common/kotlinx-coroutines-core-common/src/Dispatched.kt
+++ b/common/kotlinx-coroutines-core-common/src/Dispatched.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
@Suppress("PrivatePropertyName")
private val UNDEFINED = Symbol("UNDEFINED")
@@ -27,24 +27,14 @@
override val delegate: Continuation<T>
get() = this
- override fun resume(value: T) {
+ override fun resumeWith(result: Result<T>) {
val context = continuation.context
if (dispatcher.isDispatchNeeded(context)) {
- _state = value
- resumeMode = MODE_ATOMIC_DEFAULT
- dispatcher.dispatch(context, this)
- } else
- resumeUndispatched(value)
- }
-
- override fun resumeWithException(exception: Throwable) {
- val context = continuation.context
- if (dispatcher.isDispatchNeeded(context)) {
- _state = CompletedExceptionally(exception)
+ _state = result.toState()
resumeMode = MODE_ATOMIC_DEFAULT
dispatcher.dispatch(context, this)
} else {
- resumeUndispatchedWithException(exception)
+ resumeUndispatchedWith(result)
}
}
@@ -88,6 +78,13 @@
}
@Suppress("NOTHING_TO_INLINE") // we need it inline to save us an entry on the stack
+ inline fun resumeUndispatchedWith(result: Result<T>) {
+ withCoroutineContext(context) {
+ continuation.resumeWith(result)
+ }
+ }
+
+ @Suppress("NOTHING_TO_INLINE") // we need it inline to save us an entry on the stack
inline fun resumeUndispatched(value: T) {
withCoroutineContext(context) {
continuation.resume(value)
diff --git a/common/kotlinx-coroutines-core-common/src/Dispatchers.common.kt b/common/kotlinx-coroutines-core-common/src/Dispatchers.common.kt
index be12640..3ac49b4 100644
--- a/common/kotlinx-coroutines-core-common/src/Dispatchers.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/Dispatchers.common.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
+import kotlin.coroutines.*
/**
* Groups various implementations of [CoroutineDispatcher].
diff --git a/common/kotlinx-coroutines-core-common/src/Exceptions.common.kt b/common/kotlinx-coroutines-core-common/src/Exceptions.common.kt
index 7762a36..2210fc9 100644
--- a/common/kotlinx-coroutines-core-common/src/Exceptions.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/Exceptions.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
@InternalCoroutinesApi
public expect class CompletionHandlerException(message: String, cause: Throwable) : RuntimeException
diff --git a/common/kotlinx-coroutines-core-common/src/Job.kt b/common/kotlinx-coroutines-core-common/src/Job.kt
index 23d9be9..399d66a 100644
--- a/common/kotlinx-coroutines-core-common/src/Job.kt
+++ b/common/kotlinx-coroutines-core-common/src/Job.kt
@@ -5,11 +5,11 @@
@file:JvmMultifileClass
@file:JvmName("JobKt")
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
// --------------- core job interfaces ---------------
@@ -63,7 +63,7 @@
* ```
*
* A `Job` instance in the
- * [coroutineContext](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines.experimental/coroutine-context.html)
+ * [coroutineContext](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.coroutines/coroutine-context.html)
* represents the coroutine itself.
*
* A job can have a _parent_ job. A job with a parent is cancelled when its parent is cancelled.
diff --git a/common/kotlinx-coroutines-core-common/src/JobSupport.kt b/common/kotlinx-coroutines-core-common/src/JobSupport.kt
index 4b1ca86..3e1f5d6 100644
--- a/common/kotlinx-coroutines-core-common/src/JobSupport.kt
+++ b/common/kotlinx-coroutines-core-common/src/JobSupport.kt
@@ -2,14 +2,14 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* A concrete implementation of [Job]. It is optionally a child to a parent job.
@@ -843,7 +843,7 @@
}
}
- public final override val children: Sequence<Job> get() = buildSequence {
+ public final override val children: Sequence<Job> get() = sequence {
val state = this@JobSupport.state
when (state) {
is ChildHandleNode -> yield(state.childJob)
diff --git a/common/kotlinx-coroutines-core-common/src/MainCoroutineDispatcher.kt b/common/kotlinx-coroutines-core-common/src/MainCoroutineDispatcher.kt
index b0da263..687232d 100644
--- a/common/kotlinx-coroutines-core-common/src/MainCoroutineDispatcher.kt
+++ b/common/kotlinx-coroutines-core-common/src/MainCoroutineDispatcher.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
/**
* Base class for special [CoroutineDispatcher] which is confined to application "Main" or "UI" thread
diff --git a/common/kotlinx-coroutines-core-common/src/NonCancellable.kt b/common/kotlinx-coroutines-core-common/src/NonCancellable.kt
index 8c12ae5..2d07ea3 100644
--- a/common/kotlinx-coroutines-core-common/src/NonCancellable.kt
+++ b/common/kotlinx-coroutines-core-common/src/NonCancellable.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.NonCancellable.isActive
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.NonCancellable.isActive
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
/**
* A non-cancelable job that is always [active][isActive]. It is designed for [withContext] function
diff --git a/common/kotlinx-coroutines-core-common/src/ResumeMode.kt b/common/kotlinx-coroutines-core-common/src/ResumeMode.kt
index a444347..885dfa3 100644
--- a/common/kotlinx-coroutines-core-common/src/ResumeMode.kt
+++ b/common/kotlinx-coroutines-core-common/src/ResumeMode.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
@PublishedApi internal const val MODE_ATOMIC_DEFAULT = 0 // schedule non-cancellable dispatch for suspendCoroutine
@PublishedApi internal const val MODE_CANCELLABLE = 1 // schedule cancellable dispatch for suspendCancellableCoroutine
diff --git a/common/kotlinx-coroutines-core-common/src/Runnable.common.kt b/common/kotlinx-coroutines-core-common/src/Runnable.common.kt
index c677dd1..8f8f916 100644
--- a/common/kotlinx-coroutines-core-common/src/Runnable.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/Runnable.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
public expect interface Runnable {
public fun run()
diff --git a/common/kotlinx-coroutines-core-common/src/Scheduled.kt b/common/kotlinx-coroutines-core-common/src/Scheduled.kt
index 1545843..8dd974a 100644
--- a/common/kotlinx-coroutines-core-common/src/Scheduled.kt
+++ b/common/kotlinx-coroutines-core-common/src/Scheduled.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.selects.*
-import kotlinx.coroutines.experimental.timeunit.*
+import kotlinx.coroutines.selects.*
+import kotlinx.coroutines.timeunit.*
@Deprecated(level = DeprecationLevel.HIDDEN, message = "binary compatibility")
public suspend fun <T> withTimeout(time: Int, block: suspend CoroutineScope.() -> T): T =
diff --git a/common/kotlinx-coroutines-core-common/src/Supervisor.kt b/common/kotlinx-coroutines-core-common/src/Supervisor.kt
index 988162a..8b9dad9 100644
--- a/common/kotlinx-coroutines-core-common/src/Supervisor.kt
+++ b/common/kotlinx-coroutines-core-common/src/Supervisor.kt
@@ -2,12 +2,12 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* Creates a new _supervisor_ job object in an active state.
diff --git a/common/kotlinx-coroutines-core-common/src/Timeout.kt b/common/kotlinx-coroutines-core-common/src/Timeout.kt
index a7ac0e8..6226594 100644
--- a/common/kotlinx-coroutines-core-common/src/Timeout.kt
+++ b/common/kotlinx-coroutines-core-common/src/Timeout.kt
@@ -2,13 +2,13 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* Runs a given suspending [block] of code inside a coroutine with a specified timeout and throws
diff --git a/common/kotlinx-coroutines-core-common/src/Unconfined.kt b/common/kotlinx-coroutines-core-common/src/Unconfined.kt
index fda0c0f..7a0248c 100644
--- a/common/kotlinx-coroutines-core-common/src/Unconfined.kt
+++ b/common/kotlinx-coroutines-core-common/src/Unconfined.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
+import kotlin.coroutines.*
/**
* A coroutine dispatcher that is not confined to any specific thread.
@@ -13,7 +13,7 @@
@Deprecated(
message = "Use Dispatchers.Unconfined",
replaceWith = ReplaceWith("Dispatchers.Unconfined",
- imports = ["kotlinx.coroutines.experimental.Dispatchers"])
+ imports = ["kotlinx.coroutines.Dispatchers"])
)
// todo: This will become an internal implementation object
public object Unconfined : CoroutineDispatcher() {
diff --git a/common/kotlinx-coroutines-core-common/src/Yield.kt b/common/kotlinx-coroutines-core-common/src/Yield.kt
index f0d3de2..632dcba 100644
--- a/common/kotlinx-coroutines-core-common/src/Yield.kt
+++ b/common/kotlinx-coroutines-core-common/src/Yield.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* Yields a thread (or thread pool) of the current coroutine dispatcher to other coroutines to run.
diff --git a/common/kotlinx-coroutines-core-common/src/channels/AbstractChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/AbstractChannel.kt
index 201449b..c7d2981 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/AbstractChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/AbstractChannel.kt
@@ -2,14 +2,14 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
/**
* Abstract send channel. It is a base class for all send channel implementations.
diff --git a/common/kotlinx-coroutines-core-common/src/channels/ArrayBroadcastChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/ArrayBroadcastChannel.kt
index 2c795bc..834f6e1 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/ArrayBroadcastChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/ArrayBroadcastChannel.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.selects.*
/**
* Broadcast channel with array buffer of a fixed [capacity].
diff --git a/common/kotlinx-coroutines-core-common/src/channels/ArrayChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/ArrayChannel.kt
index a69a684..60398bb 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/ArrayChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/ArrayChannel.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.selects.*
/**
* Channel with array buffer of a fixed [capacity].
@@ -16,7 +16,7 @@
*
* This implementation uses lock to protect the buffer, which is held only during very short buffer-update operations.
* The lists of suspended senders or receivers are lock-free.
- *
+ *
* @suppress **This an internal API and should not be used from general code.**
*/
@InternalCoroutinesApi
diff --git a/common/kotlinx-coroutines-core-common/src/channels/Broadcast.kt b/common/kotlinx-coroutines-core-common/src/channels/Broadcast.kt
index 8b46a51..4fcff71 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/Broadcast.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/Broadcast.kt
@@ -2,13 +2,16 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+@file:UseExperimental(ExperimentalTypeInference::class)
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.channels.Channel.Factory.CONFLATED
-import kotlinx.coroutines.experimental.channels.Channel.Factory.UNLIMITED
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlin.coroutines.experimental.*
+package kotlinx.coroutines.channels
+
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.Channel.Factory.CONFLATED
+import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
+import kotlinx.coroutines.intrinsics.*
+import kotlin.coroutines.*
+import kotlin.experimental.*
/**
* Broadcasts all elements of the channel.
@@ -34,7 +37,7 @@
message = "Standalone coroutine builders are deprecated, use extensions on CoroutineScope instead",
replaceWith = ReplaceWith(
"GlobalScope.broadcast(context + parent, capacity, start, onCompletion, block)",
- imports = ["kotlinx.coroutines.experimental.GlobalScope", "kotlinx.coroutines.experimental.channels.broadcast"]
+ imports = ["kotlinx.coroutines.GlobalScope", "kotlinx.coroutines.channels.broadcast"]
)
)
public fun <E> broadcast(
@@ -43,7 +46,7 @@
start: CoroutineStart = CoroutineStart.LAZY,
parent: Job? = null,
onCompletion: CompletionHandler? = null,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): BroadcastChannel<E> =
GlobalScope.broadcast(context + (parent ?: EmptyCoroutineContext), capacity, start, onCompletion, block)
@@ -83,12 +86,13 @@
* @param onCompletion optional completion handler for the producer coroutine (see [Job.invokeOnCompletion]).
* @param block the coroutine code.
*/
+@BuilderInference
public fun <E> CoroutineScope.broadcast(
context: CoroutineContext = EmptyCoroutineContext,
capacity: Int = 1,
start: CoroutineStart = CoroutineStart.LAZY,
onCompletion: CompletionHandler? = null,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): BroadcastChannel<E> {
val newContext = newCoroutineContext(context)
val channel = BroadcastChannel<E>(capacity)
diff --git a/common/kotlinx-coroutines-core-common/src/channels/BroadcastChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/BroadcastChannel.kt
index 59d70e7..a48cec1 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/BroadcastChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/BroadcastChannel.kt
@@ -2,12 +2,12 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.channels.Channel.Factory.CONFLATED
-import kotlinx.coroutines.experimental.channels.Channel.Factory.UNLIMITED
-import kotlinx.coroutines.experimental.internal.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.Channel.Factory.CONFLATED
+import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
+import kotlinx.coroutines.internal.*
/**
* Broadcast channel is a non-blocking primitive for communication between the sender and multiple receivers
diff --git a/common/kotlinx-coroutines-core-common/src/channels/Channel.kt b/common/kotlinx-coroutines-core-common/src/channels/Channel.kt
index 091f368..337ffbb 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/Channel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/Channel.kt
@@ -4,13 +4,13 @@
@file:Suppress("FunctionName")
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.channels.Channel.Factory.CONFLATED
-import kotlinx.coroutines.experimental.channels.Channel.Factory.RENDEZVOUS
-import kotlinx.coroutines.experimental.channels.Channel.Factory.UNLIMITED
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.Channel.Factory.RENDEZVOUS
+import kotlinx.coroutines.channels.Channel.Factory.CONFLATED
+import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
+import kotlinx.coroutines.selects.*
/**
* Sender's interface to [Channel].
@@ -384,7 +384,7 @@
/**
* Creates a channel with the specified buffer capacity (or without a buffer by default).
* See [Channel] interface documentation for details.
- *
+ *
* @throws IllegalArgumentException when [capacity] < -1
*/
public fun <E> Channel(capacity: Int = RENDEZVOUS): Channel<E> =
diff --git a/common/kotlinx-coroutines-core-common/src/channels/ChannelCoroutine.kt b/common/kotlinx-coroutines-core-common/src/channels/ChannelCoroutine.kt
index 07e5798..70af6b2 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/ChannelCoroutine.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/ChannelCoroutine.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
internal open class ChannelCoroutine<E>(
parentContext: CoroutineContext,
diff --git a/common/kotlinx-coroutines-core-common/src/channels/Channels.common.kt b/common/kotlinx-coroutines-core-common/src/channels/Channels.common.kt
index f52a3ea..0a20ca4 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/Channels.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/Channels.common.kt
@@ -4,11 +4,11 @@
@file:JvmMultifileClass
@file:JvmName("ChannelsKt")
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
internal const val DEFAULT_CLOSE_MESSAGE = "Channel was closed"
diff --git a/common/kotlinx-coroutines-core-common/src/channels/ConflatedBroadcastChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/ConflatedBroadcastChannel.kt
index a91129d..99caf1c 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/ConflatedBroadcastChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/ConflatedBroadcastChannel.kt
@@ -2,13 +2,13 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.selects.*
/**
* Broadcasts the most recently sent element (aka [value]) to all [openSubscription] subscribers.
diff --git a/common/kotlinx-coroutines-core-common/src/channels/ConflatedChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/ConflatedChannel.kt
index 0e322cf..99cf9bc 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/ConflatedChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/ConflatedChannel.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.selects.*
+import kotlinx.coroutines.*
/**
* Channel that buffers at most one element and conflates all subsequent `send` and `offer` invocations,
diff --git a/common/kotlinx-coroutines-core-common/src/channels/LinkedListChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/LinkedListChannel.kt
index 5b017ca..f825c40 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/LinkedListChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/LinkedListChannel.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.selects.*
+import kotlinx.coroutines.*
/**
* Channel with linked-list buffer of a unlimited capacity (limited only by available memory).
diff --git a/common/kotlinx-coroutines-core-common/src/channels/Produce.kt b/common/kotlinx-coroutines-core-common/src/channels/Produce.kt
index b7e75de..47bce68 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/Produce.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/Produce.kt
@@ -2,11 +2,14 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+@file:UseExperimental(ExperimentalTypeInference::class)
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.channels.Channel.Factory.UNLIMITED
-import kotlin.coroutines.experimental.*
+package kotlinx.coroutines.channels
+
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
+import kotlin.coroutines.*
+import kotlin.experimental.*
/**
* Scope for [produce][CoroutineScope.produce] coroutine builder.
@@ -68,10 +71,11 @@
* @param block the coroutine code.
*/
@ExperimentalCoroutinesApi
+@BuilderInference
public fun <E> CoroutineScope.produce(
context: CoroutineContext = EmptyCoroutineContext,
capacity: Int = 0,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): ReceiveChannel<E> {
val channel = Channel<E>(capacity)
val newContext = newCoroutineContext(context)
@@ -84,12 +88,13 @@
* @suppress **This an internal API and should not be used from general code.**
* onCompletion parameter will be redesigned.
*/
+@BuilderInference
@InternalCoroutinesApi
public fun <E> CoroutineScope.produce(
context: CoroutineContext = EmptyCoroutineContext,
capacity: Int = 0,
onCompletion: CompletionHandler? = null,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): ReceiveChannel<E> {
val channel = Channel<E>(capacity)
val newContext = newCoroutineContext(context)
@@ -107,13 +112,13 @@
@Deprecated(
message = "Standalone coroutine builders are deprecated, use extensions on CoroutineScope instead",
replaceWith = ReplaceWith("GlobalScope.produce(context, capacity, onCompletion, block)",
- imports = ["kotlinx.coroutines.experimental.GlobalScope", "kotlinx.coroutines.experimental.channels.produce"])
+ imports = ["kotlinx.coroutines.GlobalScope", "kotlinx.coroutines.channels.produce"])
)
public fun <E> produce(
context: CoroutineContext = Dispatchers.Default,
capacity: Int = 0,
onCompletion: CompletionHandler? = null,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): ReceiveChannel<E> =
GlobalScope.produce(context, capacity, onCompletion, block)
@@ -125,14 +130,14 @@
@Deprecated(
message = "Standalone coroutine builders are deprecated, use extensions on CoroutineScope instead",
replaceWith = ReplaceWith("GlobalScope.produce(context + parent, capacity, onCompletion, block)",
- imports = ["kotlinx.coroutines.experimental.GlobalScope", "kotlinx.coroutines.experimental.channels.produce"])
+ imports = ["kotlinx.coroutines.GlobalScope", "kotlinx.coroutines.channels.produce"])
)
public fun <E> produce(
context: CoroutineContext = Dispatchers.Default,
capacity: Int = 0,
parent: Job? = null,
onCompletion: CompletionHandler? = null,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): ReceiveChannel<E> =
GlobalScope.produce(context + (parent ?: EmptyCoroutineContext), capacity, onCompletion, block)
@@ -142,7 +147,7 @@
context: CoroutineContext = Dispatchers.Default,
capacity: Int = 0,
parent: Job? = null,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): ReceiveChannel<E> = GlobalScope.produce(context + (parent ?: EmptyCoroutineContext), capacity, block = block)
/** @suppress **Deprecated**: Binary compatibility */
@@ -150,7 +155,7 @@
public fun <E> produce(
context: CoroutineContext = Dispatchers.Default,
capacity: Int = 0,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): ProducerJob<E> =
GlobalScope.produce(context, capacity, block = block) as ProducerJob<E>
@@ -161,7 +166,7 @@
public fun <E> buildChannel(
context: CoroutineContext,
capacity: Int = 0,
- block: suspend ProducerScope<E>.() -> Unit
+ @BuilderInference block: suspend ProducerScope<E>.() -> Unit
): ProducerJob<E> =
GlobalScope.produce(context, capacity, block = block) as ProducerJob<E>
diff --git a/common/kotlinx-coroutines-core-common/src/channels/RendezvousChannel.kt b/common/kotlinx-coroutines-core-common/src/channels/RendezvousChannel.kt
index 0c7f2d0..12a4572 100644
--- a/common/kotlinx-coroutines-core-common/src/channels/RendezvousChannel.kt
+++ b/common/kotlinx-coroutines-core-common/src/channels/RendezvousChannel.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
/**
* Rendezvous channel. This channel does not have any buffer at all. An element is transferred from sender
diff --git a/common/kotlinx-coroutines-core-common/src/internal/Annotations.common.kt b/common/kotlinx-coroutines-core-common/src/internal/Annotations.common.kt
index b77b46a..ebc4367 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/Annotations.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/Annotations.common.kt
@@ -4,7 +4,7 @@
// NOTE: We are defining them in a special internal package because they would break
// user code that uses kotlinx.coroutines library otherwise, see https://youtrack.jetbrains.com/issue/KT-23727
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
@Target(AnnotationTarget.FILE, AnnotationTarget.FUNCTION)
internal expect annotation class JvmName(val name: String)
diff --git a/common/kotlinx-coroutines-core-common/src/internal/ArrayCopy.common.kt b/common/kotlinx-coroutines-core-common/src/internal/ArrayCopy.common.kt
index 27fbbdc..ac620ba 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/ArrayCopy.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/ArrayCopy.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
/**
* Cross-platform array copy. Overlaps of source and destination are not supported
diff --git a/common/kotlinx-coroutines-core-common/src/internal/Atomic.kt b/common/kotlinx-coroutines-core-common/src/internal/Atomic.kt
index 4014030..f131ab6 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/Atomic.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/Atomic.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
import kotlinx.atomicfu.atomic
diff --git a/common/kotlinx-coroutines-core-common/src/internal/Closeable.common.kt b/common/kotlinx-coroutines-core-common/src/internal/Closeable.common.kt
index a9613c1..8b42e44 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/Closeable.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/Closeable.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
/**
* Closeable entity.
diff --git a/common/kotlinx-coroutines-core-common/src/internal/Concurrent.common.kt b/common/kotlinx-coroutines-core-common/src/internal/Concurrent.common.kt
index be4b57c..01416cf 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/Concurrent.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/Concurrent.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
/**
* Special kind of list intended to be used as collection of subscribers in `ArrayBroadcastChannel`
diff --git a/common/kotlinx-coroutines-core-common/src/internal/LockFreeLinkedList.common.kt b/common/kotlinx-coroutines-core-common/src/internal/LockFreeLinkedList.common.kt
index 410ae56..5f88cad 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/LockFreeLinkedList.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/LockFreeLinkedList.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
/** @suppress **This is unstable API and it is subject to change.** */
public expect open class LockFreeLinkedListNode() {
diff --git a/common/kotlinx-coroutines-core-common/src/internal/MainDispatcherFactory.kt b/common/kotlinx-coroutines-core-common/src/internal/MainDispatcherFactory.kt
index 6077849..3255b39 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/MainDispatcherFactory.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/MainDispatcherFactory.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
@InternalCoroutinesApi // Emulating DI for Kotlin object's
public interface MainDispatcherFactory {
diff --git a/common/kotlinx-coroutines-core-common/src/internal/Scopes.kt b/common/kotlinx-coroutines-core-common/src/internal/Scopes.kt
index 7625c1b..f9aeaf9 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/Scopes.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/Scopes.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
-import kotlinx.coroutines.experimental.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
/**
* This is a coroutine instance that is created by [coroutineScope] builder.
diff --git a/common/kotlinx-coroutines-core-common/src/internal/Symbol.kt b/common/kotlinx-coroutines-core-common/src/internal/Symbol.kt
index 831d73f..ddc9571 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/Symbol.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/Symbol.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
/**
* A symbol class that is used to define unique constants that are self-explanatory in debugger.
diff --git a/common/kotlinx-coroutines-core-common/src/internal/Synchronized.common.kt b/common/kotlinx-coroutines-core-common/src/internal/Synchronized.common.kt
index 6f51cbe..6b05202 100644
--- a/common/kotlinx-coroutines-core-common/src/internal/Synchronized.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/internal/Synchronized.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.internal
+package kotlinx.coroutines.internal
internal expect open class SynchronizedObject() // marker abstract class
diff --git a/common/kotlinx-coroutines-core-common/src/intrinsics/Cancellable.kt b/common/kotlinx-coroutines-core-common/src/intrinsics/Cancellable.kt
index 5d263f1..c155b96 100644
--- a/common/kotlinx-coroutines-core-common/src/intrinsics/Cancellable.kt
+++ b/common/kotlinx-coroutines-core-common/src/intrinsics/Cancellable.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.intrinsics
+package kotlinx.coroutines.intrinsics
-import kotlinx.coroutines.experimental.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* Use this function to start coroutine in a cancellable way, so that it can be cancelled
@@ -16,7 +16,7 @@
*/
@InternalCoroutinesApi
public fun <T> (suspend () -> T).startCoroutineCancellable(completion: Continuation<T>) =
- createCoroutineUnchecked(completion).resumeCancellable(Unit)
+ createCoroutineUnintercepted(completion).intercepted().resumeCancellable(Unit)
/**
* Use this function to start coroutine in a cancellable way, so that it can be cancelled
@@ -26,4 +26,4 @@
*/
@InternalCoroutinesApi
public fun <R, T> (suspend (R) -> T).startCoroutineCancellable(receiver: R, completion: Continuation<T>) =
- createCoroutineUnchecked(receiver, completion).resumeCancellable(Unit)
+ createCoroutineUnintercepted(receiver, completion).intercepted().resumeCancellable(Unit)
diff --git a/common/kotlinx-coroutines-core-common/src/intrinsics/Undispatched.kt b/common/kotlinx-coroutines-core-common/src/intrinsics/Undispatched.kt
index 8daf5da..ac61434 100644
--- a/common/kotlinx-coroutines-core-common/src/intrinsics/Undispatched.kt
+++ b/common/kotlinx-coroutines-core-common/src/intrinsics/Undispatched.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.intrinsics
+package kotlinx.coroutines.intrinsics
-import kotlinx.coroutines.experimental.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* Use this function to restart coroutine directly from inside of [suspendCoroutine],
diff --git a/common/kotlinx-coroutines-core-common/src/selects/Select.kt b/common/kotlinx-coroutines-core-common/src/selects/Select.kt
index bbec635..d7bd306 100644
--- a/common/kotlinx-coroutines-core-common/src/selects/Select.kt
+++ b/common/kotlinx-coroutines-core-common/src/selects/Select.kt
@@ -2,16 +2,16 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.channels.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.timeunit.*
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.timeunit.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* Scope for [select] invocation.
@@ -251,22 +251,15 @@
}
// Resumes in MODE_DIRECT
- override fun resume(value: R) {
- doResume({ value }) {
- uCont.resume(value)
- }
- }
-
- // Resumes in MODE_DIRECT
- override fun resumeWithException(exception: Throwable) {
- doResume({ Fail(exception) }) {
- uCont.resumeWithException(exception)
+ override fun resumeWith(result: Result<R>) {
+ doResume({ result.toState() }) {
+ uCont.resumeWith(result)
}
}
// Resumes in MODE_CANCELLABLE
override fun resumeSelectCancellableWithException(exception: Throwable) {
- doResume({ Fail(exception) }) {
+ doResume({ CompletedExceptionally(exception) }) {
uCont.intercepted().resumeCancellableWithException(exception)
}
}
@@ -281,7 +274,7 @@
}
when {
result === RESUMED -> throw IllegalStateException("Already resumed")
- result is Fail -> throw result.exception
+ result is CompletedExceptionally -> throw result.cause
else -> return result // either COROUTINE_SUSPENDED or data
}
}
@@ -438,8 +431,4 @@
private class DisposeNode(
@JvmField val handle: DisposableHandle
) : LockFreeLinkedListNode()
-
- private class Fail(
- @JvmField val exception: Throwable
- )
}
diff --git a/common/kotlinx-coroutines-core-common/src/selects/SelectUnbiased.kt b/common/kotlinx-coroutines-core-common/src/selects/SelectUnbiased.kt
index 2c84d47..37521d8 100644
--- a/common/kotlinx-coroutines-core-common/src/selects/SelectUnbiased.kt
+++ b/common/kotlinx-coroutines-core-common/src/selects/SelectUnbiased.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
/**
* Waits for the result of multiple suspending functions simultaneously like [select], but in an _unbiased_
diff --git a/common/kotlinx-coroutines-core-common/src/selects/WhileSelect.kt b/common/kotlinx-coroutines-core-common/src/selects/WhileSelect.kt
index f9260b9..1726f5f 100644
--- a/common/kotlinx-coroutines-core-common/src/selects/WhileSelect.kt
+++ b/common/kotlinx-coroutines-core-common/src/selects/WhileSelect.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
/**
* Loops while [select] expression returns `true`.
diff --git a/common/kotlinx-coroutines-core-common/src/sync/Mutex.kt b/common/kotlinx-coroutines-core-common/src/sync/Mutex.kt
index 896e682..1999877 100644
--- a/common/kotlinx-coroutines-core-common/src/sync/Mutex.kt
+++ b/common/kotlinx-coroutines-core-common/src/sync/Mutex.kt
@@ -2,14 +2,14 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.sync
+package kotlinx.coroutines.sync
import kotlinx.atomicfu.*
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.internal.*
-import kotlinx.coroutines.experimental.intrinsics.*
-import kotlinx.coroutines.experimental.selects.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.internal.*
+import kotlinx.coroutines.intrinsics.*
+import kotlinx.coroutines.selects.*
+import kotlin.coroutines.*
/**
* Mutual exclusion for coroutines.
diff --git a/common/kotlinx-coroutines-core-common/src/timeunit/TimeUnit.common.kt b/common/kotlinx-coroutines-core-common/src/timeunit/TimeUnit.common.kt
index f10609e..76710f1 100644
--- a/common/kotlinx-coroutines-core-common/src/timeunit/TimeUnit.common.kt
+++ b/common/kotlinx-coroutines-core-common/src/timeunit/TimeUnit.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.timeunit
+package kotlinx.coroutines.timeunit
/*
* @suppress **Deprecated** No replacement
diff --git a/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt b/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt
index e9a141e..53b8fba 100644
--- a/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AbstractCoroutineTest.kt
@@ -2,8 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
+import kotlin.coroutines.*
import kotlin.test.*
class AbstractCoroutineTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt b/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt
index 79fea2c..1177348 100644
--- a/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AsyncLazyTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/AsyncTest.kt b/common/kotlinx-coroutines-core-common/test/AsyncTest.kt
index 3e59837..b3a2463 100644
--- a/common/kotlinx-coroutines-core-common/test/AsyncTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AsyncTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/AtomicCancellationCommonTest.kt b/common/kotlinx-coroutines-core-common/test/AtomicCancellationCommonTest.kt
index a3a296e..1e6e836 100644
--- a/common/kotlinx-coroutines-core-common/test/AtomicCancellationCommonTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AtomicCancellationCommonTest.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.selects.*
-import kotlinx.coroutines.experimental.sync.*
+import kotlinx.coroutines.selects.*
+import kotlinx.coroutines.sync.*
import kotlin.test.*
class AtomicCancellationCommonTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/AwaitTest.kt b/common/kotlinx-coroutines-core-common/test/AwaitTest.kt
index 810f00b..6cd961d 100644
--- a/common/kotlinx-coroutines-core-common/test/AwaitTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/AwaitTest.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
@@ -36,13 +36,13 @@
@Test
fun testAwaitAllLazy() = runTest {
expect(1)
- val d = async(start = CoroutineStart.LAZY) {
- expect(2);
- 1
+ val d = async(start = CoroutineStart.LAZY) {
+ expect(2);
+ 1
}
- val d2 = async(start = CoroutineStart.LAZY) {
- expect(3);
- 2
+ val d2 = async(start = CoroutineStart.LAZY) {
+ expect(3);
+ 2
}
assertEquals(listOf(1, 2), awaitAll(d, d2))
finish(4)
diff --git a/common/kotlinx-coroutines-core-common/test/CancellableContinuationHandlersTest.kt b/common/kotlinx-coroutines-core-common/test/CancellableContinuationHandlersTest.kt
index 8dfbaf4..d177ead 100644
--- a/common/kotlinx-coroutines-core-common/test/CancellableContinuationHandlersTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CancellableContinuationHandlersTest.kt
@@ -2,8 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
+import kotlin.coroutines.*
import kotlin.test.*
class CancellableContinuationHandlersTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt b/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt
index c56cc17..7edf655 100644
--- a/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CancellableContinuationTest.kt
@@ -3,9 +3,9 @@
*/
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
+import kotlin.coroutines.*
import kotlin.test.*
class CancellableContinuationTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt b/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt
index b7cc7ab..9d824dd 100644
--- a/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CompletableDeferredTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED", "DEPRECATION") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt b/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt
index 80ddd46..86a96d2 100644
--- a/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CoroutineExceptionHandlerTest.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt b/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt
index b3d9125..b0e4ba2 100644
--- a/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CoroutineScopeTest.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.internal.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.internal.*
+import kotlin.coroutines.*
import kotlin.test.*
class CoroutineScopeTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt b/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt
index 05da2d2..281e750 100644
--- a/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CoroutinesTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/CurrentScopeTest.kt b/common/kotlinx-coroutines-core-common/test/CurrentScopeTest.kt
index db17064..ab7fe73 100644
--- a/common/kotlinx-coroutines-core-common/test/CurrentScopeTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/CurrentScopeTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/DelayTest.kt b/common/kotlinx-coroutines-core-common/test/DelayTest.kt
index 69cb52e..df4a3ea 100644
--- a/common/kotlinx-coroutines-core-common/test/DelayTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/DelayTest.kt
@@ -5,9 +5,9 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED", "DEPRECATION") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.timeunit.*
+import kotlinx.coroutines.timeunit.*
import kotlin.test.*
class DelayTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/ExperimentalDispatchModeTest.kt b/common/kotlinx-coroutines-core-common/test/ExperimentalDispatchModeTest.kt
index fc93628..37e6182 100644
--- a/common/kotlinx-coroutines-core-common/test/ExperimentalDispatchModeTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/ExperimentalDispatchModeTest.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt b/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt
index 975e376..57a5e46 100644
--- a/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/FailedJobTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt b/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt
index 9306157..3e1a4e2 100644
--- a/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/JobStatesTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/JobTest.kt b/common/kotlinx-coroutines-core-common/test/JobTest.kt
index 9e02419..61c8850 100644
--- a/common/kotlinx-coroutines-core-common/test/JobTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/JobTest.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/LaunchLazyTest.kt b/common/kotlinx-coroutines-core-common/test/LaunchLazyTest.kt
index fd1ef7a..1ed466d 100644
--- a/common/kotlinx-coroutines-core-common/test/LaunchLazyTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/LaunchLazyTest.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt b/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt
index 3c16194..f8d96e1 100644
--- a/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/NonCancellableTest.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt b/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt
index 17e8356..fdf0ac7 100644
--- a/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/ParentCancellationTest.kt
@@ -4,10 +4,10 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.channels.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.channels.*
+import kotlin.coroutines.*
import kotlin.test.*
/**
diff --git a/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt b/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt
index c9aaacb..978112f 100644
--- a/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/SupervisorTest.kt
@@ -4,7 +4,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/TestBase.common.kt b/common/kotlinx-coroutines-core-common/test/TestBase.common.kt
index eea4b63..691f159 100644
--- a/common/kotlinx-coroutines-core-common/test/TestBase.common.kt
+++ b/common/kotlinx-coroutines-core-common/test/TestBase.common.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
public expect open class TestBase constructor() {
public val isStressTest: Boolean
diff --git a/common/kotlinx-coroutines-core-common/test/Try.kt b/common/kotlinx-coroutines-core-common/test/Try.kt
index 3a9fd75..194ea4b 100644
--- a/common/kotlinx-coroutines-core-common/test/Try.kt
+++ b/common/kotlinx-coroutines-core-common/test/Try.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
public class Try<out T> private constructor(private val _value: Any?) {
private class Fail(val exception: Throwable) {
diff --git a/common/kotlinx-coroutines-core-common/test/WithContextTest.kt b/common/kotlinx-coroutines-core-common/test/WithContextTest.kt
index d56391c..6fa47ff 100644
--- a/common/kotlinx-coroutines-core-common/test/WithContextTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/WithContextTest.kt
@@ -5,9 +5,9 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlin.coroutines.experimental.*
+import kotlin.coroutines.*
import kotlin.test.*
class WithContextTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt b/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt
index f7760b8..8b88d0a 100644
--- a/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/WithTimeoutOrNullTest.kt
@@ -5,9 +5,9 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
-import kotlinx.coroutines.experimental.channels.*
+import kotlinx.coroutines.channels.*
import kotlin.test.*
class WithTimeoutOrNullTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt b/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt
index 639672c..95da378 100644
--- a/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/WithTimeoutTest.kt
@@ -5,7 +5,7 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental
+package kotlinx.coroutines
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt
index eeed553..0e695d9 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ArrayBroadcastChannelTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class ArrayBroadcastChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt
index dc6b047..bcb0b40 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ArrayChannelTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class ArrayChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt b/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt
index ad78940..be2fad3 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/BasicOperationsTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class BasicOperationsTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/BroadcastChannelFactoryTest.kt b/common/kotlinx-coroutines-core-common/test/channels/BroadcastChannelFactoryTest.kt
index 04a73ce..1d172b3 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/BroadcastChannelFactoryTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/BroadcastChannelFactoryTest.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/channels/BroadcastTest.kt b/common/kotlinx-coroutines-core-common/test/channels/BroadcastTest.kt
index 74bdb44..878437b 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/BroadcastTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/BroadcastTest.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
import kotlin.test.*
class BroadcastTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ChannelFactoryTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ChannelFactoryTest.kt
index ac75f2d..825cbb3 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ChannelFactoryTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ChannelFactoryTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ChannelsTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ChannelsTest.kt
index bf15962..042adbf 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ChannelsTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ChannelsTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.math.*
import kotlin.test.*
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ConflatedBroadcastChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ConflatedBroadcastChannelTest.kt
index 87af3e5..49e531a 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ConflatedBroadcastChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ConflatedBroadcastChannelTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class ConflatedBroadcastChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt
index c6968db..8c1959f 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ConflatedChannelTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class ConflatedChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt
index 4db28ab..788449b 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/LinkedListChannelTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class LinkedListChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ProduceConsumeTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ProduceConsumeTest.kt
index 2774088..5df0c7d 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ProduceConsumeTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ProduceConsumeTest.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
import kotlin.test.*
class ProduceConsumeTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt b/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt
index 4c05409..946f2b5 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/ProduceTest.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
-import kotlin.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
import kotlin.test.*
class ProduceTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt b/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt
index 3f422c9..12c14c0 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/RendezvousChannelTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class RendezvousChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/SendReceiveStressTest.kt b/common/kotlinx-coroutines-core-common/test/channels/SendReceiveStressTest.kt
index b48bf13..b9aa999 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/SendReceiveStressTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/SendReceiveStressTest.kt
@@ -2,9 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlin.coroutines.*
import kotlin.test.*
class SendReceiveStressTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/TestBroadcastChannelKind.kt b/common/kotlinx-coroutines-core-common/test/channels/TestBroadcastChannelKind.kt
index 5c41f6f..d58c05d 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/TestBroadcastChannelKind.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/TestBroadcastChannelKind.kt
@@ -2,7 +2,7 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
enum class TestBroadcastChannelKind {
ARRAY_1 {
diff --git a/common/kotlinx-coroutines-core-common/test/channels/TestChannelKind.kt b/common/kotlinx-coroutines-core-common/test/channels/TestChannelKind.kt
index e783120..1e9c829 100644
--- a/common/kotlinx-coroutines-core-common/test/channels/TestChannelKind.kt
+++ b/common/kotlinx-coroutines-core-common/test/channels/TestChannelKind.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.channels
+package kotlinx.coroutines.channels
-import kotlinx.coroutines.experimental.selects.*
+import kotlinx.coroutines.selects.*
enum class TestChannelKind {
RENDEZVOUS {
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectArrayChannelTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectArrayChannelTest.kt
index a20ce30..f8c3439 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectArrayChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectArrayChannelTest.kt
@@ -2,11 +2,11 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.channels.*
-import kotlinx.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.*
+import kotlinx.coroutines.intrinsics.*
import kotlin.test.*
class SelectArrayChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectBiasTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectBiasTest.kt
index b61604d..ec88fb5 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectBiasTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectBiasTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class SelectBiasTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt
index a715fd0..e8bccc4 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectBuilderImplTest.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlin.coroutines.experimental.*
-import kotlin.coroutines.experimental.intrinsics.*
+import kotlin.coroutines.*
+import kotlin.coroutines.intrinsics.*
import kotlin.test.*
class SelectBuilderImplTest {
@@ -14,11 +14,10 @@
var resumed = false
val delegate = object : Continuation<String> {
override val context: CoroutineContext get() = EmptyCoroutineContext
- override fun resume(value: String) {
- check(value === "OK")
+ override fun resumeWith(result: Result<String>) {
+ check(result.getOrNull() == "OK")
resumed = true
}
- override fun resumeWithException(exception: Throwable) { error("Should not happen") }
}
val c = SelectBuilderImpl(delegate)
// still running builder
@@ -40,11 +39,10 @@
var resumed = false
val delegate = object : Continuation<String> {
override val context: CoroutineContext get() = EmptyCoroutineContext
- override fun resume(value: String) {
- check(value === "OK")
+ override fun resumeWith(result: Result<String>) {
+ check(result.getOrNull() == "OK")
resumed = true
}
- override fun resumeWithException(exception: Throwable) { error("Should not happen") }
}
val c = SelectBuilderImpl(delegate)
check(c.getResult() === COROUTINE_SUSPENDED) // suspend first
@@ -66,9 +64,8 @@
var resumed = false
val delegate = object : Continuation<String> {
override val context: CoroutineContext get() = EmptyCoroutineContext
- override fun resume(value: String) { error("Should not happen") }
- override fun resumeWithException(exception: Throwable) {
- check(exception is TestException)
+ override fun resumeWith(result: Result<String>) {
+ check(result.exceptionOrNull() is TestException)
resumed = true
}
}
@@ -97,9 +94,8 @@
var resumed = false
val delegate = object : Continuation<String> {
override val context: CoroutineContext get() = EmptyCoroutineContext
- override fun resume(value: String) { error("Should not happen") }
- override fun resumeWithException(exception: Throwable) {
- check(exception is TestException)
+ override fun resumeWith(result: Result<String>) {
+ check(result.exceptionOrNull() is TestException)
resumed = true
}
}
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectDeferredTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectDeferredTest.kt
index c2e202c..45b7c9d 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectDeferredTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectDeferredTest.kt
@@ -4,9 +4,9 @@
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class SelectDeferredTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectJobTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectJobTest.kt
index 8a53c6f..099a874 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectJobTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectJobTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class SelectJobTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectMutexTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectMutexTest.kt
index 20ba8ec..6f4c9e1 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectMutexTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectMutexTest.kt
@@ -2,10 +2,10 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.sync.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.sync.*
import kotlin.test.*
class SelectMutexTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectRendezvousChannelTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectRendezvousChannelTest.kt
index 5aa5a3f..0c1f9f6 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectRendezvousChannelTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectRendezvousChannelTest.kt
@@ -3,11 +3,11 @@
*/
@file:Suppress("NAMED_ARGUMENTS_NOT_ALLOWED") // KT-21913
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
-import kotlinx.coroutines.experimental.channels.*
-import kotlinx.coroutines.experimental.intrinsics.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.channels.*
+import kotlinx.coroutines.intrinsics.*
import kotlin.test.*
class SelectRendezvousChannelTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/selects/SelectTimeoutTest.kt b/common/kotlinx-coroutines-core-common/test/selects/SelectTimeoutTest.kt
index 2ce7886..fbfb9c0 100644
--- a/common/kotlinx-coroutines-core-common/test/selects/SelectTimeoutTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/selects/SelectTimeoutTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.selects
+package kotlinx.coroutines.selects
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class SelectTimeoutTest : TestBase() {
diff --git a/common/kotlinx-coroutines-core-common/test/sync/MutexTest.kt b/common/kotlinx-coroutines-core-common/test/sync/MutexTest.kt
index b9d18de..c5d0ccf 100644
--- a/common/kotlinx-coroutines-core-common/test/sync/MutexTest.kt
+++ b/common/kotlinx-coroutines-core-common/test/sync/MutexTest.kt
@@ -2,9 +2,9 @@
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
-package kotlinx.coroutines.experimental.sync
+package kotlinx.coroutines.sync
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
import kotlin.test.*
class MutexTest : TestBase() {