Skip to content

Commit f7335d0

Browse files
authored
Merge pull request #1462 from Kotlin/version-1.3.0
Version 1.3.0
2 parents 0d7f3fb + 6348be1 commit f7335d0

File tree

148 files changed

+3977
-717
lines changed

Some content is hidden

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

148 files changed

+3977
-717
lines changed

CHANGES.md

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

3+
## Version 1.3.0
4+
5+
### Flow
6+
7+
This version is the first stable release with [`Flow`](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html) API.
8+
9+
All `Flow` API not marked with `@FlowPreview` or `@ExperimentalCoroutinesApi` annotations are stable and here to stay.
10+
Flow declarations marked with `@ExperimentalCoroutinesApi` have [the same guarantees](/docs/compatibility.md#experimental-api) as regular experimental API.
11+
Please note that API marked with `@FlowPreview` have [weak guarantees](/docs/compatibility.md#flow-preview-api) on source, binary and semantic compatibility.
12+
13+
### Changelog
14+
15+
* A new [guide section](/docs/flow.md) about Flow.
16+
* `CoroutineDispatcher.asExecutor` extension (#1450).
17+
* Fixed bug when `select` statement could report the same exception twice (#1433).
18+
* Fixed context preservation in `flatMapMerge` in a case when collected values were immediately emitted to another flow (#1440).
19+
* Reactive Flow integrations enclosing files are renamed for better interoperability with Java.
20+
* Default buffer size in all Flow operators is increased to 64.
21+
* Kotlin updated to 1.3.50.
22+
323
## Version 1.3.0-RC2
424

525
### Flow improvements

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
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.3.0-RC2) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.0-RC2)
5+
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.3.0) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.0)
66

77
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
8-
This is a companion version for Kotlin `1.3.41` release.
8+
This is a companion version for Kotlin `1.3.50` release.
99

1010
```kotlin
1111
suspend fun main() = coroutineScope {
@@ -81,15 +81,15 @@ Add dependencies (you can also add other modules that you need):
8181
<dependency>
8282
<groupId>org.jetbrains.kotlinx</groupId>
8383
<artifactId>kotlinx-coroutines-core</artifactId>
84-
<version>1.3.0-RC2</version>
84+
<version>1.3.0</version>
8585
</dependency>
8686
```
8787

8888
And make sure that you use the latest Kotlin version:
8989

9090
```xml
9191
<properties>
92-
<kotlin.version>1.3.41</kotlin.version>
92+
<kotlin.version>1.3.50</kotlin.version>
9393
</properties>
9494
```
9595

@@ -99,15 +99,15 @@ Add dependencies (you can also add other modules that you need):
9999

100100
```groovy
101101
dependencies {
102-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-RC2'
102+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
103103
}
104104
```
105105

106106
And make sure that you use the latest Kotlin version:
107107

108108
```groovy
109109
buildscript {
110-
ext.kotlin_version = '1.3.41'
110+
ext.kotlin_version = '1.3.50'
111111
}
112112
```
113113

@@ -125,15 +125,15 @@ Add dependencies (you can also add other modules that you need):
125125

126126
```groovy
127127
dependencies {
128-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-RC2")
128+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0")
129129
}
130130
```
131131

132132
And make sure that you use the latest Kotlin version:
133133

134134
```groovy
135135
plugins {
136-
kotlin("jvm") version "1.3.41"
136+
kotlin("jvm") version "1.3.50"
137137
}
138138
```
139139

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

150150
### Android
@@ -153,7 +153,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
153153
module as dependency when using `kotlinx.coroutines` on Android:
154154

155155
```groovy
156-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0-RC2'
156+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
157157
```
158158

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

174174
[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) version of `kotlinx.coroutines` is published as
175-
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.0-RC2/jar)
175+
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.0/jar)
176176
(follow the link to get the dependency declaration snippet).
177177

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

180180
### Native
181181

