Skip to content

Commit 82a5dfd

Browse files
committed
Restore backward compatibility
1 parent f189cec commit 82a5dfd

File tree

6 files changed

+35
-25
lines changed

6 files changed

+35
-25
lines changed

binary-compatibility-validator/reference-public-api/kotlinx-coroutines-android.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@ public final class kotlinx/coroutines/experimental/android/HandlerContext : kotl
1818
public fun toString ()Ljava/lang/String;
1919
}
2020

21+
public final class kotlinx/coroutines/experimental/android/HandlerContextKt {
22+
public static final synthetic fun asCoroutineDispatcher (Landroid/os/Handler;)Lkotlinx/coroutines/experimental/android/HandlerContext;
23+
public static final fun getUI ()Lkotlinx/coroutines/experimental/android/HandlerContext;
24+
}
25+
2126
public abstract class kotlinx/coroutines/experimental/android/HandlerDispatcher : kotlinx/coroutines/experimental/CoroutineDispatcher, kotlinx/coroutines/experimental/Delay {
2227
public fun delay (JLjava/util/concurrent/TimeUnit;Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
2328
public abstract fun getImmediate ()Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
2429
public fun invokeOnTimeout (JLjava/util/concurrent/TimeUnit;Ljava/lang/Runnable;)Lkotlinx/coroutines/experimental/DisposableHandle;
2530
}
2631

2732
public final class kotlinx/coroutines/experimental/android/HandlerDispatcherKt {
28-
public static final synthetic fun asCoroutineDispatcher (Landroid/os/Handler;)Lkotlinx/coroutines/experimental/android/HandlerContext;
2933
public static final fun asCoroutineDispatcher (Landroid/os/Handler;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
3034
public static final fun awaitFrame (Lkotlin/coroutines/experimental/Continuation;)Ljava/lang/Object;
3135
public static final fun getMain (Lkotlinx/coroutines/experimental/Dispatchers;)Lkotlinx/coroutines/experimental/android/HandlerDispatcher;
32-
public static final fun getUI ()Lkotlinx/coroutines/experimental/android/HandlerContext;
3336
}
3437

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

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5-
/*
6-
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
7-
*/
8-
95
package kotlinx.coroutines.experimental
106

117
import kotlinx.coroutines.experimental.internal.*

common/kotlinx-coroutines-core-common/src/channels/Broadcast.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public fun <E> broadcast(
4545
onCompletion: CompletionHandler? = null,
4646
block: suspend ProducerScope<E>.() -> Unit
4747
): BroadcastChannel<E> =
48-
GlobalScope.broadcast(context + (parent ?: Dispatchers.Default), capacity, start, onCompletion, block)
48+
GlobalScope.broadcast(context + (parent ?: EmptyCoroutineContext), capacity, start, onCompletion, block)
4949

5050
/**
5151
* Launches new coroutine to produce a stream of values by sending them to a broadcast channel
@@ -141,4 +141,3 @@ private class LazyBroadcastCoroutine<E>(
141141
block.startCoroutineCancellable(this, this)
142142
}
143143
}
144-

core/kotlinx-coroutines-core/src/Dispatchers.kt

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5+
@file:Suppress("unused")
6+
57
package kotlinx.coroutines.experimental
68

79
import kotlinx.coroutines.experimental.scheduling.*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package kotlinx.coroutines.experimental.android
6+
7+
import android.os.*
8+
import kotlinx.coroutines.experimental.*
9+
10+
/**
11+
* Dispatches execution onto Android main UI thread and provides native [delay][Delay.delay] support.
12+
* @suppress **Deprecated**: Use [Dispatchers.Main].
13+
*/
14+
@Deprecated(
15+
message = "Use Dispatchers.Main",
16+
replaceWith = ReplaceWith("Dispatchers.Main",
17+
imports = ["kotlinx.coroutines.experimental.Dispatchers", "kotlinx.coroutines.experimental.android.Main"])
18+
)
19+
val UI: HandlerContext
20+
get() = Dispatchers.Main as HandlerContext
21+
22+
@Deprecated(level = DeprecationLevel.HIDDEN, message = "Binary compatibility")
23+
@JvmName("asCoroutineDispatcher")
24+
public fun Handler.asCoroutineDispatcher0(): HandlerContext =
25+
HandlerContext(this)

ui/kotlinx-coroutines-android/src/HandlerDispatcher.kt

+2-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5+
@file:Suppress("unused")
6+
57
package kotlinx.coroutines.experimental.android
68

79
import android.os.*
@@ -36,23 +38,6 @@ public sealed class HandlerDispatcher : CoroutineDispatcher(), Delay {
3638
public fun Handler.asCoroutineDispatcher(): HandlerDispatcher =
3739
HandlerContext(this)
3840

39-
/**
40-
* Dispatches execution onto Android main UI thread and provides native [delay][Delay.delay] support.
41-
* @suppress **Deprecated**: Use [Dispatchers.Main].
42-
*/
43-
@Deprecated(
44-
message = "Use Dispatchers.Main",
45-
replaceWith = ReplaceWith("Dispatchers.Main",
46-
imports = ["kotlinx.coroutines.experimental.Dispatchers", "kotlinx.coroutines.experimental.android.Main"])
47-
)
48-
val UI: HandlerContext
49-
get() = mainDispatcher
50-
51-
@Deprecated(level = DeprecationLevel.HIDDEN, message = "Binary compatibility")
52-
@JvmName("asCoroutineDispatcher")
53-
public fun Handler.asCoroutineDispatcher0(): HandlerContext =
54-
HandlerContext(this)
55-
5641
private const val MAX_DELAY = Long.MAX_VALUE / 2 // cannot delay for too long on Android
5742

5843
private val mainHandler = Handler(Looper.getMainLooper())

0 commit comments

Comments
 (0)