diff --git a/kotlinx-coroutines-core/common/src/flow/Channels.kt b/kotlinx-coroutines-core/common/src/flow/Channels.kt index 130ffc72dc..2d3ef95aa1 100644 --- a/kotlinx-coroutines-core/common/src/flow/Channels.kt +++ b/kotlinx-coroutines-core/common/src/flow/Channels.kt @@ -23,7 +23,6 @@ import kotlinx.coroutines.flow.internal.unsafeFlow as flow * This function provides a more efficient shorthand for `channel.consumeEach { value -> emit(value) }`. * See [consumeEach][ReceiveChannel.consumeEach]. */ -@ExperimentalCoroutinesApi // since version 1.3.0 public suspend fun FlowCollector.emitAll(channel: ReceiveChannel): Unit = emitAllImpl(channel, consume = true) @@ -84,7 +83,6 @@ private suspend fun FlowCollector.emitAllImpl(channel: ReceiveChannel, * In particular, [produceIn] returns the original channel. * Calls to [flowOn] have generally no effect, unless [buffer] is used to explicitly request buffering. */ -@ExperimentalCoroutinesApi // since version 1.4.0 public fun ReceiveChannel.receiveAsFlow(): Flow = ChannelAsFlow(this, consume = false) /** @@ -106,7 +104,6 @@ public fun ReceiveChannel.receiveAsFlow(): Flow = ChannelAsFlow(this, * In particular, [produceIn] returns the original channel (but throws [IllegalStateException] on repeated calls). * Calls to [flowOn] have generally no effect, unless [buffer] is used to explicitly request buffering. */ -@ExperimentalCoroutinesApi // since version 1.3.0 public fun ReceiveChannel.consumeAsFlow(): Flow = ChannelAsFlow(this, consume = true) /** diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Context.kt b/kotlinx-coroutines-core/common/src/flow/operators/Context.kt index 4e6167f0cd..5f184e8feb 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Context.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Context.kt @@ -104,7 +104,6 @@ import kotlin.jvm.* * [RENDEZVOUS][Channel.RENDEZVOUS], [UNLIMITED][Channel.UNLIMITED] or a non-negative value indicating * an explicitly requested size. */ -@ExperimentalCoroutinesApi public fun Flow.buffer(capacity: Int = BUFFERED): Flow { require(capacity >= 0 || capacity == BUFFERED || capacity == CONFLATED) { "Buffer size should be non-negative, BUFFERED, or CONFLATED, but was $capacity" @@ -147,7 +146,6 @@ public fun Flow.buffer(capacity: Int = BUFFERED): Flow { * always fused so that only one properly configured channel is used for execution. * **Conflation takes precedence over `buffer()` calls with any other capacity.** */ -@ExperimentalCoroutinesApi public fun Flow.conflate(): Flow = buffer(CONFLATED) /** @@ -194,7 +192,6 @@ public fun Flow.conflate(): Flow = buffer(CONFLATED) * * @throws [IllegalArgumentException] if provided context contains [Job] instance. */ -@ExperimentalCoroutinesApi public fun Flow.flowOn(context: CoroutineContext): Flow { checkFlowContext(context) return when { diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Distinct.kt b/kotlinx-coroutines-core/common/src/flow/operators/Distinct.kt index 53c4d6d2aa..6b8c61c1af 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Distinct.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Distinct.kt @@ -15,14 +15,12 @@ import kotlinx.coroutines.flow.internal.unsafeFlow as flow /** * Returns flow where all subsequent repetitions of the same value are filtered out. */ -@ExperimentalCoroutinesApi public fun Flow.distinctUntilChanged(): Flow = distinctUntilChangedBy { it } /** * Returns flow where all subsequent repetitions of the same value are filtered out, when compared * with each other via the provided [areEquivalent] function. */ -@FlowPreview public fun Flow.distinctUntilChanged(areEquivalent: (old: T, new: T) -> Boolean): Flow = distinctUntilChangedBy(keySelector = { it }, areEquivalent = areEquivalent) @@ -30,7 +28,6 @@ public fun Flow.distinctUntilChanged(areEquivalent: (old: T, new: T) -> B * Returns flow where all subsequent repetitions of the same key are filtered out, where * key is extracted with [keySelector] function. */ -@FlowPreview public fun Flow.distinctUntilChangedBy(keySelector: (T) -> K): Flow = distinctUntilChangedBy(keySelector = keySelector, areEquivalent = { old, new -> old == new }) diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Emitters.kt b/kotlinx-coroutines-core/common/src/flow/operators/Emitters.kt index 93530234eb..d296517bdb 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Emitters.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Emitters.kt @@ -34,7 +34,6 @@ import kotlin.jvm.* * } * ``` */ -@ExperimentalCoroutinesApi public inline fun Flow.transform( @BuilderInference crossinline transform: suspend FlowCollector.(value: T) -> Unit ): Flow = flow { // Note: safe flow is used here, because collector is exposed to transform on each operation diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Errors.kt b/kotlinx-coroutines-core/common/src/flow/operators/Errors.kt index ad77ba9b14..c73ded9eea 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Errors.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Errors.kt @@ -54,7 +54,6 @@ import kotlinx.coroutines.flow.internal.unsafeFlow as flow * retry an original flow use [retryWhen] operator that can retry the flow multiple times without * introducing ever-growing stack of suspending calls. */ -@ExperimentalCoroutinesApi // tentatively stable in 1.3.0 public fun Flow.catch(action: suspend FlowCollector.(cause: Throwable) -> Unit): Flow = flow { val exception = catchImpl(this) @@ -117,7 +116,6 @@ public fun Flow.onErrorCollect( * * @throws IllegalArgumentException when [retries] is not positive. */ -@ExperimentalCoroutinesApi // tentatively stable in 1.3.0 public fun Flow.retry( retries: Long = Long.MAX_VALUE, predicate: suspend (cause: Throwable) -> Boolean = { true } @@ -169,7 +167,6 @@ public fun Flow.retry( * * See [catch] for more details. */ -@ExperimentalCoroutinesApi // tentatively stable in 1.3.0 public fun Flow.retryWhen(predicate: suspend FlowCollector.(cause: Throwable, attempt: Long) -> Boolean): Flow = flow { var attempt = 0L diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Limit.kt b/kotlinx-coroutines-core/common/src/flow/operators/Limit.kt index 988c22f489..d30a2db206 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Limit.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Limit.kt @@ -7,7 +7,6 @@ package kotlinx.coroutines.flow -import kotlinx.coroutines.* import kotlinx.coroutines.flow.internal.* import kotlin.jvm.* import kotlinx.coroutines.flow.internal.unsafeFlow as flow @@ -16,7 +15,6 @@ import kotlinx.coroutines.flow.internal.unsafeFlow as flow * Returns a flow that ignores first [count] elements. * Throws [IllegalArgumentException] if [count] is negative. */ -@ExperimentalCoroutinesApi public fun Flow.drop(count: Int): Flow { require(count >= 0) { "Drop count should be non-negative, but had $count" } return flow { @@ -30,7 +28,6 @@ public fun Flow.drop(count: Int): Flow { /** * Returns a flow containing all elements except first elements that satisfy the given predicate. */ -@ExperimentalCoroutinesApi public fun Flow.dropWhile(predicate: suspend (T) -> Boolean): Flow = flow { var matched = false collect { value -> @@ -48,7 +45,6 @@ public fun Flow.dropWhile(predicate: suspend (T) -> Boolean): Flow = f * When [count] elements are consumed, the original flow is cancelled. * Throws [IllegalArgumentException] if [count] is not positive. */ -@ExperimentalCoroutinesApi public fun Flow.take(count: Int): Flow { require(count > 0) { "Requested element count $count should be positive" } return flow { @@ -75,7 +71,6 @@ private suspend fun FlowCollector.emitAbort(value: T) { /** * Returns a flow that contains first elements satisfying the given [predicate]. */ -@ExperimentalCoroutinesApi public fun Flow.takeWhile(predicate: suspend (T) -> Boolean): Flow = flow { try { collect { value -> diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Transform.kt b/kotlinx-coroutines-core/common/src/flow/operators/Transform.kt index f446c80c23..fefa42f251 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Transform.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Transform.kt @@ -59,7 +59,6 @@ public inline fun Flow.mapNotNull(crossinline transform: suspend /** * Returns a flow that wraps each element into [IndexedValue], containing value and its index (starting from zero). */ -@ExperimentalCoroutinesApi public fun Flow.withIndex(): Flow> = flow { var index = 0 collect { value -> diff --git a/kotlinx-coroutines-core/common/src/flow/operators/Zip.kt b/kotlinx-coroutines-core/common/src/flow/operators/Zip.kt index 03bddf8330..76f61b127d 100644 --- a/kotlinx-coroutines-core/common/src/flow/operators/Zip.kt +++ b/kotlinx-coroutines-core/common/src/flow/operators/Zip.kt @@ -30,7 +30,6 @@ import kotlinx.coroutines.flow.internal.unsafeFlow as flow * This function is a shorthand for `flow.combineTransform(flow2) { a, b -> emit(transform(a, b)) } */ @JvmName("flowCombine") -@ExperimentalCoroutinesApi public fun Flow.combine(flow: Flow, transform: suspend (a: T1, b: T2) -> R): Flow = flow { combineTransformInternal(this@combine, flow) { a, b -> emit(transform(a, b)) @@ -52,7 +51,6 @@ public fun Flow.combine(flow: Flow, transform: suspend (a: T * * This function is a shorthand for `combineTransform(flow, flow2) { a, b -> emit(transform(a, b)) } */ -@ExperimentalCoroutinesApi public fun combine(flow: Flow, flow2: Flow, transform: suspend (a: T1, b: T2) -> R): Flow = flow.combine(flow2, transform) @@ -74,7 +72,6 @@ public fun combine(flow: Flow, flow2: Flow, transform: suspe * ``` */ @JvmName("flowCombineTransform") -@ExperimentalCoroutinesApi public fun Flow.combineTransform( flow: Flow, @BuilderInference transform: suspend FlowCollector.(a: T1, b: T2) -> Unit @@ -101,7 +98,6 @@ public fun Flow.combineTransform( * } * ``` */ -@ExperimentalCoroutinesApi public fun combineTransform( flow: Flow, flow2: Flow, @@ -117,7 +113,6 @@ public fun combineTransform( * Returns a [Flow] whose values are generated with [transform] function by combining * the most recently emitted values by each flow. */ -@ExperimentalCoroutinesApi public inline fun combine( flow: Flow, flow2: Flow, @@ -137,7 +132,6 @@ public inline fun combine( * The receiver of the [transform] is [FlowCollector] and thus `transform` is a * generic function that may transform emitted element, skip it or emit it multiple times. */ -@ExperimentalCoroutinesApi public inline fun combineTransform( flow: Flow, flow2: Flow, @@ -155,7 +149,6 @@ public inline fun combineTransform( * Returns a [Flow] whose values are generated with [transform] function by combining * the most recently emitted values by each flow. */ -@ExperimentalCoroutinesApi public inline fun combine( flow: Flow, flow2: Flow, @@ -177,7 +170,6 @@ public inline fun combine( * The receiver of the [transform] is [FlowCollector] and thus `transform` is a * generic function that may transform emitted element, skip it or emit it multiple times. */ -@ExperimentalCoroutinesApi public inline fun combineTransform( flow: Flow, flow2: Flow, @@ -197,7 +189,6 @@ public inline fun combineTransform( * Returns a [Flow] whose values are generated with [transform] function by combining * the most recently emitted values by each flow. */ -@ExperimentalCoroutinesApi public inline fun combine( flow: Flow, flow2: Flow, @@ -221,7 +212,6 @@ public inline fun combine( * The receiver of the [transform] is [FlowCollector] and thus `transform` is a * generic function that may transform emitted element, skip it or emit it multiple times. */ -@ExperimentalCoroutinesApi public inline fun combineTransform( flow: Flow, flow2: Flow, @@ -243,7 +233,6 @@ public inline fun combineTransform( * Returns a [Flow] whose values are generated with [transform] function by combining * the most recently emitted values by each flow. */ -@ExperimentalCoroutinesApi public inline fun combine( vararg flows: Flow, crossinline transform: suspend (Array) -> R @@ -257,7 +246,6 @@ public inline fun combine( * The receiver of the [transform] is [FlowCollector] and thus `transform` is a * generic function that may transform emitted element, skip it or emit it multiple times. */ -@ExperimentalCoroutinesApi public inline fun combineTransform( vararg flows: Flow, @BuilderInference crossinline transform: suspend FlowCollector.(Array) -> Unit @@ -269,7 +257,6 @@ public inline fun combineTransform( * Returns a [Flow] whose values are generated with [transform] function by combining * the most recently emitted values by each flow. */ -@ExperimentalCoroutinesApi public inline fun combine( flows: Iterable>, crossinline transform: suspend (Array) -> R @@ -289,7 +276,6 @@ public inline fun combine( * The receiver of the [transform] is [FlowCollector] and thus `transform` is a * generic function that may transform emitted element, skip it or emit it multiple times. */ -@ExperimentalCoroutinesApi public inline fun combineTransform( flows: Iterable>, @BuilderInference crossinline transform: suspend FlowCollector.(Array) -> Unit @@ -313,5 +299,4 @@ public inline fun combineTransform( * } * ``` */ -@ExperimentalCoroutinesApi public fun Flow.zip(other: Flow, transform: suspend (T1, T2) -> R): Flow = zipImpl(this, other, transform) diff --git a/kotlinx-coroutines-core/common/src/flow/terminal/Collect.kt b/kotlinx-coroutines-core/common/src/flow/terminal/Collect.kt index 9d463df073..e8f2a9a3b6 100644 --- a/kotlinx-coroutines-core/common/src/flow/terminal/Collect.kt +++ b/kotlinx-coroutines-core/common/src/flow/terminal/Collect.kt @@ -46,7 +46,6 @@ public suspend fun Flow<*>.collect(): Unit = collect(NopCollector) * * Note that resulting value of [launchIn] is not used the provided scope takes care of cancellation. */ -@ExperimentalCoroutinesApi // tentatively stable in 1.3.0 public fun Flow.launchIn(scope: CoroutineScope): Job = scope.launch { collect() // tail-call } @@ -80,7 +79,6 @@ public suspend inline fun Flow.collect(crossinline action: suspend (value * * See also [collect] and [withIndex]. */ -@ExperimentalCoroutinesApi public suspend inline fun Flow.collectIndexed(crossinline action: suspend (index: Int, value: T) -> Unit): Unit = collect(object : FlowCollector { private var index = 0 @@ -108,7 +106,6 @@ public suspend inline fun Flow.collectIndexed(crossinline action: suspend * * prints "Collecting 1, Collecting 2, 2 collected" */ -@ExperimentalCoroutinesApi public suspend fun Flow.collectLatest(action: suspend (value: T) -> Unit) { /* * Implementation note: @@ -131,5 +128,4 @@ public suspend fun Flow.collectLatest(action: suspend (value: T) -> Unit) * It is a shorthand for `flow.collect { value -> emit(value) }`. */ @BuilderInference -@ExperimentalCoroutinesApi public suspend inline fun FlowCollector.emitAll(flow: Flow): Unit = flow.collect(this) diff --git a/kotlinx-coroutines-core/common/src/flow/terminal/Count.kt b/kotlinx-coroutines-core/common/src/flow/terminal/Count.kt index 63cf52434b..d50c027268 100644 --- a/kotlinx-coroutines-core/common/src/flow/terminal/Count.kt +++ b/kotlinx-coroutines-core/common/src/flow/terminal/Count.kt @@ -13,7 +13,6 @@ import kotlin.jvm.* /** * Returns the number of elements in this flow. */ -@ExperimentalCoroutinesApi public suspend fun Flow.count(): Int { var i = 0 collect { @@ -26,7 +25,6 @@ public suspend fun Flow.count(): Int { /** * Returns the number of elements matching the given predicate. */ -@ExperimentalCoroutinesApi public suspend fun Flow.count(predicate: suspend (T) -> Boolean): Int { var i = 0 collect { value -> diff --git a/kotlinx-coroutines-core/common/src/flow/terminal/Reduce.kt b/kotlinx-coroutines-core/common/src/flow/terminal/Reduce.kt index 674f8322f2..98e665f601 100644 --- a/kotlinx-coroutines-core/common/src/flow/terminal/Reduce.kt +++ b/kotlinx-coroutines-core/common/src/flow/terminal/Reduce.kt @@ -17,7 +17,6 @@ import kotlin.jvm.* * Accumulates value starting with the first element and applying [operation] to current accumulator value and each element. * Throws [NoSuchElementException] if flow was empty. */ -@ExperimentalCoroutinesApi public suspend fun Flow.reduce(operation: suspend (accumulator: S, value: T) -> S): S { var accumulator: Any? = NULL @@ -38,7 +37,6 @@ public suspend fun Flow.reduce(operation: suspend (accumulator: S, /** * Accumulates value starting with [initial] value and applying [operation] current accumulator value and each element */ -@ExperimentalCoroutinesApi public suspend inline fun Flow.fold( initial: R, crossinline operation: suspend (acc: R, value: T) -> R