Skip to content

Commit fed1e60

Browse files
authored
Upgrade to Kotlin 2.2.20 (#4545)
1 parent 7d51152 commit fed1e60

File tree

20 files changed

+53
-50
lines changed

20 files changed

+53
-50
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
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)
66
[![Download](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.10.2)](https://central.sonatype.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core/1.10.2)
7-
[![Kotlin](https://img.shields.io/badge/kotlin-2.2.0-blue.svg?logo=kotlin)](http://kotlinlang.org)
7+
[![Kotlin](https://img.shields.io/badge/kotlin-2.2.20-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/)
1010

1111
Library support for Kotlin coroutines with [multiplatform](#multiplatform) support.
12-
This is a companion version for the Kotlin `2.2.0` release.
12+
This is a companion version for the Kotlin `2.2.20` release.
1313

1414
```kotlin
1515
suspend fun main() = coroutineScope {
@@ -94,7 +94,7 @@ And make sure that you use the latest Kotlin version:
9494

9595
```xml
9696
<properties>
97-
<kotlin.version>2.2.0</kotlin.version>
97+
<kotlin.version>2.2.20</kotlin.version>
9898
</properties>
9999
```
100100

@@ -113,10 +113,10 @@ And make sure that you use the latest Kotlin version:
113113
```kotlin
114114
plugins {
115115
// For build.gradle.kts (Kotlin DSL)
116-
kotlin("jvm") version "2.2.0"
116+
kotlin("jvm") version "2.2.20"
117117

118118
// For build.gradle (Groovy DSL)
119-
id "org.jetbrains.kotlin.jvm" version "2.2.0"
119+
id "org.jetbrains.kotlin.jvm" version "2.2.20"
120120
}
121121
```
122122

buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ kotlin {
131131
api("org.jetbrains.kotlin:kotlin-test-wasm-wasi:${version("kotlin")}")
132132
}
133133
}
134-
groupSourceSets("jsAndWasmJsShared", listOf("js", "wasmJs"), emptyList())
135-
groupSourceSets("jsAndWasmShared", listOf("jsAndWasmJsShared", "wasmWasi"), listOf("common"))
134+
groupSourceSets("jsAndWasmShared", listOf("web", "wasmWasi"), listOf("common"))
136135
}
137136

138137
@OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ group=org.jetbrains.kotlinx
44
# First-party dependencies.
55
# ONLY rename these properties alongside adapting kotlinx.train build chain
66
# and the `firstPartyDependencies` list in `buildSrc`.
7-
kotlin_version=2.2.0
7+
kotlin_version=2.2.20
88
atomicfu_version=0.26.1
99

1010
# Dependencies

integration-testing/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
kotlin_version=2.2.0
1+
kotlin_version=2.2.20
22
coroutines_version=1.10.2-SNAPSHOT
33
asm_version=9.3
44
junit5_version=5.7.0

kotlinx-coroutines-core/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ apply(plugin = "pub-conventions")
2424
2525
TARGETS SOURCE SETS
2626
------------------------------------------------------------
27-
wasmJs \------> jsAndWasmJsShared ----+
27+
wasmJs \-----------> web -------------+
2828
js / |
2929
V
3030
wasmWasi --------------------> jsAndWasmShared ----------+

kotlinx-coroutines-core/js/src/internal/CoroutineExceptionHandlerImpl.kt

Lines changed: 0 additions & 7 deletions
This file was deleted.

kotlinx-coroutines-core/jsAndWasmJsShared/src/internal/CoroutineExceptionHandlerImpl.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

kotlinx-coroutines-core/wasmJs/src/CoroutineContext.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
package kotlinx.coroutines
22

3+
import kotlin.js.*
4+
5+
@OptIn(ExperimentalWasmJsInterop::class)
36
internal external interface JsProcess : JsAny {
47
fun nextTick(handler: () -> Unit)
58
}
69

10+
@OptIn(ExperimentalWasmJsInterop::class)
711
internal fun tryGetProcess(): JsProcess? =
812
js("(typeof(process) !== 'undefined' && typeof(process.nextTick) === 'function') ? process : null")
913

14+
@OptIn(ExperimentalWasmJsInterop::class)
1015
internal fun tryGetWindow(): W3CWindow? =
1116
js("(typeof(window) !== 'undefined' && window != null && typeof(window.addEventListener) === 'function') ? window : null")
1217

kotlinx-coroutines-core/wasmJs/src/JSDispatcher.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ internal class NodeDispatcher(private val process: JsProcess) : SetTimeoutBasedD
4040
}
4141
}
4242

43+
@OptIn(ExperimentalWasmJsInterop::class)
4344
@Suppress("UNUSED_PARAMETER")
4445
private fun subscribeToWindowMessages(window: W3CWindow, process: () -> Unit): Unit = js("""{
4546
const handler = (event) => {
@@ -51,10 +52,12 @@ private fun subscribeToWindowMessages(window: W3CWindow, process: () -> Unit): U
5152
window.addEventListener('message', handler, true);
5253
}""")
5354

55+
@OptIn(ExperimentalWasmJsInterop::class)
5456
@Suppress("UNUSED_PARAMETER")
5557
private fun createRescheduleMessagePoster(window: W3CWindow): () -> Unit =
5658
js("() => window.postMessage('dispatchCoroutine', '*')")
5759

60+
@OptIn(ExperimentalWasmJsInterop::class)
5861
@Suppress("UNUSED_PARAMETER")
5962
private fun createScheduleMessagePoster(process: () -> Unit): () -> Unit =
6063
js("() => Promise.resolve(0).then(process)")
@@ -80,10 +83,12 @@ internal actual class WindowMessageQueue actual constructor(window: W3CWindow) :
8083
private external fun setTimeout(handler: () -> Unit, timeout: Int): Int
8184

8285
// d8 doesn't have clearTimeout
86+
@OptIn(ExperimentalWasmJsInterop::class)
8387
@Suppress("UNUSED_PARAMETER")
8488
private fun clearTimeout(handle: Int): Unit =
8589
js("{ if (typeof clearTimeout !== 'undefined') clearTimeout(handle); }")
8690

91+
@OptIn(ExperimentalWasmJsInterop::class)
8792
@Suppress("UNUSED_PARAMETER")
8893
private fun setTimeout(window: W3CWindow, handler: () -> Unit, timeout: Int): Int =
8994
js("window.setTimeout(handler, timeout)")

kotlinx-coroutines-core/wasmJs/src/Promise.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ package kotlinx.coroutines
33
import kotlin.coroutines.*
44
import kotlin.js.*
55

6+
@OptIn(ExperimentalWasmJsInterop::class)
67
@Suppress("UNUSED_PARAMETER")
78
internal fun promiseSetDeferred(promise: Promise<JsAny?>, deferred: JsAny): Unit =
89
js("promise.deferred = deferred")
910

11+
@OptIn(ExperimentalWasmJsInterop::class)
1012
@Suppress("UNUSED_PARAMETER")
1113
internal fun promiseGetDeferred(promise: Promise<JsAny?>): JsAny? = js("""{
1214
console.assert(promise instanceof Promise, "promiseGetDeferred must receive a promise, but got ", promise);
@@ -29,6 +31,7 @@ internal fun promiseGetDeferred(promise: Promise<JsAny?>): JsAny? = js("""{
2931
* @param start coroutine start option. The default value is [CoroutineStart.DEFAULT].
3032
* @param block the coroutine code.
3133
*/
34+
@ExperimentalWasmJsInterop
3235
public fun <T> CoroutineScope.promise(
3336
context: CoroutineContext = EmptyCoroutineContext,
3437
start: CoroutineStart = CoroutineStart.DEFAULT,
@@ -39,6 +42,7 @@ public fun <T> CoroutineScope.promise(
3942
/**
4043
* Converts this deferred value to the instance of [Promise<JsAny?>].
4144
*/
45+
@ExperimentalWasmJsInterop
4246
public fun <T> Deferred<T>.asPromise(): Promise<JsAny?> {
4347
val promise = Promise<JsAny?> { resolve, reject ->
4448
invokeOnCompletion {
@@ -57,6 +61,7 @@ public fun <T> Deferred<T>.asPromise(): Promise<JsAny?> {
5761
/**
5862
* Converts this promise value to the instance of [Deferred].
5963
*/
64+
@ExperimentalWasmJsInterop
6065
@Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE", "UNCHECKED_CAST")
6166
public fun <T> Promise<JsAny?>.asDeferred(): Deferred<T> {
6267
val deferred = promiseGetDeferred(this) as? JsReference<Deferred<T>>
@@ -71,6 +76,7 @@ public fun <T> Promise<JsAny?>.asDeferred(): Deferred<T> {
7176
* There is a **prompt cancellation guarantee**: even if this function is ready to return the result, but was cancelled
7277
* while suspended, [CancellationException] will be thrown. See [suspendCancellableCoroutine] for low-level details.
7378
*/
79+
@ExperimentalWasmJsInterop
7480
@Suppress("UNCHECKED_CAST")
7581
public suspend fun <T> Promise<JsAny?>.await(): T = suspendCancellableCoroutine { cont: CancellableContinuation<T> ->
7682
this@await.then(

0 commit comments

Comments
 (0)