On Wed, 15 Feb 2023 16:06:59 GMT, Kevin Rushforth <k...@openjdk.org> wrote:

> Also, please provide a test.

I was thinking of writing a simple unit test and implementing some kind of 
dummy nested event loop mechanism inside the `StubToolkit`, which will follow 
the real implementation.
But then I still only test the `StubToolkit` instead of the real 
`QuantumToolkit`.
Does this make sense or is a system test the right way here?

> 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?

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

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

Reply via email to