Skip to content

Commit d858cba

Browse files
authored
User identityHashCode instead of deprecated Kotlin_Any_hashCode for… (#2710)
* User identityHashCode instead of deprecated `Kotlin_Any_hashCode` for Native debugging capabilities
1 parent 7741256 commit d858cba

File tree

1 file changed

+2
-4
lines changed
  • kotlinx-coroutines-core/native/src

1 file changed

+2
-4
lines changed

kotlinx-coroutines-core/native/src/Debug.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
package kotlinx.coroutines
66

77
import kotlin.math.*
8+
import kotlin.native.*
89

910
internal actual val DEBUG: Boolean = false
1011

11-
internal actual val Any.hexAddress: String get() = abs(id().let { if (it == Int.MIN_VALUE) 0 else it }).toString(16)
12+
internal actual val Any.hexAddress: String get() = identityHashCode().toUInt().toString(16)
1213

1314
internal actual val Any.classSimpleName: String get() = this::class.simpleName ?: "Unknown"
1415

15-
@SymbolName("Kotlin_Any_hashCode")
16-
public external fun Any.id(): Int // Note: can return negative value on K/N
17-
1816
internal actual inline fun assert(value: () -> Boolean) {}

0 commit comments

Comments
 (0)