Skip to content

Commit

Permalink
Migrate to Kotlin 1.3 coroutines, drop experimental from package
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
elizarov committed Sep 29, 2018
1 parent 7764e43 commit d3ac541
Show file tree
Hide file tree
Showing 542 changed files with 3,275 additions and 3,103 deletions.
6 changes: 3 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ Visible consequences of include more robust exception handling for large corouti
* All coroutine builders are now extensions on `CoroutineScope` and inherit its `coroutineContext`. Standalone builders are deprecated.
* As a consequence, all nested coroutines launched via builders now automatically establish parent-child relationship and inherit `CoroutineDispatcher`.
* All coroutine builders use `Dispatchers.Default` by default if `CoroutineInterceptor` is not present in their context.
* [CoroutineScope](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/-coroutine-scope/) became the first-class citizen in `kolinx.coroutines`.
* [CoroutineScope](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/) became the first-class citizen in `kolinx.coroutines`.
* `withContext` `block` argument has `CoroutineScope` as a receiver.
* [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.
* [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.
* `currentScope` and `coroutineScope` builders are introduced to extract and provide `CoroutineScope`.
* Factory methods to create `CoroutineScope` from `CoroutineContext` are introduced.
* `CoroutineScope.isActive` became an extension property.
Expand Down Expand Up @@ -589,7 +589,7 @@ Visible consequences of include more robust exception handling for large corouti
## Version 0.11-rc

* `select` expression with onJoin/onAwait/onSend/onReceive clauses.
* `Mutex` is moved to `kotlinx.coroutines.experimental.sync` package.
* `Mutex` is moved to `kotlinx.coroutines.sync` package.
* `ClosedSendChannelException` is a subclass of `CancellationException` now.
* New sections on "Shared mutable state and concurrency" and "Select expression"
in [coroutines guide](docs/coroutines-guide.md).
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=0.30.0) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/0.30.0)

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

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

Expand Down Expand Up @@ -73,7 +73,7 @@ And make sure that you use the latest Kotlin version:

```xml
<properties>
<kotlin.version>1.2.70</kotlin.version>
<kotlin.version>1.3.0-rc-116</kotlin.version>
</properties>
```

Expand All @@ -89,7 +89,7 @@ And make sure that you use the latest Kotlin version:

```groovy
buildscript {
ext.kotlin_version = '1.2.70'
ext.kotlin_version = '1.3.0-rc-116'
}
```

Expand Down Expand Up @@ -117,7 +117,7 @@ module as dependency when using `kotlinx.coroutines` on Android:
```groovy
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.30.0'
```
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)
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)
coroutine dispatcher and also makes sure that in case of crashed coroutine with unhandled exception this
exception is logged before crashing Android application, similarly to the way uncaught exceptions in
threads are handled by Android runtime.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

package benchmarks

import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*

@Warmup(iterations = 5)
@Measurement(iterations = 10)
Expand Down Expand Up @@ -47,10 +47,7 @@ open class CancellableContinuationBenchmark {
override val context: CoroutineContext
get() = EmptyCoroutineContext

override fun resume(value: Int) {
}

override fun resumeWithException(exception: Throwable) {
override fun resumeWith(result: Result<Int>) {
}
}
}
6 changes: 3 additions & 3 deletions benchmarks/src/jmh/kotlin/benchmarks/ChannelSinkBenchmark.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

package benchmarks

import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.*

@Warmup(iterations = 10, time = 1)
@Measurement(iterations = 10, time = 1)
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/src/jmh/kotlin/benchmarks/ForkJoinBenchmark.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package benchmarks

import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*

Expand Down
Empty file.
2 changes: 1 addition & 1 deletion benchmarks/src/jmh/kotlin/benchmarks/LaunchBenchmark.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package benchmarks

import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
package benchmarks

import benchmarks.actors.CORES_COUNT
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.scheduling.*
import kotlinx.coroutines.*
import kotlinx.coroutines.scheduling.*
import org.openjdk.jmh.annotations.Param
import org.openjdk.jmh.annotations.Setup
import org.openjdk.jmh.annotations.TearDown
import java.io.Closeable
import kotlin.coroutines.experimental.CoroutineContext
import kotlin.coroutines.CoroutineContext

