RFR: JDK-8302355: Public API for Toolkit.canStartNestedEventLoop()

Kevin Rushforth kcr at openjdk.org
Wed Feb 15 21:41:50 UTC 2023


On Wed, 15 Feb 2023 20:11:47 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/application/Platform.java line 396:
>> 
>>> 394:     /**
>>> 395:      * Indicates whether a nested event loop can be started from the current thread in the current state.
>>> 396:      * Note that a nested event loop is not allowed outside an event handler.
>> 
>> You need to be explicit about whether or not this method must be called on the JavaFX thread. The two logical choices are:
>> 1. Add a statement indicating that this method must be called on the JavaFX Application thread. The toolkit method would then call `checkFxUserThread()`, as do the other nested event loop methods.
>> 2. Add a statement indicating that this method may be called on any thread (and that it will return false if not on the JavaFX application thread). The toolkit method would then first call `isFxUserThread()` and return  false if not.
>> 
>> I might lean towards option 2, but don't have a strong preference.
>
> Should I also adjust the `Toolkit` javadoc or only the `Platform` one?

It might be a good idea to also adjust the Toolkit docs; it doesn't get generated as javadoc, but could be useful for someone looking at the code. If you do, it wouldn't be part of the CSR, since Toolkit isn't API.

-------------

PR: https://git.openjdk.org/jfx/pull/1031


More information about the openjfx-dev mailing list