Skip to content

Commit

Permalink
User identityHashCode instead of deprecated Kotlin_Any_hashCode for… (
Browse files Browse the repository at this point in the history
Kotlin#2710)

* User identityHashCode instead of deprecated `Kotlin_Any_hashCode` for Native debugging capabilities
  • Loading branch information
qwwdfsad authored and pablobaxter committed Sep 14, 2022
1 parent 032fa6c commit a93b3b5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions kotlinx-coroutines-core/native/src/Debug.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

0 comments on commit a93b3b5

Please sign in to comment.