On Fri, 10 Nov 2023 09:58:21 GMT, Johan Vos <j...@openjdk.org> wrote:
>> tests/system/src/test/java/test/javafx/stage/SystemMenuBarTest.java line 164: >> >>> 162: }); >>> 163: } >>> 164: Platform.runLater( () -> { >> >> Why is `Platform.runLater` needed here? To wait until the last >> `Platform.runLater` in the for loop ends? Is it guaranteed that it will be >> called only after the previous one ends? >> >> Minor: remove unneeded white space: `Platform.runLater(() -> {` > > No, it is needed because we want to give the JavaFX platform the opportunity > to do "whatever is needed" after the last runLater() is done. Hence, we put > what we want to do on the Runnable queue of the FX thread, so that we don't > depend on internals. This makes sense. To answer one of Jose's questions: > Is it guaranteed that it will be called only after the previous one ends? Yes, this is specified behavior of `Platform::runLater`. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1277#discussion_r1389427353