On Wed, 18 Sep 2024 10:51:49 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:

>> Few AWT MenuItem related tests are converted from applet to manual and moved 
>> to open.
>
> Abhishek Kumar has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Test instruction update

Changes requested by aivanov (Reviewer).

test/jdk/java/awt/MenuItem/LotsOfMenuItemsTest.java line 65:

> 63:                 .rows((int) INSTRUCTIONS.lines().count() + 2)
> 64:                 .columns(40)
> 65:                 .testUI(obj.createAndShowUI())

Suggestion:

                .testUI(obj::createAndShowUI)

You should pass a method reference to call `createAndShowUI` on EDT.

When you pass a method reference, you delegate the job of calling the method to 
`PassFailJFrame` and it calls it on EDT.

If you use `obj.createAndShowUI`, you pass the result of calling 
`obj.createAndShowUI` — the list of windows — to `PassFailJFrame`, the method 
gets called on the main thread.

It's a subtle but important difference. I believe we're trying to ensure all 
components are created and accessed on EDT, both AWT and Swing, unless the test 
specifically verifies AWT components and needs to ensure these components 
behave as they should in a concurrent environment.

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

PR Review: https://git.openjdk.org/jdk/pull/21029#pullrequestreview-2312386493
PR Review Comment: https://git.openjdk.org/jdk/pull/21029#discussion_r1764872438

Reply via email to