• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016-2020 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 kotlinx.coroutines.internal.*
8 import kotlin.coroutines.*
9 
10 // internal debugging tools for string representation
11 
12 internal actual val Any.hexAddress: String
13     get() = Integer.toHexString(System.identityHashCode(this))
14 
toDebugStringnull15 internal actual fun Continuation<*>.toDebugString(): String = when (this) {
16     is DispatchedContinuation -> toString()
17     // Workaround for #858
18     else -> runCatching { "$this@$hexAddress" }.getOrElse { "${this::class.java.name}@$hexAddress" }
19 }
20 
21 internal actual val Any.classSimpleName: String get() = this::class.java.simpleName
22