File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed
core/kotlinx-coroutines-core Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,9 @@ internal val DEBUG = systemProp(DEBUG_PROPERTY_NAME).let { value ->
41
41
internal actual val Any .hexAddress: String
42
42
get() = Integer .toHexString(System .identityHashCode(this ))
43
43
44
- internal fun Any?.toSafeString (): String =
45
- try { toString() }
46
- catch (e: Throwable ) { " toString() failed with $e " }
47
-
48
- // **KLUDGE**: there is no reason to include continuation into debug string until the following ticket is resolved:
49
- // KT-18986 Debug-friendly toString implementation for CoroutineImpl
50
- // (the current string representation of continuation is useless and uses buggy reflection internals)
51
- // So, this function is a replacement that extract a usable information from continuation -> its class name, at least
52
44
internal actual fun Continuation <* >.toDebugString (): String = when (this ) {
53
45
is DispatchedContinuation -> toString()
54
- else -> " ${ this :: class .java.name} @$hexAddress "
46
+ else -> " $this @$hexAddress "
55
47
}
56
48
57
49
internal actual val Any .classSimpleName: String get() = this ::class .java.simpleName
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2016-2018 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
+ import kotlin.test.*
9
+
10
+ class CancellableContinuationJvmTest : TestBase () {
11
+ @Test
12
+ fun testToString () = runTest {
13
+ checkToString()
14
+ }
15
+
16
+ private suspend fun checkToString () {
17
+ suspendCancellableCoroutine<Unit > {
18
+ it.resume(Unit )
19
+ assertTrue(it.toString().contains(" kotlinx/coroutines/CancellableContinuationJvmTest.checkToString(CancellableContinuationJvmTest.kt:16" ))
20
+ }
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments