1 /* 2 * Copyright 2016-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines 6 7 import kotlin.coroutines.* 8 9 // internal debugging tools for string representation 10 11 internal actual val Any.hexAddress: String 12 get() = Integer.toHexString(System.identityHashCode(this)) 13 14 internal actual fun Continuation<*>.toDebugString(): String = when (this) { 15 is DispatchedContinuation -> toString() 16 // Workaround for #858 17 else -> runCatching { "$this@$hexAddress" }.getOrElse { "${this::class.java.name}@$hexAddress" } 18 } 19 20 internal actual val Any.classSimpleName: String get() = this::class.java.simpleName 21