Skip to content

Commit 992e631

Browse files
committed
Replace uses of deprecated javaClass
1 parent 424d22c commit 992e631

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,6 @@ public abstract class AbstractCoroutine<in T>(
9494
override fun toString(): String {
9595
val state = getState()
9696
val result = if (state is Incomplete) "" else "[$state]"
97-
return "${javaClass.simpleName}{${describeState(state)}}$result@${Integer.toHexString(System.identityHashCode(this))}"
97+
return "${this::class.java.simpleName}{${describeState(state)}}$result@${Integer.toHexString(System.identityHashCode(this))}"
9898
}
9999
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,9 @@ public open class JobSupport(active: Boolean) : AbstractCoroutineContextElement(
343343
// otherwise -- do nothing (it was Empty*)
344344
else -> check(expect is Empty)
345345
}
346-
// Do other (overridable) processing after completion handlers
346+
// handle onCompletion exceptions
347347
completionException?.let { handleCompletionException(it) }
348+
// Do other (overridable) processing after completion handlers
348349
afterCompletion(update)
349350
}
350351

@@ -497,7 +498,7 @@ public open class JobSupport(active: Boolean) : AbstractCoroutineContextElement(
497498
?: InvokeOnCompletion(this, handler)
498499

499500
// for nicer debugging
500-
override fun toString(): String = "${javaClass.simpleName}{${describeState(state)}}@${Integer.toHexString(System.identityHashCode(this))}"
501+
override fun toString(): String = "${this::class.java.simpleName}{${describeState(state)}}@${Integer.toHexString(System.identityHashCode(this))}"
501502

502503
/**
503504
* Interface for incomplete [state][getState] of a job.
@@ -548,7 +549,7 @@ public open class JobSupport(active: Boolean) : AbstractCoroutineContextElement(
548549
_exception ?: // atomic read volatile var or else create new
549550
CancellationException("Job was cancelled").also { _exception = it }
550551

551-
override fun toString(): String = "${javaClass.simpleName}[$exception]"
552+
override fun toString(): String = "${this::class.java.simpleName}[$exception]"
552553
}
553554

554555
/**
@@ -579,7 +580,7 @@ private class InvokeOnCompletion(
579580
val handler: CompletionHandler
580581
) : JobNode(job) {
581582
override fun invoke(reason: Throwable?) = handler.invoke(reason)
582-
override fun toString() = "InvokeOnCompletion[${handler.javaClass.name}@${Integer.toHexString(System.identityHashCode(handler))}]"
583+
override fun toString() = "InvokeOnCompletion[${handler::class.java.name}@${Integer.toHexString(System.identityHashCode(handler))}]"
583584
}
584585

585586
private class ResumeOnCompletion(

0 commit comments

Comments
 (0)