On Thu, 16 Feb 2023 21:48:08 GMT, Marius Hanl <mh...@openjdk.org> wrote:
>> This PR adds the last missing method for dealing with nested event loops. >> As also written in the ticket, there is currently no (public) way to find >> out whether it is safe to start an event loop now or not. >> Classes like `Dialog` check via >> `Toolkit.getToolkit().canStartNestedEventLoop()` (sun api), if it safe to >> start a nested event loop before doing so. > > Marius Hanl has updated the pull request incrementally with one additional > commit since the last revision: > > JDK-8302355: checkFxUserThread(), adjusted javadoc accordingly. Added Tests I left a couple suggestions on the docs, but otherwise it looks ready to me. The implementation changes and the new test look good. 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. I would either remove this sentence (probably cleanest), or else change it to a positive statement (say when it is allowed, not when it isn't) and also add that it's ok when called from a Runnable passed to `Platform.runLater`. Maybe something like this: A nested event loop can be started from an event handler or from a `Runnable` passed to `Platform.runLater(Runnable)`. modules/javafx.graphics/src/main/java/javafx/application/Platform.java line 399: > 397: * This method must be called on the JavaFX Application thread. > 398: * > 399: * @return true if a nested event loop can be started, and false > otherwise. I recommend code case here: `{@code true}` and `{@code false}`. ------------- PR: https://git.openjdk.org/jfx/pull/1031