182182
[Kotlin/Native](https://kotlinlang.org/docs/reference/native-overview.html) version of `kotlinx.coroutines` is published as
183-
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.0-RC2/jar)
183+
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.0/jar)
184184
(follow the link to get the dependency declaration snippet).
185185

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

benchmarks/src/jmh/kotlin/benchmarks/YieldRelativeCostBenchmark.kt

-35
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package benchmarks.flow
6+
7+
import kotlinx.coroutines.*
8+
import kotlinx.coroutines.flow.*
9+
import org.openjdk.jmh.annotations.*
10+
import java.util.concurrent.*
11+
12+
@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
13+
@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
14+
@Fork(value = 1)
15+
@BenchmarkMode(Mode.AverageTime)
16+
@OutputTimeUnit(TimeUnit.MICROSECONDS)
17+
@State(Scope.Benchmark)
18+
open class FlatMapMergeBenchmark {
19+
20+
// Note: tests only absence of contention on downstream
21+
22+
@Param("10", "100", "1000")
23+
private var iterations = 100
24+
25+
@Benchmark
26+
fun flatMapUnsafe() = runBlocking {
27+
benchmarks.flow.scrabble.flow {
28+
repeat(iterations) { emit(it) }
29+
}.flatMapMerge { value ->
30+
flowOf(value)
31+
}.collect {
32+
if (it == -1) error("")
33+
}
34+
}
35+
36+
@Benchmark
37+
fun flatMapSafe() = runBlocking {
38+
kotlinx.coroutines.flow.flow {
39+
repeat(iterations) { emit(it) }
40+
}.flatMapMerge { value ->
41+
flowOf(value)
42+
}.collect {
43+
if (it == -1) error("")
44+
}
45+
}
46+
47+
}

benchmarks/src/jmh/kotlin/benchmarks/flow/misc/Numbers.kt renamed to benchmarks/src/jmh/kotlin/benchmarks/flow/NumbersBenchmark.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55

6-
package benchmarks.flow.misc
6+
package benchmarks.flow
77

