4
4
5
5
package kotlinx.coroutines
6
6
7
- import kotlinx.coroutines.flow.Flow
7
+ import kotlinx.coroutines.flow.*
8
8
9
9
/* *
10
10
* 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
14
14
*/
15
15
@MustBeDocumented
16
16
@Retention(value = AnnotationRetention .BINARY )
17
- @Experimental (level = Experimental .Level .WARNING )
17
+ @RequiresOptIn (level = RequiresOptIn .Level .WARNING )
18
18
public annotation class ExperimentalCoroutinesApi
19
19
20
20
/* *
@@ -30,7 +30,12 @@ public annotation class ExperimentalCoroutinesApi
30
30
*/
31
31
@MustBeDocumented
32
32
@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
+ )
34
39
@Target(AnnotationTarget .CLASS , AnnotationTarget .FUNCTION , AnnotationTarget .TYPEALIAS , AnnotationTarget .PROPERTY )
35
40
public annotation class FlowPreview
36
41
@@ -42,7 +47,7 @@ public annotation class FlowPreview
42
47
*/
43
48
@MustBeDocumented
44
49
@Retention(value = AnnotationRetention .BINARY )
45
- @Experimental (level = Experimental .Level .WARNING )
50
+ @RequiresOptIn (level = RequiresOptIn .Level .WARNING )
46
51
public annotation class ObsoleteCoroutinesApi
47
52
48
53
/* *
@@ -51,6 +56,11 @@ public annotation class ObsoleteCoroutinesApi
51
56
* warnings and without providing any migration aids.
52
57
*/
53
58
@Retention(value = AnnotationRetention .BINARY )
54
- @Experimental(level = Experimental .Level .ERROR )
55
59
@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
+ )
56
66
public annotation class InternalCoroutinesApi
0 commit comments