Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8342012

javax/swing/JPopupMenu/6694823/bug6694823.java fails Windows, Linux after SM removal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • client-libs
    • generic
    • linux, windows

      javax/swing/JPopupMenu/6694823/bug6694823.java fails on windows and linux when Security Manager is removed

      Originally the test was configured to throw SecurityException for the permission "setWindowAlwaysOnTop" which caused JPopupMenu.canPopupOverlapTaskBar() (which in turn calls SunToolkit.canPopupOverlapTaskBar()) to return false, thus the popup menu was positioned to appear above the taskbar without overlapping it.

      https://github.com/openjdk/jdk/blob/41ee582df8c65f2f26b21e46784cf0bc4ece0585/src/java.desktop/share/classes/javax/swing/JPopupMenu.java#L428

      https://github.com/openjdk/jdk/blob/41ee582df8c65f2f26b21e46784cf0bc4ece0585/src/java.desktop/share/classes/sun/awt/SunToolkit.java#L1117

      With SM removed this check returns true which causes the popup to overlap the taskbar and thus the test fails on windows and linux.

      On macOS the test passes since JPopupMenu's canPopupOverlapTaskBar() is overridden in LWCToolkit-Ln#900 to return false by default which is missing in WToolkit and XToolkit.

      https://github.com/openjdk/jdk/blob/41ee582df8c65f2f26b21e46784cf0bc4ece0585/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java#L900

      The solution would be to override canPopupOverlapTaskBar() in WToolkit and XToolkit similar to LWCToolkit to match native popup behavior (popups don't overlap the taskbar) on windows and linux too.

            honkar Harshitha Onkar
            honkar Harshitha Onkar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: