Skip to content

Commit 0950dfa

Browse files
elizarovqwwdfsad
authored andcommitted
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)
1 parent 305ac20 commit 0950dfa

File tree

550 files changed

+3298
-3128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

550 files changed

+3298
-3128
lines changed

CHANGES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ Visible consequences of include more robust exception handling for large corouti
7474
* All coroutine builders are now extensions on `CoroutineScope` and inherit its `coroutineContext`. Standalone builders are deprecated.
7575
* As a consequence, all nested coroutines launched via builders now automatically establish parent-child relationship and inherit `CoroutineDispatcher`.
7676
* All coroutine builders use `Dispatchers.Default` by default if `CoroutineInterceptor` is not present in their context.
77-
* [CoroutineScope](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-coroutine-scope/) became the first-class citizen in `kolinx.coroutines`.
77+
* [CoroutineScope](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/) became the first-class citizen in `kolinx.coroutines`.
7878
* `withContext` `block` argument has `CoroutineScope` as a receiver.
79-
* [GlobalScope](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-global-scope/) is introduced to simplify migration to new API and to launch global-level coroutines.
79+
* [GlobalScope](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-global-scope/) is introduced to simplify migration to new API and to launch global-level coroutines.
8080
* `currentScope` and `coroutineScope` builders are introduced to extract and provide `CoroutineScope`.
8181
* Factory methods to create `CoroutineScope` from `CoroutineContext` are introduced.
8282
* `CoroutineScope.isActive` became an extension property.
@@ -604,7 +604,7 @@ Visible consequences of include more robust exception handling for large corouti
604604
## Version 0.11-rc
605605

606606
* `select` expression with onJoin/onAwait/onSend/onReceive clauses.
607-
* `Mutex` is moved to `kotlinx.coroutines.experimental.sync` package.
607+
* `Mutex` is moved to `kotlinx.coroutines.sync` package.
608608
* `ClosedSendChannelException` is a subclass of `CancellationException` now.
609609
* New sections on "Shared mutable state and concurrency" and "Select expression"
610610
in [coroutines guide](docs/coroutines-guide.md).

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=0.30.2) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/0.30.2)
66

77
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
8-
This is a companion version for Kotlin 1.2.70 release.
8+
This is a companion version for Kotlin 1.3.0-rc-116 release.
99

1010
**NOTE**: This is the latest experimental release. See [COMPATIBILITY.md](COMPATIBILITY.md) for details on migration.
1111

@@ -76,7 +76,7 @@ And make sure that you use the latest Kotlin version:
7676

7777
```xml
7878
<properties>
79-
<kotlin.version>1.2.70</kotlin.version>
79+
<kotlin.version>1.3.0-rc-116</kotlin.version>
8080
</properties>
8181
```
8282

@@ -94,7 +94,7 @@ And make sure that you use the latest Kotlin version:
9494

9595
```groovy
9696
buildscript {
97-
ext.kotlin_version = '1.2.70'
97+
ext.kotlin_version = '1.3.0-rc-116'
9898
}
9999
```
100100

@@ -122,7 +122,7 @@ module as dependency when using `kotlinx.coroutines` on Android:
122122
```groovy
123123
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.2'
124124
```
125-
This gives you access to Android [Dispatchers.Main](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-android/kotlinx.coroutines.experimental.android/kotlinx.coroutines.experimental.-dispatchers/index.html)
125+
This gives you access to Android [Dispatchers.Main](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-android/kotlinx.coroutines.android/kotlinx.coroutines.-dispatchers/index.html)
126126
coroutine dispatcher and also makes sure that in case of crashed coroutine with unhandled exception this
127127
exception is logged before crashing Android application, similarly to the way uncaught exceptions in
128128
threads are handled by Android runtime.

benchmarks/src/jmh/kotlin/benchmarks/CancellableContinuationBenchmark.kt

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
package benchmarks
66

