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

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

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: openjfx17
    • Component/s: javafx
    • Labels:
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      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.
    • Interface Kind:
      Java API
    • Scope:
      JDK

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: