Skip to content

Commit 2cea84c

Browse files
committed
Merge remote-tracking branch 'origin/master' into develop
2 parents 85afa72 + 7a87eab commit 2cea84c

File tree

15 files changed

+61
-70
lines changed

15 files changed

+61
-70
lines changed

CHANGES.md

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

3+
## Version 1.7.3
4+
5+
* Disabled the publication of the multiplatform library metadata for the old (1.6 and earlier) KMP Gradle plugin (#3809).
6+
* Fixed a bug introduced in 1.7.2 that disabled the coroutine debugger in IDEA (#3822).
7+
38
## Version 1.7.2
49

510
### Bug fixes and improvements

README.md

+9-9
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.7.2)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.2)
6+
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.3)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.7.3)
77
[![Kotlin](https://img.shields.io/badge/kotlin-1.9.21-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

@@ -26,7 +26,7 @@ suspend fun main() = coroutineScope {
2626

2727
* [core](kotlinx-coroutines-core/README.md) — common coroutines across all platforms:
2828
* [launch] and [async] coroutine builders returning [Job] and [Deferred] light-weight futures with cancellation support;
29-
* [Dispatchers] object with [Main][Dispatchers.Main] dispatcher for Android/Swing/JavaFx, and [Default][Dispatchers.Default] dispatcher for background coroutines;
29+
* [Dispatchers] object with [Main][Dispatchers.Main] dispatcher for Android/Swing/JavaFx (which require the corresponding artifacts in runtime) and Darwin (included out of the box), and [Default][Dispatchers.Default] dispatcher for background coroutines;
3030
* [delay] and [yield] top-level suspending functions;
3131
* [Flow] — cold asynchronous stream with [flow][_flow] builder and comprehensive operator set ([filter], [map], etc);
3232
* [Channel], [Mutex], and [Semaphore] communication and synchronization primitives;
@@ -36,7 +36,7 @@ suspend fun main() = coroutineScope {
3636
* [select] expression support and more.
3737
* [core/jvm](kotlinx-coroutines-core/jvm/) — additional core features available on Kotlin/JVM:
3838
* [Dispatchers.IO] dispatcher for blocking coroutines;
39-
* [Executor.asCoroutineDispatcher][asCoroutineDispatcher] extension, custom thread pools, and more.
39+
* [Executor.asCoroutineDispatcher][asCoroutineDispatcher] extension, custom thread pools, and more;
4040
* Integrations with `CompletableFuture` and JVM-specific extensions.
4141
* [core/js](kotlinx-coroutines-core/js/) — additional core features available on Kotlin/JS:
4242
* Integration with `Promise` via [Promise.await] and [promise] builder;
@@ -54,7 +54,7 @@ suspend fun main() = coroutineScope {
5454
* RxJava 2.x ([rxFlowable], [rxSingle], etc), and
5555
* RxJava 3.x ([rxFlowable], [rxSingle], etc), and
5656
* Project Reactor ([flux], [mono], etc).
57-
* [ui](ui/README.md) — modules that provide coroutine dispatchers for various single-threaded UI libraries:
57+
* [ui](ui/README.md) — modules that provide the [Main][Dispatchers.Main] dispatcher for various single-threaded UI libraries:
5858
* Android, JavaFX, and Swing.
5959
* [integration](integration/README.md) — modules that provide integration with various asynchronous callback- and future-based libraries:
6060
* Guava [ListenableFuture.await], and Google Play Services [Task.await];
@@ -85,7 +85,7 @@ Add dependencies (you can also add other modules that you need):
8585
<dependency>
8686
<groupId>org.jetbrains.kotlinx</groupId>
8787
<artifactId>kotlinx-coroutines-core</artifactId>
88-
<version>1.7.2</version>
88+
<version>1.7.3</version>
8989
</dependency>
9090
```
9191

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

104104
```kotlin
105105
dependencies {
106-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2")
106+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
107107
}
108108
```
109109

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

135135
```kotlin
136-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2")
136+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
137137
```
138138

139139
This gives you access to the Android [Dispatchers.Main]
@@ -168,7 +168,7 @@ In common code that should get compiled for different platforms, you can add a d
168168
```kotlin
169169
commonMain {
170170
dependencies {
171-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.2")
171+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
172172
}
173173
}
174174
```
@@ -180,7 +180,7 @@ Platform-specific dependencies are recommended to be used only for non-multiplat
180180
#### JS
181181

182182
Kotlin/JS version of `kotlinx.coroutines` is published as
183-
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.7.2)
183+
[`kotlinx-coroutines-core-js`](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-js/1.7.3)
184184
(follow the link to get the dependency declaration snippet) and as [`kotlinx-coroutines-core`](https://www.npmjs.com/package/kotlinx-coroutines-core) NPM package.
185185

186186
#### Native

docs/topics/composing-suspending-functions.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@ standard `lazy` function in cases when computation of the value involves suspend
189189

190190
## Async-style functions
191191

192+
> This programming style with async functions is provided here only for illustration, because it is a popular style
193+
> in other programming languages. Using this style with Kotlin coroutines is **strongly discouraged** for the
194+
> reasons explained below.
195+
>
196+
{type="note"}
197+
192198
We can define async-style functions that invoke `doSomethingUsefulOne` and `doSomethingUsefulTwo`
193199
_asynchronously_ using the [async] coroutine builder using a [GlobalScope] reference to
194200
opt-out of the structured concurrency.
@@ -275,12 +281,6 @@ The answer is 42
275281
Completed in 1085 ms
276282
-->
277283

278-
> This programming style with async functions is provided here only for illustration, because it is a popular style
279-
> in other programming languages. Using this style with Kotlin coroutines is **strongly discouraged** for the
280-
> reasons explained below.
281-
>
282-
{type="note"}
283-
284284
Consider what happens if between the `val one = somethingUsefulOneAsync()` line and `one.await()` expression there is some logic
285285
error in the code, and the program throws an exception, and the operation that was being performed by the program aborts.
286286
Normally, a global error-handler could catch this exception, log and report the error for developers, but the program

docs/topics/coroutine-context-and-dispatchers.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,9 @@ fun main() {
239239
}
240240
}
241241
}
242-
//sampleEnd
242+
//sampleEnd
243243
}
244244
```
245-
{kotlin-runnable="true" kotlin-min-compiler-version="1.3"}
246245

247246
> You can get the full code [here](../../kotlinx-coroutines-core/jvm/test/guide/example-context-04.kt).
248247
>

docs/topics/coroutines-basics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This section covers basic coroutine concepts.
66

77
## Your first coroutine
88

9-
A _coroutine_ is an instance of suspendable computation. It is conceptually similar to a thread, in the sense that it
9+
A _coroutine_ is an instance of a suspendable computation. It is conceptually similar to a thread, in the sense that it
1010
takes a block of code to run that works concurrently with the rest of the code.
1111
However, a coroutine is not bound to any particular thread. It may suspend its execution in one thread and resume in another one.
1212

docs/topics/exception-handling.md

+3-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ coroutine throw an exception.
99

1010
## Exception propagation
1111

12-
Coroutine builders come in two flavors: propagating exceptions automatically ([launch] and [actor]) or
12+
Coroutine builders come in two flavors: propagating exceptions automatically ([launch]) or
1313
exposing them to users ([async] and [produce]).
1414
When these builders are used to create a _root_ coroutine, that is not a _child_ of another coroutine,
1515
the former builders treat exceptions as **uncaught** exceptions, similar to Java's `Thread.uncaughtExceptionHandler`,
@@ -276,10 +276,6 @@ fun main() = runBlocking {
276276
>
277277
{type="note"}
278278

279-
> Note: This above code will work properly only on JDK7+ that supports `suppressed` exceptions
280-
>
281-
{type="note"}
282-
283279
The output of this code is:
284280

285281
```text
@@ -306,15 +302,15 @@ fun main() = runBlocking {
306302
println("CoroutineExceptionHandler got $exception")
307303
}
308304
val job = GlobalScope.launch(handler) {
309-
val inner = launch { // all this stack of coroutines will get cancelled
305+
val innerJob = launch { // all this stack of coroutines will get cancelled
310306
launch {
311307
launch {
312308
throw IOException() // the original exception
313309
}
314310
}
315311
}
316312
try {
317-
inner.join()
313+
innerJob.join()
318314
} catch (e: CancellationException) {
319315
println("Rethrowing CancellationException with original cause")
320316
throw e // cancellation exception is rethrown, yet the original IOException gets to the handler
@@ -523,7 +519,6 @@ The scope is completed
523519

524520
<!--- INDEX kotlinx.coroutines.channels -->
525521

526-
[actor]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/actor.html
527522
[produce]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/produce.html
528523
[ReceiveChannel.receive]: https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-receive-channel/receive.html
529524

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
#
44

55
# Kotlin
6-
version=1.7.2-SNAPSHOT
6+
version=1.7.3-SNAPSHOT
77
group=org.jetbrains.kotlinx
88
kotlin_version=1.9.21
99

1010
# Dependencies
1111
junit_version=4.12
1212
junit5_version=5.7.0
1313
atomicfu_version=0.23.1
14-
knit_version=0.4.0
14+
knit_version=0.5.0-Beta
1515
html_version=0.7.2
1616
lincheck_version=2.18.1
1717
dokka_version=1.8.10

gradle/dokka.gradle.kts

+23-31
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ import java.net.*
99
apply<DokkaPlugin>()
1010
//apply<JavaPlugin>()
1111

12-
fun GradleDokkaSourceSetBuilder.makeLinkMapping(projectDir: File) {
13-
sourceLink {
14-
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
15-
localDirectory.set(projectDir.resolve("src"))
16-
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src"))
17-
remoteLineSuffix.set("#L")
18-
}
19-
}
2012

2113
val knit_version: String by project
2214
tasks.withType(DokkaTaskPartial::class).configureEach {
@@ -45,31 +37,31 @@ tasks.withType(DokkaTaskPartial::class).configureEach {
4537
}
4638
}
4739

48-
val kotlin_version: String by project
40+
fun GradleDokkaSourceSetBuilder.makeLinkMapping(projectDir: File) {
41+
sourceLink {
42+
val relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath())
43+
localDirectory.set(projectDir.resolve("src"))
44+
remoteUrl.set(URL("https://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src"))
45+
remoteLineSuffix.set("#L")
46+
}
47+
}
4948

50-
if (project.name == "kotlinx-coroutines-core") {
51-
// Custom configuration for MPP modules
49+
if (project.isMultiplatform) {
50+
// Configuration for MPP modules
5251
tasks.withType(DokkaTaskPartial::class).configureEach {
53-
dokkaSourceSets {
54-
val commonMain by getting {
55-
makeLinkMapping(project.file("common"))
56-
}
57-
58-
val nativeMain by getting {
59-
makeLinkMapping(project.file("native"))
60-
}
61-
62-
val jsMain by getting {
63-
makeLinkMapping(project.file("js"))
64-
}
65-
66-
val jvmMain by getting {
67-
makeLinkMapping(project.file("jvm"))
68-
}
69-
70-
val wasmJsMain by getting {
71-
makeLinkMapping(project.file("wasm"))
72-
}
52+
// sources in MPP are located in moduleDir/PLATFORM/src,
53+
// where PLATFORM could be jvm, js, jdk8, concurrent, etc
54+
// configuration happens in buildSrc/src/main/kotlin/SourceSetsKt.configureMultiplatform
55+
dokkaSourceSets.matching { it.name.endsWith("Main") }.configureEach {
56+
val platform = name.dropLast(4)
57+
makeLinkMapping(project.file(platform))
58+
}
59+
}
60+
} else {
61+
// Configuration for JVM modules
62+
tasks.withType(DokkaTaskPartial::class).configureEach {
63+
dokkaSourceSets.named("main") {
64+
makeLinkMapping(projectDir)
7365
}
7466
}
7567
}

integration-testing/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
kotlin_version=1.9.21
2-
coroutines_version=1.7.2-SNAPSHOT
2+
coroutines_version=1.7.3-SNAPSHOT
33
asm_version=9.3
44

55
kotlin.code.style=official

kotlinx-coroutines-core/common/src/CoroutineScope.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public interface CoroutineScope {
9090
* Adds the specified coroutine context to this scope, overriding existing elements in the current
9191
* scope's context with the corresponding keys.
9292
*
93-
* This is a shorthand for `CoroutineScope(thisScope + context)`.
93+
* This is a shorthand for `CoroutineScope(thisScope.coroutineContext + context)`.
9494
*/
9595
public operator fun CoroutineScope.plus(context: CoroutineContext): CoroutineScope =
9696
ContextScope(coroutineContext + context)
@@ -226,7 +226,7 @@ public object GlobalScope : CoroutineScope {
226226
* The provided scope inherits its [coroutineContext][CoroutineScope.coroutineContext] from the outer scope, but overrides
227227
* the context's [Job].
228228
*
229-
* This function is designed for _parallel decomposition_ of work. When any child coroutine in this scope fails,
229+
* This function is designed for _concurrent decomposition_ of work. When any child coroutine in this scope fails,
230230
* this scope fails and all the rest of the children are cancelled (for a different behavior see [supervisorScope]).
231231
* This function returns as soon as the given block and all its children coroutines are completed.
232232
* A usage example of a scope looks like this:

kotlinx-coroutines-core/common/src/Dispatchers.common.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public expect object Dispatchers {
3131
* [`ServiceLoader`](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html).
3232
* - On JS it is equivalent to the [Default] dispatcher with [immediate][MainCoroutineDispatcher.immediate] support.
3333
* - On Native Darwin-based targets, it is a dispatcher backed by Darwin's main queue.
34-
* - On other Native targets, it is a single-threaded dispatcher backed by a standalone worker.
34+
* - On other Native targets, it is not available.
35+
* - `Dispatchers.setMain` from the `kotlinx-coroutines-test` artifact can replace the main dispatcher with a mock one for testing.
3536
*
36-
* In order to work with the `Main` dispatcher, the following artifact should be added to the project runtime dependencies:
37+
* In order to work with the `Main` dispatcher on the JVM, the following artifact should be added to the project runtime dependencies:
3738
* - `kotlinx-coroutines-android` &mdash; for Android Main thread dispatcher
3839
* - `kotlinx-coroutines-javafx` &mdash; for JavaFx Application thread dispatcher
3940
* - `kotlinx-coroutines-swing` &mdash; for Swing EDT dispatcher
40-
* - `kotlinx-coroutines-test` &mdash; for mocking the `Main` dispatcher in tests via `Dispatchers.setMain`
4141
*/
4242
public val Main: MainCoroutineDispatcher
4343

kotlinx-coroutines-core/jvm/test/guide/example-exceptions-06.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ fun main() = runBlocking {
1414
println("CoroutineExceptionHandler got $exception")
1515
}
1616
val job = GlobalScope.launch(handler) {
17-
val inner = launch { // all this stack of coroutines will get cancelled
17+
val innerJob = launch { // all this stack of coroutines will get cancelled
1818
launch {
1919
launch {
2020
throw IOException() // the original exception
2121
}
2222
}
2323
}
2424
try {
25-
inner.join()
25+
innerJob.join()
2626
} catch (e: CancellationException) {
2727
println("Rethrowing CancellationException with original cause")
2828
throw e // cancellation exception is rethrown, yet the original IOException gets to the handler

kotlinx-coroutines-debug/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ stacktraces will be dumped to the console.
6161
### Using as JVM agent
6262

6363
Debug module can also be used as a standalone JVM agent to enable debug probes on the application startup.
64-
You can run your application with an additional argument: `-javaagent:kotlinx-coroutines-debug-1.7.2.jar`.
64+
You can run your application with an additional argument: `-javaagent:kotlinx-coroutines-debug-1.7.3.jar`.
6565
Additionally, on Linux and Mac OS X you can use `kill -5 $pid` command in order to force your application to print all alive coroutines.
6666
When used as Java agent, `"kotlinx.coroutines.debug.enable.creation.stack.trace"` system property can be used to control
6767
[DebugProbes.enableCreationStackTraces] along with agent startup.

kotlinx-coroutines-test/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Provided [TestDispatcher] implementations:
2626
Add `kotlinx-coroutines-test` to your project test dependencies:
2727
```
2828
dependencies {
29-
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.2'
29+
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3'
3030
}
3131
```
3232

ui/coroutines-guide-ui.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Add dependencies on `kotlinx-coroutines-android` module to the `dependencies { .
110110
`app/build.gradle` file:
111111

112112
```groovy
113-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2"
113+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
114114
```
115115

116116
You can clone [kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines) project from GitHub onto your

0 commit comments

Comments
 (0)