On Fri, 3 Feb 2023 07:27:39 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: > > jcheck fix I think we should update the wording alongside this fix like this * {@code state} property change to {@code StateValue.STARTED}. After the - * {@code doInBackground} method is finished the {@code done} method is - * executed. Then {@code SwingWorker} notifies any {@code PropertyChangeListeners} - * about the {@code state} property change to {@code StateValue.DONE}. + * {@code doInBackground} method is finished, then + * {@code SwingWorker} notifies any {@code PropertyChangeListeners} + * about the {@code state} property change to {@code StateValue.DONE}, then {@code done} method is + * executed. To me, when `doInBackground `is finished, SwingWorker's job is done and so the STATE should be changed to DONE which is as per spec already mentioned earlier, and then it will call user's `done `method spec of which just says it will be executed `"after the {@code doInBackground} method is finished." ` which will still be valid. ------------- PR: https://git.openjdk.org/jdk/pull/11940