Skip to content

Commit ffda1da

Browse files
committed
Copy deprecated annotations on Job member to inheritors
* Makes them easier to find for cleanup * Avoids bug with light classes
1 parent 18cc588 commit ffda1da

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,13 @@ internal open class JobSupport constructor(active: Boolean) : Job, ChildJob, Sel
429429
invokeOnCompletion(onCancelling = false, invokeImmediately = true, handler = handler)
430430

431431
@Suppress("OverridingDeprecatedMember")
432+
@Deprecated(message = "For binary compatibility", level = DeprecationLevel.HIDDEN)
432433
public final override fun invokeOnCompletion(handler: CompletionHandler, onCancelling: Boolean): DisposableHandle =
433434
invokeOnCompletion(onCancelling = onCancelling, invokeImmediately = true, handler = handler)
434435

435436
@Suppress("OverridingDeprecatedMember")
437+
@Deprecated(message = "Use with named `onCancellation` and `handler` parameters", level = DeprecationLevel.WARNING,
438+
replaceWith = ReplaceWith("this.invokeOnCompletion(onCancellation = onCancelling_, handler = handler)"))
436439
public final override fun invokeOnCompletion(onCancelling_: Boolean, handler: CompletionHandler): DisposableHandle =
437440
invokeOnCompletion(onCancelling = onCancelling_, invokeImmediately = true, handler = handler)
438441

@@ -878,6 +881,7 @@ internal open class JobSupport constructor(active: Boolean) : Job, ChildJob, Sel
878881
}
879882

880883
@Suppress("OverridingDeprecatedMember")
884+
@Deprecated(message = "Binary compatibility, it is an extension now", level = DeprecationLevel.HIDDEN)
881885
public final override fun cancelChildren(cause: Throwable?) {
882886
this.cancelChildren(cause) // use extension function
883887
}

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

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public object NonCancellable : AbstractCoroutineContextElement(Job), Job {
8484
*/
8585
@Suppress("OverridingDeprecatedMember")
8686
@InternalCoroutinesApi
87+
@Deprecated(message = "For binary compatibility", level = DeprecationLevel.HIDDEN)
8788
override fun invokeOnCompletion(handler: CompletionHandler, onCancelling: Boolean): DisposableHandle =
8889
NonDisposableHandle
8990

@@ -93,6 +94,8 @@ public object NonCancellable : AbstractCoroutineContextElement(Job), Job {
9394
*/
9495
@Suppress("OverridingDeprecatedMember")
9596
@InternalCoroutinesApi
97+
@Deprecated(message = "Use with named `onCancellation` and `handler` parameters", level = DeprecationLevel.WARNING,
98+
replaceWith = ReplaceWith("this.invokeOnCompletion(onCancellation = onCancelling_, handler = handler)"))
9699
override fun invokeOnCompletion(onCancelling_: Boolean, handler: CompletionHandler): DisposableHandle =
97100
NonDisposableHandle
98101

@@ -140,5 +143,6 @@ public object NonCancellable : AbstractCoroutineContextElement(Job), Job {
140143
*/
141144
@Suppress("OverridingDeprecatedMember")
142145
@InternalCoroutinesApi
146+
@Deprecated(message = "Binary compatibility, it is an extension now", level = DeprecationLevel.HIDDEN)
143147
override fun cancelChildren(cause: Throwable?) {}
144148
}

0 commit comments

Comments
 (0)