7-
import kotlinx.coroutines.experimental.*
7+
import kotlinx.coroutines.*
88
import org.openjdk.jmh.annotations.*
99
import java.util.concurrent.*
10-
import kotlin.coroutines.experimental.*
11-
import kotlin.coroutines.experimental.intrinsics.*
10+
import kotlin.coroutines.*
11+
import kotlin.coroutines.intrinsics.*
1212

1313
@Warmup(iterations = 5)
1414
@Measurement(iterations = 10)
@@ -47,10 +47,7 @@ open class CancellableContinuationBenchmark {
4747
override val context: CoroutineContext
4848
get() = EmptyCoroutineContext
4949

50-
override fun resume(value: Int) {
51-
}
52-
53-
override fun resumeWithException(exception: Throwable) {
50+
override fun resumeWith(result: Result<Int>) {
5451
}
5552
}
5653
}

benchmarks/src/jmh/kotlin/benchmarks/ChannelSinkBenchmark.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
package benchmarks
66

7-
import kotlinx.coroutines.experimental.*
8-
import kotlinx.coroutines.experimental.channels.*
7+
import kotlinx.coroutines.*
8+
import kotlinx.coroutines.channels.*
99
import org.openjdk.jmh.annotations.*
1010
import java.util.concurrent.*
11-
import kotlin.coroutines.experimental.*
11+
import kotlin.coroutines.*
1212

1313
@Warmup(iterations = 10, time = 1)
1414
@Measurement(iterations = 10, time = 1)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package benchmarks
66

7-
import kotlinx.coroutines.experimental.*
7+
import kotlinx.coroutines.*
88
import org.openjdk.jmh.annotations.*
99
import java.util.concurrent.*
1010

benchmarks/src/jmh/kotlin/benchmarks/GuideSyncBenchmark.kt

Whitespace-only changes.

benchmarks/src/jmh/kotlin/benchmarks/LaunchBenchmark.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package benchmarks
66

7-
import kotlinx.coroutines.experimental.*
7+
import kotlinx.coroutines.*
88
import org.openjdk.jmh.annotations.*
99
import java.util.concurrent.*
1010

benchmarks/src/jmh/kotlin/benchmarks/ParametrizedDispatcherBase.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
package benchmarks
66

77
import benchmarks.actors.CORES_COUNT
8-
import kotlinx.coroutines.experimental.*
9-
import kotlinx.coroutines.experimental.scheduling.*
8+
import kotlinx.coroutines.*
9+
import kotlinx.coroutines.scheduling.*
1010
import org.openjdk.jmh.annotations.Param
1111
import org.openjdk.jmh.annotations.Setup
1212
import org.openjdk.jmh.annotations.TearDown
1313
import java.io.Closeable
14-
import kotlin.coroutines.experimental.CoroutineContext
14+
import kotlin.coroutines.CoroutineContext
1515

