diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..0004a935d9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @tbogdanova @woainikk diff --git a/buildSrc/src/main/kotlin/CacheRedirector.kt b/buildSrc/src/main/kotlin/CacheRedirector.kt index 85e6eef840..b7e2772b53 100644 --- a/buildSrc/src/main/kotlin/CacheRedirector.kt +++ b/buildSrc/src/main/kotlin/CacheRedirector.kt @@ -4,7 +4,6 @@ import org.gradle.api.artifacts.repositories.* import org.gradle.api.initialization.dsl.* import org.gradle.kotlin.dsl.* import org.jetbrains.kotlin.gradle.targets.js.nodejs.* -import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.* import org.jetbrains.kotlin.gradle.targets.js.yarn.* import java.net.* @@ -100,6 +99,7 @@ private fun Project.checkRedirect(repositories: RepositoryHandler, containerName } } +@Suppress("DEPRECATION", "DEPRECATION_ERROR") // KT-68597, KT-68597 private fun Project.configureYarnAndNodeRedirects() { if (CacheRedirector.isEnabled) { val yarnRootExtension = extensions.findByType() diff --git a/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts b/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts index e2e1e66e2d..6f3c2fb58e 100644 --- a/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/kotlin-multiplatform-conventions.gradle.kts @@ -47,6 +47,7 @@ kotlin { watchosDeviceArm64() } js { + @Suppress("DEPRECATION", "DEPRECATION_ERROR") // KT-68597, KT-68597 moduleName = project.name nodejs() compilations["main"]?.dependencies { @@ -57,6 +58,7 @@ kotlin { wasmJs { // Module name should be different from the one from JS // otherwise IC tasks that start clashing different modules with the same module name + @Suppress("DEPRECATION", "DEPRECATION_ERROR") // KT-68597, KT-68597 moduleName = project.name + "Wasm" nodejs() compilations["main"]?.dependencies { diff --git a/integration-testing/build.gradle.kts b/integration-testing/build.gradle.kts index 95556ed9f6..b50aff4fb3 100644 --- a/integration-testing/build.gradle.kts +++ b/integration-testing/build.gradle.kts @@ -47,6 +47,7 @@ buildscript { if (usingSnapshotVersion) { repositories { mavenLocal() + maven("https://redirector.kotlinlang.org/maven/dev") maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } } @@ -58,9 +59,11 @@ plugins { repositories { if (extra["using_snapshot_version"] == true) { + maven("https://redirector.kotlinlang.org/maven/dev") maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") } mavenLocal() + maven("https://redirector.kotlinlang.org/maven/dev") mavenCentral() } diff --git a/integration-testing/gradle.properties b/integration-testing/gradle.properties index 56cac5b0ec..a0e462a8c9 100644 --- a/integration-testing/gradle.properties +++ b/integration-testing/gradle.properties @@ -5,3 +5,4 @@ junit5_version=5.7.0 kotlin.code.style=official kotlin.mpp.stability.nowarn=true +org.gradle.jvmargs=-Xmx4096M \ No newline at end of file diff --git a/integration-testing/java8Test/build.gradle.kts b/integration-testing/java8Test/build.gradle.kts index ada90adaab..8e6b330cb7 100644 --- a/integration-testing/java8Test/build.gradle.kts +++ b/integration-testing/java8Test/build.gradle.kts @@ -5,6 +5,7 @@ plugins { repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") // Coroutines from the outer project are published by previous CI buils step mavenLocal() } diff --git a/integration-testing/jpmsTest/build.gradle.kts b/integration-testing/jpmsTest/build.gradle.kts index f96f99822f..ef0a9fae96 100644 --- a/integration-testing/jpmsTest/build.gradle.kts +++ b/integration-testing/jpmsTest/build.gradle.kts @@ -8,6 +8,7 @@ val coroutines_version: String by project repositories { if (project.properties["build_snapshot_train"]?.toString()?.toBoolean() == true) { maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") } mavenLocal() mavenCentral() diff --git a/integration-testing/settings.gradle.kts b/integration-testing/settings.gradle.kts index f6711b86c0..d73c83ad67 100644 --- a/integration-testing/settings.gradle.kts +++ b/integration-testing/settings.gradle.kts @@ -3,6 +3,7 @@ pluginManagement { mavenCentral() maven("https://plugins.gradle.org/m2/") maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") mavenLocal() } } diff --git a/integration-testing/smokeTest/build.gradle.kts b/integration-testing/smokeTest/build.gradle.kts index 3739c7209e..c9cd166421 100644 --- a/integration-testing/smokeTest/build.gradle.kts +++ b/integration-testing/smokeTest/build.gradle.kts @@ -11,6 +11,7 @@ plugins { repositories { mavenCentral() maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev") + maven("https://redirector.kotlinlang.org/maven/dev") // Coroutines from the outer project are published by previous CI builds step mavenLocal() } @@ -79,11 +80,3 @@ kotlin { } } } - -// Drop this configuration when the Node.JS version in KGP will support wasm gc milestone 4 -// check it here: -// https://github.com/JetBrains/kotlin/blob/master/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/js/nodejs/NodeJsRootExtension.kt -rootProject.extensions.findByType(NodeJsRootExtension::class.java)?.apply { - nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2" - nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary" -} \ No newline at end of file diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api index 9790ed05ab..322c60099e 100644 --- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api +++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api @@ -742,12 +742,25 @@ public final class kotlinx/coroutines/channels/ChannelResult { public final synthetic fun unbox-impl ()Ljava/lang/Object; } +public final class kotlinx/coroutines/channels/ChannelResult$Closed : kotlinx/coroutines/channels/ChannelResult$Failed { + public final field cause Ljava/lang/Throwable; + public fun (Ljava/lang/Throwable;)V + public fun equals (Ljava/lang/Object;)Z + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + public final class kotlinx/coroutines/channels/ChannelResult$Companion { public final fun closed-JP2dKIU (Ljava/lang/Throwable;)Ljava/lang/Object; public final fun failure-PtdJZtk ()Ljava/lang/Object; public final fun success-JP2dKIU (Ljava/lang/Object;)Ljava/lang/Object; } +public class kotlinx/coroutines/channels/ChannelResult$Failed { + public fun ()V + public fun toString ()Ljava/lang/String; +} + public final class kotlinx/coroutines/channels/ChannelsKt { public static final synthetic fun any (Lkotlinx/coroutines/channels/ReceiveChannel;Lkotlin/coroutines/Continuation;)Ljava/lang/Object; public static final fun cancelConsumed (Lkotlinx/coroutines/channels/ReceiveChannel;Ljava/lang/Throwable;)V diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api index effb60f649..b352f412ee 100644 --- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api +++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api @@ -546,6 +546,23 @@ final value class <#A: out kotlin/Any?> kotlinx.coroutines.channels/ChannelResul final fun hashCode(): kotlin/Int // kotlinx.coroutines.channels/ChannelResult.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.toString|toString(){}[0] + final class Closed : kotlinx.coroutines.channels/ChannelResult.Failed { // kotlinx.coroutines.channels/ChannelResult.Closed|null[0] + constructor (kotlin/Throwable?) // kotlinx.coroutines.channels/ChannelResult.Closed.|(kotlin.Throwable?){}[0] + + final val cause // kotlinx.coroutines.channels/ChannelResult.Closed.cause|{}cause[0] + final fun (): kotlin/Throwable? // kotlinx.coroutines.channels/ChannelResult.Closed.cause.|(){}[0] + + final fun equals(kotlin/Any?): kotlin/Boolean // kotlinx.coroutines.channels/ChannelResult.Closed.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // kotlinx.coroutines.channels/ChannelResult.Closed.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.Closed.toString|toString(){}[0] + } + + open class Failed { // kotlinx.coroutines.channels/ChannelResult.Failed|null[0] + constructor () // kotlinx.coroutines.channels/ChannelResult.Failed.|(){}[0] + + open fun toString(): kotlin/String // kotlinx.coroutines.channels/ChannelResult.Failed.toString|toString(){}[0] + } + final object Companion { // kotlinx.coroutines.channels/ChannelResult.Companion|null[0] final fun <#A2: kotlin/Any?> closed(kotlin/Throwable?): kotlinx.coroutines.channels/ChannelResult<#A2> // kotlinx.coroutines.channels/ChannelResult.Companion.closed|closed(kotlin.Throwable?){0§}[0] final fun <#A2: kotlin/Any?> failure(): kotlinx.coroutines.channels/ChannelResult<#A2> // kotlinx.coroutines.channels/ChannelResult.Companion.failure|failure(){0§}[0] diff --git a/kotlinx-coroutines-core/common/src/channels/Channel.kt b/kotlinx-coroutines-core/common/src/channels/Channel.kt index 3e3c0f5fae..4f058127a9 100644 --- a/kotlinx-coroutines-core/common/src/channels/Channel.kt +++ b/kotlinx-coroutines-core/common/src/channels/Channel.kt @@ -939,10 +939,12 @@ public value class ChannelResult */ public fun exceptionOrNull(): Throwable? = (holder as? Closed)?.cause + @PublishedApi internal open class Failed { override fun toString(): String = "Failed" } + @PublishedApi internal class Closed(@JvmField val cause: Throwable?): Failed() { override fun equals(other: Any?): Boolean = other is Closed && cause == other.cause override fun hashCode(): Int = cause.hashCode() diff --git a/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt b/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt index 4f19641e48..690eb29281 100644 --- a/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt +++ b/kotlinx-coroutines-core/common/src/flow/SharedFlow.kt @@ -519,9 +519,9 @@ internal open class SharedFlowImpl( } private fun cancelEmitter(emitter: Emitter) = synchronized(this) { - if (emitter.index < head) return // already skipped past this index + if (emitter.index < head) return@synchronized // already skipped past this index val buffer = buffer!! - if (buffer.getBufferAt(emitter.index) !== emitter) return // already resumed + if (buffer.getBufferAt(emitter.index) !== emitter) return@synchronized // already resumed buffer.setBufferAt(emitter.index, NO_VALUE) cleanupTailLocked() } diff --git a/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt b/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt index 8f21b13c25..979d357ee0 100644 --- a/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt +++ b/kotlinx-coroutines-core/jvm/src/internal/ThreadContext.kt @@ -96,6 +96,7 @@ internal fun restoreThreadContext(context: CoroutineContext, oldState: Any?) { @PublishedApi internal data class ThreadLocalKey(private val threadLocal: ThreadLocal<*>) : CoroutineContext.Key> +@PublishedApi internal class ThreadLocalElement( private val value: T, private val threadLocal: ThreadLocal diff --git a/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api b/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api index 38dfad99c6..8c4a13a274 100644 --- a/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api +++ b/kotlinx-coroutines-test/api/kotlinx-coroutines-test.klib.api @@ -74,23 +74,6 @@ final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = . // Targets: [native, wasmWasi] final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = ..., kotlin/Long, kotlin.coroutines/SuspendFunction1) // kotlinx.coroutines.test/runTest|runTest(kotlin.coroutines.CoroutineContext;kotlin.Long;kotlin.coroutines.SuspendFunction1){}[0] -// Targets: [js, wasmJs] -final class kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting { // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting|null[0] - constructor () // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.|(){}[0] - - // Targets: [js] - final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] - - // Targets: [js] - final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] - - // Targets: [wasmJs] - final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] - - // Targets: [wasmJs] - final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] -} - // Targets: [js, wasmJs] final fun (kotlinx.coroutines.test/TestScope).kotlinx.coroutines.test/runTest(kotlin.time/Duration = ..., kotlin.coroutines/SuspendFunction1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test/runTest|runTest@kotlinx.coroutines.test.TestScope(kotlin.time.Duration;kotlin.coroutines.SuspendFunction1){}[0] @@ -105,3 +88,19 @@ final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = . // Targets: [js, wasmJs] final fun kotlinx.coroutines.test/runTest(kotlin.coroutines/CoroutineContext = ..., kotlin/Long, kotlin.coroutines/SuspendFunction1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test/runTest|runTest(kotlin.coroutines.CoroutineContext;kotlin.Long;kotlin.coroutines.SuspendFunction1){}[0] + +// Targets: [js] +final class kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting { // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting|null[0] + constructor () // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.|(){}[0] + + final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] + final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] +} + +// Targets: [wasmJs] +final class kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting : kotlin.js/JsAny { // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting|null[0] + constructor () // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.|(){}[0] + + final fun then(kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1){}[0] + final fun then(kotlin/Function1, kotlin/Function1): kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting // kotlinx.coroutines.test.internal/JsPromiseInterfaceForTesting.then|then(kotlin.Function1;kotlin.Function1){}[0] +} diff --git a/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt b/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt index 8409b0f2d0..ed9f9c9139 100644 --- a/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt +++ b/kotlinx-coroutines-test/wasmJs/src/TestBuilders.kt @@ -6,7 +6,6 @@ import kotlin.js.* public actual typealias TestResult = JsPromiseInterfaceForTesting -@Suppress("INFERRED_TYPE_VARIABLE_INTO_POSSIBLE_EMPTY_INTERSECTION") internal actual fun createTestResult(testProcedure: suspend CoroutineScope.() -> Unit): TestResult = GlobalScope.promise { testProcedure() diff --git a/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt b/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt index e6697db307..da1e1c8759 100644 --- a/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt +++ b/kotlinx-coroutines-test/wasmJs/src/internal/JsPromiseInterfaceForTesting.kt @@ -7,7 +7,7 @@ a parametric class. So, we make a non-parametric class just for this. */ * @suppress */ @JsName("Promise") -public external class JsPromiseInterfaceForTesting { +public external class JsPromiseInterfaceForTesting : JsAny { /** * @suppress */