RFR: 8288415: java/awt/PopupMenu/PopupMenuLocation.java is unstable in MacOS machines [v2]

Manukumar V S mvs at openjdk.org
Fri Jun 17 10:58:04 UTC 2022


On Fri, 17 Jun 2022 08:01:45 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> Manukumar V S has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review comments fixed: Removed -Dsun.java2d.uiScale=1, frame.getLocationOnScreen() removed from EDT, added volatile keyword for actionEventReceivedLatch
>
> test/jdk/java/awt/PopupMenu/PopupMenuLocation.java line 47:
> 
>> 45:  * @key headful
>> 46:  * @bug 8160270
>> 47:  * @run main/timeout=300/othervm -Dsun.java2d.uiScale=1 PopupMenuLocation
> 
> Why do you need a "-Dsun.java2d.uiScale=1" option? I do not think it affects this test execution in any way.

Removed it

> test/jdk/java/awt/PopupMenu/PopupMenuLocation.java line 77:
> 
>> 75: 
>> 76:     private static void test(final Point tmp) throws Exception {
>> 77:         actionEventReceivedLatch = new CountDownLatch(1);
> 
> You set this field on one thread and read on another, some synchronization is needed.

Added volatile keyword for this field

> test/jdk/java/awt/PopupMenu/PopupMenuLocation.java line 119:
> 
>> 117:         final AtomicReference<Point> pt = new AtomicReference<>();
>> 118:         SwingUtilities.invokeAndWait(() -> {
>> 119:                                           pt.set(frame.getLocationOnScreen());
> 
> This test uses only awt components which should work on any threads, why invokeAndWait is necessary?

Removed from EDT

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

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



More information about the client-libs-dev mailing list