@@ -25,29 +25,21 @@ import java.io.Closeable
2525 * that subscribe for the elements using [openSubscription] function and unsubscribe using [SubscriptionReceiveChannel.close]
2626 * function.
2727 *
28- * See [ BroadcastChannel()][BroadcastChannel.invoke] factory function for the description of available
28+ * See ` BroadcastChannel()` factory function for the description of available
2929 * broadcast channel implementations.
3030 */
3131public interface BroadcastChannel <E > : SendChannel <E > {
3232 /* *
3333 * Factory for broadcast channels.
34+ * @suppress **Deprecated**
3435 */
3536 public companion object Factory {
3637 /* *
3738 * Creates a broadcast channel with the specified buffer capacity.
38- *
39- * The resulting channel type depends on the specified [capacity] parameter:
40- * * when `capacity` positive, but less than [UNLIMITED] -- creates [ArrayBroadcastChannel];
41- * * when `capacity` is [CONFLATED] -- creates [ConflatedBroadcastChannel] that conflates back-to-back sends;
42- * * otherwise -- throws [IllegalArgumentException].
39+ * @suppress **Deprecated**
4340 */
44- public operator fun <E > invoke (capacity : Int ): BroadcastChannel <E > =
45- when (capacity) {
46- 0 -> throw IllegalArgumentException (" Unsupported 0 capacity for BroadcastChannel" )
47- UNLIMITED -> throw IllegalArgumentException (" Unsupported UNLIMITED capacity for BroadcastChannel" )
48- CONFLATED -> ConflatedBroadcastChannel ()
49- else -> ArrayBroadcastChannel (capacity)
50- }
41+ @Deprecated(" Replaced with top-level function" , level = DeprecationLevel .HIDDEN )
42+ public operator fun <E > invoke (capacity : Int ): BroadcastChannel <E > = BroadcastChannel (capacity)
5143 }
5244
5345 /* *
@@ -65,6 +57,22 @@ public interface BroadcastChannel<E> : SendChannel<E> {
6557 public fun open (): SubscriptionReceiveChannel <E > = openSubscription()
6658}
6759
60+ /* *
61+ * Creates a broadcast channel with the specified buffer capacity.
62+ *
63+ * The resulting channel type depends on the specified [capacity] parameter:
64+ * * when `capacity` positive, but less than [UNLIMITED] -- creates [ArrayBroadcastChannel];
65+ * * when `capacity` is [CONFLATED] -- creates [ConflatedBroadcastChannel] that conflates back-to-back sends;
66+ * * otherwise -- throws [IllegalArgumentException].
67+ */
68+ public fun <E > BroadcastChannel (capacity : Int ): BroadcastChannel <E > =
69+ when (capacity) {
70+ 0 -> throw IllegalArgumentException (" Unsupported 0 capacity for BroadcastChannel" )
71+ UNLIMITED -> throw IllegalArgumentException (" Unsupported UNLIMITED capacity for BroadcastChannel" )
72+ CONFLATED -> ConflatedBroadcastChannel ()
73+ else -> ArrayBroadcastChannel (capacity)
74+ }
75+
6876/* *
6977 * Return type for [BroadcastChannel.openSubscription] that can be used to [receive] elements from the
7078 * open subscription and to [close] it to unsubscribe.
0 commit comments