diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt index 4a36722add0..94c1568b163 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt @@ -5,6 +5,7 @@ package kotlin +import kotlin.experimental.ExperimentalNativeApi import kotlin.native.identityHashCode import kotlin.native.internal.fullName import kotlin.native.internal.ExportTypeInfo @@ -36,7 +37,7 @@ public open class Any { * * Whenever it is invoked on the same object more than once, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. * * If two objects are equal according to the `equals()` method, then calling the `hashCode` method on each of the two objects must produce the same integer result. */ - @OptIn(ExperimentalStdlibApi::class) + @OptIn(ExperimentalNativeApi::class) public open fun hashCode(): Int = this.identityHashCode() /** diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt index 81d3a78d137..33e2cd1e08a 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Runtime.kt @@ -4,6 +4,7 @@ */ package kotlin.native +import kotlin.experimental.ExperimentalNativeApi import kotlin.native.concurrent.InvalidMutabilityException import kotlin.native.internal.ExportForCppRuntime import kotlin.native.internal.GCUnsafeCall @@ -114,6 +115,6 @@ public external fun terminateWithUnhandledException(throwable: Throwable): Nothi * Compute stable wrt potential object relocations by the memory manager identity hash code. * @return 0 for `null` object, identity hash code otherwise. */ -@ExperimentalStdlibApi +@ExperimentalNativeApi @GCUnsafeCall("Kotlin_Any_hashCode") public external fun Any?.identityHashCode(): Int diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt index f05ffe89154..0bb956517e9 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt @@ -5,6 +5,7 @@ package kotlin.native.concurrent +import kotlin.experimental.ExperimentalNativeApi import kotlin.native.internal.DescribeObjectForDebugging import kotlin.native.internal.ExportForCppRuntime import kotlin.native.internal.GCUnsafeCall @@ -130,7 +131,7 @@ internal fun ThrowFreezingException(toFreeze: Any, blocker: Any): Nothing = @ExportForCppRuntime @FreezingIsDeprecated -@OptIn(ExperimentalStdlibApi::class) +@OptIn(ExperimentalNativeApi::class) internal fun ThrowInvalidMutabilityException(where: Any): Nothing { val description = debugDescription(where::class, where.identityHashCode()) throw InvalidMutabilityException("mutation attempt of frozen $description")