RFR: 8081474: SwingWorker calls 'done' before the 'doInBackground' is finished [v10]

Alexey Ivanov aivanov at openjdk.org
Thu Feb 2 21:20:31 UTC 2023


On Thu, 2 Feb 2023 20:58:50 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Test update
>
> src/java.desktop/share/classes/javax/swing/SwingWorker.java line 309:
> 
>> 307:                             setState(StateValue.DONE);
>> 308:                             doneEDT();
>> 309:                         }
> 
> Probably been discussed already, but this will not follow this part of spec:
> 
>  * Before the {@code doInBackground} method is invoked on a <i>worker</i> thread,
>  * {@code SwingWorker} notifies any {@code PropertyChangeListeners} about the
>  * {@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}.

Valid concern.

I mentioned it before [here](https://github.com/openjdk/jdk/pull/11940#issuecomment-1407690445), yet I forgot about this later on.

Changing the order of the calls should be enough.

I guess we should verify this condition in the test, what do you think?

-------------

PR: https://git.openjdk.org/jdk/pull/11940



More information about the client-libs-dev mailing list