Skip to content

Commit b79277b

Browse files
committed
MPP: Debug toString should not depend on kotlin-reflect
1 parent e8986b8 commit b79277b

File tree

4 files changed

+40
-1
lines changed
  • common/kotlinx-coroutines-core-common/src/main/kotlin/kotlinx/coroutines/experimental
  • core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental
  • js/kotlinx-coroutines-core-js/src/main/kotlin/kotlinx/coroutines/experimental

4 files changed

+40
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2016-2017 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package kotlinx.coroutines.experimental
18+
19+
internal expect val Any.classSimpleName: String

common/kotlinx-coroutines-core-common/src/main/kotlin/kotlinx/coroutines/experimental/CompletedExceptionally.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public open class CompletedExceptionally protected constructor(
5252

5353
protected open fun createException(): Throwable = error("Completion exception was not specified")
5454

55-
override fun toString(): String = "${this::class.simpleName}[$exception]"
55+
override fun toString(): String = "$classSimpleName[$exception]"
5656
}
5757

5858
/**

core/kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/Debug.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ internal actual fun Continuation<*>.toDebugString(): String = when (this) {
3636
else -> "${this::class.java.name}@$hexAddress"
3737
}
3838

39+
internal actual val Any.classSimpleName: String get() = this::class.java.simpleName
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2016-2017 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package kotlinx.coroutines.experimental
18+
19+
internal actual val Any.classSimpleName: String get() = this::class.simpleName ?: "Unknown"

0 commit comments

Comments
 (0)