1
1
/*
2
2
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
3
3
*/
4
- @file:Suppress(" DEPRECATION" )
4
+ @file:Suppress(" DEPRECATION_ERROR " , " DEPRECATION" )
5
5
6
6
package kotlinx.coroutines.test
7
7
@@ -22,7 +22,7 @@ import kotlin.coroutines.*
22
22
" Please see the migration guide for details: " +
23
23
" https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-test/MIGRATION.md" ,
24
24
level = DeprecationLevel .WARNING )
25
- // Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8 .0
25
+ // Since 1.6.0, kept as warning in 1.7.0, ERROR in 1.8.0 and removed as experimental in 1.9 .0
26
26
public interface TestCoroutineScope : CoroutineScope {
27
27
/* *
28
28
* Called after the test completes.
@@ -45,7 +45,7 @@ public interface TestCoroutineScope : CoroutineScope {
45
45
*/
46
46
@ExperimentalCoroutinesApi
47
47
@Deprecated(" Please call `runTest`, which automatically performs the cleanup, instead of using this function." )
48
- // Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8 .0
48
+ // Since 1.6.0, kept as warning in 1.7.0, ERROR in 1.8.0 and removed as experimental in 1.9 .0
49
49
public fun cleanupTestCoroutines ()
50
50
51
51
/* *
@@ -139,7 +139,7 @@ internal fun CoroutineContext.activeJobs(): Set<Job> {
139
139
),
140
140
level = DeprecationLevel .WARNING
141
141
)
142
- // Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8 .0
142
+ // Since 1.6.0, kept as warning in 1.7.0, ERROR in 1.8.0 and removed as experimental in 1.9 .0
143
143
public fun TestCoroutineScope (context : CoroutineContext = EmptyCoroutineContext ): TestCoroutineScope {
144
144
val scheduler = context[TestCoroutineScheduler ] ? : TestCoroutineScheduler ()
145
145
return createTestCoroutineScope(TestCoroutineDispatcher (scheduler) + TestCoroutineExceptionHandler () + context)
@@ -181,7 +181,7 @@ public fun TestCoroutineScope(context: CoroutineContext = EmptyCoroutineContext)
181
181
" Please use TestScope() construction instead, or just runTest(), without creating a scope." ,
182
182
level = DeprecationLevel .WARNING
183
183
)
184
- // Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8 .0
184
+ // Since 1.6.0, kept as warning in 1.7.0, ERROR in 1.8.0 and removed as experimental in 1.9 .0
185
185
public fun createTestCoroutineScope (context : CoroutineContext = EmptyCoroutineContext ): TestCoroutineScope {
186
186
val ctxWithDispatcher = context.withDelaySkipping()
187
187
var scope: TestCoroutineScopeImpl ? = null
@@ -239,7 +239,7 @@ public val TestCoroutineScope.currentTime: Long
239
239
" The name of this function is misleading: it not only advances the time, but also runs the tasks " +
240
240
" scheduled *at* the ending moment." ,
241
241
ReplaceWith (" this.testScheduler.apply { advanceTimeBy(delayTimeMillis); runCurrent() }" ),
242
- DeprecationLevel .WARNING
242
+ DeprecationLevel .ERROR
243
243
)
244
244
// Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8.0
245
245
public fun TestCoroutineScope.advanceTimeBy (delayTimeMillis : Long ): Unit =
@@ -283,7 +283,7 @@ public fun TestCoroutineScope.runCurrent() {
283
283
" (this.coroutineContext[ContinuationInterceptor]!! as DelayController).pauseDispatcher(block)" ,
284
284
" kotlin.coroutines.ContinuationInterceptor"
285
285
),
286
- DeprecationLevel .WARNING
286
+ DeprecationLevel .ERROR
287
287
)
288
288
// Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8.0
289
289
public suspend fun TestCoroutineScope.pauseDispatcher (block : suspend () -> Unit ) {
@@ -299,7 +299,7 @@ public suspend fun TestCoroutineScope.pauseDispatcher(block: suspend () -> Unit)
299
299
" (this.coroutineContext[ContinuationInterceptor]!! as DelayController).pauseDispatcher()" ,
300
300
" kotlin.coroutines.ContinuationInterceptor"
301
301
),
302
- level = DeprecationLevel .WARNING
302
+ level = DeprecationLevel .ERROR
303
303
)
304
304
// Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8.0
305
305
public fun TestCoroutineScope.pauseDispatcher () {
@@ -315,7 +315,7 @@ public fun TestCoroutineScope.pauseDispatcher() {
315
315
" (this.coroutineContext[ContinuationInterceptor]!! as DelayController).resumeDispatcher()" ,
316
316
" kotlin.coroutines.ContinuationInterceptor"
317
317
),
318
- level = DeprecationLevel .WARNING
318
+ level = DeprecationLevel .ERROR
319
319
)
320
320
// Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8.0
321
321
public fun TestCoroutineScope.resumeDispatcher () {
@@ -335,8 +335,9 @@ public fun TestCoroutineScope.resumeDispatcher() {
335
335
" easily misused. It is only present for backward compatibility and will be removed in the subsequent " +
336
336
" releases. If you need to check the list of exceptions, please consider creating your own " +
337
337
" `CoroutineExceptionHandler`." ,
338
- level = DeprecationLevel .WARNING
338
+ level = DeprecationLevel .ERROR
339
339
)
340
+ // Since 1.6.0, ERROR in 1.7.0 and removed as experimental in 1.8.0
340
341
public val TestCoroutineScope .uncaughtExceptions: List <Throwable >
341
342
get() = (coroutineContext[CoroutineExceptionHandler ] as ? UncaughtExceptionCaptor )?.uncaughtExceptions
342
343
? : emptyList()
0 commit comments