Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If JavaFx dispatcher is present in the classpath, using any other dispatcher will start the JavaFx platform. #665

Closed
jcornaz opened this issue Oct 5, 2018 · 1 comment
Assignees

Comments

@jcornaz
Copy link
Contributor

jcornaz commented Oct 5, 2018

Hello,

Please consider the following code:

suspend fun main() {
  withContext(Dispatchers.IO) {}
  println("done")
}

This code has the following output:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by kotlinx.coroutines.javafx.JavaFxDispatcherKt (file:~/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-coroutines-javafx/0.30.1-eap13/6eec25d3a9961d45fd2c097b0e038d348b3cc243/kotlinx-coroutines-javafx-0.30.1-eap13.jar) to method com.sun.javafx.application.PlatformImpl.startup(java.lang.Runnable)
WARNING: Please consider reporting this to the maintainers of kotlinx.coroutines.javafx.JavaFxDispatcherKt
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
done

Here I'm not talking about the warning which is already addressed in #463.

No, here the concern is the fact that the JavaFx platform has been started. And since the JavaFx platform thread is a user-thread, it prevents the program to terminate.

This behavior only happens if kotlinx-coroutines-javafx is in the classpath.

@jcornaz jcornaz changed the title If JavaFx dispatcher is present in the classpath, using any other dispatcher will start the JavaFxPlatform. If JavaFx dispatcher is present in the classpath, using any other dispatcher will start the JavaFx platform. Oct 5, 2018
@qwwdfsad qwwdfsad self-assigned this Oct 5, 2018
@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Oct 5, 2018

We should instantiate DIspatchers.Main lazily

elizarov added a commit that referenced this issue Oct 6, 2018
Also specified explicit public visibility for Dispatchers object.

Fixes #658
Fixes #665
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants