On Thu, 2 Feb 2023 21:28:18 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:
>> But it did not work as expected before the fix as well since the >> "notification and done" work in parallel anyway. > > It could be tested by flushing and blocking the EDT in the listener. That > will allow us to check the order of events posted from the listener and from > the "doneEDT". I haven't verified it, but I think it worked as it's stated: `done` is called first, then listeners are notified. According to the order of calls https://github.com/openjdk/jdk/blob/b00b70c2400d28070d26630614a010bc52237827/src/java.desktop/share/classes/javax/swing/SwingWorker.java#L310-L313 `SwingWorker.done` gets invoked first followed by `setState` which, in its turn, notifies the listeners. At this time, as you pointed out, the order is reversed: https://github.com/openjdk/jdk/blob/76b02ea3a8add954705d6df7f91f5896d141b02d/src/java.desktop/share/classes/javax/swing/SwingWorker.java#L307-L308 ------------- PR: https://git.openjdk.org/jdk/pull/11940