Skip to content

Commit 99b78e4

Browse files
authored
Merge pull request #1703 from Kotlin/version-1.3.3
Version 1.3.3
2 parents 344e932 + efc234f commit 99b78e4

File tree

281 files changed

+6779
-4040
lines changed

Some content is hidden

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

281 files changed

+6779
-4040
lines changed

Diff for: CHANGES.md

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

3+
## Version 1.3.3
4+
5+
### Flow
6+
* `Flow.take` performance is significantly improved (#1538).
7+
* `Flow.merge` operator (#1491).
8+
* Reactive Flow adapters are promoted to stable API (#1549).
9+
* Reusable cancellable continuations were introduced that improved the performance of various flow operators and iteration over channels (#1534).
10+
* Fixed interaction of multiple flows with `take` operator (#1610).
11+
* Throw `NoSuchElementException` instead of `UnsupportedOperationException` for empty `Flow` in `reduce` operator (#1659).
12+
* `onCompletion` now rethrows downstream exceptions on emit attempt (#1654).
13+
* Allow non-emitting `withContext` from `flow` builder (#1616).
14+
15+
### Debugging
16+
17+
* `DebugProbes.dumpCoroutines` is optimized to be able to print the 6-digit number of coroutines (#1535).
18+
* Properly capture unstarted lazy coroutines in debugger (#1544).
19+
* Capture coroutines launched from within a test constructor with `CoroutinesTimeout` test rule (#1542).
20+
* Stacktraces of `Job`-related coroutine machinery are shortened and prettified (#1574).
21+
* Stacktrace recovery unification that should provide a consistent experience recover of stacktrace (#1597).
22+
* Stacktrace recovery for `withTimeout` is supported (#1625).
23+
* Do not recover exception with a single `String` parameter constructor that is not a `message` (#1631).
24+
25+
### Other features
26+
27+
* `Dispatchers.Default` and `Dispatchers.IO` rework: CPU consumption is significantly lower, predictable idle threads termination (#840, #1046, #1286).
28+
* Avoid `ServiceLoader` for loading `Dispatchers.Main` (#1572, #1557, #878, #1606).
29+
* Consistently handle undeliverable exceptions in RxJava and Reactor integrations (#252, #1614).
30+
* `yield` support in immediate dispatchers (#1474).
31+
* `CompletableDeferred.completeWith(result: Result<T>)` is introduced.
32+
* Added support for tvOS and watchOS-based Native targets (#1596).
33+
34+
### Bug fixes and improvements
35+
36+
* Kotlin version is updated to 1.3.61.
37+
* `CoroutineDispatcher.isDispatchNeeded` is promoted to stable API (#1014).
38+
* Livelock and stackoverflows in mutual `select` expressions are fixed (#1411, #504).
39+
* Properly handle `null` values in `ListenableFuture` integration (#1510).
40+
* Making ReceiveChannel.cancel linearizability-friendly.
41+
* Linearizability of Channel.close in a complex contended cases (#1419).
42+
* ArrayChannel.isBufferEmpty atomicity is fixed (#1526).
43+
* Various documentation improvements.
44+
* Reduced bytecode size of `kotlinx-coroutines-core`, reduced size of minified `dex` when using basic functionality of `kotlinx-coroutines`.
45+
346
## Version 1.3.2
447

548
This is a maintenance release that does not include any new features or bug fixes.

Diff for: 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.2) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.2)
5+
[![Download](https://api.bintray.com/packages/kotlin/kotlinx/kotlinx.coroutines/images/download.svg?version=1.3.3) ](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines/1.3.3)
66

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

1010
```kotlin
1111
suspend fun main() = coroutineScope {
@@ -82,15 +82,15 @@ Add dependencies (you can also add other modules that you need):
8282
<dependency>
8383
<groupId>org.jetbrains.kotlinx</groupId>
8484
<artifactId>kotlinx-coroutines-core</artifactId>
85-
<version>1.3.2</version>
85+
<version>1.3.3</version>
8686
</dependency>
8787
```
8888

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

9191
```xml
9292
<properties>
93-
<kotlin.version>1.3.50</kotlin.version>
93+
<kotlin.version>1.3.61</kotlin.version>
9494
</properties>
9595
```
9696

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

101101
```groovy
102102
dependencies {
103-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2'
103+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
104104
}
105105
```
106106

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

109109
```groovy
110110
buildscript {
111-
ext.kotlin_version = '1.3.50'
111+
ext.kotlin_version = '1.3.61'
112112
}
113113
```
114114

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

127127
```groovy
128128
dependencies {
129-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2")
129+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
130130
}
131131
```
132132

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

135135
```groovy
136136
plugins {
137-
kotlin("jvm") version "1.3.50"
137+
kotlin("jvm") version "1.3.61"
138138
}
139139
```
140140

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

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

156156
```groovy
157-
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2'
157+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
158158
```
159159

160160
This gives you access to Android [Dispatchers.Main]
@@ -173,15 +173,15 @@ R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default
173173
### JS
174174

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

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

181181
### Native
182182

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

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

Diff for: benchmarks/src/jmh/kotlin/benchmarks/CancellableContinuationBenchmark.kt

-53
This file was deleted.

Diff for: benchmarks/src/jmh/kotlin/benchmarks/ChannelProducerConsumerBenchmark.kt

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
15
package benchmarks
26

37
import kotlinx.coroutines.*

Diff for: benchmarks/src/jmh/kotlin/benchmarks/ParametrizedDispatcherBase.kt

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

55
package benchmarks
66

7-
import benchmarks.actors.CORES_COUNT
7+
import benchmarks.akka.CORES_COUNT
88
import kotlinx.coroutines.*
99
import kotlinx.coroutines.scheduling.*
1010
import org.openjdk.jmh.annotations.Param
@@ -22,14 +22,14 @@ abstract class ParametrizedDispatcherBase : CoroutineScope {
2222

2323
abstract var dispatcher: String
2424
override lateinit var coroutineContext: CoroutineContext
25-
var closeable: Closeable? = null
25+
private var closeable: Closeable? = null
2626

27-
@UseExperimental(InternalCoroutinesApi::class)
2827
@Setup
28+
@UseExperimental(InternalCoroutinesApi::class)
2929
open fun setup() {
3030
coroutineContext = when {
3131
dispatcher == "fjp" -> ForkJoinPool.commonPool().asCoroutineDispatcher()
32-
dispatcher == "experimental" -> {
32+
dispatcher == "scheduler" -> {
3333
ExperimentalCoroutineDispatcher(CORES_COUNT).also { closeable = it }
3434
}
3535
dispatcher.startsWith("ftp") -> {

Diff for: benchmarks/src/jmh/kotlin/benchmarks/actors/PingPongAkkaBenchmark.kt renamed to benchmarks/src/jmh/kotlin/benchmarks/akka/PingPongAkkaBenchmark.kt

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* 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.actors
5+
package benchmarks.akka
66

77
import akka.actor.ActorRef
88
import akka.actor.ActorSystem
@@ -13,7 +13,6 @@ import org.openjdk.jmh.annotations.*
1313
import scala.concurrent.Await
1414
import scala.concurrent.duration.Duration
1515
import java.util.concurrent.CountDownLatch
16-
import java.util.concurrent.TimeUnit
1716

1817
const val N_MESSAGES = 100_000
1918

@@ -29,12 +28,12 @@ class Stop
2928
* PingPongAkkaBenchmark.singlePingPong default-dispatcher avgt 10 173.742 ± 41.984 ms/op
3029
* PingPongAkkaBenchmark.singlePingPong single-thread-dispatcher avgt 10 24.181 ± 0.730 ms/op
3130
*/
32-
@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
33-
@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
34-
@Fork(value = 2)
35-
@BenchmarkMode(Mode.AverageTime)
36-
@OutputTimeUnit(TimeUnit.MILLISECONDS)
37-
@State(Scope.Benchmark)
31+
//@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
32+
//@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
33+
//@Fork(value = 2)
34+
//@BenchmarkMode(Mode.AverageTime)
35+
//@OutputTimeUnit(TimeUnit.MILLISECONDS)
36+
//@State(Scope.Benchmark)
3837
open class PingPongAkkaBenchmark {
3938

4039
lateinit var system: ActorSystem
@@ -62,12 +61,12 @@ open class PingPongAkkaBenchmark {
6261
Await.ready(system.terminate(), Duration.Inf())
6362
}
6463

65-
@Benchmark
64+
// @Benchmark
6665
fun singlePingPong() {
6766
runPingPongs(1)
6867
}
6968

70-
@Benchmark
69+
// @Benchmark
7170
fun coresCountPingPongs() {
7271
runPingPongs(Runtime.getRuntime().availableProcessors())
7372
}

Diff for: benchmarks/src/jmh/kotlin/benchmarks/actors/StatefulActorAkkaBenchmark.kt renamed to benchmarks/src/jmh/kotlin/benchmarks/akka/StatefulActorAkkaBenchmark.kt

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
2+
* 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.actors
5+
package benchmarks.akka
66

77
import akka.actor.ActorRef
88
import akka.actor.ActorSystem
@@ -14,7 +14,6 @@ import scala.concurrent.Await
1414
import scala.concurrent.duration.Duration
1515
import java.util.concurrent.CountDownLatch
1616
import java.util.concurrent.ThreadLocalRandom
17-
import java.util.concurrent.TimeUnit
1817

1918
const val ROUNDS = 10_000
2019
const val STATE_SIZE = 1024
@@ -38,12 +37,12 @@ val CORES_COUNT = Runtime.getRuntime().availableProcessors()
3837
* StatefulActorAkkaBenchmark.singleComputationSingleRequestor default-dispatcher avgt 14 39.964 ± 2.343 ms/op
3938
* StatefulActorAkkaBenchmark.singleComputationSingleRequestor single-thread-dispatcher avgt 14 10.214 ± 2.152 ms/op
4039
*/
41-
@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
42-
@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
43-
@Fork(value = 2)
44-
@BenchmarkMode(Mode.AverageTime)
45-
@OutputTimeUnit(TimeUnit.MILLISECONDS)
46-
@State(Scope.Benchmark)
40+
//@Warmup(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
41+
//@Measurement(iterations = 7, time = 1, timeUnit = TimeUnit.SECONDS)
42+
//@Fork(value = 2)
43+
//@BenchmarkMode(Mode.AverageTime)
44+
//@OutputTimeUnit(TimeUnit.MILLISECONDS)
45+
//@State(Scope.Benchmark)
4746
open class StatefulActorAkkaBenchmark {
4847

4948
lateinit var system: ActorSystem
@@ -72,22 +71,22 @@ open class StatefulActorAkkaBenchmark {
7271
Await.ready(system.terminate(), Duration.Inf())
7372
}
7473

75-
@Benchmark
74+
// @Benchmark
7675
fun singleComputationSingleRequestor() {
7776
run(1, 1)
7877
}
7978

80-
@Benchmark
79+
// @Benchmark
8180
fun singleComputationMultipleRequestors() {
8281
run(1, CORES_COUNT)
8382
}
8483

85-
@Benchmark
84+
// @Benchmark
8685
fun multipleComputationsSingleRequestor() {
8786
run(CORES_COUNT, 1)
8887
}
8988

90-
@Benchmark
89+
// @Benchmark
9190
fun multipleComputationsMultipleRequestors() {
9291
run(CORES_COUNT, CORES_COUNT)
9392
}
@@ -120,7 +119,8 @@ open class StatefulActorAkkaBenchmark {
120119

121120
private fun createComputationActors(initLatch: CountDownLatch, count: Int): List<ActorRef> {
122121
return (0 until count).map {
123-
system.actorOf(Props.create(ComputationActor::class.java,
122+
system.actorOf(Props.create(
123+
ComputationActor::class.java,
124124
LongArray(STATE_SIZE) { ThreadLocalRandom.current().nextLong(0, 100) }, initLatch)
125125
.withDispatcher("akka.actor.$dispatcher"))
126126
}

0 commit comments

Comments
 (0)