xref: /aosp_15_r20/external/kotlinx.coroutines/kotlinx-coroutines-core/jvm/src/DebugStrings.kt (revision 7a7160fed73afa6648ef8aa100d4a336fe921d9a)
1 package kotlinx.coroutines
2 
3 import kotlinx.coroutines.internal.*
4 import kotlin.coroutines.*
5 
6 // internal debugging tools for string representation
7 
8 internal actual val Any.hexAddress: String
9     get() = Integer.toHexString(System.identityHashCode(this))
10 
toDebugStringnull11 internal actual fun Continuation<*>.toDebugString(): String = when (this) {
12     is DispatchedContinuation -> toString()
13     // Workaround for #858
14     else -> runCatching { "$this@$hexAddress" }.getOrElse { "${this::class.java.name}@$hexAddress" }
15 }
16 
17 internal actual val Any.classSimpleName: String get() = this::class.java.simpleName
18