Skip to content

Commit 49ebab9

Browse files
committed
Compile kotlinx-coroutines-core under JDK1.6
1 parent bab2555 commit 49ebab9

File tree

7 files changed

+30
-13
lines changed
  • kotlinx-coroutines-core
  • kotlinx-coroutines-javafx/src/test/kotlin/examples
  • kotlinx-coroutines-jdk8/src/test/kotlin/examples
  • kotlinx-coroutines-nio/src/test/kotlin/examples
  • kotlinx-coroutines-swing/src/test/kotlin/examples

7 files changed

+30
-13
lines changed

kotlinx-coroutines-core/pom.xml

+14
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,22 @@
1414

1515
<name>Kotlin coroutines core library</name>
1616

17+
<properties>
18+
<kotlin.compiler.jdkHome>${env.JDK_16}</kotlin.compiler.jdkHome>
19+
</properties>
20+
1721
<build>
1822
<sourceDirectory>src/main/kotlin</sourceDirectory>
1923
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
24+
25+
<plugins>
26+
<plugin>
27+
<artifactId>maven-surefire-plugin</artifactId>
28+
<configuration>
29+
<forkMode>once</forkMode>
30+
<jvm>${env.JDK_16}/bin/java</jvm>
31+
</configuration>
32+
</plugin>
33+
</plugins>
2034
</build>
2135
</project>

kotlinx-coroutines-core/src/main/kotlin/kotlinx/coroutines/experimental/CommonPool.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package kotlinx.coroutines.experimental
22

33
import java.util.concurrent.Executor
44
import java.util.concurrent.Executors
5-
import java.util.concurrent.ForkJoinPool
65
import java.util.concurrent.atomic.AtomicInteger
76
import kotlin.coroutines.CoroutineContext
87

98
/**
109
* Represents common pool of shared threads as coroutine dispatcher for compute-intensive tasks.
11-
* It uses [ForkJoinPool] when available, which implements efficient work-stealing algorithm for its queues, so every
10+
* It uses [java.util.concurrent.ForkJoinPool] when available, which implements efficient work-stealing algorithm for its queues, so every
1211
* coroutine resumption is dispatched as a separate task even when it already executes inside the pool.
13-
* When available, it wraps [ForkJoinPool.commonPool] and provides a similar shared pool where not.
12+
* When available, it wraps `ForkJoinPool.commonPool` and provides a similar shared pool where not.
1413
*/
1514
object CommonPool : CoroutineDispatcher() {
1615
private val pool: Executor = findPool()
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package examples
22

3-
import java.time.Instant
3+
import java.text.SimpleDateFormat
4+
import java.util.*
45

5-
fun log(msg: String) = println("${Instant.now()} [${Thread.currentThread().name}] $msg")
6+
fun log(msg: String) = println("${SimpleDateFormat("YYYYMMdd-HHmmss.sss").format(Date())} [${Thread.currentThread().name}] $msg")

kotlinx-coroutines-javafx/src/test/kotlin/examples/FxExampleApp.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import kotlinx.coroutines.experimental.Job
1515
import kotlinx.coroutines.experimental.delay
1616
import kotlinx.coroutines.experimental.javafx.JavaFx
1717
import kotlinx.coroutines.experimental.launch
18-
import java.time.Instant
18+
import java.text.SimpleDateFormat
1919
import java.util.*
2020

2121
fun main(args: Array<String>) {
2222
Application.launch(FxTestApp::class.java, *args)
2323
}
2424

25-
fun log(msg: String) = println("${Instant.now()} [${Thread.currentThread().name}] $msg")
25+
fun log(msg: String) = println("${SimpleDateFormat("YYYYMMdd-HHmmss.sss").format(Date())} [${Thread.currentThread().name}] $msg")
2626

2727
class FxTestApp : Application() {
2828
val buttons = FlowPane().apply {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package examples
22

3-
import java.time.Instant
3+
import java.text.SimpleDateFormat
4+
import java.util.*
45

5-
fun log(msg: String) = println("${Instant.now()} [${Thread.currentThread().name}] $msg")
6+
fun log(msg: String) = println("${SimpleDateFormat("YYYYMMdd-HHmmss.sss").format(Date())} [${Thread.currentThread().name}] $msg")
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package examples
22

3-
import java.time.Instant
3+
import java.text.SimpleDateFormat
4+
import java.util.*
45

5-
fun log(msg: String) = println("${Instant.now()} [${Thread.currentThread().name}] $msg")
6+
fun log(msg: String) = println("${SimpleDateFormat("YYYYMMdd-HHmmss.sss").format(Date())} [${Thread.currentThread().name}] $msg")

kotlinx-coroutines-swing/src/test/kotlin/examples/swing-example.kt

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ package examples
22

33
import kotlinx.coroutines.experimental.runBlocking
44
import kotlinx.coroutines.experimental.swing.Swing
5-
import java.time.Instant
5+
import java.text.SimpleDateFormat
6+
import java.util.*
67
import java.util.concurrent.ForkJoinPool
78
import kotlin.coroutines.suspendCoroutine
89

9-
fun log(msg: String) = println("${Instant.now()} [${Thread.currentThread().name}] $msg")
10+
fun log(msg: String) = println("${SimpleDateFormat("YYYYMMdd-HHmmss.sss").format(Date())} [${Thread.currentThread().name}] $msg")
1011

1112
suspend fun makeRequest(): String {
1213
log("Making request...")

0 commit comments

Comments
 (0)