1616
/**
1717
* Base class to use different [CoroutineContext] in benchmarks via [Param] in inheritors.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
package benchmarks
66

7-
import kotlinx.coroutines.experimental.*
8-
import kotlinx.coroutines.experimental.channels.*
7+
import kotlinx.coroutines.*
8+
import kotlinx.coroutines.channels.*
99
import org.openjdk.jmh.annotations.*
1010
import java.util.concurrent.*
1111

benchmarks/src/jmh/kotlin/benchmarks/actors/ConcurrentStatefulActorBenchmark.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package benchmarks.actors
66

77
import benchmarks.*
88
import benchmarks.actors.StatefulActorBenchmark.*
9-
import kotlinx.coroutines.experimental.*
10-
import kotlinx.coroutines.experimental.channels.*
9+
import kotlinx.coroutines.*
10+
import kotlinx.coroutines.channels.*
1111
import org.openjdk.jmh.annotations.*
1212
import java.util.concurrent.*
1313

benchmarks/src/jmh/kotlin/benchmarks/actors/CycledActorsBenchmark.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ package benchmarks.actors
66

77
import benchmarks.*
88
import benchmarks.actors.PingPongActorBenchmark.*
9-
import kotlinx.coroutines.experimental.*
10-
import kotlinx.coroutines.experimental.channels.*
9+
import kotlinx.coroutines.*
10+
import kotlinx.coroutines.channels.*
1111
import org.openjdk.jmh.annotations.*
1212
import java.util.concurrent.*
1313

benchmarks/src/jmh/kotlin/benchmarks/actors/PingPongActorBenchmark.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
package benchmarks.actors
66

77
import benchmarks.*
8-
import kotlinx.coroutines.experimental.*
9-
import kotlinx.coroutines.experimental.channels.*
8+
import kotlinx.coroutines.*
9+
import kotlinx.coroutines.channels.*
1010
import org.openjdk.jmh.annotations.*
1111
import java.util.concurrent.*
12-
import kotlin.coroutines.experimental.*
12+
import kotlin.coroutines.*
1313

1414
/*
1515
* Benchmark (dispatcher) Mode Cnt Score Error Units

benchmarks/src/jmh/kotlin/benchmarks/actors/PingPongWithBlockingContext.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
package benchmarks.actors
66

7-
import kotlinx.coroutines.experimental.*
8-
import kotlinx.coroutines.experimental.channels.*
9-
import kotlinx.coroutines.experimental.scheduling.*
7+
import kotlinx.coroutines.*
8+
import kotlinx.coroutines.channels.*
9+
import kotlinx.coroutines.scheduling.*
1010
import org.openjdk.jmh.annotations.*
1111
import java.util.concurrent.*
12-
import kotlin.coroutines.experimental.*
12+
import kotlin.coroutines.*
1313

1414

1515
/*

benchmarks/src/jmh/kotlin/benchmarks/actors/StatefulActorBenchmark.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
package benchmarks.actors
66

77
import benchmarks.*
8-
import kotlinx.coroutines.experimental.*
9-
import kotlinx.coroutines.experimental.channels.*
8+
import kotlinx.coroutines.*
9+
import kotlinx.coroutines.channels.*
1010
import org.openjdk.jmh.annotations.*
1111
import java.util.concurrent.*
1212

Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
public final class kotlinx/coroutines/experimental/android/HandlerContext : kotlinx/coroutines/experimental/android/HandlerDispatcher, kotlinx/coroutines/experimental/Delay {
1+
public final class kotlinx/coroutines/android/HandlerContext : kotlinx/coroutines/android/HandlerDispatcher, kotlinx/coroutines/Delay {
22
public fun <init> (Landroid/os/Handler;Ljava/lang/String;)V
33
public synthetic fun <init> (Landroid/os/Handler;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
4-
public final fun awaitFrame (Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
5-
public fun dispatch (Lkotlin/coroutines/experimental/CoroutineContext;Ljava/lang/Runnable;)V
4+
public final fun awaitFrame (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
5+
public fun dispatch (Lkotlin/coroutines/CoroutineContext;Ljava/lang/Runnable;)V
66
public fun equals (Ljava/lang/Object;)Z
7-
public synthetic fun getImmediate ()Lkotlinx/coroutines/experimental/MainCoroutineDispatcher;
8-
public fun getImmediate ()Lkotlinx/coroutines/experimental/android/HandlerContext;
9-
public synthetic fun getImmediate ()Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
7+
public synthetic fun getImmediate ()Lkotlinx/coroutines/MainCoroutineDispatcher;
8+
public fun getImmediate ()Lkotlinx/coroutines/android/HandlerContext;
9+
public synthetic fun getImmediate ()Lkotlinx/coroutines/android/HandlerDispatcher;
1010
public fun hashCode ()I
11-
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/experimental/DisposableHandle;
12-
public fun isDispatchNeeded (Lkotlin/coroutines/experimental/CoroutineContext;)Z
13-
public fun scheduleResumeAfterDelay (JLkotlinx/coroutines/experimental/CancellableContinuation;)V
11+
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/DisposableHandle;
12+
public fun isDispatchNeeded (Lkotlin/coroutines/CoroutineContext;)Z
13+
public fun scheduleResumeAfterDelay (JLkotlinx/coroutines/CancellableContinuation;)V
1414
public fun toString ()Ljava/lang/String;
1515
}
1616

17-
public final class kotlinx/coroutines/experimental/android/HandlerContextKt {
18-
public static final synthetic fun asCoroutineDispatcher (Landroid/os/Handler;)Lkotlinx/coroutines/experimental/android/HandlerContext;
19-
public static final fun getUI ()Lkotlinx/coroutines/experimental/android/HandlerContext;
17+
public final class kotlinx/coroutines/android/HandlerContextKt {
18+
public static final synthetic fun asCoroutineDispatcher (Landroid/os/Handler;)Lkotlinx/coroutines/android/HandlerContext;
19+
public static final fun getUI ()Lkotlinx/coroutines/android/HandlerContext;
2020
}
2121

22-
public abstract class kotlinx/coroutines/experimental/android/HandlerDispatcher : kotlinx/coroutines/experimental/MainCoroutineDispatcher, kotlinx/coroutines/experimental/Delay {
23-
public synthetic fun delay (JLjava/util/concurrent/TimeUnit;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
24-
public fun delay (JLkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
25-
public abstract fun getImmediate ()Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
26-
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/experimental/DisposableHandle;
27-
public synthetic fun invokeOnTimeout (JLjava/util/concurrent/TimeUnit;Ljava/lang/Runnable;)Lkotlinx/coroutines/experimental/DisposableHandle;
28-
public synthetic fun scheduleResumeAfterDelay (JLjava/util/concurrent/TimeUnit;Lkotlinx/coroutines/experimental/CancellableContinuation;)V
22+
public abstract class kotlinx/coroutines/android/HandlerDispatcher : kotlinx/coroutines/MainCoroutineDispatcher, kotlinx/coroutines/Delay {
23+
public synthetic fun delay (JLjava/util/concurrent/TimeUnit;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
24+
public fun delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
25+
public abstract fun getImmediate ()Lkotlinx/coroutines/android/HandlerDispatcher;
26+
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/DisposableHandle;
27+
public synthetic fun invokeOnTimeout (JLjava/util/concurrent/TimeUnit;Ljava/lang/Runnable;)Lkotlinx/coroutines/DisposableHandle;
28+
public synthetic fun scheduleResumeAfterDelay (JLjava/util/concurrent/TimeUnit;Lkotlinx/coroutines/CancellableContinuation;)V
2929
}
3030

31-
public final class kotlinx/coroutines/experimental/android/HandlerDispatcherKt {
32-
public static final fun awaitFrame (Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
33-
public static final fun from (Landroid/os/Handler;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
34-
public static final fun from (Landroid/os/Handler;Ljava/lang/String;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
35-
public static synthetic fun from$default (Landroid/os/Handler;Ljava/lang/String;ILjava/lang/Object;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
36-
public static final synthetic fun getMain (Lkotlinx/coroutines/experimental/Dispatchers;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
31+
public final class kotlinx/coroutines/android/HandlerDispatcherKt {
32+
public static final fun awaitFrame (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
33+
public static final fun from (Landroid/os/Handler;)Lkotlinx/coroutines/android/HandlerDispatcher;
34+
public static final fun from (Landroid/os/Handler;Ljava/lang/String;)Lkotlinx/coroutines/android/HandlerDispatcher;
35+
public static synthetic fun from$default (Landroid/os/Handler;Ljava/lang/String;ILjava/lang/Object;)Lkotlinx/coroutines/android/HandlerDispatcher;
36+
public static final synthetic fun getMain (Lkotlinx/coroutines/Dispatchers;)Lkotlinx/coroutines/android/HandlerDispatcher;
3737
}
3838

0 commit comments

Comments
 (0)