Increase the deprecation levels for BroadcastChannel APIs (#4197)

diff --git a/benchmarks/src/jmh/kotlin/benchmarks/scheduler/StatefulAwaitsBenchmark.kt b/benchmarks/src/jmh/kotlin/benchmarks/scheduler/StatefulAwaitsBenchmark.kt
index 14bc44b..47d4cb2 100644
--- a/benchmarks/src/jmh/kotlin/benchmarks/scheduler/StatefulAwaitsBenchmark.kt
+++ b/benchmarks/src/jmh/kotlin/benchmarks/scheduler/StatefulAwaitsBenchmark.kt
@@ -40,6 +40,7 @@
 @BenchmarkMode(Mode.AverageTime)
 @OutputTimeUnit(TimeUnit.MICROSECONDS)
 @State(Scope.Benchmark)
+@Suppress("DEPRECATION_ERROR")
 open class StatefulAsyncBenchmark : ParametrizedDispatcherBase() {
 
     private val stateSize = 2048
diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
index d02434c..af4c0ba 100644
--- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
+++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.api
@@ -987,7 +987,6 @@
 	public static final fun asFlow (Lkotlin/ranges/IntRange;)Lkotlinx/coroutines/flow/Flow;
 	public static final fun asFlow (Lkotlin/ranges/LongRange;)Lkotlinx/coroutines/flow/Flow;
 	public static final fun asFlow (Lkotlin/sequences/Sequence;)Lkotlinx/coroutines/flow/Flow;
-	public static final fun asFlow (Lkotlinx/coroutines/channels/BroadcastChannel;)Lkotlinx/coroutines/flow/Flow;
 	public static final fun asFlow ([I)Lkotlinx/coroutines/flow/Flow;
 	public static final fun asFlow ([J)Lkotlinx/coroutines/flow/Flow;
 	public static final fun asFlow ([Ljava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
diff --git a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api
index 70a3274..4cdf598 100644
--- a/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api
+++ b/kotlinx-coroutines-core/api/kotlinx-coroutines-core.klib.api
@@ -825,7 +825,6 @@
 final fun <#A: kotlin/Any?> (kotlin.sequences/Sequence<#A>).kotlinx.coroutines.flow/asFlow(): kotlinx.coroutines.flow/Flow<#A> // kotlinx.coroutines.flow/asFlow|[email protected]<0:0>(){0§<kotlin.Any?>}[0]
 final fun <#A: kotlin/Any?> (kotlin/Array<#A>).kotlinx.coroutines.flow/asFlow(): kotlinx.coroutines.flow/Flow<#A> // kotlinx.coroutines.flow/asFlow|[email protected]<0:0>(){0§<kotlin.Any?>}[0]
 final fun <#A: kotlin/Any?> (kotlin/Function0<#A>).kotlinx.coroutines.flow/asFlow(): kotlinx.coroutines.flow/Flow<#A> // kotlinx.coroutines.flow/asFlow|[email protected]<0:0>(){0§<kotlin.Any?>}[0]
-final fun <#A: kotlin/Any?> (kotlinx.coroutines.channels/BroadcastChannel<#A>).kotlinx.coroutines.flow/asFlow(): kotlinx.coroutines.flow/Flow<#A> // kotlinx.coroutines.flow/asFlow|[email protected]<0:0>(){0§<kotlin.Any?>}[0]
 final fun <#A: kotlin/Any?> (kotlinx.coroutines.channels/ReceiveChannel<#A>).kotlinx.coroutines.channels/broadcast(kotlin/Int = ..., kotlinx.coroutines/CoroutineStart = ...): kotlinx.coroutines.channels/BroadcastChannel<#A> // kotlinx.coroutines.channels/broadcast|[email protected]<0:0>(kotlin.Int;kotlinx.coroutines.CoroutineStart){0§<kotlin.Any?>}[0]
 final fun <#A: kotlin/Any?> (kotlinx.coroutines.channels/ReceiveChannel<#A>).kotlinx.coroutines.channels/distinct(): kotlinx.coroutines.channels/ReceiveChannel<#A> // kotlinx.coroutines.channels/distinct|[email protected]<0:0>(){0§<kotlin.Any?>}[0]
 final fun <#A: kotlin/Any?> (kotlinx.coroutines.channels/ReceiveChannel<#A>).kotlinx.coroutines.channels/drop(kotlin/Int, kotlin.coroutines/CoroutineContext = ...): kotlinx.coroutines.channels/ReceiveChannel<#A> // kotlinx.coroutines.channels/drop|[email protected]<0:0>(kotlin.Int;kotlin.coroutines.CoroutineContext){0§<kotlin.Any?>}[0]
diff --git a/kotlinx-coroutines-core/common/src/channels/Broadcast.kt b/kotlinx-coroutines-core/common/src/channels/Broadcast.kt
index eba767d..f5d1426 100644
--- a/kotlinx-coroutines-core/common/src/channels/Broadcast.kt
+++ b/kotlinx-coroutines-core/common/src/channels/Broadcast.kt
@@ -1,4 +1,4 @@
-@file:Suppress("DEPRECATION")
+@file:Suppress("DEPRECATION", "DEPRECATION_ERROR")
 
 package kotlinx.coroutines.channels
 
@@ -10,36 +10,10 @@
 import kotlin.coroutines.intrinsics.*
 
 /**
- * Broadcasts all elements of the channel.
- * This function [consumes][ReceiveChannel.consume] all elements of the original [ReceiveChannel].
- *
- * The kind of the resulting channel depends on the specified [capacity] parameter:
- * when `capacity` is positive (1 by default), but less than [UNLIMITED] -- uses [BroadcastChannel] with a buffer of given capacity,
- * when `capacity` is [CONFLATED] -- uses [ConflatedBroadcastChannel] that conflates back-to-back sends;
- *   Note that resulting channel behaves like [ConflatedBroadcastChannel] but is not an instance of [ConflatedBroadcastChannel].
- *   otherwise -- throws [IllegalArgumentException].
- *
- * ### Cancelling broadcast
- *
- * **To stop broadcasting from the underlying channel call [cancel][BroadcastChannel.cancel] on the result.**
- *
- * Do not use [close][BroadcastChannel.close] on the resulting channel.
- * It causes eventual failure of the broadcast coroutine and cancellation of the underlying channel, too,
- * but it is not as prompt.
- *
- * ### Future replacement
- *
- * This function has an inappropriate result type of [BroadcastChannel] which provides
- * [send][BroadcastChannel.send] and [close][BroadcastChannel.close] operations that interfere with
- * the broadcasting coroutine in hard-to-specify ways.
- *
- * **Note: This API is obsolete since 1.5.0.** It is deprecated with warning in 1.7.0.
- * It is replaced with [Flow.shareIn][kotlinx.coroutines.flow.shareIn] operator.
- *
- * @param start coroutine start option. The default value is [CoroutineStart.LAZY].
+ * @suppress obsolete since 1.5.0, WARNING since 1.7.0, ERROR since 1.9.0
  */
 @ObsoleteCoroutinesApi
-@Deprecated(level = DeprecationLevel.WARNING, message = "BroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
+@Deprecated(level = DeprecationLevel.ERROR, message = "BroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
 public fun <E> ReceiveChannel<E>.broadcast(
     capacity: Int = 1,
     start: CoroutineStart = CoroutineStart.LAZY
@@ -56,60 +30,10 @@
 }
 
 /**
- * Launches new coroutine to produce a stream of values by sending them to a broadcast channel
- * and returns a reference to the coroutine as a [BroadcastChannel]. The resulting
- * object can be used to [subscribe][BroadcastChannel.openSubscription] to elements produced by this coroutine.
- *
- * The scope of the coroutine contains [ProducerScope] interface, which implements
- * both [CoroutineScope] and [SendChannel], so that coroutine can invoke
- * [send][SendChannel.send] directly. The channel is [closed][SendChannel.close]
- * when the coroutine completes.
- *
- * Coroutine context is inherited from a [CoroutineScope], additional context elements can be specified with [context] argument.
- * If the context does not have any dispatcher nor any other [ContinuationInterceptor], then [Dispatchers.Default] is used.
- * The parent job is inherited from a [CoroutineScope] as well, but it can also be overridden
- * with corresponding [context] element.
- *
- * Uncaught exceptions in this coroutine close the channel with this exception as a cause and
- * the resulting channel becomes _failed_, so that any attempt to receive from such a channel throws exception.
- *
- * The kind of the resulting channel depends on the specified [capacity] parameter:
- * - when `capacity` is positive (1 by default), but less than [UNLIMITED] -- uses [BroadcastChannel] with a buffer of given capacity,
- * - when `capacity` is [CONFLATED] -- uses [ConflatedBroadcastChannel] that conflates back-to-back sends;
- *   Note that resulting channel behaves like [ConflatedBroadcastChannel] but is not an instance of [ConflatedBroadcastChannel].
- * - otherwise -- throws [IllegalArgumentException].
- *
- * **Note:** By default, the coroutine does not start until the first subscriber appears via [BroadcastChannel.openSubscription]
- * as [start] parameter has a value of [CoroutineStart.LAZY] by default.
- * This ensures that the first subscriber does not miss any sent elements.
- * However, later subscribers may miss elements.
- *
- * See [newCoroutineContext] for a description of debugging facilities that are available for newly created coroutine.
- *
- * ### Cancelling broadcast
- *
- * **To stop broadcasting from the underlying channel call [cancel][BroadcastChannel.cancel] on the result.**
- *
- * Do not use [close][BroadcastChannel.close] on the resulting channel.
- * It causes  failure of the `send` operation in broadcast coroutine and would not cancel it if the
- * coroutine is doing something else.
- *
- * ### Future replacement
- *
- * This API is obsolete since 1.5.0 and deprecated with warning since 1.7.0.
- * This function has an inappropriate result type of [BroadcastChannel] which provides
- * [send][BroadcastChannel.send] and [close][BroadcastChannel.close] operations that interfere with
- * the broadcasting coroutine in hard-to-specify ways.
- * It is replaced with [Flow.shareIn][kotlinx.coroutines.flow.shareIn] operator.
- *
- * @param context additional to [CoroutineScope.coroutineContext] context of the coroutine.
- * @param capacity capacity of the channel's buffer (1 by default).
- * @param start coroutine start option. The default value is [CoroutineStart.LAZY].
- * @param onCompletion optional completion handler for the producer coroutine (see [Job.invokeOnCompletion]).
- * @param block the coroutine code.
+ * @suppress obsolete since 1.5.0, WARNING since 1.7.0, ERROR since 1.9.0
  */
 @ObsoleteCoroutinesApi
-@Deprecated(level = DeprecationLevel.WARNING, message = "BroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
+@Deprecated(level = DeprecationLevel.ERROR, message = "BroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
 public fun <E> CoroutineScope.broadcast(
     context: CoroutineContext = EmptyCoroutineContext,
     capacity: Int = 1,
diff --git a/kotlinx-coroutines-core/common/src/channels/BroadcastChannel.kt b/kotlinx-coroutines-core/common/src/channels/BroadcastChannel.kt
index b90f17e..1f07391 100644
--- a/kotlinx-coroutines-core/common/src/channels/BroadcastChannel.kt
+++ b/kotlinx-coroutines-core/common/src/channels/BroadcastChannel.kt
@@ -1,4 +1,4 @@
-@file:Suppress("FunctionName", "DEPRECATION")
+@file:Suppress("FunctionName", "DEPRECATION", "DEPRECATION_ERROR")
 
 package kotlinx.coroutines.channels
 
@@ -10,62 +10,35 @@
 import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
 import kotlinx.coroutines.internal.*
 import kotlinx.coroutines.selects.*
-import kotlin.native.concurrent.*
 
 /**
- * Broadcast channel is a non-blocking primitive for communication between the sender and multiple receivers
- * that subscribe for the elements using [openSubscription] function and unsubscribe using [ReceiveChannel.cancel]
- * function.
- *
- * See `BroadcastChannel()` factory function for the description of available
- * broadcast channel implementations.
- *
- * **Note: This API is obsolete since 1.5.0 and deprecated for removal since 1.7.0**
- * It is replaced with [SharedFlow][kotlinx.coroutines.flow.SharedFlow].
+ * @suppress obsolete since 1.5.0, WARNING since 1.7.0, ERROR since 1.9.0
  */
 @ObsoleteCoroutinesApi
-@Deprecated(level = DeprecationLevel.WARNING, message = "BroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
+@Deprecated(level = DeprecationLevel.ERROR, message = "BroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
 public interface BroadcastChannel<E> : SendChannel<E> {
     /**
-     * Subscribes to this [BroadcastChannel] and returns a channel to receive elements from it.
-     * The resulting channel shall be [cancelled][ReceiveChannel.cancel] to unsubscribe from this
-     * broadcast channel.
+     * @suppress
      */
     public fun openSubscription(): ReceiveChannel<E>
 
     /**
-     * Cancels reception of remaining elements from this channel with an optional cause.
-     * This function closes the channel with
-     * the specified cause (unless it was already closed), removes all buffered sent elements from it,
-     * and [cancels][ReceiveChannel.cancel] all open subscriptions.
-     * A cause can be used to specify an error message or to provide other details on
-     * a cancellation reason for debugging purposes.
+     * @suppress
      */
     public fun cancel(cause: CancellationException? = null)
 
     /**
-     * @suppress This method has bad semantics when cause is not a [CancellationException]. Use [cancel].
+     * @suppress
      */
     @Deprecated(level = DeprecationLevel.HIDDEN, message = "Binary compatibility only")
     public fun cancel(cause: Throwable? = null): Boolean
 }
 
 /**
- * Creates a broadcast channel with the specified buffer capacity.
- *
- * The resulting channel type depends on the specified [capacity] parameter:
- *
- * - when `capacity` positive, but less than [UNLIMITED] -- creates `ArrayBroadcastChannel` with a buffer of given capacity.
- *   **Note:** this channel looses all items that have been sent to it until the first subscriber appears;
- * - when `capacity` is [CONFLATED] -- creates [ConflatedBroadcastChannel] that conflates back-to-back sends;
- * - when `capacity` is [BUFFERED] -- creates `ArrayBroadcastChannel` with a default capacity.
- * - otherwise -- throws [IllegalArgumentException].
- *
- * **Note: This API is obsolete since 1.5.0 and deprecated for removal since 1.7.0**
- * It is replaced with [SharedFlow][kotlinx.coroutines.flow.SharedFlow] and [StateFlow][kotlinx.coroutines.flow.StateFlow].
+ * @suppress obsolete since 1.5.0, WARNING since 1.7.0, ERROR since 1.9.0
  */
 @ObsoleteCoroutinesApi
-@Deprecated(level = DeprecationLevel.WARNING, message = "BroadcastChannel is deprecated in the favour of SharedFlow and StateFlow, and is no longer supported")
+@Deprecated(level = DeprecationLevel.ERROR, message = "BroadcastChannel is deprecated in the favour of SharedFlow and StateFlow, and is no longer supported")
 public fun <E> BroadcastChannel(capacity: Int): BroadcastChannel<E> =
     when (capacity) {
         0 -> throw IllegalArgumentException("Unsupported 0 capacity for BroadcastChannel")
@@ -76,49 +49,28 @@
     }
 
 /**
- * Broadcasts the most recently sent element (aka [value]) to all [openSubscription] subscribers.
- *
- * Back-to-send sent elements are _conflated_ -- only the most recently sent value is received,
- * while previously sent elements **are lost**.
- * Every subscriber immediately receives the most recently sent element.
- * Sender to this broadcast channel never suspends and [trySend] always succeeds.
- *
- * A secondary constructor can be used to create an instance of this class that already holds a value.
- * This channel is also created by `BroadcastChannel(Channel.CONFLATED)` factory function invocation.
- *
- * In this implementation, [opening][openSubscription] and [closing][ReceiveChannel.cancel] subscription
- * takes linear time in the number of subscribers.
- *
- * **Note: This API is obsolete since 1.5.0 and deprecated for removal since 1.7.0**
- * It is replaced with [SharedFlow][kotlinx.coroutines.flow.StateFlow].
+ * @suppress obsolete since 1.5.0, WARNING since 1.7.0, ERROR since 1.9.0
  */
 @ObsoleteCoroutinesApi
-@Deprecated(level = DeprecationLevel.WARNING, message = "ConflatedBroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
+@Deprecated(level = DeprecationLevel.ERROR, message = "ConflatedBroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
 public class ConflatedBroadcastChannel<E> private constructor(
     private val broadcast: BroadcastChannelImpl<E>
 ) : BroadcastChannel<E> by broadcast {
     public constructor(): this(BroadcastChannelImpl<E>(capacity = CONFLATED))
     /**
-     * Creates an instance of this class that already holds a value.
-     *
-     * It is as a shortcut to creating an instance with a default constructor and
-     * immediately sending an element: `ConflatedBroadcastChannel().apply { offer(value) }`.
+     * @suppress
      */
     public constructor(value: E) : this() {
         trySend(value)
     }
 
     /**
-     * The most recently sent element to this channel.
-     *
-     * Access to this property throws [IllegalStateException] when this class is constructed without
-     * initial value and no value was sent yet or if it was [closed][close] without a cause.
-     * It throws the original [close][SendChannel.close] cause exception if the channel has _failed_.
+     * @suppress
      */
     public val value: E get() = broadcast.value
+
     /**
-     * The most recently sent element to this channel or `null` when this class is constructed without
-     * initial value and no value was sent yet or if it was [closed][close].
+     * @suppress
      */
     public val valueOrNull: E? get() = broadcast.valueOrNull
 }
diff --git a/kotlinx-coroutines-core/common/src/channels/Deprecated.kt b/kotlinx-coroutines-core/common/src/channels/Deprecated.kt
index acb8daf..463adcb 100644
--- a/kotlinx-coroutines-core/common/src/channels/Deprecated.kt
+++ b/kotlinx-coroutines-core/common/src/channels/Deprecated.kt
@@ -18,7 +18,7 @@
  * Safe to remove in 1.9.0 as was inline before.
  */
 @ObsoleteCoroutinesApi
-@Suppress("DEPRECATION")
+@Suppress("DEPRECATION_ERROR")
 @Deprecated(level = DeprecationLevel.ERROR, message = "BroadcastChannel is deprecated in the favour of SharedFlow and is no longer supported")
 public inline fun <E, R> BroadcastChannel<E>.consume(block: ReceiveChannel<E>.() -> R): R {
     val channel = openSubscription()
diff --git a/kotlinx-coroutines-core/common/src/flow/Channels.kt b/kotlinx-coroutines-core/common/src/flow/Channels.kt
index 7bfa499..2d509ad 100644
--- a/kotlinx-coroutines-core/common/src/flow/Channels.kt
+++ b/kotlinx-coroutines-core/common/src/flow/Channels.kt
@@ -132,25 +132,6 @@
 }
 
 /**
- * Represents the given broadcast channel as a hot flow.
- * Every flow collector will trigger a new broadcast channel subscription.
- *
- * ### Cancellation semantics
- * 1) Flow consumer is cancelled when the original channel is cancelled.
- * 2) Flow consumer completes normally when the original channel completes (~is closed) normally.
- * 3) If the flow consumer fails with an exception, subscription is cancelled.
- */
-@Suppress("DEPRECATION")
-@Deprecated(
-    level = DeprecationLevel.ERROR,
-    message = "'BroadcastChannel' is obsolete and all corresponding operators are deprecated " +
-        "in the favour of StateFlow and SharedFlow"
-) // Since 1.5.0, ERROR since 1.7.0, was @FlowPreview, safe to remove in 1.8.0
-public fun <T> BroadcastChannel<T>.asFlow(): Flow<T> = flow {
-    emitAll(openSubscription())
-}
-
-/**
  * Creates a [produce] coroutine that collects the given flow.
  *
  * This transformation is **stateful**, it launches a [produce] coroutine
diff --git a/kotlinx-coroutines-core/common/test/CancelledParentAttachTest.kt b/kotlinx-coroutines-core/common/test/CancelledParentAttachTest.kt
index e981248..e34cba4 100644
--- a/kotlinx-coroutines-core/common/test/CancelledParentAttachTest.kt
+++ b/kotlinx-coroutines-core/common/test/CancelledParentAttachTest.kt
@@ -9,7 +9,7 @@
 
     @Test
     fun testAsync() = runTest {
-        CoroutineStart.values().forEach { testAsyncCancelledParent(it) }
+        CoroutineStart.entries.forEach { testAsyncCancelledParent(it) }
     }
 
     private suspend fun testAsyncCancelledParent(start: CoroutineStart) {
@@ -25,14 +25,14 @@
                 }
             }
             expectUnreached()
-        } catch (e: CancellationException) {
+        } catch (_: CancellationException) {
             // Expected
         }
     }
 
     @Test
     fun testLaunch() = runTest {
-        CoroutineStart.values().forEach { testLaunchCancelledParent(it) }
+        CoroutineStart.entries.forEach { testLaunchCancelledParent(it) }
     }
 
     private suspend fun testLaunchCancelledParent(start: CoroutineStart) {
@@ -48,7 +48,7 @@
                 }
             }
             expectUnreached()
-        } catch (e: CancellationException) {
+        } catch (_: CancellationException) {
             // Expected
         }
     }
@@ -67,9 +67,10 @@
 
     @Test
     fun testBroadcast() = runTest {
-        CoroutineStart.values().forEach { testBroadcastCancelledParent(it) }
+        CoroutineStart.entries.forEach { testBroadcastCancelledParent(it) }
     }
 
+    @Suppress("DEPRECATION_ERROR")
     private suspend fun testBroadcastCancelledParent(start: CoroutineStart) {
         try {
             withContext(Job()) {
@@ -83,7 +84,7 @@
                 }
             }
             expectUnreached()
-        } catch (e: CancellationException) {
+        } catch (_: CancellationException) {
             // Expected
         }
     }
@@ -105,7 +106,7 @@
                 block()
             }
             expectUnreached()
-        } catch (e: CancellationException) {
+        } catch (_: CancellationException) {
             // Expected
         }
     }
diff --git a/kotlinx-coroutines-core/common/test/ParentCancellationTest.kt b/kotlinx-coroutines-core/common/test/ParentCancellationTest.kt
index fd07a06..43f77a5 100644
--- a/kotlinx-coroutines-core/common/test/ParentCancellationTest.kt
+++ b/kotlinx-coroutines-core/common/test/ParentCancellationTest.kt
@@ -4,7 +4,6 @@
 
 import kotlinx.coroutines.testing.*
 import kotlinx.coroutines.channels.*
-import kotlin.coroutines.*
 import kotlin.test.*
 
 /**
@@ -57,6 +56,7 @@
     }
 
     @Test
+    @Suppress("DEPRECATION_ERROR")
     fun testBroadcastChild() = runTest {
         testParentCancellation(runsInScopeContext = true) { fail ->
             broadcast<Unit> { fail() }.openSubscription()
@@ -165,4 +165,4 @@
         }
         finish(3)
     }
-}
\ No newline at end of file
+}
diff --git a/kotlinx-coroutines-core/common/test/channels/BroadcastChannelFactoryTest.kt b/kotlinx-coroutines-core/common/test/channels/BroadcastChannelFactoryTest.kt
index 652f307..f13aae5 100644
--- a/kotlinx-coroutines-core/common/test/channels/BroadcastChannelFactoryTest.kt
+++ b/kotlinx-coroutines-core/common/test/channels/BroadcastChannelFactoryTest.kt
@@ -1,10 +1,9 @@
 package kotlinx.coroutines.channels
 
 import kotlinx.coroutines.testing.*
-import kotlinx.coroutines.*
 import kotlin.test.*
 
-
+@Suppress("DEPRECATION_ERROR")
 class BroadcastChannelFactoryTest : TestBase() {
 
     @Test
diff --git a/kotlinx-coroutines-core/common/test/channels/BroadcastTest.kt b/kotlinx-coroutines-core/common/test/channels/BroadcastTest.kt
index a308f7a..3e8514b 100644
--- a/kotlinx-coroutines-core/common/test/channels/BroadcastTest.kt
+++ b/kotlinx-coroutines-core/common/test/channels/BroadcastTest.kt
@@ -1,4 +1,4 @@
-@file:Suppress("DEPRECATION")
+@file:Suppress("DEPRECATION_ERROR")
 
 package kotlinx.coroutines.channels
 
diff --git a/kotlinx-coroutines-core/common/test/channels/BufferedBroadcastChannelTest.kt b/kotlinx-coroutines-core/common/test/channels/BufferedBroadcastChannelTest.kt
index 834d974..9680232 100644
--- a/kotlinx-coroutines-core/common/test/channels/BufferedBroadcastChannelTest.kt
+++ b/kotlinx-coroutines-core/common/test/channels/BufferedBroadcastChannelTest.kt
@@ -4,6 +4,7 @@
 import kotlinx.coroutines.*
 import kotlin.test.*
 
+@Suppress("DEPRECATION_ERROR")
 class BufferedBroadcastChannelTest : TestBase() {
 
     @Test
diff --git a/kotlinx-coroutines-core/common/test/channels/ConflatedBroadcastChannelTest.kt b/kotlinx-coroutines-core/common/test/channels/ConflatedBroadcastChannelTest.kt
index 72b5fde..9c534e0 100644
--- a/kotlinx-coroutines-core/common/test/channels/ConflatedBroadcastChannelTest.kt
+++ b/kotlinx-coroutines-core/common/test/channels/ConflatedBroadcastChannelTest.kt
@@ -4,6 +4,7 @@
 import kotlinx.coroutines.*
 import kotlin.test.*
 
+@Suppress("DEPRECATION_ERROR")
 class ConflatedBroadcastChannelTest : TestBase() {
 
     @Test
diff --git a/kotlinx-coroutines-core/common/test/channels/TestBroadcastChannelKind.kt b/kotlinx-coroutines-core/common/test/channels/TestBroadcastChannelKind.kt
index 0d23238..693f1f1 100644
--- a/kotlinx-coroutines-core/common/test/channels/TestBroadcastChannelKind.kt
+++ b/kotlinx-coroutines-core/common/test/channels/TestBroadcastChannelKind.kt
@@ -1,5 +1,6 @@
 package kotlinx.coroutines.channels
 
+@Suppress("DEPRECATION_ERROR")
 enum class TestBroadcastChannelKind {
     ARRAY_1 {
         override fun <T> create(): BroadcastChannel<T> = BroadcastChannel(1)
@@ -18,4 +19,4 @@
 
     abstract fun <T> create(): BroadcastChannel<T>
     open val isConflated: Boolean get() = false
-}
\ No newline at end of file
+}
diff --git a/kotlinx-coroutines-core/common/test/channels/TestChannelKind.kt b/kotlinx-coroutines-core/common/test/channels/TestChannelKind.kt
index 97562d4..605c746 100644
--- a/kotlinx-coroutines-core/common/test/channels/TestChannelKind.kt
+++ b/kotlinx-coroutines-core/common/test/channels/TestChannelKind.kt
@@ -21,7 +21,7 @@
 
     fun <T> create(onUndeliveredElement: ((T) -> Unit)? = null): Channel<T> = when {
         viaBroadcast && onUndeliveredElement != null -> error("Broadcast channels to do not support onUndeliveredElement")
-        viaBroadcast -> ChannelViaBroadcast(BroadcastChannel(capacity))
+        viaBroadcast -> @Suppress("DEPRECATION_ERROR") ChannelViaBroadcast(BroadcastChannel(capacity))
         else -> Channel(capacity, onUndeliveredElement = onUndeliveredElement)
     }
 
@@ -30,6 +30,7 @@
 }
 
 internal class ChannelViaBroadcast<E>(
+    @Suppress("DEPRECATION_ERROR")
     private val broadcast: BroadcastChannel<E>
 ): Channel<E>, SendChannel<E> by broadcast {
     val sub = broadcast.openSubscription()
diff --git a/kotlinx-coroutines-core/concurrent/test/channels/ConflatedBroadcastChannelNotifyStressTest.kt b/kotlinx-coroutines-core/concurrent/test/channels/ConflatedBroadcastChannelNotifyStressTest.kt
index a9e8756..99b3262 100644
--- a/kotlinx-coroutines-core/concurrent/test/channels/ConflatedBroadcastChannelNotifyStressTest.kt
+++ b/kotlinx-coroutines-core/concurrent/test/channels/ConflatedBroadcastChannelNotifyStressTest.kt
@@ -5,6 +5,7 @@
 import kotlinx.coroutines.*
 import kotlin.test.*
 
+@Suppress("DEPRECATION_ERROR")
 class ConflatedBroadcastChannelNotifyStressTest : TestBase() {
     private val nSenders = 2
     private val nReceivers = 3
diff --git a/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelLeakTest.kt b/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelLeakTest.kt
index 7102636..7cd1487 100644
--- a/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelLeakTest.kt
+++ b/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelLeakTest.kt
@@ -4,6 +4,7 @@
 import org.junit.Test
 import kotlin.test.*
 
+@Suppress("DEPRECATION_ERROR")
 class BroadcastChannelLeakTest : TestBase() {
     @Test
     fun testBufferedBroadcastChannelSubscriptionLeak() {
@@ -18,7 +19,7 @@
     enum class TestKind { BROADCAST_CLOSE, SUB_CANCEL, BOTH }
 
     private fun checkLeak(factory: () -> BroadcastChannel<String>) = runTest {
-        for (kind in TestKind.values()) {
+        for (kind in TestKind.entries) {
             val broadcast = factory()
             val sub = broadcast.openSubscription()
             broadcast.send("OK")
diff --git a/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelMultiReceiveStressTest.kt b/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelMultiReceiveStressTest.kt
index 5b21180..671f5d8 100644
--- a/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelMultiReceiveStressTest.kt
+++ b/kotlinx-coroutines-core/jvm/test/channels/BroadcastChannelMultiReceiveStressTest.kt
@@ -118,7 +118,7 @@
             try {
                 val stop = doReceived(receiverIndex, channel.receive())
                 if (stop) break
-            } catch (ex: ClosedReceiveChannelException) {
+            } catch (_: ClosedReceiveChannelException) {
                 break
             }
         }
@@ -144,7 +144,7 @@
                 val event = select<Long> { channel.onReceive { it } }
                 val stop = doReceived(receiverIndex, event)
                 if (stop) break
-            } catch (ex: ClosedReceiveChannelException) {
+            } catch (_: ClosedReceiveChannelException) {
                 break
             }
         }
diff --git a/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt b/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt
index 26a58c3..96a8d13 100644
--- a/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt
+++ b/kotlinx-coroutines-core/jvm/test/lincheck/ChannelsLincheckTest.kt
@@ -54,6 +54,7 @@
     sequentialSpecification = SequentialConflatedChannel::class.java,
     obstructionFree = false
 )
+@Suppress("DEPRECATION_ERROR")
 class ConflatedBroadcastChannelLincheckTest : ChannelLincheckTestBaseAll(
     c = ChannelViaBroadcast(ConflatedBroadcastChannel()),
     sequentialSpecification = SequentialConflatedChannel::class.java,
diff --git a/kotlinx-coroutines-debug/test/BlockHoundTest.kt b/kotlinx-coroutines-debug/test/BlockHoundTest.kt
index 8faa3e8..685dbb3 100644
--- a/kotlinx-coroutines-debug/test/BlockHoundTest.kt
+++ b/kotlinx-coroutines-debug/test/BlockHoundTest.kt
@@ -56,6 +56,7 @@
         }
     }
 
+    @Suppress("DEPRECATION_ERROR")
     @Test
     fun testBroadcastChannelNotBeingConsideredBlocking() = runTest {
         withContext(Dispatchers.Default) {
diff --git a/kotlinx-coroutines-debug/test/StartModeProbesTest.kt b/kotlinx-coroutines-debug/test/StartModeProbesTest.kt
index 035873a..d2e2552 100644
--- a/kotlinx-coroutines-debug/test/StartModeProbesTest.kt
+++ b/kotlinx-coroutines-debug/test/StartModeProbesTest.kt
@@ -140,6 +140,7 @@
     fun testLazy() = runTest({ it is CancellationException }) {
         launch(start = CoroutineStart.LAZY) {  }
         actor<Int>(start = CoroutineStart.LAZY) {  }
+        @Suppress("DEPRECATION_ERROR")
         broadcast<Int>(start = CoroutineStart.LAZY) {  }
         async(start = CoroutineStart.LAZY) { 1 }
         verifyPartialDump(5, "BlockingCoroutine",