[K/N] Mark Any?.identityHashCode() as experimental
As part of stabilizing Native stdlib.
This commit is contained in:
@@ -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.
|
* * 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.
|
* * 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()
|
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.
|
* Compute stable wrt potential object relocations by the memory manager identity hash code.
|
||||||
* @return 0 for `null` object, identity hash code otherwise.
|
* @return 0 for `null` object, identity hash code otherwise.
|
||||||
*/
|
*/
|
||||||
|
@ExperimentalStdlibApi
|
||||||
@GCUnsafeCall("Kotlin_Any_hashCode")
|
@GCUnsafeCall("Kotlin_Any_hashCode")
|
||||||
public external fun Any?.identityHashCode(): Int
|
public external fun Any?.identityHashCode(): Int
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ internal fun ThrowFreezingException(toFreeze: Any, blocker: Any): Nothing =
|
|||||||
|
|
||||||
@ExportForCppRuntime
|
@ExportForCppRuntime
|
||||||
@FreezingIsDeprecated
|
@FreezingIsDeprecated
|
||||||
|
@OptIn(ExperimentalStdlibApi::class)
|
||||||
internal fun ThrowInvalidMutabilityException(where: Any): Nothing {
|
internal fun ThrowInvalidMutabilityException(where: Any): Nothing {
|
||||||
val description = debugDescription(where::class, where.identityHashCode())
|
val description = debugDescription(where::class, where.identityHashCode())
|
||||||
throw InvalidMutabilityException("mutation attempt of frozen $description")
|
throw InvalidMutabilityException("mutation attempt of frozen $description")
|
||||||
|
|||||||
Reference in New Issue
Block a user