[K/N] Mark Any?.identityHashCode() with ExperimentalNativeApi
Instead of ExperimentalStdlibApi As a part of efforts to stabilize Native stdlib #KT-55765.
This commit is contained in:
committed by
Space Team
parent
92ab82b2f3
commit
2140580fb1
@@ -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()
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user