[K/N] Mark Any?.identityHashCode() as experimental

As part of stabilizing Native stdlib.
This commit is contained in:
Abduqodiri Qurbonzoda
2023-03-23 14:44:56 +02:00
parent 25bcd86552
commit 33053405e0
3 changed files with 3 additions and 0 deletions
@@ -36,6 +36,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)
public open fun hashCode(): Int = this.identityHashCode()
/**
@@ -111,5 +111,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
@GCUnsafeCall("Kotlin_Any_hashCode")
public external fun Any?.identityHashCode(): Int
@@ -109,6 +109,7 @@ internal fun ThrowFreezingException(toFreeze: Any, blocker: Any): Nothing =
@ExportForCppRuntime
@FreezingIsDeprecated
@OptIn(ExperimentalStdlibApi::class)
internal fun ThrowInvalidMutabilityException(where: Any): Nothing {
val description = debugDescription(where::class, where.identityHashCode())
throw InvalidMutabilityException("mutation attempt of frozen $description")