Kotlinx.coroutines: Illegal reflective access reported

Created on 28 Jul 2018  路  4Comments  路  Source: Kotlin/kotlinx.coroutines

I got the following warning:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by kotlinx.coroutines.experimental.javafx.JavaFxKt (file:~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-javafx/0.24.0/af084a87ebc1f1fc372a652f53fbe691336f52b/kotlinx-coroutines-javafx-0.24.0.jar) to method com.sun.javafx.application.PlatformImpl.startup(java.lang.Runnable)
WARNING: Please consider reporting this to the maintainers of kotlinx.coroutines.experimental.javafx.JavaFxKt
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

I guess it is caused by the resolution of #443

bug

Most helpful comment

Will fix it in the library

All 4 comments

Yes.
It will be fixed with multirelease JAR, but now it just not worth it.

Android doesn't properly support multi-release JAR, postponed

On Java 11 with JavaFX 11, the warning becomes an exception:

Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ExceptionInInitializerError
    at [email protected]/kotlinx.coroutines.javafx.JavaFxDispatcherKt.getJavaFx(JavaFxDispatcher.kt:21)
    at com.example.HelloFX.start(HelloFX.kt:36)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    ... 1 more
Caused by: java.lang.IllegalAccessException: class kotlinx.coroutines.javafx.JavaFxDispatcherKt (in module kotlinx.coroutines.javafx) cannot access class com.sun.javafx.application.PlatformImpl (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.application to module kotlinx.coroutines.javafx
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
    at java.base/java.lang.reflect.Method.invoke(Method.java:558)
    at [email protected]/kotlinx.coroutines.javafx.JavaFxDispatcherKt.initPlatform(JavaFxDispatcher.kt:121)
    at [email protected]/kotlinx.coroutines.javafx.JavaFx.<clinit>(JavaFxDispatcher.kt:79)
    ... 11 more

Well, is there any workaround for this? 馃

Will fix it in the library

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elizarov picture elizarov  路  116Comments

SUPERCILEX picture SUPERCILEX  路  40Comments

elizarov picture elizarov  路  35Comments

Tolriq picture Tolriq  路  50Comments

elizarov picture elizarov  路  62Comments