8130895: Test javax/swing/system/6799345/TestShutdown.java fails on Solaris11 Sparcv9
authorssadetsky
Wed, 28 Oct 2015 13:54:43 +0300
changeset 33853 a26aa530a23a
parent 33852 5072049a858d
child 33854 e89a68072d5b
8130895: Test javax/swing/system/6799345/TestShutdown.java fails on Solaris11 Sparcv9 Reviewed-by: alexsch, serb
jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java
jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java
--- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java	Tue Oct 27 15:19:15 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java	Wed Oct 28 13:54:43 2015 +0300
@@ -325,23 +325,6 @@
     };
 
     /**
-     * The default strokes for initializing the default focus traversal keys.
-     */
-    private static final AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
-        {
-            AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false),
-            AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK, false),
-        },
-        {
-            AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK, false),
-            AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
-                                         InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK,
-                                         false),
-        },
-        {},
-        {},
-      };
-    /**
      * The default focus traversal keys. Each array of traversal keys will be
      * in effect on all Windows that have no such array of their own explicitly
      * set. Each array will also be inherited, recursively, by any child
@@ -431,6 +414,27 @@
      * Initializes a KeyboardFocusManager.
      */
     public KeyboardFocusManager() {
+        AWTKeyStroke[][] defaultFocusTraversalKeyStrokes = {
+                {
+                        AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0, false),
+                        AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
+                                InputEvent.CTRL_DOWN_MASK |
+                                        InputEvent.CTRL_MASK, false),
+                },
+                {
+                        AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
+                                InputEvent.SHIFT_DOWN_MASK |
+                                        InputEvent.SHIFT_MASK, false),
+                        AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB,
+                                InputEvent.SHIFT_DOWN_MASK |
+                                        InputEvent.SHIFT_MASK |
+                                        InputEvent.CTRL_DOWN_MASK |
+                                        InputEvent.CTRL_MASK,
+                                false),
+                },
+                {},
+                {},
+        };
         for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) {
             Set<AWTKeyStroke> work_set = new HashSet<>();
             for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) {
--- a/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java	Tue Oct 27 15:19:15 2015 -0400
+++ b/jdk/src/java.desktop/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java	Wed Oct 28 13:54:43 2015 +0300
@@ -42,8 +42,10 @@
 
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.awt.focus.KeyboardFocusManagerPeerImpl");
 
-    private static AWTAccessor.KeyboardFocusManagerAccessor kfmAccessor =
-        AWTAccessor.getKeyboardFocusManagerAccessor();
+    private static class KfmAccessor {
+        private static AWTAccessor.KeyboardFocusManagerAccessor instance =
+                AWTAccessor.getKeyboardFocusManagerAccessor();
+    }
 
     // The constants are copied from java.awt.KeyboardFocusManager
     public static final int SNFH_FAILURE         = 0;
@@ -152,12 +154,13 @@
                                                      long time,
                                                      CausedFocusEvent.Cause cause)
     {
-        return kfmAccessor.shouldNativelyFocusHeavyweight(
-            heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
+        return KfmAccessor.instance.shouldNativelyFocusHeavyweight(
+            heavyweight, descendant, temporary, focusedWindowChangeAllowed,
+                time, cause);
     }
 
     public static void removeLastFocusRequest(Component heavyweight) {
-        kfmAccessor.removeLastFocusRequest(heavyweight);
+        KfmAccessor.instance.removeLastFocusRequest(heavyweight);
     }
 
     // WARNING: Don't call it on the Toolkit thread.
@@ -167,7 +170,8 @@
                                                                 boolean focusedWindowChangeAllowed,
                                                                 long time)
     {
-        return kfmAccessor.processSynchronousLightweightTransfer(
-            heavyweight, descendant, temporary, focusedWindowChangeAllowed, time);
+        return KfmAccessor.instance.processSynchronousLightweightTransfer(
+            heavyweight, descendant, temporary, focusedWindowChangeAllowed,
+                time);
     }
 }