/**
* Base class to use different [CoroutineContext] in benchmarks via [Param] in inheritors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

package benchmarks

import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package benchmarks.actors

import benchmarks.*
import benchmarks.actors.StatefulActorBenchmark.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package benchmarks.actors

import benchmarks.*
import benchmarks.actors.PingPongActorBenchmark.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
package benchmarks.actors

import benchmarks.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.*

/*
* Benchmark (dispatcher) Mode Cnt Score Error Units
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

package benchmarks.actors

import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.experimental.scheduling.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import kotlinx.coroutines.scheduling.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*
import kotlin.coroutines.experimental.*
import kotlin.coroutines.*


/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package benchmarks.actors

import benchmarks.*
import kotlinx.coroutines.experimental.*
import kotlinx.coroutines.experimental.channels.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import org.openjdk.jmh.annotations.*
import java.util.concurrent.*

Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
public final class kotlinx/coroutines/experimental/android/HandlerContext : kotlinx/coroutines/experimental/android/HandlerDispatcher, kotlinx/coroutines/experimental/Delay {
public final class kotlinx/coroutines/android/HandlerContext : kotlinx/coroutines/android/HandlerDispatcher, kotlinx/coroutines/Delay {
public fun <init> (Landroid/os/Handler;Ljava/lang/String;)V
public synthetic fun <init> (Landroid/os/Handler;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun awaitFrame (Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
public fun dispatch (Lkotlin/coroutines/experimental/CoroutineContext;Ljava/lang/Runnable;)V
public final fun awaitFrame (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun dispatch (Lkotlin/coroutines/CoroutineContext;Ljava/lang/Runnable;)V
public fun equals (Ljava/lang/Object;)Z
public fun getImmediate ()Lkotlinx/coroutines/experimental/android/HandlerContext;
public synthetic fun getImmediate ()Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
public fun getImmediate ()Lkotlinx/coroutines/android/HandlerContext;
public synthetic fun getImmediate ()Lkotlinx/coroutines/android/HandlerDispatcher;
public fun hashCode ()I
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/experimental/DisposableHandle;
public fun isDispatchNeeded (Lkotlin/coroutines/experimental/CoroutineContext;)Z
public fun scheduleResumeAfterDelay (JLkotlinx/coroutines/experimental/CancellableContinuation;)V
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/DisposableHandle;
public fun isDispatchNeeded (Lkotlin/coroutines/CoroutineContext;)Z
public fun scheduleResumeAfterDelay (JLkotlinx/coroutines/CancellableContinuation;)V
public fun toString ()Ljava/lang/String;
}

public final class kotlinx/coroutines/experimental/android/HandlerContextKt {
public static final synthetic fun asCoroutineDispatcher (Landroid/os/Handler;)Lkotlinx/coroutines/experimental/android/HandlerContext;
public static final fun getUI ()Lkotlinx/coroutines/experimental/android/HandlerContext;
public final class kotlinx/coroutines/android/HandlerContextKt {
public static final synthetic fun asCoroutineDispatcher (Landroid/os/Handler;)Lkotlinx/coroutines/android/HandlerContext;
public static final fun getUI ()Lkotlinx/coroutines/android/HandlerContext;
}

public abstract class kotlinx/coroutines/experimental/android/HandlerDispatcher : kotlinx/coroutines/experimental/CoroutineDispatcher, kotlinx/coroutines/experimental/Delay {
public synthetic fun delay (JLjava/util/concurrent/TimeUnit;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
public fun delay (JLkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
public abstract fun getImmediate ()Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/experimental/DisposableHandle;
public synthetic fun invokeOnTimeout (JLjava/util/concurrent/TimeUnit;Ljava/lang/Runnable;)Lkotlinx/coroutines/experimental/DisposableHandle;
public synthetic fun scheduleResumeAfterDelay (JLjava/util/concurrent/TimeUnit;Lkotlinx/coroutines/experimental/CancellableContinuation;)V
public abstract class kotlinx/coroutines/android/HandlerDispatcher : kotlinx/coroutines/CoroutineDispatcher, kotlinx/coroutines/Delay {
public synthetic fun delay (JLjava/util/concurrent/TimeUnit;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun getImmediate ()Lkotlinx/coroutines/android/HandlerDispatcher;
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/DisposableHandle;
public synthetic fun invokeOnTimeout (JLjava/util/concurrent/TimeUnit;Ljava/lang/Runnable;)Lkotlinx/coroutines/DisposableHandle;
public synthetic fun scheduleResumeAfterDelay (JLjava/util/concurrent/TimeUnit;Lkotlinx/coroutines/CancellableContinuation;)V
}

public final class kotlinx/coroutines/experimental/android/HandlerDispatcherKt {
public static final fun awaitFrame (Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
public static final fun from (Landroid/os/Handler;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
public static final fun from (Landroid/os/Handler;Ljava/lang/String;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
public static synthetic fun from$default (Landroid/os/Handler;Ljava/lang/String;ILjava/lang/Object;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
public static final fun getMain (Lkotlinx/coroutines/experimental/Dispatchers;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
public final class kotlinx/coroutines/android/HandlerDispatcherKt {
public static final fun awaitFrame (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun from (Landroid/os/Handler;)Lkotlinx/coroutines/android/HandlerDispatcher;
public static final fun from (Landroid/os/Handler;Ljava/lang/String;)Lkotlinx/coroutines/android/HandlerDispatcher;
public static synthetic fun from$default (Landroid/os/Handler;Ljava/lang/String;ILjava/lang/Object;)Lkotlinx/coroutines/android/HandlerDispatcher;
public static final fun getMain (Lkotlinx/coroutines/Dispatchers;)Lkotlinx/coroutines/android/HandlerDispatcher;
}

Loading

0 comments on commit d3ac541

Please sign in to comment.