Skip to content

Commit 6028ffd

Browse files
committed
migrate from deprecated API
1 parent c504917 commit 6028ffd

File tree

11 files changed

+27
-12
lines changed

11 files changed

+27
-12
lines changed

kotlinx-coroutines-core/common/src/flow/operators/Delay.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import kotlin.time.*
2323
----- INCLUDE .*
2424
import kotlinx.coroutines.*
2525
import kotlinx.coroutines.flow.*
26+
import kotlin.time.Duration.Companion.milliseconds
2627
2728
fun main() = runBlocking {
2829
----- SUFFIX .*

kotlinx-coroutines-core/common/test/DelayDurationTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ package kotlinx.coroutines
1010

1111
import kotlin.test.*
1212
import kotlin.time.*
13+
import kotlin.time.Duration.Companion.seconds
14+
import kotlin.time.Duration.Companion.nanoseconds
1315

1416
@ExperimentalTime
1517
class DelayDurationTest : TestBase() {

kotlinx-coroutines-core/common/test/flow/sharing/SharingStartedWhileSubscribedTest.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ package kotlinx.coroutines.flow
77
import kotlinx.coroutines.*
88
import kotlin.test.*
99
import kotlin.time.*
10+
import kotlin.time.Duration.Companion.milliseconds
11+
import kotlin.time.Duration.Companion.seconds
1012

1113
class SharingStartedWhileSubscribedTest : TestBase() {
1214
@Test // make sure equals works properly, or otherwise other tests don't make sense
@@ -30,14 +32,15 @@ class SharingStartedWhileSubscribedTest : TestBase() {
3032
@Test
3133
fun testDurationParams() {
3234
assertEquals(SharingStarted.WhileSubscribed(0), SharingStarted.WhileSubscribed(Duration.ZERO))
33-
assertEquals(SharingStarted.WhileSubscribed(10), SharingStarted.WhileSubscribed(Duration.milliseconds(10)))
35+
assertEquals(SharingStarted.WhileSubscribed(10), SharingStarted.WhileSubscribed(10.milliseconds))
3436
assertEquals(SharingStarted.WhileSubscribed(1000), SharingStarted.WhileSubscribed(1.seconds))
3537
assertEquals(SharingStarted.WhileSubscribed(Long.MAX_VALUE), SharingStarted.WhileSubscribed(Duration.INFINITE))
3638
assertEquals(SharingStarted.WhileSubscribed(replayExpirationMillis = 0), SharingStarted.WhileSubscribed(replayExpiration = Duration.ZERO))
3739
assertEquals(SharingStarted.WhileSubscribed(replayExpirationMillis = 3), SharingStarted.WhileSubscribed(
3840
replayExpiration = Duration.milliseconds(3)
3941
))
40-
assertEquals(SharingStarted.WhileSubscribed(replayExpirationMillis = 7000), SharingStarted.WhileSubscribed(replayExpiration = 7.seconds))
42+
assertEquals(SharingStarted.WhileSubscribed(replayExpirationMillis = 7000),
43+
SharingStarted.WhileSubscribed(replayExpiration = 7.seconds))
4144
assertEquals(SharingStarted.WhileSubscribed(replayExpirationMillis = Long.MAX_VALUE), SharingStarted.WhileSubscribed(replayExpiration = Duration.INFINITE))
4245
}
4346

kotlinx-coroutines-core/jvm/test/examples/example-delay-01.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package kotlinx.coroutines.examples.exampleDelay01
77

88
import kotlinx.coroutines.*
99
import kotlinx.coroutines.flow.*
10+
import kotlin.time.Duration.Companion.milliseconds
1011

1112
fun main() = runBlocking {
1213

kotlinx-coroutines-core/jvm/test/examples/example-delay-02.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package kotlinx.coroutines.examples.exampleDelay02
77

88
import kotlinx.coroutines.*
99
import kotlinx.coroutines.flow.*
10+
import kotlin.time.Duration.Companion.milliseconds
1011

1112
fun main() = runBlocking {
1213

kotlinx-coroutines-core/jvm/test/examples/example-delay-03.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package kotlinx.coroutines.examples.exampleDelay03
77

88
import kotlinx.coroutines.*
99
import kotlinx.coroutines.flow.*
10+
import kotlin.time.Duration.Companion.milliseconds
1011

1112
fun main() = runBlocking {
1213

kotlinx-coroutines-core/jvm/test/examples/example-delay-duration-01.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package kotlinx.coroutines.examples.exampleDelayDuration01
99
import kotlin.time.*
1010
import kotlinx.coroutines.*
1111
import kotlinx.coroutines.flow.*
12+
import kotlin.time.Duration.Companion.milliseconds
1213

1314
fun main() = runBlocking {
1415

kotlinx-coroutines-core/jvm/test/examples/example-delay-duration-02.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package kotlinx.coroutines.examples.exampleDelayDuration02
99
import kotlin.time.*
1010
import kotlinx.coroutines.*
1111
import kotlinx.coroutines.flow.*
12+
import kotlin.time.Duration.Companion.milliseconds
1213

1314
fun main() = runBlocking {
1415

kotlinx-coroutines-core/jvm/test/examples/example-delay-duration-03.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package kotlinx.coroutines.examples.exampleDelayDuration03
99
import kotlin.time.*
1010
import kotlinx.coroutines.*
1111
import kotlinx.coroutines.flow.*
12+
import kotlin.time.Duration.Companion.milliseconds
1213

1314
fun main() = runBlocking {
1415

kotlinx-coroutines-core/jvm/test/flow/SharedFlowStressTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class SharedFlowStressTest : TestBase() {
7171
var lastProduced = 0L
7272
var lastConsumed = 0L
7373
for (sec in 1..nSeconds) {
74-
delay(1.seconds)
74+
delay(Duration.seconds(1))
7575
val produced = totalProduced.value
7676
val consumed = totalConsumed.value
7777
println("$sec sec: produced = $produced; consumed = $consumed")
@@ -84,4 +84,4 @@ class SharedFlowStressTest : TestBase() {
8484
jobs.forEach { it.join() }
8585
println("total: produced = ${totalProduced.value}; consumed = ${totalConsumed.value}")
8686
}
87-
}
87+
}

ui/kotlinx-coroutines-javafx/build.gradle.kts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ plugins {
66
id("org.openjfx.javafxplugin") version "0.0.9"
77
}
88

9+
configurations {
10+
register("javafx")
11+
named("compileOnly") {
12+
extendsFrom(configurations["javafx"])
13+
}
14+
named("testImplementation") {
15+
extendsFrom(configurations["javafx"])
16+
}
17+
}
18+
919
javafx {
1020
version = version("javafx")
1121
modules = listOf("javafx.controls")
12-
configuration = "compileOnly"
13-
}
14-
15-
sourceSets {
16-
test.configure {
17-
compileClasspath += configurations.compileOnly
18-
runtimeClasspath += configurations.compileOnly
19-
}
22+
configuration = "javafx"
2023
}
2124

2225
val JDK_18: String? by lazy {

0 commit comments

Comments
 (0)