44
55package kotlinx.coroutines
66
7- import kotlinx.coroutines.flow.Flow
7+ import kotlinx.coroutines.flow.*
88
99/* *
1010 * Marks declarations that are still **experimental** in coroutines API, which means that the design of the
@@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.Flow
1414 */
1515@MustBeDocumented
1616@Retention(value = AnnotationRetention .BINARY )
17- @Experimental (level = Experimental .Level .WARNING )
17+ @RequiresOptIn (level = RequiresOptIn .Level .WARNING )
1818public annotation class ExperimentalCoroutinesApi
1919
2020/* *
@@ -30,7 +30,12 @@ public annotation class ExperimentalCoroutinesApi
3030 */
3131@MustBeDocumented
3232@Retention(value = AnnotationRetention .BINARY )
33- @Experimental(level = Experimental .Level .WARNING )
33+ @RequiresOptIn(
34+ level = RequiresOptIn .Level .WARNING ,
35+ message = " This declaration is in a preview state and can be changed in a backwards-incompatible manner with a best-effort migration. " +
36+ " Its usage should be marked with '@kotlinx.coroutines.FlowPreview' or '@OptIn(kotlinx.coroutines.FlowPreview::class)' " +
37+ " if you accept the drawback of relying on preview API"
38+ )
3439@Target(AnnotationTarget .CLASS , AnnotationTarget .FUNCTION , AnnotationTarget .TYPEALIAS , AnnotationTarget .PROPERTY )
3540public annotation class FlowPreview
3641
@@ -42,7 +47,7 @@ public annotation class FlowPreview
4247 */
4348@MustBeDocumented
4449@Retention(value = AnnotationRetention .BINARY )
45- @Experimental (level = Experimental .Level .WARNING )
50+ @RequiresOptIn (level = RequiresOptIn .Level .WARNING )
4651public annotation class ObsoleteCoroutinesApi
4752
4853/* *
@@ -51,6 +56,11 @@ public annotation class ObsoleteCoroutinesApi
5156 * warnings and without providing any migration aids.
5257 */
5358@Retention(value = AnnotationRetention .BINARY )
54- @Experimental(level = Experimental .Level .ERROR )
5559@Target(AnnotationTarget .CLASS , AnnotationTarget .FUNCTION , AnnotationTarget .TYPEALIAS , AnnotationTarget .PROPERTY )
60+ @RequiresOptIn(
61+ level = RequiresOptIn .Level .ERROR , message = " This is an internal kotlinx.coroutines API that " +
62+ " should not be used from outside of kotlinx.coroutines. No compatibility guarantees are provided." +
63+ " It is recommended to report your use-case of internal API to kotlinx.coroutines issue tracker, " +
64+ " so stable API could be provided instead"
65+ )
5666public annotation class InternalCoroutinesApi
0 commit comments