On Wed, 8 Feb 2023 09:46:21 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
>> SwingWorker done() method [spec >> ](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/SwingWorker.java#L452) >> says "Executed on the Event Dispatch Thread after the doInBackground method >> is finished" >> but there's no mechanism in place to honor that claim. >> The >> [spec](https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/SwingWorker.java#L289) >> also says the state should be DONE after doInBackground() returns which is >> also not done. >> >> Modified the code to honour the specification. > > Prasanta Sadhukhan has updated the pull request incrementally with one > additional commit since the last revision: > > Test updated test/jdk/javax/swing/SwingWorker/TestDoneBeforeDoInBackground.java line 94: > 92: // before doInBackground started running > 93: if (!doInBackground && > 94: worker.getState() == > SwingWorker.StateValue.STARTED) { This condition doesn't guarantee that `STARTED` state is set before `doInBackground` starts running. The boolean flag is set to `true` only in the end of the method. test/jdk/javax/swing/SwingWorker/TestDoneBeforeDoInBackground.java line 106: > 104: throw new RuntimeException( > 105: "PropertyChangeListeners called after " + > 106: " doInBackground is finised but before State > changed to DONE"); Suggestion: " doInBackground is finished but before State changed to DONE"); ------------- PR: https://git.openjdk.org/jdk/pull/11940