Skip to content

Commit 04522a4

Browse files
authored
Merge branch 'Kotlin:master' into channels-remove-counters
2 parents 7a9906b + fed40ad commit 04522a4

File tree

82 files changed

+1130
-529
lines changed

Some content is hidden

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

82 files changed

+1130
-529
lines changed

Diff for: CHANGES.md

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

3+
## Version 1.10.1
4+
5+
* Fixed binary incompatibility introduced for non-JVM targets in #4261 (#4309).
6+
7+
## Version 1.10.0
8+
9+
* Kotlin was updated to 2.1.0 (#4284).
10+
* Introduced `Flow.any`, `Flow.all`, and `Flow.none` (#4212). Thanks, @CLOVIS-AI!
11+
* Reorganized `kotlinx-coroutines-debug` and `kotlinx-coroutines-core` code to avoid a split package between the two artifacts (#4247). Note that directly referencing `kotlinx.coroutines.debug.AgentPremain` must now be replaced with `kotlinx.coroutines.debug.internal.AgentPremain`. Thanks, @sellmair!
12+
* No longer shade byte-buddy in `kotlinx-coroutines-debug`, reducing the artifact size and simplifying the build configuration of client code. Thanks, @sellmair!
13+
* Fixed `NullPointerException` when using Java-deserialized `kotlinx-coroutines-core` exceptions (#4291). Thanks, @AlexRiedler!
14+
* Properly report exceptions thrown by `CoroutineDispatcher.dispatch` instead of raising internal errors (#4091). Thanks, @zuevmaxim!
15+
* Fixed a bug that delayed scheduling of a `Dispatchers.Default` or `Dispatchers.IO` task after a `yield()` in rare scenarios (#4248).
16+
* Fixed a bug that prevented the `main()` coroutine on Wasm/WASI from executing after a `delay()` call in some scenarios (#4239).
17+
* Fixed scheduling of `runBlocking` tasks on Kotlin/Native that arrive after the `runBlocking` block was exited (#4245).
18+
* Fixed some terminal `Flow` operators sometimes resuming without taking cancellation into account (#4254). Thanks, @jxdabc!
19+
* Fixed a bug on the JVM that caused coroutine-bound `ThreadLocal` values not to get cleaned when using non-`CoroutineDispatcher` continuation interceptors (#4296).
20+
* Small tweaks, fixes, and documentation improvements.
21+
322
## Version 1.9.0
423

524
### Features

Diff for: README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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.9.0)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.9.0)
6+
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.10.1)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.10.1)
77
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.0-blue.svg?logo=kotlin)](http://kotlinlang.org)
88
[![KDoc link](https://img.shields.io/badge/API_reference-KDoc-blue)](https://kotlinlang.org/api/kotlinx.coroutines/)
99
[![Slack channel](https://img.shields.io/badge/chat-slack-green.svg?logo=slack)](https://kotlinlang.slack.com/messages/coroutines/)
@@ -86,7 +86,7 @@ Add dependencies (you can also add other modules that you need):
8686
<dependency>
8787
<groupId>org.jetbrains.kotlinx</groupId>
8888
<artifactId>kotlinx-coroutines-core</artifactId>
89-
<version>1.9.0</version>
89+
<version>1.10.1</version>
9090
</dependency>
9191
```
9292

@@ -104,7 +104,7 @@ Add dependencies (you can also add other modules that you need):
104104

105105
```kotlin
106106
dependencies {
107-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
107+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
108108
}
109109
```
110110

@@ -134,7 +134,7 @@ Add [`kotlinx-coroutines-android`](ui/kotlinx-coroutines-android)
134134
module as a dependency when using `kotlinx.coroutines` on Android:
135135

136136
```kotlin
137-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
137+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
138138
```
139139

140140
This gives you access to the Android [Dispatchers.Main]
@@ -169,7 +169,7 @@ In common code that should get compiled for different platforms, you can add a d
169169
```kotlin
170170
commonMain {
171171
dependencies {
172-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
172+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
173173
}
174174
}
175175
```
@@ -179,7 +179,7 @@ Platform-specific dependencies are recommended to be used only for non-multiplat
179179
#### JS
180180

181181
Kotlin/JS version of `kotlinx.coroutines` is published as
182-
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.9.0)
182+
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.10.1)
183183
(follow the link to get the dependency declaration snippet).
184184

185185
#### Native

Diff for: docs/cfg/buildprofiles.xml

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<buildprofiles>
4-
<variables>
5-
<enable-browser-edits>true</enable-browser-edits>
6-
<browser-edits-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/</browser-edits-url>
7-
<allow-indexable-eaps>true</allow-indexable-eaps>
8-
</variables>
9-
<build-profile product="kc"/>
10-
</buildprofiles>
2+
<buildprofiles xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/build-profiles.xsd">
3+
<variables>
4+
<enable-browser-edits>true</enable-browser-edits>
5+
<browser-edits-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/</browser-edits-url>
6+
<allow-indexable-eaps>true</allow-indexable-eaps>
7+
</variables>
8+
<build-profile instance="kc"/>
9+
</buildprofiles>

Diff for: docs/kc.tree

+19-25
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<!DOCTYPE product-profile
4-
SYSTEM "https://resources.jetbrains.com/stardust/product-profile.dtd">
5-
6-
<product-profile id="kc"
7-
name="Kotlin coroutines"
8-
start-page="coroutines-guide.md">
9-
10-
<chunk include-id="coroutines">
11-
<toc-element id="coroutines-guide.md"/>
12-
<toc-element id="coroutines-basics.md" accepts-web-file-names="basics.html,coroutines-basic-jvm.html"/>
13-
<toc-element id="coroutines-and-channels.md"/>
14-
<toc-element id="cancellation-and-timeouts.md"/>
15-
<toc-element id="composing-suspending-functions.md"/>
16-
<toc-element id="coroutine-context-and-dispatchers.md"/>
17-
<toc-element id="flow.md"/>
18-
<toc-element id="channels.md"/>
19-
<toc-element id="exception-handling.md"/>
20-
<toc-element id="shared-mutable-state-and-concurrency.md"/>
21-
<toc-element id="select-expression.md"/>
22-
<toc-element id="debug-coroutines-with-idea.md"/>
23-
<toc-element id="debug-flow-with-idea.md"/>
24-
</chunk>
25-
</product-profile>
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<!DOCTYPE instance-profile SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">
3+
<instance-profile id="kc" name="Kotlin coroutines" start-page="coroutines-guide.md">
4+
<snippet id="coroutines">
5+
<toc-element topic="coroutines-guide.md"/>
6+
<toc-element accepts-web-file-names="basics.html,coroutines-basic-jvm.html" topic="coroutines-basics.md"/>
7+
<toc-element topic="coroutines-and-channels.md"/>
8+
<toc-element topic="cancellation-and-timeouts.md"/>
9+
<toc-element topic="composing-suspending-functions.md"/>
10+
<toc-element topic="coroutine-context-and-dispatchers.md"/>
11+
<toc-element topic="flow.md"/>
12+
<toc-element topic="channels.md"/>
13+
<toc-element topic="exception-handling.md"/>
14+
<toc-element topic="shared-mutable-state-and-concurrency.md"/>
15+
<toc-element topic="select-expression.md"/>
16+
<toc-element topic="debug-coroutines-with-idea.md"/>
17+
<toc-element topic="debug-flow-with-idea.md"/>
18+
</snippet>
19+
</instance-profile>

Diff for: docs/project.ihp

-14
This file was deleted.

Diff for: docs/topics/cancellation-and-timeouts.md

+33-32
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!--- TEST_NAME CancellationGuideTest -->
2+
<contribute-url>https://github.com/Kotlin/kotlinx.coroutines/edit/master/docs/topics/</contribute-url>
23

34
[//]: # (title: Cancellation and timeouts)
45

@@ -31,10 +32,10 @@ fun main() = runBlocking {
3132
}
3233
```
3334
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
34-
35-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-01.kt).
35+
<!--- KNIT example-cancel-01.kt -->
36+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-01.kt).
3637
>
37-
{type="note"}
38+
{style="note"}
3839

3940
It produces the following output:
4041

@@ -85,10 +86,10 @@ fun main() = runBlocking {
8586
}
8687
```
8788
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
88-
89-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-02.kt).
89+
<!--- KNIT example-cancel-02.kt -->
90+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-02.kt).
9091
>
91-
{type="note"}
92+
{style="note"}
9293

9394
Run it to see that it continues to print "I'm sleeping" even after cancellation
9495
until the job completes by itself after five iterations.
@@ -130,10 +131,10 @@ fun main() = runBlocking {
130131
}
131132
```
132133
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
133-
134-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-03.kt).
134+
<!--- KNIT example-cancel-03.kt -->
135+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-03.kt).
135136
>
136-
{type="note"}
137+
{style="note"}
137138

138139
While catching `Exception` is an anti-pattern, this issue may surface in more subtle ways, like when using the
139140
[`runCatching`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/run-catching.html) function,
@@ -172,10 +173,10 @@ fun main() = runBlocking {
172173
}
173174
```
174175
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
175-
176-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-04.kt).
176+
<!--- KNIT example-cancel-04.kt -->
177+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-04.kt).
177178
>
178-
{type="note"}
179+
{style="note"}
179180

180181
As you can see, now this loop is cancelled. [isActive] is an extension property
181182
available inside the coroutine via the [CoroutineScope] object.
@@ -188,7 +189,7 @@ main: I'm tired of waiting!
188189
main: Now I can quit.
189190
-->
190191

191-
## Closing resources with `finally`
192+
## Closing resources with finally
192193

193194
Cancellable suspending functions throw [CancellationException] on cancellation, which can be handled in
194195
the usual way. For example, the `try {...} finally {...}` expression and Kotlin's `use` function execute their
@@ -217,10 +218,10 @@ fun main() = runBlocking {
217218
}
218219
```
219220
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
220-
221-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-05.kt).
221+
<!--- KNIT example-cancel-05.kt -->
222+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-05.kt).
222223
>
223-
{type="note"}
224+
{style="note"}
224225

225226
Both [join][Job.join] and [cancelAndJoin] wait for all finalization actions to complete,
226227
so the example above produces the following output:
@@ -272,10 +273,10 @@ fun main() = runBlocking {
272273
}
273274
```
274275
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
275-
276-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-06.kt).
276+
<!--- KNIT example-cancel-06.kt -->
277+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-06.kt).
277278
>
278-
{type="note"}
279+
{style="note"}
279280

280281
<!--- TEST
281282
job: I'm sleeping 0 ...
@@ -310,10 +311,10 @@ fun main() = runBlocking {
310311
}
311312
```
312313
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
313-
314-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-07.kt).
314+
<!--- KNIT example-cancel-07.kt -->
315+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-07.kt).
315316
>
316-
{type="note"}
317+
{style="note"}
317318

318319
It produces the following output:
319320

@@ -353,10 +354,10 @@ fun main() = runBlocking {
353354
}
354355
```
355356
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
356-
357-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-08.kt).
357+
<!--- KNIT example-cancel-08.kt -->
358+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-08.kt).
358359
>
359-
{type="note"}
360+
{style="note"}
360361

361362
There is no longer an exception when running this code:
362363

@@ -414,10 +415,10 @@ fun main() {
414415
//sampleEnd
415416
```
416417
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
417-
418-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-09.kt).
418+
<!--- KNIT example-cancel-09.kt -->
419+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-09.kt).
419420
>
420-
{type="note"}
421+
{style="note"}
421422

422423
<!--- CLEAR -->
423424

@@ -428,7 +429,7 @@ of your machine. You may need to tweak the timeout in this example to actually s
428429
> since it always happens from the same thread, the one used by `runBlocking`.
429430
> More on that will be explained in the chapter on coroutine context.
430431
>
431-
{type="note"}
432+
{style="note"}
432433

433434
To work around this problem you can store a reference to the resource in a variable instead of returning it
434435
from the `withTimeout` block.
@@ -467,10 +468,10 @@ fun main() {
467468
}
468469
```
469470
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
470-
471-
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-cancel-10.kt).
471+
<!--- KNIT example-cancel-10.kt -->
472+
> You can get the full code [here](https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/test/guide/example-cancel-10.kt).
472473
>
473-
{type="note"}
474+
{style="note"}
474475

475476
This example always prints zero. Resources do not leak.
476477

0 commit comments

Comments
 (0)