From 60c6595237a98c4c36432535ae32a2b0ebe88087 Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Wed, 25 Jun 2025 14:59:14 +0200 Subject: [PATCH 1/2] Rename KClass<*>.isInterface helper in the JS part We are going to introduce a new KClass member in the standard library with the same name marked with an opt-in annotation, so in the usages of this extension property would stop compiling because the member is always favored and there is no opt-in. See KT-78581 --- core/jsMain/src/kotlinx/serialization/internal/Platform.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/jsMain/src/kotlinx/serialization/internal/Platform.kt b/core/jsMain/src/kotlinx/serialization/internal/Platform.kt index 72625567f..83edeed11 100644 --- a/core/jsMain/src/kotlinx/serialization/internal/Platform.kt +++ b/core/jsMain/src/kotlinx/serialization/internal/Platform.kt @@ -26,7 +26,7 @@ internal actual fun KClass.compiledSerializerImpl(): KSerializer else this.js.asDynamic().Companion?.serializer() ) as? KSerializer -internal actual fun KClass.isInterface(): Boolean = isInterface +internal actual fun KClass.isInterface(): Boolean = isInterfaceHack internal actual fun createCache(factory: (KClass<*>) -> KSerializer?): SerializerCache { return object: SerializerCache { @@ -73,8 +73,10 @@ internal actual fun isReferenceArray(rootClass: KClass): Boolean = rootClas * WARNING: may be broken in arbitrary time in the future without notice * * Should be eventually replaced with compiler intrinsics + * + * TODO: Remove this when KT-78581 lands into a release */ -private val KClass<*>.isInterface: Boolean +private val KClass<*>.isInterfaceHack: Boolean get(): Boolean { // .js throws an exception for Nothing if (this === Nothing::class) return false From 293f72587208fe6779680e729488d303ad81c9e1 Mon Sep 17 00:00:00 2001 From: Leonid Startsev Date: Wed, 25 Jun 2025 15:18:35 +0200 Subject: [PATCH 2/2] Update core/jsMain/src/kotlinx/serialization/internal/Platform.kt --- core/jsMain/src/kotlinx/serialization/internal/Platform.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/jsMain/src/kotlinx/serialization/internal/Platform.kt b/core/jsMain/src/kotlinx/serialization/internal/Platform.kt index 83edeed11..63f48bcb3 100644 --- a/core/jsMain/src/kotlinx/serialization/internal/Platform.kt +++ b/core/jsMain/src/kotlinx/serialization/internal/Platform.kt @@ -74,7 +74,7 @@ internal actual fun isReferenceArray(rootClass: KClass): Boolean = rootClas * * Should be eventually replaced with compiler intrinsics * - * TODO: Remove this when KT-78581 lands into a release + * TODO: Remove this when KT-78581 lands into a 2.2.20 release */ private val KClass<*>.isInterfaceHack: Boolean get(): Boolean {