Skip to content

Commit d7de5f5

Browse files
authored
Merge pull request #1846 from Kotlin/version-1.3.4
Version 1.3.4
2 parents 9be85a4 + bb3cf09 commit d7de5f5

File tree

699 files changed

+4984
-6206
lines changed

Some content is hidden

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

699 files changed

+4984
-6206
lines changed

Diff for: 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.4
4+
5+
### Flow
6+
7+
* Detect missing `awaitClose` calls in `callbackFlow` to make it less error-prone when used with callbacks (#1762, #1770). This change makes `callbackFlow` **different** from `channelFlow`.
8+
* `ReceiveChannel.asFlow` extension is introduced (#1490).
9+
* Enforce exception transparency invariant in `flow` builder (#1657).
10+
* Proper `Dispatcher` support in `Flow` reactive integrations (#1765).
11+
* Batch `Subscription.request` calls in `Flow` reactive integration (#766).
12+
* `ObservableValue.asFlow` added to JavaFx integration module (#1695).
13+
* `ObservableSource.asFlow` added to RxJava2 integration module (#1768).
14+
15+
### Other changes
16+
17+
* `kotlinx-coroutines-core` is optimized for R8, making it much smaller for Android usages (75 KB for `1.3.4` release).
18+
* Performance of `Dispatchers.Default` is improved (#1704, #1706).
19+
* Kotlin is updated to 1.3.70.
20+
* `CoroutineDispatcher` and `ExecutorCoroutineDispatcher` experimental coroutine context keys are introduced (#1805).
21+
* Performance of various `Channel` operations is improved (#1565).
22+
323
## Version 1.3.3
424

525
### Flow

Diff for: README.md

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

77
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
8-
This is a companion version for Kotlin `1.3.61` release.
8+
This is a companion version for Kotlin `1.3.70` 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.3</version>
85+
<version>1.3.4</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.61</kotlin.version>
93+
<kotlin.version>1.3.70</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.3'
103+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4'
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.61'
111+
ext.kotlin_version = '1.3.70'
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.3")
129+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4")
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.61"
137+
kotlin("jvm") version "1.3.70"
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.3/jar)
148+
[`kotlinx-coroutines-core-common`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-common/1.3.4/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.3'
157+
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4'
158158
```
159159

160160
This gives you access to Android [Dispatchers.Main]
@@ -164,24 +164,21 @@ threads are handled by Android runtime.
164164

165165
#### R8 and ProGuard
166166

167-
For R8 no actions required, it will take obfuscation rules from the jar.
168-
169-
For Proguard you need to add options from [coroutines.pro](kotlinx-coroutines-core/jvm/resources/META-INF/proguard/coroutines.pro) to your rules manually.
170-
171-
R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default since Android gradle plugin 3.4.0 (3.3.0-beta also had it enabled).
167+
R8 and ProGuard rules are bundled into the [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android) module.
168+
For more details see ["Optimization" section for Android](ui/kotlinx-coroutines-android/README.md#optimization).
172169

173170
### JS
174171

175172
[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.3/jar)
173+
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.3.4/jar)
177174
(follow the link to get the dependency declaration snippet).
178175

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

181178
### Native
182179

183180
[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.3/jar)
181+
[`kotlinx-coroutines-core-native`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-native/1.3.4/jar)
185182
(follow the link to get the dependency declaration snippet).
186183

187184
Only single-threaded code (JS-style) on Kotlin/Native is currently supported.
@@ -203,8 +200,9 @@ to Gradle (in Preferences -> Build, Execution, Deployment -> Build Tools -> Grad
203200

204201
### Requirements
205202

206-
* JDK >= 1.8 referred to by the `JAVA_HOME` environment variable. JDK must include JavaFX.
203+
* JDK >= 11 referred to by the `JAVA_HOME` environment variable.
207204
* JDK 1.6 referred to by the `JDK_16` environment variable. It is okay to have `JDK_16` pointing to `JAVA_HOME` for external contributions.
205+
* JDK 1.8 referred to by the `JDK_18` environment variable. Only used by nightly stress-tests. It is okay to have `JDK_16` pointing to `JAVA_HOME` for external contributions.
208206

209207
## Contributions and releases
210208

@@ -217,6 +215,12 @@ The `develop` branch is pushed to `master` during release.
217215

218216
* Full release procedure checklist is [here](RELEASE.md).
219217
* Steps for contributing new integration modules are explained [here](integration/README.md#Contributing).
218+
* Use [Knit](https://github.com/Kotlin/kotlinx-knit/blob/master/README.md) for updates to documentation:
219+
* In project root directory run `./gradlew knit`.
220+
* Commit updated documents and examples together with other changes.
221+
* Use [Binary Compatibility Validator](https://github.com/Kotlin/binary-compatibility-validator/blob/master/README.md) for updates to public API:
222+
* In project root directory run `./gradlew apiDump`.
223+
* Commit updated API index together with other changes.
220224

221225
<!--- MODULE kotlinx-coroutines-core -->
222226
<!--- INDEX kotlinx.coroutines -->

Diff for: RELEASE.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ To release new `<version>` of `kotlinx-coroutines`:
5353
* Create a release named `<version>`.
5454
* Cut & paste lines from [`CHANGES.md`](CHANGES.md) into description.
5555

56-
3. Build and publish documentation for web-site: <br>
56+
3. Build and publish documentation for web-site
57+
(make sure you have [Docker](https://www.docker.com/) installed first): <br>
5758
`site/deploy.sh <version> push`
5859

5960
4. In [Bintray](https://bintray.com/kotlin/kotlinx/kotlinx.coroutines) admin interface:

Diff for: benchmarks/build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44
sourceCompatibility = 1.8
55
targetCompatibility = 1.8
@@ -74,4 +74,6 @@ dependencies {
7474
compile "org.openjdk.jmh:jmh-core:1.21"
7575
compile 'com.typesafe.akka:akka-actor_2.12:2.5.0'
7676
compile project(':kotlinx-coroutines-core')
77+
// add jmh dependency on main
78+
jmh sourceSets.main.runtimeClasspath
7779
}
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# To run this script run the command 'python3 scripts/generate_plots_flow_flatten_merge.py' in the /benchmarks folder
2+
3+
4+
import pandas as pd
5+
import sys
6+
import locale
7+
import matplotlib.pyplot as plt
8+
from matplotlib.ticker import FormatStrFormatter
9+
10+
input_file = "build/reports/jmh/results.csv"
11+
output_file = "out/flow-flatten-merge.svg"
12+
# Please change the value of this variable according to the FlowFlattenMergeBenchmarkKt.ELEMENTS
13+
elements = 100000
14+
benchmark_name = "benchmarks.flow.FlowFlattenMergeBenchmark.flattenMerge"
15+
csv_columns = ["Benchmark", "Score", "Unit", "Param: concurrency", "Param: flowsNumberStrategy"]
16+
rename_columns = {"Benchmark": "benchmark", "Score" : "score", "Unit" : "unit",
17+
"Param: concurrency" : "concurrency", "Param: flowsNumberStrategy" : "flows"}
18+
19+
markers = ['.', 'v', '^', '1', '2', '8', 'p', 'P', 'x', 'D', 'd', 's']
20+
colours = ['red', 'gold', 'sienna', 'olivedrab', 'lightseagreen', 'navy', 'blue', 'm', 'crimson', 'yellow', 'orangered', 'slateblue', 'aqua', 'black', 'silver']
21+
22+
def next_colour():
23+
i = 0
24+
while True:
25+
yield colours[i % len(colours)]
26+
i += 1
27+
28+
def next_marker():
29+
i = 0
30+
while True:
31+
yield markers[i % len(markers)]
32+
i += 1
33+
34+
def draw(data, plt):
35+
plt.xscale('log', basex=2)
36+
plt.gca().xaxis.set_major_formatter(FormatStrFormatter('%0.f'))
37+
plt.grid(linewidth='0.5', color='lightgray')
38+
if data.unit.unique()[0] != "ops/s":
39+
print("Unexpected time unit: " + data.unit.unique()[0])
40+
sys.exit(1)
41+
plt.ylabel("elements / ms")
42+
plt.xlabel('concurrency')
43+
plt.xticks(data.concurrency.unique())
44+
45+
colour_gen = next_colour()
46+
marker_gen = next_marker()
47+
for flows in data.flows.unique():
48+
gen_colour = next(colour_gen)
49+
gen_marker = next(marker_gen)
50+
res = data[(data.flows == flows)]
51+
# plt.plot(res.concurrency, res.score*elements/1000, label="flows={}".format(flows), color=gen_colour, marker=gen_marker)
52+
plt.errorbar(x=res.concurrency, y=res.score*elements/1000, yerr=res.score_error*elements/1000, solid_capstyle='projecting',
53+
label="flows={}".format(flows), capsize=4, color=gen_colour, linewidth=2.2)
54+
55+
langlocale = locale.getdefaultlocale()[0]
56+
locale.setlocale(locale.LC_ALL, langlocale)
57+
dp = locale.localeconv()['decimal_point']
58+
if dp == ",":
59+
csv_columns.append("Score Error (99,9%)")
60+
rename_columns["Score Error (99,9%)"] = "score_error"
61+
elif dp == ".":
62+
csv_columns.append("Score Error (99.9%)")
63+
rename_columns["Score Error (99.9%)"] = "score_error"
64+
else:
65+
print("Unexpected locale delimeter: " + dp)
66+
sys.exit(1)
67+
data = pd.read_csv(input_file, sep=",", decimal=dp)
68+
data = data[csv_columns].rename(columns=rename_columns)
69+
data = data[(data.benchmark == benchmark_name)]
70+
plt.rcParams.update({'font.size': 15})
71+
plt.figure(figsize=(12.5, 10))
72+
draw(data, plt)
73+
plt.legend(loc='upper center', borderpad=0, bbox_to_anchor=(0.5, 1.3), ncol=2, frameon=False, borderaxespad=2, prop={'size': 15})
74+
plt.tight_layout(pad=12, w_pad=2, h_pad=1)
75+
plt.savefig(output_file, bbox_inches='tight')

Diff for: benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabble.java

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

55
package benchmarks.flow.scrabble;
@@ -160,4 +160,4 @@ public List<Entry<Integer, List<String>>> play() throws Exception {
160160
.blockingGet() ;
161161
return finalList2 ;
162162
}
163-
}
163+
}

Diff for: benchmarks/src/jmh/java/benchmarks/flow/scrabble/RxJava2PlaysScrabbleOpt.java

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

55
package benchmarks.flow.scrabble;
@@ -171,4 +171,4 @@ public List<Entry<Integer, List<String>>> play() throws Exception {
171171

172172
return finalList2 ;
173173
}
174-
}
174+
}

Diff for: benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/FlowableCharSequence.java

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

55
package benchmarks.flow.scrabble.optimizations;

Diff for: benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/FlowableSplit.java

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

55
package benchmarks.flow.scrabble.optimizations;

Diff for: benchmarks/src/jmh/java/benchmarks/flow/scrabble/optimizations/StringFlowable.java

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

55
package benchmarks.flow.scrabble.optimizations;

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

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

55
package benchmarks
@@ -147,4 +147,4 @@ private fun doWork(): Unit = Blackhole.consumeCPU(ThreadLocalRandom.current().ne
147147

148148
private const val WORK_MIN = 50L
149149
private const val WORK_MAX = 100L
150-
private const val APPROX_BATCH_SIZE = 100000
150+
private const val APPROX_BATCH_SIZE = 100000

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package benchmarks

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

55
package benchmarks
@@ -44,4 +44,4 @@ abstract class ParametrizedDispatcherBase : CoroutineScope {
4444
closeable?.close()
4545
}
4646

47-
}
47+
}

0 commit comments

Comments
 (0)