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

Alexey Ivanov aivanov at openjdk.org
Wed Feb 15 15:22:14 UTC 2023


On Wed, 15 Feb 2023 05:29:11 GMT, Prasanta Sadhukhan <psadhukhan at 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 update

Marked as reviewed by aivanov (Reviewer).

test/jdk/javax/swing/SwingWorker/TestDoneBeforeDoInBackground.java line 89:

> 87:                 public void propertyChange(PropertyChangeEvent evt) {
> 88:                     System.out.println("doInBackground started: " +
> 89:                                         doInBackgroundStarted.get() +

Suggestion:

                    System.out.println("doInBackgroundStarted: " +
                                        doInBackgroundStarted.get() +

Just for consistency with the following `-Finished` line.

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

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



More information about the client-libs-dev mailing list