Skip to content

Commit f13cbae

Browse files
committed
Get rid of references to deprecated AbstractCoroutine.onCancellation
Also make JobSupport.onFailing protected instead of internal This will produce nicer stack-traces
1 parent 409ed26 commit f13cbae

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

common/kotlinx-coroutines-core-common/src/AbstractCoroutine.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import kotlin.coroutines.experimental.*
1515
* This class implements completion [Continuation], [Job], and [CoroutineScope] interfaces.
1616
* It stores the result of continuation in the state of the job.
1717
* This coroutine waits for children coroutines to finish before completing and
18-
* is cancelled through an intermediate _cancelling_ state.
18+
* fails through an intermediate _failing_ state.
1919
*
2020
* The following methods are available for override:
2121
*
2222
* * [onStart] is invoked when coroutine is create in not active state and is [started][Job.start].
23-
* * [onCancellation] is invoked as soon as coroutine is [cancelled][cancel] (becomes _cancelling_)
23+
* * [onFailing] is invoked as soon as coroutine is _failing_, or is cancelled,
2424
* or when it completes for any reason.
2525
* * [onCompleted] is invoked when coroutine completes with a value.
2626
* * [onCompletedExceptionally] in invoked when coroutines completes with exception.
@@ -82,10 +82,8 @@ public abstract class AbstractCoroutine<in T>(
8282
* * Cause is an instance of [CancellationException] when job was cancelled _normally_.
8383
* **It should not be treated as an error**. In particular, it should not be reported to error logs.
8484
* * Otherwise, the job had _failed_.
85-
*
86-
* @suppress **Deprecated**: Override [onFailing].
8785
*/
88-
override fun onFailing(cause: Throwable?) {
86+
protected override fun onFailing(cause: Throwable?) {
8987
onCancellation(cause)
9088
}
9189

common/kotlinx-coroutines-core-common/src/JobSupport.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ internal open class JobSupport constructor(active: Boolean) : Job, SelectClause0
905905
*
906906
* @suppress **This is unstable API and it is subject to change.*
907907
*/
908-
internal open fun onFailing(cause: Throwable?) {}
908+
protected open fun onFailing(cause: Throwable?) {}
909909

910910
/**
911911
* When this function returns `true` the parent fails on the failure of this job.

0 commit comments

Comments
 (0)