Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8263401

Calling Application.launch on FX thread should throw IllegalStateException, but causes deadlock

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • jfx17
    • javafx
    • behavioral
    • minimal
    • Hide
      It's very unlikely that someone depends on a deadlock.
      This is also relatively new because Platform.startup was added in JavaFX9.
      Show
      It's very unlikely that someone depends on a deadlock. This is also relatively new because Platform.startup was added in JavaFX9.
    • Java API
    • JDK

      Summary

      Initializing the JavaFX runtime via Platform.startup and then launching an Application on the JavaFX Application should throw IllegalStateException.

      Problem

      The current behavior causes a deadlock, instead of a reasonable Exception.

      Solution

      Application.launch will now throw an IllegalStateException, when it's called from the JavaFX Application Thread.

      Specification

      In the javafx.application.Application class, add the following to the API docs of these two methods:

      void launch(Class<? extends Application> appClass)
      void launch(Class<? extends Application> appClass, String... args)

           * @throws IllegalStateException if this method is called from the JavaFX application thread.

            fkirmaier Florian Kirmaier
            fkirmaier Florian Kirmaier
            Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: