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).

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

Commit messages:
 - 7184956: [macosx] JPopupMenu.setDefaultLightPopupEnable(true) doesn't work 
correctly

Changes: https://git.openjdk.org/jdk/pull/32696/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32696&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-7184956
  Stats: 5 lines in 2 files changed: 2 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/32696.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32696/head:pull/32696

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

Reply via email to