@@ -25,29 +25,21 @@ import java.io.Closeable
25
25
* that subscribe for the elements using [openSubscription] function and unsubscribe using [SubscriptionReceiveChannel.close]
26
26
* function.
27
27
*
28
- * See [ BroadcastChannel()][BroadcastChannel.invoke] factory function for the description of available
28
+ * See ` BroadcastChannel()` factory function for the description of available
29
29
* broadcast channel implementations.
30
30
*/
31
31
public interface BroadcastChannel <E > : SendChannel <E > {
32
32
/* *
33
33
* Factory for broadcast channels.
34
+ * @suppress **Deprecated**
34
35
*/
35
36
public companion object Factory {
36
37
/* *
37
38
* 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**
43
40
*/
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)
51
43
}
52
44
53
45
/* *
@@ -65,6 +57,22 @@ public interface BroadcastChannel<E> : SendChannel<E> {
65
57
public fun open (): SubscriptionReceiveChannel <E > = openSubscription()
66
58
}
67
59
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
+
68
76
/* *
69
77
* Return type for [BroadcastChannel.openSubscription] that can be used to [receive] elements from the
70
78
* open subscription and to [close] it to unsubscribe.
0 commit comments