88
import benchmarks.flow.scrabble.flow
99
import io.reactivex.*
@@ -35,7 +35,7 @@ import java.util.concurrent.*
3535
@BenchmarkMode(Mode.AverageTime)
3636
@OutputTimeUnit(TimeUnit.MICROSECONDS)
3737
@State(Scope.Benchmark)
38-
open class Numbers {
38+
open class NumbersBenchmark {
3939

4040
companion object {
4141
private const val primes = 100

benchmarks/src/jmh/kotlin/benchmarks/flow/misc/SafeFlowBenchmark.kt renamed to benchmarks/src/jmh/kotlin/benchmarks/flow/SafeFlowBenchmark.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
package benchmarks.flow.misc
5+
package benchmarks.flow
66

77
import kotlinx.coroutines.*
88
import kotlinx.coroutines.flow.*

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ public abstract class kotlinx/coroutines/ExecutorCoroutineDispatcher : kotlinx/c
293293
}
294294

295295
public final class kotlinx/coroutines/ExecutorsKt {
296+
public static final fun asExecutor (Lkotlinx/coroutines/CoroutineDispatcher;)Ljava/util/concurrent/Executor;
296297
public static final fun from (Ljava/util/concurrent/Executor;)Lkotlinx/coroutines/CoroutineDispatcher;
297298
public static final fun from (Ljava/util/concurrent/ExecutorService;)Lkotlinx/coroutines/ExecutorCoroutineDispatcher;
298299
}
@@ -992,7 +993,7 @@ public final class kotlinx/coroutines/flow/internal/SafeCollectorKt {
992993
public static final fun unsafeFlow (Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
993994
}
994995

995-
public final class kotlinx/coroutines/flow/internal/SendingCollector : kotlinx/coroutines/flow/internal/ConcurrentFlowCollector {
996+
public final class kotlinx/coroutines/flow/internal/SendingCollector : kotlinx/coroutines/flow/FlowCollector {
996997
public fun <init> (Lkotlinx/coroutines/channels/SendChannel;)V
997998
public fun emit (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
998999
}
@@ -1045,7 +1046,6 @@ public final class kotlinx/coroutines/selects/SelectBuilderImpl : kotlinx/corout
10451046
public fun invoke (Lkotlinx/coroutines/selects/SelectClause2;Lkotlin/jvm/functions/Function2;)V
10461047
public fun isSelected ()Z
10471048
public fun onTimeout (JLkotlin/jvm/functions/Function1;)V
1048-
public fun performAtomicIfNotSelected (Lkotlinx/coroutines/internal/AtomicDesc;)Ljava/lang/Object;
10491049
public fun performAtomicTrySelect (Lkotlinx/coroutines/internal/AtomicDesc;)Ljava/lang/Object;
10501050
public fun resumeSelectCancellableWithException (Ljava/lang/Throwable;)V
10511051
public fun resumeWith (Ljava/lang/Object;)V
@@ -1068,7 +1068,6 @@ public abstract interface class kotlinx/coroutines/selects/SelectInstance {
10681068
public abstract fun disposeOnSelect (Lkotlinx/coroutines/DisposableHandle;)V
10691069
public abstract fun getCompletion ()Lkotlin/coroutines/Continuation;
10701070
public abstract fun isSelected ()Z
1071-
public abstract fun performAtomicIfNotSelected (Lkotlinx/coroutines/internal/AtomicDesc;)Ljava/lang/Object;
10721071
public abstract fun performAtomicTrySelect (Lkotlinx/coroutines/internal/AtomicDesc;)Ljava/lang/Object;
10731072
public abstract fun resumeSelectCancellableWithException (Ljava/lang/Throwable;)V
10741073
public abstract fun trySelect (Ljava/lang/Object;)Z

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

+5
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@ public final class kotlinx/coroutines/reactive/PublisherCoroutine : kotlinx/coro
6262
public fun send (Ljava/lang/Object;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
6363
}
6464

65+
public final class kotlinx/coroutines/reactive/ReactiveFlowKt {
66+
public static final fun asFlow (Lorg/reactivestreams/Publisher;)Lkotlinx/coroutines/flow/Flow;
67+
public static final fun asPublisher (Lkotlinx/coroutines/flow/Flow;)Lorg/reactivestreams/Publisher;
68+
}
69+

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

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public final class kotlinx/coroutines/reactor/ReactorContextKt {
3636
public static final fun asCoroutineContext (Lreactor/util/context/Context;)Lkotlinx/coroutines/reactor/ReactorContext;
3737
}
3838

39+
public final class kotlinx/coroutines/reactor/ReactorFlowKt {
40+
public static final fun asFlux (Lkotlinx/coroutines/flow/Flow;)Lreactor/core/publisher/Flux;
41+
}
42+
3943
public final class kotlinx/coroutines/reactor/SchedulerCoroutineDispatcher : kotlinx/coroutines/CoroutineDispatcher, kotlinx/coroutines/Delay {
4044
public fun <init> (Lreactor/core/scheduler/Scheduler;)V
4145
public fun delay (JLkotlin/coroutines/Continuation;)Ljava/lang/Object;

build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ allprojects {
8282
ext.kotlin_version = rootProject.properties['kotlin_snapshot_version']
8383
println "Using Kotlin $kotlin_version for project $it"
8484

85-
if (version != atomicfu_version) {
85+
def skipSnapshotChecks = rootProject.properties['skip_snapshot_checks'] != null
86+
if (!skipSnapshotChecks && version != atomicfu_version) {
8687
throw new IllegalStateException("Current deploy version is $version, but atomicfu version is not overridden ($atomicfu_version) for $it")
8788
}
8889

0 commit comments

Comments
 (0)