8158358: [TEST_BUG] test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java: compilation failed
authorrchamyal
Fri, 03 Jun 2016 12:27:06 +0530
changeset 39027 60fc2577ef28
parent 39026 d3ca7dd77918
child 39028 0b738aef65d0
8158358: [TEST_BUG] test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java: compilation failed Reviewed-by: alexsch, aniyogi
jdk/test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java
--- a/jdk/test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java	Fri Jun 03 11:55:46 2016 +0530
+++ b/jdk/test/javax/swing/JPopupMenu/8147521/PopupMenuTest.java	Fri Jun 03 12:27:06 2016 +0530
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 8147521
+ * @bug 8147521 8158358
  * @summary [macosx] Internal API Usage: setPopupType used to force creation of
- *  heavyweight popup
+ * heavyweight popup
  * @run main PopupMenuTest
  */
 import java.awt.Component;
@@ -91,6 +91,10 @@
 
     private void dispose() throws Exception {
         SwingUtilities.invokeAndWait(() -> {
+            Popup popup = PopMenuUIExt.getPopup();
+            if (popup != null) {
+                popup.hide();
+            }
             frame.dispose();
         });
     }
@@ -150,7 +154,7 @@
 
 class PopMenuUIExt extends BasicPopupMenuUI {
 
-    private Popup popup;
+    private static Popup popUp;
 
     @Override
     public Popup getPopup(JPopupMenu popup, int x, int y) {
@@ -159,17 +163,16 @@
             @Override
             public Popup getPopup(Component owner, Component contents,
                     int x, int y) {
-                return super.getPopup(popup, popup x, y, true);
+                return super.getPopup(owner, contents, x, y, true);
             }
         });
         PopupFactory factory = PopupFactory.getSharedInstance();
-        popup = factory.getPopup(popup, popup, x, y);
-        return popup;
+        popUp = factory.getPopup(popup.getInvoker(), popup, x, y);
+        return popUp;
     }
 
-
-    public Popup getPopup() {
-        return popup;
+    public static Popup getPopup() {
+        return popUp;
     }
 }