Skip to content

Commit

Permalink
Opt into OptInRequired
Browse files Browse the repository at this point in the history
  • Loading branch information
dkhalanskyjb committed May 16, 2024
1 parent 77844cf commit 4fb023d
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/common/src/AbstractCoroutine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import kotlin.coroutines.*
*
* @suppress **This an internal API and should not be used from general code.**
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
@InternalCoroutinesApi
public abstract class AbstractCoroutine<in T>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import kotlin.coroutines.intrinsics.*
* +-----------+
* ```
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public interface CancellableContinuation<in T> : Continuation<T> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package kotlinx.coroutines
* Examples of closeable dispatchers are dispatchers backed by `java.lang.Executor` and
* by `kotlin.native.Worker`.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@ExperimentalCoroutinesApi
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public expect abstract class CloseableCoroutineDispatcher() : CoroutineDispatcher {
Expand Down
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/common/src/CompletableDeferred.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import kotlinx.coroutines.selects.*
* All functions on this interface are **thread-safe** and can
* be safely invoked from concurrent coroutines without external synchronization.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(markerClass = BrittleForInheritanceCoroutinesApi::class)
public interface CompletableDeferred<T> : Deferred<T> {
/**
Expand Down
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/common/src/CompletableJob.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package kotlinx.coroutines
* **The `CompletableJob` interface is not stable for inheritance in 3rd party libraries**,
* as new methods might be added to this interface in the future, but is stable for use.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(markerClass = BrittleForInheritanceCoroutinesApi::class)
public interface CompletableJob : Job {
/**
Expand Down
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/common/src/Deferred.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import kotlinx.coroutines.selects.*
* All functions on this interface and on all interfaces derived from it are **thread-safe** and can
* be safely invoked from concurrent coroutines without external synchronization.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(markerClass = BrittleForInheritanceCoroutinesApi::class)
public interface Deferred<out T> : Job {

Expand Down
3 changes: 3 additions & 0 deletions kotlinx-coroutines-core/common/src/Job.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ import kotlin.jvm.*
* All functions on this interface and on all interfaces derived from it are **thread-safe** and can
* be safely invoked from concurrent coroutines without external synchronization.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(markerClass = BrittleForInheritanceCoroutinesApi::class)
public interface Job : CoroutineContext.Element {
/**
Expand Down Expand Up @@ -398,6 +399,7 @@ public fun interface DisposableHandle {
*
* @suppress **This is unstable API and it is subject to change.**
*/
@OptIn(ExperimentalSubclassOptIn::class)
@InternalCoroutinesApi
@Deprecated(level = DeprecationLevel.ERROR, message = "This is internal API and may be removed in the future releases")
@SubclassOptInRequired(markerClass = BrittleForInheritanceCoroutinesApi::class)
Expand All @@ -418,6 +420,7 @@ public interface ChildJob : Job {
*
* @suppress **This is unstable API and it is subject to change.**
*/
@OptIn(ExperimentalSubclassOptIn::class)
@InternalCoroutinesApi
@Deprecated(level = DeprecationLevel.ERROR, message = "This is internal API and may be removed in the future releases")
@SubclassOptInRequired(markerClass = BrittleForInheritanceCoroutinesApi::class)
Expand Down
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/common/src/JobSupport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import kotlin.jvm.*
* @param active when `true` the job is created in _active_ state, when `false` in _new_ state. See [Job] for details.
* @suppress **This is unstable API and it is subject to change.**
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
@Deprecated(level = DeprecationLevel.ERROR, message = "This is internal API and may be removed in the future releases")
public open class JobSupport constructor(active: Boolean) : Job, ChildJob, ParentJob {
Expand Down
2 changes: 2 additions & 0 deletions kotlinx-coroutines-core/common/src/flow/Flow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ import kotlin.coroutines.*
* These implementations ensure that the context preservation property is not violated, and prevent most
* of the developer mistakes related to concurrency, inconsistent flow dispatchers, and cancellation.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public interface Flow<out T> {

Expand Down Expand Up @@ -218,6 +219,7 @@ public interface Flow<out T> {
* }
* ```
*/
@OptIn(ExperimentalSubclassOptIn::class)
@ExperimentalCoroutinesApi
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public abstract class AbstractFlow<T> : Flow<T>, CancellableFlow<T> {
Expand Down
2 changes: 2 additions & 0 deletions kotlinx-coroutines-core/common/src/flow/SharedFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ import kotlin.jvm.*
* might be added to this interface in the future, but is stable for use.
* Use the `MutableSharedFlow(replay, ...)` constructor function to create an implementation.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public interface SharedFlow<out T> : Flow<T> {
/**
Expand Down Expand Up @@ -171,6 +172,7 @@ public interface SharedFlow<out T> : Flow<T> {
* might be added to this interface in the future, but is stable for use.
* Use the `MutableSharedFlow(...)` constructor function to create an implementation.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public interface MutableSharedFlow<T> : SharedFlow<T>, FlowCollector<T> {
/**
Expand Down
2 changes: 2 additions & 0 deletions kotlinx-coroutines-core/common/src/flow/StateFlow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ import kotlin.coroutines.*
* might be added to this interface in the future, but is stable for use.
* Use the `MutableStateFlow(value)` constructor function to create an implementation.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public interface StateFlow<out T> : SharedFlow<T> {
/**
Expand All @@ -152,6 +153,7 @@ public interface StateFlow<out T> : SharedFlow<T> {
* might be added to this interface in the future, but is stable for use.
* Use the `MutableStateFlow()` constructor function to create an implementation.
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public interface MutableStateFlow<T> : StateFlow<T>, MutableSharedFlow<T> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal fun <T> Flow<T>.asChannelFlow(): ChannelFlow<T> =
*
* @suppress **This an internal API and should not be used from general code.**
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
@InternalCoroutinesApi
public interface FusibleFlow<T> : Flow<T> {
Expand All @@ -39,6 +40,7 @@ public interface FusibleFlow<T> : Flow<T> {
*
* @suppress **This an internal API and should not be used from general code.**
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
@InternalCoroutinesApi
public abstract class ChannelFlow<T>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kotlinx.coroutines

@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public actual abstract class CloseableCoroutineDispatcher actual constructor() : CoroutineDispatcher() {
public actual abstract fun close()
Expand Down
1 change: 1 addition & 0 deletions kotlinx-coroutines-core/jvm/src/Executors.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import kotlin.coroutines.*
* This class is generally used as a bridge between coroutine-based API and
* asynchronous API that requires an instance of the [Executor].
*/
@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public abstract class ExecutorCoroutineDispatcher: CoroutineDispatcher(), Closeable {
/** @suppress */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kotlinx.coroutines

@OptIn(ExperimentalSubclassOptIn::class)
@SubclassOptInRequired(BrittleForInheritanceCoroutinesApi::class)
public actual abstract class CloseableCoroutineDispatcher actual constructor() : CoroutineDispatcher() {
public actual abstract fun close()
Expand Down

0 comments on commit 4fb023d

Please sign in to comment.