On Fri, 4 Sep 2026 06:27:48 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

> Test fails citing
> 
> 
> java.lang.Exception: popup class is: 
> javax.swing.PopupFactory$HeavyWeightPopup, expected: 
> javax.swing.PopupFactory$LightWeightPopup
>         at bug6800513.testFrame(bug6800513.java:78)
>         at bug6800513.main(bug6800513.java:146)
>         at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:583)
>         at 
> com.sun.javatest.regtest.agent.MainMethodHelper.executeModernMainClass(MainMethodHelper.java:56)
>         at 
> com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:140)
>         at java.base/java.lang.Thread.run(Thread.java:1527)
> JavaTest Message: Test threw exception: java.lang.Exception: popup class is: 
> javax.swing.PopupFactory$HeavyWeightPopup, expected: 
> javax.swing.PopupFactory$LightWeightPopup
> 
> 
> 
> On macOS, Aqua installs `com.apple.laf.ScreenPopupFactory` as Swing’s shared 
> PopupFactory. While Aqua is active, its getPopup(...) explicitly [calls the 
> internal “get heavy-weight popup 
> [accessor]"](https://github.com/openjdk/jdk/blob/f0952f6ce6cc43db4326eda0e397711d36c31fc6/src/java.desktop/macosx/classes/com/apple/laf/ScreenPopupFactory.java#L58-L60)
>  
> It does this so that menu popups can have native [Aqua-specific translucency, 
> shadow, 
> rounded-corner](https://github.com/openjdk/jdk/blob/f0952f6ce6cc43db4326eda0e397711d36c31fc6/src/java.desktop/macosx/classes/com/apple/laf/ScreenPopupFactory.java#L40).
>  Therefore it intentionally ignores 
> JPopupMenu.setDefaultLightWeightPopupEnabled(true).
> 
> Also the spec supports that L&F can choose to always choose heavy weight 
> popups 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.desktop/javax/swing/JPopupMenu.html#setLightWeightPopupEnabled(boolean)
> 
>> Some look and feels might always use heavyweight popups, no matter what the 
>> value of this property.
> 
> so fix is made to ignore the subtest for Aqua L&F
> 
> 
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Marked as reviewed by azvegint (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/32696#pullrequestreview-5158426946

Reply via email to