From a93b3b5a895519282634dd2add82f747c10b22d1 Mon Sep 17 00:00:00 2001 From: Vsevolod Tolstopyatov Date: Tue, 18 May 2021 14:32:03 +0300 Subject: [PATCH] =?UTF-8?q?User=20identityHashCode=20instead=20of=20deprec?= =?UTF-8?q?ated=20`Kotlin=5FAny=5FhashCode`=20for=E2=80=A6=20(#2710)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * User identityHashCode instead of deprecated `Kotlin_Any_hashCode` for Native debugging capabilities --- kotlinx-coroutines-core/native/src/Debug.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kotlinx-coroutines-core/native/src/Debug.kt b/kotlinx-coroutines-core/native/src/Debug.kt index a0a8d272f8..f17c2ed7fc 100644 --- a/kotlinx-coroutines-core/native/src/Debug.kt +++ b/kotlinx-coroutines-core/native/src/Debug.kt @@ -5,14 +5,12 @@ package kotlinx.coroutines import kotlin.math.* +import kotlin.native.* internal actual val DEBUG: Boolean = false -internal actual val Any.hexAddress: String get() = abs(id().let { if (it == Int.MIN_VALUE) 0 else it }).toString(16) +internal actual val Any.hexAddress: String get() = identityHashCode().toUInt().toString(16) internal actual val Any.classSimpleName: String get() = this::class.simpleName ?: "Unknown" -@SymbolName("Kotlin_Any_hashCode") -public external fun Any.id(): Int // Note: can return negative value on K/N - internal actual inline fun assert(value: () -> Boolean) {}