Skip to content

Commit 5557245

Browse files
committed
Access to PlatformImpl in JavaFx dispatcher, on Java 9 it's an internal module which should be explicitly exported
Fixes #443
1 parent c2fba3a commit 5557245

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

ui/kotlinx-coroutines-javafx/src/JavaFx.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package kotlinx.coroutines.experimental.javafx
66

7-
import com.sun.javafx.application.*
87
import javafx.animation.*
98
import javafx.application.*
109
import javafx.event.*
@@ -86,5 +85,9 @@ class ApplicationThreadChecker : BlockingChecker {
8685
}
8786

8887
internal fun initPlatform() {
89-
PlatformImpl.startup {}
90-
}
88+
// Ad-hoc workaround for #443. Will be fixed with multi-release jar.
89+
// If this code throws an exception (Java 9 + prohibited reflective access), initialize JavaFX directly
90+
Class.forName("com.sun.javafx.application.PlatformImpl")
91+
.getMethod("startup", java.lang.Runnable::class.java)
92+
.invoke(null, java.lang.Runnable { })
93+
}

0 commit comments

Comments
 (0)