changeset 4838:7dbc53242c2a

7117008: Warnings cleanup day: reduce number of javac warnings in the sun.awt package Reviewed-by: anthony, denis, bagiras
author art
date Wed, 07 Dec 2011 17:45:22 +0400
parents 79b5c5a8c7e9
children 18925904efc2
files src/share/classes/sun/awt/AWTAutoShutdown.java src/share/classes/sun/awt/AppContext.java src/share/classes/sun/awt/CausedFocusEvent.java src/share/classes/sun/awt/DebugSettings.java src/share/classes/sun/awt/EmbeddedFrame.java src/share/classes/sun/awt/EventListenerAggregate.java src/share/classes/sun/awt/FocusingTextField.java src/share/classes/sun/awt/HeadlessToolkit.java src/share/classes/sun/awt/HorizBagLayout.java src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java src/share/classes/sun/awt/ModalityEvent.java src/share/classes/sun/awt/OrientableFlowLayout.java src/share/classes/sun/awt/PaintEventDispatcher.java src/share/classes/sun/awt/PeerEvent.java src/share/classes/sun/awt/SunDisplayChanger.java src/share/classes/sun/awt/SunGraphicsCallback.java src/share/classes/sun/awt/SunToolkit.java src/share/classes/sun/awt/UngrabEvent.java src/share/classes/sun/awt/VariableGridLayout.java src/share/classes/sun/awt/VerticalBagLayout.java
diffstat 20 files changed, 144 insertions(+), 1094 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/awt/AWTAutoShutdown.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/AWTAutoShutdown.java	Wed Dec 07 17:45:22 2011 +0400
@@ -26,10 +26,13 @@
 package sun.awt;
 
 import java.awt.AWTEvent;
+
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.IdentityHashMap;
 import java.util.Map;
+import java.util.Set;
+
 import sun.util.logging.PlatformLogger;
 
 /**
@@ -81,7 +84,7 @@
      * new event to appear in their event queue.
      * Access is synchronized on the main lock object.
      */
-    private final HashSet busyThreadSet = new HashSet(7);
+    private final Set<Thread> busyThreadSet = new HashSet<>(7);
 
     /**
      * Indicates whether the toolkit thread is waiting for a new native
@@ -93,7 +96,7 @@
      * This is a map between components and their peers.
      * we should work with in under activationLock&mainLock lock.
      */
-    private final Map peerMap = new IdentityHashMap();
+    private final Map<Object, Object> peerMap = new IdentityHashMap<>();
 
     /**
      * References the alive non-daemon thread that is currently used
@@ -319,8 +322,10 @@
         }
     }
 
+    @SuppressWarnings("serial")
     static AWTEvent getShutdownEvent() {
-        return new AWTEvent(getInstance(), 0) {};
+        return new AWTEvent(getInstance(), 0) {
+        };
     }
 
     /**
--- a/src/share/classes/sun/awt/AppContext.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/AppContext.java	Wed Dec 07 17:45:22 2011 +0400
@@ -171,7 +171,7 @@
      * HashMap's potentially risky methods, such as clear(), elements(),
      * putAll(), etc.
      */
-    private final HashMap table = new HashMap();
+    private final Map<Object, Object> table = new HashMap<>();
 
     private final ThreadGroup threadGroup;
 
@@ -198,8 +198,8 @@
         // On the main Thread, we get the ThreadGroup, make a corresponding
         // AppContext, and instantiate the Java EventQueue.  This way, legacy
         // code is unaffected by the move to multiple AppContext ability.
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
                 ThreadGroup currentThreadGroup =
                         Thread.currentThread().getThreadGroup();
                 ThreadGroup parentThreadGroup = currentThreadGroup.getParent();
@@ -210,7 +210,7 @@
                 }
                 mainAppContext = new AppContext(currentThreadGroup);
                 numAppContexts = 1;
-                return mainAppContext;
+                return null;
             }
         });
     }
@@ -399,8 +399,8 @@
                         log.finer("exception occured while disposing app context", t);
                     }
                 }
