Skip to content

Commit 4d5246a

Browse files
authored
Merge pull request #1142 from Kotlin/version-1.2.1
Version 1.2.1
2 parents 69c26df + 42b5237 commit 4d5246a

File tree

101 files changed

+3431
-289
lines changed

Some content is hidden

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

101 files changed

+3431
-289
lines changed

CHANGES.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Change log for kotlinx.coroutines
22

3+
## Version 1.2.1
4+
5+
Major:
6+
* Infrastructure for testing coroutine-specific code in `kotlinx-coroutines-test`: `runBlockingTest`, `TestCoroutineScope` and `TestCoroutineDispatcher`, contributed by Sean McQuillan (@objcode). Obsolete `TestCoroutineContext` from `kotlinx-coroutines-core` is deprecated.
7+
* `Job.asCompletableFuture` extension in jdk8 module (#1113).
8+
9+
Flow improvements:
10+
* `flowViaChannel` rework: block parameter is no longer suspending, but provides `CoroutineScope` receiver and allows conflated channel (#1081, #1112).
11+
* New operators: `switchMap`, `sample`, `debounce` (#1107).
12+
* `consumerEach` is deprecated on `Publisher`, `ObservableSource` and `MaybeSource`, `collect` extension is introduced instead (#1080).
13+
14+
Other:
15+
* Race in Job.join and concurrent cancellation is fixed (#1123).
16+
* Stacktrace recovery machinery improved: cycle detection works through recovered exceptions, cancellation exceptions are recovered on cancellation fast-path.
17+
* Atomicfu-related bug fixes: publish transformed artifacts, do not propagate transitive atomicfu dependency (#1064, #1116).
18+
* Publication to NPM fixed (#1118).
19+
* Misplaced resources are removed from the final jar (#1131).
20+
321
## Version 1.2.0
422

523
* Kotlin updated to 1.3.30.

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![official JetBrains project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
44
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
5-
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.2.0) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.2.0)
5+
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.2.1) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.2.1)
66

77
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
88
This is a companion version for Kotlin `1.3.30` release.
@@ -39,6 +39,7 @@ suspend fun main() = coroutineScope {
3939
* Integration with `Window`.
4040
* [test](kotlinx-coroutines-test/README.md) — test utilities for coroutines
4141
* `Dispatchers.setMain` to override `Dispatchers.Main` in tests.
42+
* `TestCoroutineScope` to test suspending functions and coroutines.
4243
* [debug](kotlinx-coroutines-debug/README.md) — debug utilities for coroutines.
4344
* `DebugProbes` API to probe, keep track of, print and dump active coroutines.
4445
* `CoroutinesTimeout` test rule to automatically dump coroutines on test timeout.
@@ -80,7 +81,7 @@ Add dependencies (you can also add other modules that you need):
8081
<dependency>
8182
<groupId>org.jetbrains.kotlinx</groupId>
8283
<artifactId>kotlinx-coroutines-core</artifactId>
83-
<version>1.2.0</version>
84+
<version>1.2.1</version>
8485
</dependency>
8586
```
8687

@@ -98,7 +99,7 @@ Add dependencies (you can also add other modules that you need):
9899

99100
```groovy
100101
dependencies {
101-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0'
102+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1'
102103
}
103104
```
104105

@@ -124,7 +125,7 @@ Add dependencies (you can also add other modules that you need):
124125

125126
```groovy
126127
dependencies {
127-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.0")
128+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1")
128129
}
129130
```
130131

@@ -143,7 +144,7 @@ Make sure that you have either `jcenter()` or `mavenCentral()` in the list of re
143144
Core modules of `kotlinx.coroutines` are also available for
144145
[Kotlin/JS](#js) and [Kotlin/Native](#native).
145146
In common code that should get compiled for different platforms, add dependency to
146-
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.2.0/jar)
147+
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.2.1/jar)
147148
(follow the link to get the dependency declaration snippet).
148149

149150
### Android
@@ -152,7 +153,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
152153
module as dependency when using `kotlinx.coroutines` on Android:
153154

154155
```groovy
155-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0'
156+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.1'
156157
```
157158

158159
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)
@@ -171,15 +172,15 @@ R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default
171172
### JS
172173

173174
[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) version of `kotlinx.coroutines` is published as
174-
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.2.0/jar)
175+
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.2.1/jar)
175176
(follow the link to get the dependency declaration snippet).
176177

177178
You can also use [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) package via NPM.
178179

179180
### Native
180181

181182
[Kotlin/Native](https://kotlinlang.org/docs/reference/native-overview.html) version of `kotlinx.coroutines` is published as
182-
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.2.0/jar)
183+
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.2.1/jar)
183184
(follow the link to get the dependency declaration snippet).
184185

185186
Only single-threaded code (JS-style) on Kotlin/Native is currently supported.

binary-compatibility-validator/reference-public-api/kotlinx-coroutines-core.txt

+3
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ public final class kotlinx/coroutines/flow/FlowKt {
796796
public static final fun combineLatest (Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/flow/Flow;
797797
public static final fun count (Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
798798
public static final fun count (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
799+
public static final fun debounce (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
799800
public static final fun delayEach (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
800801
public static final fun delayFlow (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
801802
public static final fun distinctUntilChanged (Lkotlinx/coroutines/flow/Flow;)Lkotlinx/coroutines/flow/Flow;
@@ -833,8 +834,10 @@ public final class kotlinx/coroutines/flow/FlowKt {
833834
public static final fun reduce (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
834835
public static final fun retry (Lkotlinx/coroutines/flow/Flow;ILkotlin/jvm/functions/Function1;)Lkotlinx/coroutines/flow/Flow;
835836
public static synthetic fun retry$default (Lkotlinx/coroutines/flow/Flow;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
837+
public static final fun sample (Lkotlinx/coroutines/flow/Flow;J)Lkotlinx/coroutines/flow/Flow;
836838
public static final fun single (Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
837839
public static final fun singleOrNull (Lkotlinx/coroutines/flow/Flow;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
840+
public static final fun switchMap (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
838841
public static final fun take (Lkotlinx/coroutines/flow/Flow;I)Lkotlinx/coroutines/flow/Flow;
839842
public static final fun takeWhile (Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
840843
public static final fun toCollection (Lkotlinx/coroutines/flow/Flow;Ljava/util/Collection;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

binary-compatibility-validator/reference-public-api/kotlinx-coroutines-jdk8.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
public final class kotlinx/coroutines/future/FutureKt {
22
public static final fun asCompletableFuture (Lkotlinx/coroutines/Deferred;)Ljava/util/concurrent/CompletableFuture;
3+
public static final fun asCompletableFuture (Lkotlinx/coroutines/Job;)Ljava/util/concurrent/CompletableFuture;
34
public static final fun asDeferred (Ljava/util/concurrent/CompletionStage;)Lkotlinx/coroutines/Deferred;
45
public static final fun await (Ljava/util/concurrent/CompletionStage;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
56
public static final fun future (Lkotlinx/coroutines/CoroutineScope;Lkotlin/coroutines/CoroutineContext;Lkotlinx/coroutines/CoroutineStart;Lkotlin/jvm/functions/Function2;)Ljava/util/concurrent/CompletableFuture;

binary-compatibility-validator/reference-public-api/kotlinx-coroutines-reactive.txt

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public final class kotlinx/coroutines/reactive/AwaitKt {
88
}
99

1010
public final class kotlinx/coroutines/reactive/ChannelKt {
11+
public static final fun collect (Lorg/reactivestreams/Publisher;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
1112
public static final fun consumeEach (Lorg/reactivestreams/Publisher;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
1213
public static final fun openSubscription (Lorg/reactivestreams/Publisher;I)Lkotlinx/coroutines/channels/ReceiveChannel;
1314
public static synthetic fun openSubscription$default (Lorg/reactivestreams/Publisher;IILjava/lang/Object;)Lkotlinx/coroutines/channels/ReceiveChannel;

binary-compatibility-validator/reference-public-api/kotlinx-coroutines-rx2.txt

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public final class kotlinx/coroutines/rx2/RxAwaitKt {
1212
}
1313

1414
public final class kotlinx/coroutines/rx2/RxChannelKt {
15+
public static final fun collect (Lio/reactivex/MaybeSource;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
16+
public static final fun collect (Lio/reactivex/ObservableSource;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
1517
public static final fun consumeEach (Lio/reactivex/MaybeSource;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
1618
public static final fun consumeEach (Lio/reactivex/ObservableSource;Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
1719
public static final fun openSubscription (Lio/reactivex/MaybeSource;)Lkotlinx/coroutines/channels/ReceiveChannel;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
1+
public abstract interface class kotlinx/coroutines/test/DelayController {
2+
public abstract fun advanceTimeBy (J)J
3+
public abstract fun advanceUntilIdle ()J
4+
public abstract fun cleanupTestCoroutines ()V
5+
public abstract fun getCurrentTime ()J
6+
public abstract fun pauseDispatcher ()V
7+
public abstract fun pauseDispatcher (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
8+
public abstract fun resumeDispatcher ()V
9+
public abstract fun runCurrent ()V
10+
}
11+
12+
public final class kotlinx/coroutines/test/TestBuildersKt {
13+
public static final fun runBlockingTest (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;)V
14+
public static final fun runBlockingTest (Lkotlinx/coroutines/test/TestCoroutineDispatcher;Lkotlin/jvm/functions/Function2;)V
15+
public static final fun runBlockingTest (Lkotlinx/coroutines/test/TestCoroutineScope;Lkotlin/jvm/functions/Function2;)V
16+
public static synthetic fun runBlockingTest$default (Lkotlin/coroutines/CoroutineContext;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)V
17+
}
18+
19+
public final class kotlinx/coroutines/test/TestCoroutineDispatcher : kotlinx/coroutines/CoroutineDispatcher, kotlinx/coroutines/Delay, kotlinx/coroutines/test/DelayController {
20+
public fun <init> ()V
21+
public fun advanceTimeBy (J)J
22+
public fun advanceUntilIdle ()J
23+
public fun cleanupTestCoroutines ()V
24+
public fun delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;
25+
public fun dispatch (Lkotlin/coroutines/CoroutineContext;Ljava/lang/Runnable;)V
26+
public fun dispatchYield (Lkotlin/coroutines/CoroutineContext;Ljava/lang/Runnable;)V
27+
public fun getCurrentTime ()J
28+
public fun invokeOnTimeout (JLjava/lang/Runnable;)Lkotlinx/coroutines/DisposableHandle;
29+
public fun pauseDispatcher ()V
30+
public fun pauseDispatcher (Lkotlin/jvm/functions/Function1;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
31+
public fun resumeDispatcher ()V
32+
public fun runCurrent ()V
33+
public fun scheduleResumeAfterDelay (JLkotlinx/coroutines/CancellableContinuation;)V
34+
public fun toString ()Ljava/lang/String;
35+
}
36+
37+
public final class kotlinx/coroutines/test/TestCoroutineExceptionHandler : kotlin/coroutines/AbstractCoroutineContextElement, kotlinx/coroutines/CoroutineExceptionHandler, kotlinx/coroutines/test/UncaughtExceptionCaptor {
38+
public fun <init> ()V
39+
public fun cleanupTestCoroutines ()V
40+
public fun getUncaughtExceptions ()Ljava/util/List;
41+
public fun handleException (Lkotlin/coroutines/CoroutineContext;Ljava/lang/Throwable;)V
42+
}
43+
44+
public abstract interface class kotlinx/coroutines/test/TestCoroutineScope : kotlinx/coroutines/CoroutineScope, kotlinx/coroutines/test/DelayController, kotlinx/coroutines/test/UncaughtExceptionCaptor {
45+
public abstract fun cleanupTestCoroutines ()V
46+
}
47+
48+
public final class kotlinx/coroutines/test/TestCoroutineScopeKt {
49+
public static final fun TestCoroutineScope (Lkotlin/coroutines/CoroutineContext;)Lkotlinx/coroutines/test/TestCoroutineScope;
50+
public static synthetic fun TestCoroutineScope$default (Lkotlin/coroutines/CoroutineContext;ILjava/lang/Object;)Lkotlinx/coroutines/test/TestCoroutineScope;
51+
}
52+
153
public final class kotlinx/coroutines/test/TestDispatchers {
254
public static final fun resetMain (Lkotlinx/coroutines/Dispatchers;)V
355
public static final fun setMain (Lkotlinx/coroutines/Dispatchers;Lkotlinx/coroutines/CoroutineDispatcher;)V
456
}
557

58+
public abstract interface class kotlinx/coroutines/test/UncaughtExceptionCaptor {
59+
public abstract fun cleanupTestCoroutines ()V
60+
public abstract fun getUncaughtExceptions ()Ljava/util/List;
61+
}
62+
63+
public final class kotlinx/coroutines/test/UncompletedCoroutinesError : java/lang/AssertionError {
64+
public fun <init> (Ljava/lang/String;Ljava/lang/Throwable;)V
65+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Throwable;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
66+
}
67+

binary-compatibility-validator/test/PublicApiTest.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,16 @@ class PublicApiTest(
5555

5656
private fun getJarPath(libsDir: File): File {
5757
val regex = Regex("$moduleName-.+\\.jar")
58-
val files = (libsDir.listFiles() ?: throw Exception("Cannot list files in $libsDir"))
58+
var files = (libsDir.listFiles() ?: throw Exception("Cannot list files in $libsDir"))
5959
.filter { it.name.let {
6060
it matches regex
6161
&& !it.endsWith("-sources.jar")
6262
&& !it.endsWith("-javadoc.jar")
6363
&& !it.endsWith("-tests.jar")}
6464
&& !it.name.contains("-metadata-")}
65-
return files.singleOrNull() ?: throw Exception("No single file matching $regex in $libsDir:\n${files.joinToString("\n")}")
65+
if (files.size > 1) // maybe multiplatform?
66+
files = files.filter { it.name.startsWith("$moduleName-jvm-") }
67+
return files.singleOrNull() ?:
68+
error("No single file matching $regex in $libsDir:\n${files.joinToString("\n")}")
6669
}
6770
}

0 commit comments

Comments
 (0)