diff --git a/runtime/src/main/kotlin/kotlin/native/Compatibility.kt b/runtime/src/main/kotlin/kotlin/native/Compatibility.kt index 9e6cfd4ea82..2a9185347b1 100644 --- a/runtime/src/main/kotlin/kotlin/native/Compatibility.kt +++ b/runtime/src/main/kotlin/kotlin/native/Compatibility.kt @@ -18,4 +18,5 @@ public annotation class Volatile public annotation class Synchronized @kotlin.internal.InlineOnly -public actual inline fun synchronized(@Suppress("UNUSED_PARAMETER") lock: Any, block: () -> R): R = block() \ No newline at end of file +public actual inline fun synchronized(@Suppress("UNUSED_PARAMETER") lock: Any, block: () -> R): R = + throw UnsupportedOperationException("synchronized() is unsupported") \ No newline at end of file diff --git a/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt b/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt index 4dcf63b3a74..bf682ec4e5d 100644 --- a/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt +++ b/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt @@ -68,7 +68,13 @@ internal fun ThrowFreezingException(toFreeze: Any, blocker: Any): Nothing = throw FreezingException(toFreeze, blocker) @ExportForCppRuntime -internal fun ThrowInvalidMutabilityException(where: Any): Nothing = throw InvalidMutabilityException(where) +internal fun ThrowInvalidMutabilityException(where: Any): Nothing { + val kClass = where::class + val className = kClass.qualifiedName ?: kClass.simpleName ?: "" + val unsignedHashCode = where.hashCode().toLong() and 0xffffffffL + val hashCodeStr = unsignedHashCode.toString(16) + throw InvalidMutabilityException("$className@$hashCodeStr") +} @SymbolName("Kotlin_AtomicReference_checkIfFrozen") external internal fun checkIfFrozen(ref: Any?)