Skip to content

Commit 204cf5d

Browse files
authored
Merge pull request #3667 from Kotlin/version-1.7.0-Beta
Version 1.7.0-Beta
2 parents 4116d4a + a3060c6 commit 204cf5d

File tree

403 files changed

+11425
-6893
lines changed

Some content is hidden

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

403 files changed

+11425
-6893
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ build
1212
out
1313
target
1414
local.properties
15+
benchmarks.jar
1516
/kotlin-js-store

.idea/dictionaries/shared.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGES.md

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

3+
## Version 1.7.0-Beta
4+
5+
### Core API significant improvements
6+
7+
* New `Channel` implementation with significant performance improvements across the API (#3621).
8+
* New `select` operator implementation: faster, more lightweight, and more robust (#3020).
9+
* `Mutex` and `Semaphore` now share the same underlying data structure (#3020).
10+
* `Dispatchers.IO` is added to K/N (#3205)
11+
* `newFixedThreadPool` and `Dispatchers.Default` implementations on K/N were wholly rewritten to support graceful growth under load (#3595).
12+
* `kotlinx-coroutines-test` rework:
13+
- Add the `timeout` parameter to `runTest` for the whole-test timeout, 10 seconds by default (#3270). This replaces the configuration of quiescence timeouts, which is now deprecated (#3603).
14+
- The `withTimeout` exception messages indicate if the timeout used the virtual time (#3588).
15+
- `TestCoroutineScheduler`, `runTest`, and `TestScope` API are promoted to stable (#3622).
16+
- `runTest` now also fails if there were uncaught exceptions in coroutines not inherited from the test coroutine (#1205).
17+
18+
### Breaking changes
19+
20+
* Old K/N memory model is no longer supported (#3375).
21+
* New generic upper bounds were added to reactive integration API where the language since 1.8.0 dictates (#3393).
22+
* `kotlinx-coroutines-core` and `kotlinx-coroutines-jdk8` artifacts were merged into a single artifact (#3268).
23+
* Artificial stackframes in stacktrace recovery no longer contain the `\b` symbol and are now navigable in IDE and supplied with proper documentation (#2291).
24+
* `CoroutineContext.isActive` returns `true` for contexts without any job in them (#3300).
25+
26+
### Bug fixes and improvements
27+
28+
* Kotlin version is updated to 1.8.10.
29+
* JPMS is supported (#2237). Thanks @lion7!
30+
* `BroadcastChannel` and all the corresponding API are deprecated (#2680).
31+
* Added all supported K/N targets (#3601, #812, #855).
32+
* K/N `Dispatchers.Default` is backed by the number of threads equal to the number of available cores (#3366).
33+
* Fixed an issue where some coroutines' internal exceptions were not properly serializable (#3328).
34+
* Introduced `Job.parent` API (#3201).
35+
* Fixed a bug when `TestScheduler` leaked cancelled jobs (#3398).
36+
* `TestScope.timeSource` now provides comparable time marks (#3617). Thanks @hfhbd!
37+
* Fixed an issue when cancelled `withTimeout` handles were preserved in JS runtime (#3440).
38+
* Ensure `awaitFrame` only awaits a single frame when used from the main looper (#3432). Thanks @pablobaxter!
39+
* Obsolete `Class-Path` attribute was removed from `kotlinx-coroutines-debug.jar` manifest (#3361).
40+
* Fixed a bug when `updateThreadContext` operated on the parent context (#3411).
41+
* Added new `Flow.filterIsInstance` extension (#3240).
42+
* `Dispatchers.Default` thread name prefixes are now configurable with system property (#3231).
43+
* Added `Flow.timeout` operator as `@FlowPreview` (#2624). Thanks @pablobaxter!
44+
* Improved the performance of the `future` builder in case of exceptions (#3475). Thanks @He-Pin!
45+
* `Mono.awaitSingleOrNull` now waits for the `onComplete` signal (#3487).
46+
* `Channel.isClosedForSend` and `Channel.isClosedForReceive` are promoted from experimental to delicate (#3448).
47+
* Fixed a data race in native `EventLoop` (#3547).
48+
* `Dispatchers.IO.limitedParallelism(valueLargerThanIOSize)` no longer creates an additional wrapper (#3442). Thanks @dovchinnikov!
49+
* Various `@FlowPreview` and `@ExperimentalCoroutinesApi` are promoted to experimental and stable respectively (#3542, #3097, #3548).
50+
* Performance improvements in `Dispatchers.Default` and `Dispatchers.IO` (#3416, #3418).
51+
* Fixed a bug when internal `suspendCancellableCoroutineReusable` might have hanged (#3613).
52+
* Introduced internal API to process events in the current system dispatcher (#3439).
53+
* Global `CoroutineExceptionHandler` is no longer invoked in case of unprocessed `future` failure (#3452).
54+
* Performance improvements and reduced thread-local pressure for the `withContext` operator (#3592).
55+
* Improved performance of `DebugProbes` (#3527).
56+
* Fixed a bug when the coroutine debugger might have detected the state of a coroutine incorrectly (#3193).
57+
* Various documentation improvements and fixes.
58+
359
## Version 1.6.4
460

561
* Added `TestScope.backgroundScope` for launching coroutines that perform work in the background and need to be cancelled at the end of the test (#3287).

README.md

+16-18
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
[![Kotlin Stable](https://kotl.in/badges/stable.svg)](https://kotlinlang.org/docs/components-stability.html)
44
[![JetBrains official project](https://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
55
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0)
6-
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.6.4)](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.6.4/pom)
7-
[![Kotlin](https://img.shields.io/badge/kotlin-1.6.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
6+
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-Beta)](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.0-Beta/pom)
7+
[![Kotlin](https://img.shields.io/badge/kotlin-1.8.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
88
[![Slack channel](https://img.shields.io/badge/chat-slack-green.svg?logo=slack)](https://kotlinlang.slack.com/messages/coroutines/)
99

1010
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
11-
This is a companion version for the Kotlin `1.6.21` release.
11+
This is a companion version for the Kotlin `1.8.10` release.
1212

1313
```kotlin
1414
suspend fun main() = coroutineScope {
@@ -37,6 +37,7 @@ suspend fun main() = coroutineScope {
3737
* [core/jvm](kotlinx-coroutines-core/jvm/) — additional core features available on Kotlin/JVM:
3838
* [Dispatchers.IO] dispatcher for blocking coroutines;
3939
* [Executor.asCoroutineDispatcher][asCoroutineDispatcher] extension, custom thread pools, and more.
40+
* Integrations with `CompletableFuture` and JVM-specific extensions.
4041
* [core/js](kotlinx-coroutines-core/js/) — additional core features available on Kotlin/JS:
4142
* Integration with `Promise` via [Promise.await] and [promise] builder;
4243
* Integration with `Window` via [Window.asCoroutineDispatcher], etc.
@@ -56,7 +57,7 @@ suspend fun main() = coroutineScope {
5657
* [ui](ui/README.md) — modules that provide coroutine dispatchers for various single-threaded UI libraries:
5758
* Android, JavaFX, and Swing.
5859
* [integration](integration/README.md) — modules that provide integration with various asynchronous callback- and future-based libraries:
59-
* JDK8 [CompletionStage.await], Guava [ListenableFuture.await], and Google Play Services [Task.await];
60+
* Guava [ListenableFuture.await], and Google Play Services [Task.await];
6061
* SLF4J MDC integration via [MDCContext].
6162

6263
## Documentation
@@ -84,15 +85,15 @@ Add dependencies (you can also add other modules that you need):
8485
<dependency>
8586
<groupId>org.jetbrains.kotlinx</groupId>
8687
<artifactId>kotlinx-coroutines-core</artifactId>
87-
<version>1.6.4</version>
88+
<version>1.7.0-Beta</version>
8889
</dependency>
8990
```
9091

9192
And make sure that you use the latest Kotlin version:
9293

9394
```xml
9495
<properties>
95-
<kotlin.version>1.6.21</kotlin.version>
96+
<kotlin.version>1.8.10</kotlin.version>
9697
</properties>
9798
```
9899

@@ -102,7 +103,7 @@ Add dependencies (you can also add other modules that you need):
102103

103104
```kotlin
104105
dependencies {
105-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
106+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-Beta")
106107
}
107108
```
108109

@@ -111,10 +112,10 @@ And make sure that you use the latest Kotlin version:
111112
```kotlin
112113
plugins {
113114
// For build.gradle.kts (Kotlin DSL)
114-
kotlin("jvm") version "1.6.21"
115+
kotlin("jvm") version "1.8.10"
115116

116117
// For build.gradle (Groovy DSL)
117-
id "org.jetbrains.kotlin.jvm" version "1.6.21"
118+
id "org.jetbrains.kotlin.jvm" version "1.8.10"
118119
}
119120
```
120121

@@ -132,7 +133,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
132133
module as a dependency when using `kotlinx.coroutines` on Android:
133134

134135
```kotlin
135-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
136+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0-Beta")
136137
```
137138

138139
This gives you access to the Android [Dispatchers.Main]
@@ -167,7 +168,7 @@ In common code that should get compiled for different platforms, you can add a d
167168
```kotlin
168169
commonMain {
169170
dependencies {
170-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
171+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.0-Beta")
171172
}
172173
}
173174
```
@@ -179,15 +180,15 @@ Platform-specific dependencies are recommended to be used only for non-multiplat
179180
#### JS
180181

181182
Kotlin/JS version of `kotlinx.coroutines` is published as
182-
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.6.4/jar)
183+
[`kotlinx-coroutines-core-js`](https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.7.0-Beta/jar)
183184
(follow the link to get the dependency declaration snippet) and as [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) NPM package.
184185

185186
#### Native
186187

187188
Kotlin/Native version of `kotlinx.coroutines` is published as
188189
[`kotlinx-coroutines-core-$platform`](https://mvnrepository.com/search?q=kotlinx-coroutines-core-) where `$platform` is
189-
the target Kotlin/Native platform. [List of currently supported targets](https://github.com/Kotlin/kotlinx.coroutines/blob/master/gradle/compile-native-multiplatform.gradle#L16).
190-
190+
the target Kotlin/Native platform.
191+
Targets are provided in accordance with [official K/N target support](https://kotlinlang.org/docs/native-target-support.html).
191192
## Building and Contributing
192193

193194
See [Contributing Guidelines](CONTRIBUTING.md).
@@ -211,7 +212,7 @@ See [Contributing Guidelines](CONTRIBUTING.md).
211212
[MainScope()]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-main-scope.html
212213
[SupervisorJob()]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-supervisor-job.html
213214
[CoroutineExceptionHandler]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-exception-handler/index.html
214-
[Dispatchers.IO]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-dispatchers/-i-o.html
215+
[Dispatchers.IO]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-i-o.html
215216
[asCoroutineDispatcher]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/as-coroutine-dispatcher.html
216217
[Promise.await]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/await.html
217218
[promise]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/promise.html
@@ -259,9 +260,6 @@ See [Contributing Guidelines](CONTRIBUTING.md).
259260

260261
<!--- MODULE kotlinx-coroutines-jdk8 -->
261262
<!--- INDEX kotlinx.coroutines.future -->
262-
263-
[CompletionStage.await]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-jdk8/kotlinx.coroutines.future/await.html
264-
265263
<!--- MODULE kotlinx-coroutines-guava -->
266264
<!--- INDEX kotlinx.coroutines.guava -->
267265

benchmarks/build.gradle.kts

+6-19
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
@file:Suppress("UnstableApiUsage")
66

7-
import me.champeau.gradle.*
7+
import me.champeau.jmh.*
88
import org.jetbrains.kotlin.gradle.tasks.*
99

1010
plugins {
1111
id("com.github.johnrengelman.shadow")
12-
id("me.champeau.gradle.jmh") apply false
12+
id("me.champeau.jmh")
1313
}
1414

1515
repositories {
@@ -21,33 +21,19 @@ java {
2121
targetCompatibility = JavaVersion.VERSION_1_8
2222
}
2323

24-
apply(plugin="me.champeau.gradle.jmh")
25-
2624
tasks.named<KotlinCompile>("compileJmhKotlin") {
2725
kotlinOptions {
2826
jvmTarget = "1.8"
2927
freeCompilerArgs += "-Xjvm-default=enable"
3028
}
3129
}
3230

33-
// It is better to use the following to run benchmarks, otherwise you may get unexpected errors:
34-
// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark"
35-
extensions.configure<JMHPluginExtension>("jmh") {
36-
jmhVersion = "1.26"
37-
duplicateClassesStrategy = DuplicatesStrategy.INCLUDE
38-
failOnError = true
39-
resultFormat = "CSV"
40-
project.findProperty("jmh")?.also {
41-
include = listOf(".*$it.*")
42-
}
43-
// includeTests = false
44-
}
45-
4631
val jmhJarTask = tasks.named<Jar>("jmhJar") {
4732
archiveBaseName by "benchmarks"
4833
archiveClassifier by null
4934
archiveVersion by null
50-
destinationDirectory.file("$rootDir")
35+
archiveVersion.convention(null as String?)
36+
destinationDirectory.set(file("$rootDir"))
5137
}
5238

5339
tasks {
@@ -63,13 +49,14 @@ tasks {
6349
}
6450

6551
dependencies {
66-
implementation("org.openjdk.jmh:jmh-core:1.26")
52+
implementation("org.openjdk.jmh:jmh-core:1.35")
6753
implementation("io.projectreactor:reactor-core:${version("reactor")}")
6854
implementation("io.reactivex.rxjava2:rxjava:2.1.9")
6955
implementation("com.github.akarnokd:rxjava2-extensions:0.20.8")
7056

7157
implementation("com.typesafe.akka:akka-actor_2.12:2.5.0")
7258
implementation(project(":kotlinx-coroutines-core"))
59+
implementation(project(":kotlinx-coroutines-debug"))
7360
implementation(project(":kotlinx-coroutines-reactive"))
7461

7562
// add jmh dependency on main

0 commit comments

Comments
 (0)