-                AccessController.doPrivileged(new PrivilegedAction() {
-                        public Object run() {
+                AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                        public Void run() {
                             if (!GraphicsEnvironment.isHeadless() && SystemTray.isSupported())
                             {
                                 SystemTray systemTray = SystemTray.getSystemTray();
@@ -523,7 +523,7 @@
         }
     }
 
-    static final class CreateThreadAction implements PrivilegedAction {
+    static final class CreateThreadAction implements PrivilegedAction<Thread> {
         private final AppContext appContext;
         private final Runnable runnable;
 
@@ -532,7 +532,7 @@
             runnable = r;
         }
 
-        public Object run() {
+        public Thread run() {
             Thread t = new Thread(appContext.getThreadGroup(), runnable);
             t.setContextClassLoader(appContext.getContextClassLoader());
             t.setPriority(Thread.NORM_PRIORITY + 1);
@@ -552,8 +552,8 @@
             if (appContext != AppContext.getAppContext()) {
                 // Create a thread that belongs to the thread group associated
                 // with the AppContext and invokes EventQueue.postEvent.
-                PrivilegedAction action = new CreateThreadAction(appContext, r);
-                Thread thread = (Thread)AccessController.doPrivileged(action);
+                PrivilegedAction<Thread> action = new CreateThreadAction(appContext, r);
+                Thread thread = AccessController.doPrivileged(action);
                 thread.start();
             } else {
                 r.run();
--- a/src/share/classes/sun/awt/CausedFocusEvent.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/CausedFocusEvent.java	Wed Dec 07 17:45:22 2011 +0400
@@ -35,6 +35,7 @@
  * CausedFocusEvent class or implicitly, by calling appropriate requestFocusXXX method with "cause"
  * parameter. The default cause is UNKNOWN.
  */
+@SuppressWarnings("serial")
 public class CausedFocusEvent extends FocusEvent {
     public enum Cause {
         UNKNOWN,
--- a/src/share/classes/sun/awt/DebugSettings.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/DebugSettings.java	Wed Dec 07 17:45:22 2011 +0400
@@ -87,9 +87,9 @@
     };
 
     /* global instance of the settings object */
-    private static DebugSettings        instance = null;
+    private static DebugSettings instance = null;
 
-    private Properties  props = new Properties();
+    private Properties props = new Properties();
 
     static void init() {
         if (instance != null) {
@@ -102,12 +102,13 @@
     }
 
     private DebugSettings() {
-        new java.security.PrivilegedAction() {
-            public Object run() {
-                loadProperties();
-                return null;
-            }
-        }.run();
+        java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    loadProperties();
+                    return null;
+                }
+            });
     }
 
     /*
@@ -117,15 +118,14 @@
     private synchronized void loadProperties() {
         // setup initial properties
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction()
-        {
-            public Object run() {
-                loadDefaultProperties();
-                loadFileProperties();
-                loadSystemProperties();
-                return null;
-            }
-        });
+            new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    loadDefaultProperties();
+                    loadFileProperties();
+                    loadSystemProperties();
+                    return null;
+                }
+            });
 
         // echo the initial property settings to stdout
         if (log.isLoggable(PlatformLogger.FINE)) {
@@ -134,12 +134,9 @@
     }
 
     public String toString() {
-        Enumeration enum_ = props.propertyNames();
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         PrintStream pout = new PrintStream(bout);
-
-        while (enum_.hasMoreElements()) {
-            String key = (String)enum_.nextElement();
+        for (String key : props.stringPropertyNames()) {
             String value = props.getProperty(key, "");
             pout.println(key + " = " + value);
         }
@@ -198,9 +195,7 @@
     private void loadSystemProperties() {
         // override file properties with system properties
         Properties sysProps = System.getProperties();
-        Enumeration enum_ = sysProps.propertyNames();
-        while ( enum_.hasMoreElements() ) {
-            String key = (String)enum_.nextElement();
+        for (String key : sysProps.stringPropertyNames()) {
             String value = sysProps.getProperty(key,"");
             // copy any "awtdebug" properties over
             if ( key.startsWith(PREFIX) ) {
@@ -244,17 +239,14 @@
         return value;
     }
 
-    public synchronized Enumeration getPropertyNames() {
-        Vector          propNames = new Vector();
-        Enumeration     enum_ = props.propertyNames();
-
+    private synchronized List<String> getPropertyNames() {
+        List<String> propNames = new LinkedList<>();
         // remove global prefix from property names
-        while ( enum_.hasMoreElements() ) {
-            String propName = (String)enum_.nextElement();
+        for (String propName : props.stringPropertyNames()) {
             propName = propName.substring(PREFIX.length()+1);
-            propNames.addElement(propName);
+            propNames.add(propName);
         }
-        return propNames.elements();
+        return propNames;
     }
 
     private void println(Object object) {
@@ -279,13 +271,11 @@
         //
         // Filter out file/line ctrace properties from debug settings
         //
-        Vector                traces = new Vector();
-        Enumeration         enum_ = getPropertyNames();
+        List<String> traces = new LinkedList<>();
 
-        while ( enum_.hasMoreElements() ) {
-            String key = (String)enum_.nextElement();
-            if ( key.startsWith(PROP_CTRACE) && key.length() > PROP_CTRACE_LEN ) {
-                traces.addElement(key);
+        for (String key : getPropertyNames()) {
+            if (key.startsWith(PROP_CTRACE) && key.length() > PROP_CTRACE_LEN) {
+                traces.add(key);
             }
         }
 
@@ -295,15 +285,12 @@
         //
         // Setup the trace points
         //
-        Enumeration        enumTraces = traces.elements();
-
-        while ( enumTraces.hasMoreElements() ) {
-            String        key = (String)enumTraces.nextElement();
-            String         trace = key.substring(PROP_CTRACE_LEN+1);
+        for (String key : traces) {
+            String        trace = key.substring(PROP_CTRACE_LEN+1);
             String        filespec;
             String        linespec;
-            int                delim= trace.indexOf('@');
-            boolean        enabled;
+            int           delim= trace.indexOf('@');
+            boolean       enabled;
 
             // parse out the filename and linenumber from the property name
             filespec = delim != -1 ? trace.substring(0, delim) : trace;
--- a/src/share/classes/sun/awt/EmbeddedFrame.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/EmbeddedFrame.java	Wed Dec 07 17:45:22 2011 +0400
@@ -180,6 +180,7 @@
      * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
      * add listeners in show() and remove them in hide().
      */
+    @SuppressWarnings("deprecation")
     public void show() {
         if (appletKFM != null) {
             addTraversingOutListeners(appletKFM);
@@ -193,6 +194,7 @@
      * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
      * add listeners in show() and remove them in hide().
      */
+    @SuppressWarnings("deprecation")
     public void hide() {
         if (appletKFM != null) {
             removeTraversingOutListeners(appletKFM);
@@ -212,8 +214,8 @@
         // belongs to. That's why we can't use public methods to find current focus cycle
         // root. Instead, we access KFM's private field directly.
         if (currentCycleRoot == null) {
-            currentCycleRoot = (Field)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+            currentCycleRoot = AccessController.doPrivileged(new PrivilegedAction<Field>() {
+                public Field run() {
                     try {
                         Field unaccessibleRoot = KeyboardFocusManager.class.
                                                      getDeclaredField("currentFocusCycleRoot");
@@ -257,7 +259,7 @@
         }
 
         AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
-        Set toTest;
+        Set<AWTKeyStroke> toTest;
         Component currentFocused = e.getComponent();
 
         toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
@@ -357,6 +359,7 @@
         return true;
     }
 
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized (getTreeLock()) {
             if (getPeer() == null) {
@@ -367,6 +370,7 @@
     }
 
     // These three functions consitute RFE 4100710. Do not remove.
+    @SuppressWarnings("deprecation")
     public void setCursorAllowed(boolean isCursorAllowed) {
         this.isCursorAllowed = isCursorAllowed;
         getPeer().updateCursorImmediately();
@@ -380,27 +384,28 @@
             : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
     }
 
-    protected  void setPeer(final ComponentPeer p){
+    @SuppressWarnings("deprecation")
+    protected void setPeer(final ComponentPeer p){
         if (fieldPeer == null) {
-            fieldPeer = (Field)AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        try {
-                            Field lnkPeer = Component.class.getDeclaredField("peer");
-                            if (lnkPeer != null) {
-                                lnkPeer.setAccessible(true);
-                            }
-                            return lnkPeer;
-                        } catch (NoSuchFieldException e) {
-                            assert false;
-                        } catch (SecurityException e) {
-                            assert false;
+            fieldPeer = AccessController.doPrivileged(new PrivilegedAction<Field>() {
+                public Field run() {
+                    try {
+                        Field lnkPeer = Component.class.getDeclaredField("peer");
+                        if (lnkPeer != null) {
+                            lnkPeer.setAccessible(true);
                         }
-                        return null;
-                    }//run
-                });
+                        return lnkPeer;
+                    } catch (NoSuchFieldException e) {
+                        assert false;
+                    } catch (SecurityException e) {
+                        assert false;
+                    }
+                    return null;
+                }//run
+            });
         }
         try{
-            if (fieldPeer !=null){
+            if (fieldPeer != null){
                 fieldPeer.set(EmbeddedFrame.this, p);
             }
         } catch (IllegalAccessException e) {
@@ -507,6 +512,7 @@
      * @see #getBoundsPrivate
      * @since 1.5
      */
+    @SuppressWarnings("deprecation")
     protected void setBoundsPrivate(int x, int y, int width, int height) {
         final FramePeer peer = (FramePeer)getPeer();
         if (peer != null) {
@@ -538,6 +544,7 @@
      * @see #setBoundsPrivate
      * @since 1.6
      */
+    @SuppressWarnings("deprecation")
     protected Rectangle getBoundsPrivate() {
         final FramePeer peer = (FramePeer)getPeer();
         if (peer != null) {
--- a/src/share/classes/sun/awt/EventListenerAggregate.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/EventListenerAggregate.java	Wed Dec 07 17:45:22 2011 +0400
@@ -53,20 +53,15 @@
      * @throws ClassCastException if <code>listenerClass</code> is not
      *         assignable to <code>java.util.EventListener</code>
      */
-    public EventListenerAggregate(Class listenerClass) {
+    public EventListenerAggregate(Class<? extends EventListener> listenerClass) {
         if (listenerClass == null) {
             throw new NullPointerException("listener class is null");
         }
 
-        if (!EventListener.class.isAssignableFrom(listenerClass)) {
-            throw new ClassCastException("listener class " + listenerClass +
-                                         " is not assignable to EventListener");
-        }
-
         listenerList = (EventListener[])Array.newInstance(listenerClass, 0);
     }
 
-    private Class getListenerClass() {
+    private Class<?> getListenerClass() {
         return listenerList.getClass().getComponentType();
     }
 
@@ -80,7 +75,7 @@
      *         in the constructor
      */
     public synchronized void add(EventListener listener) {
-        Class listenerClass = getListenerClass();
+        Class<?> listenerClass = getListenerClass();
 
         if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
             throw new ClassCastException("listener " + listener + " is not " +
@@ -107,7 +102,7 @@
      *         in the constructor
      */
     public synchronized boolean remove(EventListener listener) {
-        Class listenerClass = getListenerClass();
+        Class<?> listenerClass = getListenerClass();
 
         if (!listenerClass.isInstance(listener)) { // null is not an instance of any class
             throw new ClassCastException("listener " + listener + " is not " +
@@ -155,7 +150,7 @@
      *         array if there are no listeners)
      */
     public synchronized EventListener[] getListenersCopy() {
-        return (listenerList.length == 0) ? listenerList : (EventListener[])listenerList.clone();
+        return (listenerList.length == 0) ? listenerList : listenerList.clone();
     }
 
     /**
--- a/src/share/classes/sun/awt/FocusingTextField.java	Mon Dec 05 17:11:57 2011 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * FocusingTextField: a subclass of java.awt.TextField that handles moving the
- * input focus from field to field, as when the user hits 'return.'
- *
- * @author Herb Jellinek
- */
-
-public class FocusingTextField extends TextField {
-
-    /** The field to move to on 'return' - can be null. */
-    TextField next;
-
-    /** If true, select the contents of the field when it gets the focus. */
-    boolean willSelect;
-
-    /**
-     * Create a FocusingTextField.
-     * @param cols number of columns of text.
-     */
-    public FocusingTextField(int cols) {
-        super("", cols);
-    }
-
-    /**
-     * Create a FocusingTextField.
-     * @param cols number of columns of text.
-     * @param willSelect if true, will select all contents of field when
-     * focus is gained.
-     */
-    public FocusingTextField(int cols, boolean willSelect) {
-        this(cols);
-        this.willSelect = willSelect;
-    }
-
-    public void setWillSelect(boolean will) {
-        willSelect = will;
-    }
-
-    public boolean getWillSelect() {
-        return willSelect;
-    }
-
-    /**
-     * Call this to set the next field to receive the input focus.
-     * @param next the next TextField in order - can be null.
-     */
-    public void setNextField(TextField next) {
-        this.next = next;
-    }
-
-    /**
-     * We got the focus.  If willSelect is true, select everything.
-     */
-    public boolean gotFocus(Event e, Object arg) {
-        if (willSelect) {
-            select(0, getText().length());
-        }
-        return true;
-    }
-
-    /**
-     * We lost the focus.  If willSelect is true, deselect everything.
-     */
-    public boolean lostFocus(Event e, Object arg) {
-        if (willSelect) {
-            select(0, 0);
-        }
-        return true;
-    }
-
-    /**
-     * Pass the focus to the next guy, if any.
-     */
-    public void nextFocus() {
-        if (next != null) {
-            next.requestFocus();
-        }
-        super.nextFocus();
-    }
-}
--- a/src/share/classes/sun/awt/HeadlessToolkit.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/HeadlessToolkit.java	Wed Dec 07 17:45:22 2011 +0400
@@ -396,6 +396,7 @@
     /*
      * Fonts
      */
+    @SuppressWarnings("deprecation")
     public FontPeer getFontPeer(String name, int style) {
         if (componentFactory != null) {
             return componentFactory.getFontPeer(name, style);
@@ -403,10 +404,12 @@
         return null;
     }
 
+    @SuppressWarnings("deprecation")
     public FontMetrics getFontMetrics(Font font) {
         return tk.getFontMetrics(font);
     }
 
+    @SuppressWarnings("deprecation")
     public String[] getFontList() {
         return tk.getFontList();
     }
--- a/src/share/classes/sun/awt/HorizBagLayout.java	Mon Dec 05 17:11:57 2011 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * A horizontal 'bag' of Components.  Allocates space for each Component
- * from left to right.
- *
- * @author      Herb Jellinek
- */
-public class HorizBagLayout implements LayoutManager {
-
-    int hgap;
-
-    /**
-     * Constructs a new HorizBagLayout.
-     */
-    public HorizBagLayout() {
-        this(0);
-    }
-
-    /**
-     * Constructs a HorizBagLayout with the specified gaps.
-     * @param hgap the horizontal gap
-     */
-    public HorizBagLayout(int hgap) {
-        this.hgap = hgap;
-    }
-
-    /**
-     * Adds the specified named component to the layout.
-     * @param name the String name
-     * @param comp the component to be added
-     */
-    public void addLayoutComponent(String name, Component comp) {
-    }
-
-    /**
-     * Removes the specified component from the layout.
-     * @param comp the component to be removed
-     */
-    public void removeLayoutComponent(Component comp) {
-    }
-
-    /**
-     * Returns the minimum dimensions needed to lay out the components
-     * contained in the specified target container.
-     * @param target the Container on which to do the layout
-     * @see Container
-     * @see #preferredLayoutSize
-     */
-    public Dimension minimumLayoutSize(Container target) {
-        Dimension dim = new Dimension();
-
-        for (int i = 0; i < target.countComponents(); i++) {
-            Component comp = target.getComponent(i);
-            if (comp.isVisible()) {
-                Dimension d = comp.minimumSize();
-                dim.width += d.width + hgap;
-                dim.height = Math.max(d.height, dim.height);
-            }
-        }
-
-        Insets insets = target.insets();
-        dim.width += insets.left + insets.right;
-        dim.height += insets.top + insets.bottom;
-
-        return dim;
-    }
-
-    /**
-     * Returns the preferred dimensions for this layout given the components
-     * in the specified target container.
-     * @param target the component which needs to be laid out
-     * @see Container
-     * @see #minimumLayoutSize
-     */
-    public Dimension preferredLayoutSize(Container target) {
-        Dimension dim = new Dimension();
-
-        for (int i = 0; i < target.countComponents(); i++) {
-            Component comp = target.getComponent(i);
-            if (comp.isVisible()) {
-                Dimension d = comp.preferredSize();
-                dim.width += d.width + hgap;
-                dim.height = Math.max(dim.height, d.height);
-            }
-        }
-
-        Insets insets = target.insets();
-        dim.width += insets.left + insets.right;
-        dim.height += insets.top + insets.bottom;
-
-        return dim;
-    }
-
-    /**
-     * Lays out the specified container. This method will actually reshape the
-     * components in the specified target container in order to satisfy the
-     * constraints of the HorizBagLayout object.
-     * @param target the component being laid out
-     * @see Container
-     */
-    public void layoutContainer(Container target) {
-        Insets insets = target.insets();
-        int top = insets.top;
-        int bottom = target.size().height - insets.bottom;
-        int left = insets.left;
-        int right = target.size().width - insets.right;
-
-        for (int i = 0; i < target.countComponents(); i++) {
-            Component comp = target.getComponent(i);
-            if (comp.isVisible()) {
-                int compWidth = comp.size().width;
-                comp.resize(compWidth, bottom - top);
-                Dimension d = comp.preferredSize();
-                comp.reshape(left, top, d.width, bottom - top);
-                left += d.width + hgap;
-            }
-        }
-    }
-
-    /**
-     * Returns the String representation of this HorizBagLayout's values.
-     */
-    public String toString() {
-        return getClass().getName() + "[hgap=" + hgap + "]";
-    }
-}
--- a/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java	Wed Dec 07 17:45:22 2011 +0400
@@ -80,6 +80,7 @@
      * 1) accepts focus on click (in general)
      * 2) may be a focus owner (in particular)
      */
+    @SuppressWarnings("deprecation")
     public static boolean shouldFocusOnClick(Component component) {
         boolean acceptFocusOnClick = false;
 
@@ -110,6 +111,7 @@
     /*
      * Posts proper lost/gain focus events to the event queue.
      */
+    @SuppressWarnings("deprecation")
     public static boolean deliverFocus(Component lightweightChild,
                                        Component target,
                                        boolean temporary,
@@ -119,7 +121,7 @@
                                        Component currentFocusOwner) // provided by the descendant peers
     {
         if (lightweightChild == null) {
-            lightweightChild = (Component)target;
+            lightweightChild = target;
         }
 
         Component currentOwner = currentFocusOwner;
--- a/src/share/classes/sun/awt/ModalityEvent.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/ModalityEvent.java	Wed Dec 07 17:45:22 2011 +0400
@@ -30,6 +30,7 @@
 /**
  * Event object describing changes in AWT modality
  */
+@SuppressWarnings("serial")
 public class ModalityEvent extends AWTEvent implements ActiveEvent {
 
     public static final int MODALITY_PUSHED = 1300;
--- a/src/share/classes/sun/awt/OrientableFlowLayout.java	Mon Dec 05 17:11:57 2011 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.awt;
-
-import java.awt.*;
-
-/**
- * Extends the FlowLayout class to support both vertical and horizontal
- * layout of components.  Orientation can be changed dynamically after
- * creation by calling either of the methods @method orientHorizontally or
- * @method orientVertically.  Separate values for alignment, vertical gap,
- * and horizontal gap can be specified for horizontal and vertical
- * orientation.
- *
- * @author Terry Cline
- */
-public class OrientableFlowLayout extends FlowLayout {
-    /**
-     * The horizontal orientation constant.
-     */
-    public static final int HORIZONTAL = 0;
-
-    /**
-     * The vertical orientation constant.
-     */
-    public static final int VERTICAL   = 1;
-
-    /**
-     * The top vertical alignment constant.
-     */
-    public static final int TOP        = 0;
-
-    /**
-     * The bottom vertical alignment constant.
-     */
-    public static final int BOTTOM     = 2; // CENTER == 1
-
-    int orientation;
-    int vAlign;
-    int vHGap;
-    int vVGap;
-
-    /**
-     * Constructs a new flow layout with a horizontal orientation and
-     * centered alignment.
-     */
-    public OrientableFlowLayout() {
-        this(HORIZONTAL, CENTER, CENTER, 5, 5, 5, 5);
-    }
-
-    /**
-     * Constructs a new flow layout with the specified orientation and
-     * a centered alignment.
-     *
-     * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
-     */
-    public OrientableFlowLayout(int orientation) {
-        this(orientation, CENTER, CENTER, 5, 5, 5, 5);
-    }
-
-    /**
-     * Constructs a new flow layout with the specified orientation and
-     * alignment.
-     *
-     * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
-     * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT.
-     * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM.
-     */
-    public OrientableFlowLayout(int orientation, int hAlign, int vAlign) {
-        this(orientation, hAlign, vAlign, 5, 5, 5, 5);
-    }
-
-    /**
-     * Constructs a new flow layout with the specified orientation,
-     * alignment, and gap values.
-     *
-     * @param orientation the orientation, one of HORIZONTAL or VERTICAL.
-     * @param hAlign the horizontal alignment, one of LEFT, CENTER, or RIGHT.
-     * @param vAlign the vertical alignment, one of TOP, CENTER, or BOTTOM.
-     * @param hHGap the horizontal gap between components in HORIZONTAL.
-     * @param hVGap the vertical gap between components in HORIZONTAL.
-     * @param vHGap the horizontal gap between components in VERTICAL.
-     * @param vVGap the vertical gap between components in VERTICAL.
-     */
-    public OrientableFlowLayout(int orientation, int hAlign, int vAlign, int hHGap, int hVGap, int vHGap, int vVGap) {
-        super(hAlign, hHGap, hVGap);
-        this.orientation = orientation;
-        this.vAlign      = vAlign;
-        this.vHGap       = vHGap;
-        this.vVGap       = vVGap;
-    }
-
-    /**
-     * Set the layout's current orientation to horizontal.
-     */
-    public synchronized void orientHorizontally() {
-        orientation = HORIZONTAL;
-    }
-
-    /**
-     * Set the layout's current orientation to vertical.
-     */
-    public synchronized void orientVertically() {
-        orientation = VERTICAL;
-    }
-
-    /**
-     * Returns the preferred dimensions for this layout given the
-     * components in the specified target container.
-     *
-     * @param target the component which needs to be laid out.
-     * @see Container
-     * @see FlowLayout
-     * @see #minimumLayoutSize
-     */
-    public Dimension preferredLayoutSize(Container target) {
-        if (orientation == HORIZONTAL) {
-            return super.preferredLayoutSize(target);
-        }
-        else {
-            Dimension dim = new Dimension(0, 0);
-
-            int n = target.countComponents();
-            for (int i = 0; i < n; i++) {
-                Component c = target.getComponent(i);
-                if (c.isVisible()) {
-                    Dimension cDim = c.preferredSize();
-                    dim.width = Math.max(dim.width, cDim.width);
-                    if (i > 0) {
-                        dim.height += vVGap;
-                    }
-                    dim.height += cDim.height;
-                }
-            }
-
-            Insets insets = target.insets();;
-            dim.width  += insets.left + insets.right  + vHGap*2;
-            dim.height += insets.top  + insets.bottom + vVGap*2;
-
-            return dim;
-        }
-    }
-
-    /**
-     * Returns the minimum dimensions needed to layout the components
-     * contained in the specified target container.
-     *
-     * @param target the component which needs to be laid out.
-     * @see #preferredLayoutSize.
-     */
-    public Dimension minimumLayoutSize(Container target) {
-        if (orientation == HORIZONTAL) {
-            return super.minimumLayoutSize(target);
-        }
-        else {
-            Dimension dim = new Dimension(0, 0);
-
-            int n = target.countComponents();
-            for (int i = 0; i < n; i++) {
-                Component c = target.getComponent(i);
-                if (c.isVisible()) {
-                    Dimension cDim = c.minimumSize();
-                    dim.width = Math.max(dim.width, cDim.width);
-                    if (i > 0) {
-                        dim.height += vVGap;
-                    }
-                    dim.height += cDim.height;
-                }
-            }
-
-            Insets insets = target.insets();
-            dim.width  += insets.left + insets.right  + vHGap*2;
-            dim.height += insets.top  + insets.bottom + vVGap*2;
-
-            return dim;
-        }
-    }
-
-    /**
-     * Lays out the container.  This method will reshape the
-     * components in the target to satisfy the constraints of the
-     * layout.
-     *
-     * @param target the specified component being laid out.
-     * @see Container.
-     */
-    public void layoutContainer(Container target) {
-        if (orientation == HORIZONTAL) {
-            super.layoutContainer(target);
-        }
-        else {
-            Insets insets = target.insets();
-            Dimension targetDim = target.size();
-            int maxHeight = targetDim.height - (insets.top + insets.bottom + vVGap*2);
-            int x = insets.left + vHGap;
-            int y = 0;
-            int colWidth = 0;
-            int start = 0;
-
-            int n = target.countComponents();
-            for (int i = 0; i < n; i++) {
-                Component c = target.getComponent(i);
-                if (c.isVisible()) {
-                    Dimension cDim = c.preferredSize();
-                    c.resize(cDim.width, cDim.height);
-
-                    if ((y == 0) || ((y + cDim.height) <= maxHeight)) {
-                        if (y > 0) {
-                            y += vVGap;
-                        }
-                        y += cDim.height;
-                        colWidth = Math.max(colWidth, cDim.width);
-                    }
-                    else {
-                        moveComponents(target,
-                                       x,
-                                       insets.top + vVGap,
-                                       colWidth,
-                                       maxHeight - y,
-                                       start,
-                                       i);
-                        x += vHGap + colWidth;
-                        y = cDim.width;
-                        colWidth = cDim.width;
-                        start = i;
-                    }
-                }
-            }
-
-            moveComponents(target,
-                           x,
-                           insets.top + vVGap,
-                           colWidth,
-                           maxHeight - y,
-                           start,
-                           n);
-        }
-    }
-
-    /**
-     * Aligns the components vertically if there is any slack.
-     *
-     * @param target the container whose components need to be moved.
-     * @param x the x coordinate.
-     * @param y the y coordinate.
-     * @param width the width available.
-     * @param height the height available.
-     * @param colStart the beginning of the column.
-     * @param colEnd the end of the column.
-     */
-    private void moveComponents(Container target, int x, int y, int width, int height, int colStart, int colEnd) {
-        switch (vAlign) {
-        case TOP:
-            break;
-        case CENTER:
-            y += height/2;
-            break;
-        case BOTTOM:
-            y += height;
-        }
-
-        for (int i = colStart; i < colEnd; i++) {
-            Component c = target.getComponent(i);
-            Dimension cDim = c.size();
-            if (c.isVisible()) {
-                c.move(x + (width - cDim.width)/2, y);
-                y += vVGap + cDim.height;
-            }
-        }
-    }
-
-    /**
-     * Returns the String representation of this layout's values.
-     */
-    public String toString() {
-        String str = "";
-        switch (orientation) {
-        case HORIZONTAL:
-            str = "orientation=horizontal, ";
-            break;
-        case VERTICAL:
-            str = "orientation=vertical, ";
-            break;
-        }
-
-        return getClass().getName() + "[" + str + super.toString() + "]";
-    }
-}
--- a/src/share/classes/sun/awt/PaintEventDispatcher.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/PaintEventDispatcher.java	Wed Dec 07 17:45:22 2011 +0400
@@ -77,7 +77,7 @@
     public PaintEvent createPaintEvent(Component target, int x, int y, int w,
                                        int h) {
 
-        return new PaintEvent((Component)target, PaintEvent.PAINT,
+        return new PaintEvent(target, PaintEvent.PAINT,
                               new Rectangle(x, y, w, h));
     }
 
--- a/src/share/classes/sun/awt/PeerEvent.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/PeerEvent.java	Wed Dec 07 17:45:22 2011 +0400
@@ -27,7 +27,9 @@
 
 import java.awt.event.InvocationEvent;
 
+@SuppressWarnings("serial")
 public class PeerEvent extends InvocationEvent {
+
     public static final long PRIORITY_EVENT = 0x01;
     public static final long ULTIMATE_PRIORITY_EVENT = 0x02;
     public static final long LOW_PRIORITY_EVENT = 0x04;
--- a/src/share/classes/sun/awt/SunDisplayChanger.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/SunDisplayChanger.java	Wed Dec 07 17:45:22 2011 +0400
@@ -28,9 +28,10 @@
 import java.awt.IllegalComponentStateException;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.HashMap;
 import java.util.WeakHashMap;
 
 import sun.util.logging.PlatformLogger;
@@ -54,12 +55,14 @@
  * screen to another on a system equipped with multiple displays.
  */
 public class SunDisplayChanger {
+
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.multiscreen.SunDisplayChanger");
 
-    // Create a new synchronizedMap with initial capacity of one listener.
+    // Create a new synchronized map with initial capacity of one listener.
     // It is asserted that the most common case is to have one GraphicsDevice
     // and one top-level Window.
-    private Map listeners = Collections.synchronizedMap(new WeakHashMap(1));
+    private Map<DisplayChangedListener, Void> listeners =
+        Collections.synchronizedMap(new WeakHashMap<DisplayChangedListener, Void>(1));
 
     public SunDisplayChanger() {}
 
@@ -113,18 +116,15 @@
     // synchronization provides no protection against modifying the listener
     // list while in the middle of iterating over it.  -bchristi 7/10/2001
 
-        HashMap listClone;
-        Set cloneSet;
+        Set<DisplayChangedListener> cloneSet;
 
         synchronized(listeners) {
-            listClone = new HashMap(listeners);
+            cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
         }
 
-        cloneSet = listClone.keySet();
-        Iterator itr = cloneSet.iterator();
+        Iterator<DisplayChangedListener> itr = cloneSet.iterator();
         while (itr.hasNext()) {
-            DisplayChangedListener current =
-             (DisplayChangedListener) itr.next();
+            DisplayChangedListener current = itr.next();
             try {
                 if (log.isLoggable(PlatformLogger.FINEST)) {
                     log.finest("displayChanged for listener: " + current);
@@ -160,17 +160,14 @@
     // synchronization provides no protection against modifying the listener
     // list while in the middle of iterating over it.  -bchristi 7/10/2001
 
-        HashMap listClone;
-        Set cloneSet;
+        Set<DisplayChangedListener> cloneSet;
 
         synchronized (listeners) {
-            listClone = new HashMap(listeners);
+            cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
         }
-        cloneSet = listClone.keySet();
-        Iterator itr = cloneSet.iterator();
+        Iterator<DisplayChangedListener> itr = cloneSet.iterator();
         while (itr.hasNext()) {
-            DisplayChangedListener current =
-             (DisplayChangedListener) itr.next();
+            DisplayChangedListener current = itr.next();
             try {
                 if (log.isLoggable(PlatformLogger.FINEST)) {
                     log.finest("paletteChanged for listener: " + current);
--- a/src/share/classes/sun/awt/SunGraphicsCallback.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/SunGraphicsCallback.java	Wed Dec 07 17:45:22 2011 +0400
@@ -47,6 +47,7 @@
         g.clipRect(0, 0, bounds.width, bounds.height);
     }
 
+    @SuppressWarnings("deprecation")
     public final void runOneComponent(Component comp, Rectangle bounds,
                                       Graphics g, Shape clip,
                                       int weightFlags) {
--- a/src/share/classes/sun/awt/SunToolkit.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/SunToolkit.java	Wed Dec 07 17:45:22 2011 +0400
@@ -197,6 +197,7 @@
 
     public abstract boolean isTraySupported();
 
+    @SuppressWarnings("deprecation")
     public abstract FontPeer getFontPeer(String name, int style);
 
     public abstract RobotPeer createRobot(Robot target, GraphicsDevice screen)
@@ -305,7 +306,7 @@
         return appContext;
     }
 
-    public static Field getField(final Class klass, final String fieldName) {
+    public static Field getField(final Class<?> klass, final String fieldName) {
         return AccessController.doPrivileged(new PrivilegedAction<Field>() {
             public Field run() {
                 try {
@@ -325,8 +326,8 @@
 
     static void wakeupEventQueue(EventQueue q, boolean isShutdown){
         if (wakeupMethod == null){
-            wakeupMethod = (Method)AccessController.doPrivileged(new PrivilegedAction(){
-                    public Object run(){
+            wakeupMethod = AccessController.doPrivileged(new PrivilegedAction<Method>() {
+                    public Method run() {
                         try {
                             Method method  = EventQueue.class.getDeclaredMethod("wakeup",new Class [] {Boolean.TYPE} );
                             if (method != null) {
@@ -386,8 +387,8 @@
 
     // Maps from non-Component/MenuComponent to AppContext.
     // WeakHashMap<Component,AppContext>
-    private static final Map appContextMap =
-        Collections.synchronizedMap(new WeakHashMap());
+    private static final Map<Object, AppContext> appContextMap =
+        Collections.synchronizedMap(new WeakHashMap<Object, AppContext>());
 
     /**
      * Sets the appContext field of target. If target is not a Component or
@@ -437,7 +438,7 @@
         if (context == null) {
             // target is not a Component/MenuComponent, try the
             // appContextMap.
-            context = (AppContext)appContextMap.get(target);
+            context = appContextMap.get(target);
         }
         return context;
     }
@@ -519,9 +520,9 @@
     private static FocusTraversalPolicy createLayoutPolicy() {
         FocusTraversalPolicy policy = null;
         try {
-            Class layoutPolicyClass =
+            Class<?> layoutPolicyClass =
                 Class.forName("javax.swing.LayoutFocusTraversalPolicy");
-            policy = (FocusTraversalPolicy) layoutPolicyClass.newInstance();
+            policy = (FocusTraversalPolicy)layoutPolicyClass.newInstance();
         }
         catch (ClassNotFoundException e) {
             assert false;
@@ -642,11 +643,13 @@
      * Fixed 5064013: the InvocationEvent time should be equals
      * the time of the ActionEvent
      */
+    @SuppressWarnings("serial")
     public static void executeOnEventHandlerThread(Object target,
                                                    Runnable runnable,
                                                    final long when) {
-        executeOnEventHandlerThread(new PeerEvent(target, runnable, PeerEvent.PRIORITY_EVENT){
-                public long getWhen(){
+        executeOnEventHandlerThread(
+            new PeerEvent(target, runnable, PeerEvent.PRIORITY_EVENT) {
+                public long getWhen() {
                     return when;
                 }
             });
@@ -727,10 +730,12 @@
     protected abstract int getScreenWidth();
     protected abstract int getScreenHeight();
 
+    @SuppressWarnings("deprecation")
     public FontMetrics getFontMetrics(Font font) {
         return FontDesignMetrics.getMetrics(font);
     }
 
+    @SuppressWarnings("deprecation")
     public String[] getFontList() {
         String[] hardwiredFontList = {
             Font.DIALOG, Font.SANS_SERIF, Font.SERIF, Font.MONOSPACED,
@@ -1156,10 +1161,10 @@
     public static Locale getStartupLocale() {
         if (startupLocale == null) {
             String language, region, country, variant;
-            language = (String) AccessController.doPrivileged(
+            language = AccessController.doPrivileged(
                             new GetPropertyAction("user.language", "en"));
             // for compatibility, check for old user.region property
-            region = (String) AccessController.doPrivileged(
+            region = AccessController.doPrivileged(
                             new GetPropertyAction("user.region"));
             if (region != null) {
                 // region can be of form country, country_variant, or _variant
@@ -1172,9 +1177,9 @@
                     variant = "";
                 }
             } else {
-                country = (String) AccessController.doPrivileged(
+                country = AccessController.doPrivileged(
                                 new GetPropertyAction("user.country", ""));
-                variant = (String) AccessController.doPrivileged(
+                variant = AccessController.doPrivileged(
                                 new GetPropertyAction("user.variant", ""));
             }
             startupLocale = new Locale(language, country, variant);
@@ -1254,7 +1259,7 @@
      * @return <code>true</code>, if XEmbed is needed, <code>false</code> otherwise
      */
     public static boolean needsXEmbed() {
-        String noxembed = (String) AccessController.
+        String noxembed = AccessController.
             doPrivileged(new GetPropertyAction("sun.awt.noxembed", "false"));
         if ("true".equals(noxembed)) {
             return false;
@@ -1466,7 +1471,7 @@
             || comp instanceof Window);
     }
 
-    public static Method getMethod(final Class clz, final String methodName, final Class[] params) {
+    public static Method getMethod(final Class<?> clz, final String methodName, final Class[] params) {
         Method res = null;
         try {
             res = AccessController.doPrivileged(new PrivilegedExceptionAction<Method>() {
@@ -1482,6 +1487,7 @@
         return res;
     }
 
+    @SuppressWarnings("serial")
     public static class OperationTimedOut extends RuntimeException {
         public OperationTimedOut(String msg) {
             super(msg);
@@ -1489,9 +1495,12 @@
         public OperationTimedOut() {
         }
     }
+
+    @SuppressWarnings("serial")
     public static class InfiniteLoop extends RuntimeException {
     }
 
+    @SuppressWarnings("serial")
     public static class IllegalThreadException extends RuntimeException {
         public IllegalThreadException(String msg) {
             super(msg);
@@ -1648,6 +1657,7 @@
      * Should return <code>true</code> if more processing is
      * necessary, <code>false</code> otherwise.
      */
+    @SuppressWarnings("serial")
     protected final boolean waitForIdle(final long timeout) {
         flushPendingEvents();
         boolean queueWasEmpty = isEQEmpty();
@@ -1831,7 +1841,7 @@
             Toolkit tk = Toolkit.getDefaultToolkit();
             if (tk instanceof SunToolkit) {
                 systemAAFonts =
-                    (String)AccessController.doPrivileged(
+                    AccessController.doPrivileged(
                          new GetPropertyAction("awt.useSystemAAFontSettings"));
             }
             if (systemAAFonts != null) {
@@ -1898,7 +1908,7 @@
         if (consumeNextKeyTypedMethod == null) {
             consumeNextKeyTypedMethod = getMethod(DefaultKeyboardFocusManager.class,
                                                   "consumeNextKeyTyped",
-                                                  new Class[] {KeyEvent.class});
+                                                  new Class<?>[] {KeyEvent.class});
         }
         try {
             consumeNextKeyTypedMethod.invoke(KeyboardFocusManager.getCurrentKeyboardFocusManager(),
@@ -1930,8 +1940,8 @@
      * Returns the value of the system property indicated by the specified key.
      */
     public static String getSystemProperty(final String key) {
-        return (String)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+        return AccessController.doPrivileged(new PrivilegedAction<String>() {
+                public String run() {
                     return System.getProperty(key);
                 }
             });
@@ -1941,8 +1951,7 @@
      * Returns the boolean value of the system property indicated by the specified key.
      */
     protected static Boolean getBooleanSystemProperty(String key) {
-        return Boolean.valueOf(AccessController.
-                   doPrivileged(new GetBooleanAction(key)));
+        return AccessController.doPrivileged(new GetBooleanAction(key));
     }
 
     private static Boolean sunAwtDisableMixing = null;
@@ -2015,7 +2024,7 @@
      */
     public static boolean isContainingTopLevelTranslucent(Component c) {
         Window w = getContainingWindow(c);
-        return w != null && ((Window)w).getOpacity() < 1.0f;
+        return w != null && w.getOpacity() < 1.0f;
     }
 
     /**
@@ -2057,14 +2066,14 @@
         return isInstanceOf(obj.getClass(), type);
     }
 
-    private static boolean isInstanceOf(Class cls, String type) {
+    private static boolean isInstanceOf(Class<?> cls, String type) {
         if (cls == null) return false;
 
         if (cls.getName().equals(type)) {
             return true;
         }
 
-        for (Class c : cls.getInterfaces()) {
+        for (Class<?> c : cls.getInterfaces()) {
             if (c.getName().equals(type)) {
                 return true;
             }
--- a/src/share/classes/sun/awt/UngrabEvent.java	Mon Dec 05 17:11:57 2011 +0400
+++ b/src/share/classes/sun/awt/UngrabEvent.java	Wed Dec 07 17:45:22 2011 +0400
@@ -39,7 +39,9 @@
  * <p>Notice that this event is not generated on mouse click inside of the window area.
  * <p>To listen for this event, install AWTEventListener with {@value sun.awt.SunToolkit#GRAB_EVENT_MASK}
  */
+@SuppressWarnings("serial")
 public class UngrabEvent extends AWTEvent {
+
     private final static int UNGRAB_EVENT_ID = 1998;
 
     public UngrabEvent(Component source) {
--- a/src/share/classes/sun/awt/VariableGridLayout.java	Mon Dec 05 17:11:57 2011 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-import java.util.BitSet;
-
-
-/**
- * A layout manager for a container that lays out grids.  Allows setting
- * the relative sizes of rows and columns.
- *
- * @author Herb Jellinek
- */
-
-
-public class VariableGridLayout extends GridLayout {
-
-    BitSet rowsSet = new BitSet();
-    double rowFractions[] = null;
-
-    BitSet colsSet = new BitSet();
-    double colFractions[] = null;
-
-    int rows;
-    int cols;
-    int hgap;
-    int vgap;
-
-    /**
-     * Creates a grid layout with the specified rows and specified columns.
-     * @param rows the rows
-     * @param cols the columns
-     */
-    public VariableGridLayout(int rows, int cols) {
-        this(rows, cols, 0, 0);
-
-        if (rows != 0) {
-            rowsSet = new BitSet(rows);
-            stdRowFractions(rows);
-        }
-
-        if (cols != 0) {
-            colsSet = new BitSet(cols);
-            stdColFractions(cols);
-        }
-    }
-
-    /**
-     * Creates a grid layout with the specified rows, columns,
-     * horizontal gap, and vertical gap.
-     * @param rows the rows
-     * @param cols the columns
-     * @param hgap the horizontal gap variable
-     * @param vgap the vertical gap variable
-     * @exception IllegalArgumentException If the rows and columns are invalid.
-     */
-    public VariableGridLayout(int rows, int cols, int hgap, int vgap) {
-        super(rows, cols, hgap, vgap);
-
-        this.rows = rows;
-        this.cols = cols;
-        this.hgap = hgap;
-        this.vgap = vgap;
-
-        if (rows != 0) {
-            rowsSet = new BitSet(rows);
-            stdRowFractions(rows);
-        }
-
-        if (cols != 0) {
-            colsSet = new BitSet(cols);
-            stdColFractions(cols);
-        }
-    }
-
-    void stdRowFractions(int nrows) {
-        rowFractions = new double[nrows];
-        for (int i = 0; i < nrows; i++) {
-            rowFractions[i] = 1.0 / nrows;
-        }
-    }
-
-    void stdColFractions(int ncols) {
-        colFractions = new double[ncols];
-        for (int i = 0; i < ncols; i++) {
-            colFractions[i] = 1.0 / ncols;
-        }
-    }
-
-    public void setRowFraction(int rowNum, double fraction) {
-        rowsSet.set(rowNum);
-        rowFractions[rowNum] = fraction;
-    }
-
-    public void setColFraction(int colNum, double fraction) {
-        colsSet.set(colNum);
-        colFractions[colNum] = fraction;
-    }
-
-    public double getRowFraction(int rowNum) {
-        return rowFractions[rowNum];
-    }
-
-    public double getColFraction(int colNum) {
-        return colFractions[colNum];
-    }
-
-    void allocateExtraSpace(double vec[], BitSet userSet) {
-        // collect the space that's been explicitly allocated...
-        double total = 0.0;
-        int unallocated = 0;
-        int i;
-        for (i = 0; i < vec.length; i++) {
-            if (userSet.get(i)) {
-                total += vec[i];
-            } else {
-                unallocated++;
-            }
-        }
-
-        // ... then spread the extra space
-        if (unallocated != 0) {
-            double space = (1.0 - total) / unallocated;
-            for (i = 0; i < vec.length; i++) {
-                if (!userSet.get(i)) {
-                    vec[i] = space;
-                    userSet.set(i);
-                }
-            }
-        }
-    }
-
-
-    void allocateExtraSpace() {
-        allocateExtraSpace(rowFractions, rowsSet);
-        allocateExtraSpace(colFractions, colsSet);
-    }
-
-    /**
-     * Lays out the container in the specified panel.
-     * @param parent the specified component being laid out
-     * @see Container
-     */
-    public void layoutContainer(Container parent) {
-        Insets insets = parent.insets();
-        int ncomponents = parent.countComponents();
-        int nrows = rows;
-        int ncols = cols;
-
-        if (nrows > 0) {
-            ncols = (ncomponents + nrows - 1) / nrows;
-        } else {
-            nrows = (ncomponents + ncols - 1) / ncols;
-        }
-
-        if (rows == 0) {
-            stdRowFractions(nrows);
-        }
-        if (cols == 0) {
-            stdColFractions(ncols);
-        }
-
-        Dimension size = parent.size();
-        int w = size.width - (insets.left + insets.right);
-        int h = size.height - (insets.top + insets.bottom);
-
-        w = (w - (ncols - 1) * hgap);
-        h = (h - (nrows - 1) * vgap);
-
-        allocateExtraSpace();
-
-        for (int c = 0, x = insets.left ; c < ncols ; c++) {
-            int colWidth = (int)(getColFraction(c) * w);
-            for (int r = 0, y = insets.top ; r < nrows ; r++) {
-                int i = r * ncols + c;
-                int rowHeight = (int)(getRowFraction(r) * h);
-
-                if (i < ncomponents) {
-                    parent.getComponent(i).reshape(x, y, colWidth, rowHeight);
-                }
-                y += rowHeight + vgap;
-            }
-            x += colWidth + hgap;
-        }
-    }
-
-    static String fracsToString(double array[]) {
-        String result = "["+array.length+"]";
-
-        for (int i = 0; i < array.length; i++) {
-            result += "<"+array[i]+">";
-        }
-        return result;
-    }
-
-    /**
-     * Returns the String representation of this VariableGridLayout's values.
-     */
-    public String toString() {
-        return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap +
-                                       ",rows=" + rows + ",cols=" + cols +
-                                       ",rowFracs=" +
-                                       fracsToString(rowFractions) +
-                                       ",colFracs=" +
-                                       fracsToString(colFractions) + "]";
-    }
-}
--- a/src/share/classes/sun/awt/VerticalBagLayout.java	Mon Dec 05 17:11:57 2011 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.*;
-
-
-/**
- * A vertical 'bag' of Components.  Allocates space for each Component from
- * top to bottom.
- *
- * @author      Herb Jellinek
- */
-public class VerticalBagLayout implements LayoutManager {
-
-    int vgap;
-
-    /**
-     * Constructs a new VerticalBagLayout.
-     */
-    public VerticalBagLayout() {
-        this(0);
-    }
-
-    /**
-     * Constructs a VerticalBagLayout with the specified gaps.
-     * @param vgap the vertical gap
-     */
-    public VerticalBagLayout(int vgap) {
-        this.vgap = vgap;
-    }
-
-    /**
-     * Adds the specified named component to the layout.
-     * @param name the String name
-     * @param comp the component to be added
-     */
-    public void addLayoutComponent(String name, Component comp) {
-    }
-
-    /**
-     * Removes the specified component from the layout.
-     * @param comp the component to be removed
-     */
-    public void removeLayoutComponent(Component comp) {
-    }
-
-    /**
-     * Returns the minimum dimensions needed to lay out the components
-     * contained in the specified target container.
-     * @param target the Container on which to do the layout
-     * @see Container
-     * @see #preferredLayoutSize
-     */
-    public Dimension minimumLayoutSize(Container target) {
-        Dimension dim = new Dimension();
-        int nmembers = target.countComponents();
-
-        for (int i = 0; i < nmembers; i++) {
-            Component comp = target.getComponent(i);
-            if (comp.isVisible()) {
-                Dimension d = comp.minimumSize();
-                dim.width = Math.max(d.width, dim.width);
-                dim.height += d.height + vgap;
-            }
-        }
-
-        Insets insets = target.insets();
-        dim.width += insets.left + insets.right;
-        dim.height += insets.top + insets.bottom;
-
-        return dim;
-    }
-
-    /**
-     * Returns the preferred dimensions for this layout given the components
-     * in the specified target container.
-     * @param target the component which needs to be laid out
-     * @see Container
-     * @see #minimumLayoutSize
-     */
-    public Dimension preferredLayoutSize(Container target) {
-        Dimension dim = new Dimension();
-        int nmembers = target.countComponents();
-
-        for (int i = 0; i < nmembers; i++) {
-            Component comp = target.getComponent(i);
-            if (true || comp.isVisible()) {
-                Dimension d = comp.preferredSize();
-                dim.width = Math.max(d.width, dim.width);
-                dim.height += d.height + vgap;
-            }
-        }
-
-        Insets insets = target.insets();
-        dim.width += insets.left + insets.right;
-        dim.height += insets.top + insets.bottom;
-
-        return dim;
-    }
-
-    /**
-     * Lays out the specified container. This method will actually reshape the
-     * components in the specified target container in order to satisfy the
-     * constraints of the VerticalBagLayout object.
-     * @param target the component being laid out
-     * @see Container
-     */
-    public void layoutContainer(Container target) {
-        Insets insets = target.insets();
-        int top = insets.top;
-        int bottom = target.size().height - insets.bottom;
-        int left = insets.left;
-        int right = target.size().width - insets.right;
-        int nmembers = target.countComponents();
-
-        for (int i = 0; i < nmembers; i++) {
-            Component comp = target.getComponent(i);
-            if (comp.isVisible()) {
-                int compHeight = comp.size().height;
-                comp.resize(right - left, compHeight);
-                Dimension d = comp.preferredSize();
-                comp.reshape(left, top, right - left, d.height);
-                top += d.height + vgap;
-            }
-        }
-    }
-
-    /**
-     * Returns the String representation of this VerticalBagLayout's values.
-     */
-    public String toString() {
-        return getClass().getName() + "[vgap=" + vgap + "]";
-    }
-}