Skip to content

Commit 1f0df4b

Browse files
committed
MPP: Fixed invokeOnCompletion source compatibility
1 parent e1c0b65 commit 1f0df4b

File tree

2 files changed

+8
-7
lines changed
  • core
    • kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental
    • kotlinx-coroutines-io/src/test/kotlin/kotlinx/coroutines/experimental/io

2 files changed

+8
-7
lines changed

core/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
@@ -267,8 +267,9 @@ public actual interface Job : CoroutineContext.Element {
267267
@Deprecated(message = "For binary compatibility", level = DeprecationLevel.HIDDEN)
268268
public fun invokeOnCompletion(handler: CompletionHandler, onCancelling: Boolean): DisposableHandle
269269

270-
@Deprecated(message = "For binary compatibility", level = DeprecationLevel.HIDDEN)
271-
public fun invokeOnCompletion(onCancelling: Boolean = false, handler: CompletionHandler): DisposableHandle
270+
@Deprecated(message = "Use with named `onCancelling` and `handler` parameters", level = DeprecationLevel.WARNING,
271+
replaceWith = ReplaceWith("this.invokeOnCompletion(onCancelling = onCancelling_, handler = handler)"))
272+
public fun invokeOnCompletion(onCancelling_: Boolean = false, handler: CompletionHandler): DisposableHandle
272273

273274
/**
274275
* Registers handler that is **synchronously** invoked once on completion of this job.
@@ -843,8 +844,8 @@ public open class JobSupport(active: Boolean) : Job, SelectClause0, SelectClause
843844
invokeOnCompletion(onCancelling = onCancelling, invokeImmediately = true, handler = handler)
844845

845846
@Suppress("OverridingDeprecatedMember")
846-
public final override fun invokeOnCompletion(onCancelling: Boolean, handler: CompletionHandler): DisposableHandle =
847-
invokeOnCompletion(onCancelling = onCancelling, invokeImmediately = true, handler = handler)
847+
public final override fun invokeOnCompletion(onCancelling_: Boolean, handler: CompletionHandler): DisposableHandle =
848+
invokeOnCompletion(onCancelling = onCancelling_, invokeImmediately = true, handler = handler)
848849

849850
public override fun invokeOnCompletion(
850851
onCancelling: Boolean,

core/kotlinx-coroutines-io/src/test/kotlin/kotlinx/coroutines/experimental/io/ByteBufferChannelTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,9 @@ class ByteBufferChannelTest {
747747
if (r.decrementAndGet() == 0) latch.countDown()
748748
}
749749

750-
reader.invokeOnCompletion(true, handler)
751-
writerJob.invokeOnCompletion(true, handler)
752-
joinerJob.invokeOnCompletion(true, handler)
750+
reader.invokeOnCompletion(onCancelling = true, handler = handler)
751+
writerJob.invokeOnCompletion(onCancelling = true, handler = handler)
752+
joinerJob.invokeOnCompletion(onCancelling = true, handler = handler)
753753

754754
latch.await()
755755
}

0 commit comments

Comments
 (0)