7117011: Reduce number of warnings in sun/awt/windows and sun/awt/datatransfer
authordenis
Mon, 19 Dec 2011 16:44:36 +0400
changeset 11271 f10f98b24801
parent 11270 d7b0b63bd082
child 11272 d890af1d95b7
7117011: Reduce number of warnings in sun/awt/windows and sun/awt/datatransfer Reviewed-by: art
jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java
jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java
jdk/src/solaris/classes/sun/awt/X11/XClipboard.java
jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java
jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java
jdk/src/windows/classes/sun/awt/windows/WClipboard.java
jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java
jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java
jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java
jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java
jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
jdk/src/windows/classes/sun/awt/windows/WFramePeer.java
jdk/src/windows/classes/sun/awt/windows/WInputMethod.java
jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java
jdk/src/windows/classes/sun/awt/windows/WPageDialog.java
jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java
jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java
jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
jdk/src/windows/classes/sun/awt/windows/WToolkit.java
jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -649,8 +649,9 @@
      * The map keys are sorted according to the native formats preference
      * order.
      */
-    public SortedMap getFormatsForTransferable(Transferable contents,
-                                               FlavorTable map) {
+    public SortedMap<Long,DataFlavor> getFormatsForTransferable(
+                               Transferable contents, FlavorTable map)
+    {
         DataFlavor[] flavors = contents.getTransferDataFlavors();
         if (flavors == null) {
             return new TreeMap();
@@ -686,9 +687,13 @@
      *            DataFlavors and data formats
      * @throws NullPointerException if flavors or map is <code>null</code>
      */
-    public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
-        Map formatMap = new HashMap(flavors.length);
-        Map textPlainMap = new HashMap(flavors.length);
+    public SortedMap <Long, DataFlavor> getFormatsForFlavors(
+        DataFlavor[] flavors, FlavorTable map)
+    {
+        Map <Long,DataFlavor> formatMap =
+            new HashMap <> (flavors.length);
+        Map <Long,DataFlavor> textPlainMap =
+            new HashMap <> (flavors.length);
         // Maps formats to indices that will be used to sort the formats
         // according to the preference order.
         // Larger index value corresponds to the more preferable format.
--- a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -52,6 +52,7 @@
 
 import sun.awt.SunToolkit;
 import sun.awt.datatransfer.DataTransferer;
+import java.awt.datatransfer.DataFlavor;
 
 /**
  * <p>
@@ -126,9 +127,9 @@
         dragImageOffset   = p;
 
         Transferable transferable  = getDragSourceContext().getTransferable();
-        SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
-             (transferable, DataTransferer.adaptFlavorMap
-                 (getTrigger().getDragSource().getFlavorMap()));
+        SortedMap<Long,DataFlavor> formatMap = DataTransferer.getInstance().
+            getFormatsForTransferable(transferable, DataTransferer.adaptFlavorMap
+                (getTrigger().getDragSource().getFlavorMap()));
         long[] formats = DataTransferer.getInstance().
             keysToLongArray(formatMap);
         startDrag(transferable, formats, formatMap);
--- a/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XClipboard.java	Mon Dec 19 16:44:36 2011 +0400
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
 import java.util.SortedMap;
 import java.io.IOException;
 import java.security.AccessController;
@@ -83,7 +84,8 @@
     }
 
     protected synchronized void setContentsNative(Transferable contents) {
-        SortedMap formatMap = DataTransferer.getInstance().getFormatsForTransferable
+        SortedMap<Long,DataFlavor> formatMap =
+            DataTransferer.getInstance().getFormatsForTransferable
                 (contents, DataTransferer.adaptFlavorMap(flavorMap));
         long[] formats = DataTransferer.keysToLongArray(formatMap);
 
--- a/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java	Mon Dec 19 16:44:36 2011 +0400
@@ -40,6 +40,7 @@
 import sun.java2d.InvalidPipeException;
 import sun.java2d.Surface;
 import sun.java2d.pipe.RenderQueue;
+import sun.java2d.pipe.BufferedContext;
 import sun.java2d.pipe.hw.AccelGraphicsConfig;
 import sun.java2d.pipe.hw.AccelSurface;
 import sun.security.action.GetPropertyAction;
@@ -310,7 +311,7 @@
                     RenderQueue rq = as.getContext().getRenderQueue();
                     rq.lock();
                     try {
-                        as.getContext().validateContext(as);
+                        BufferedContext.validateContext(as);
                         rq.flushAndInvokeNow(new Runnable() {
                             public void run() {
                                 long psdops = as.getNativeOps();
--- a/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WBufferStrategy.java	Mon Dec 19 16:44:36 2011 +0400
@@ -37,7 +37,7 @@
  */
 public class WBufferStrategy {
 
-    private static native void initIDs(Class componentClass);
+    private static native void initIDs(Class <?> componentClass);
 
     static {
         initIDs(Component.class);
--- a/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -84,6 +84,7 @@
 
     native void create(WComponentPeer parent);
 
+    @SuppressWarnings("deprecation")
     void initialize() {
         Choice opt = (Choice)target;
         int itemCount = opt.getItemCount();
@@ -116,6 +117,7 @@
         super.initialize();
     }
 
+    @SuppressWarnings("deprecation")
     protected void disposeImpl() {
         // TODO: we should somehow reset the listener when the choice
         // is moved to another toplevel without destroying its peer.
--- a/jdk/src/windows/classes/sun/awt/windows/WClipboard.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WClipboard.java	Mon Dec 19 16:44:36 2011 +0400
@@ -71,17 +71,14 @@
         // Get all of the target formats into which the Transferable can be
         // translated. Then, for each format, translate the data and post
         // it to the Clipboard.
-        Map formatMap = WDataTransferer.getInstance().
+        Map <Long, DataFlavor> formatMap = WDataTransferer.getInstance().
             getFormatsForTransferable(contents, flavorMap);
 
         openClipboard(this);
 
         try {
-            for (Iterator iter = formatMap.keySet().iterator();
-                 iter.hasNext(); ) {
-                Long lFormat = (Long)iter.next();
-                long format = lFormat.longValue();
-                DataFlavor flavor = (DataFlavor)formatMap.get(lFormat);
+            for (Long format : formatMap.keySet()) {
+                DataFlavor flavor = formatMap.get(format);
 
                 try {
                     byte[] bytes = WDataTransferer.getInstance().
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -222,7 +222,7 @@
         updateWindow();
         // make sure paint events are transferred to main event queue
         // for coalescing
-        WToolkit.getWToolkit().flushPendingEvents();
+        SunToolkit.flushPendingEvents();
         // paint the damaged area
         paintArea.paint(target, shouldClearRectBeforePaint());
     }
@@ -320,6 +320,7 @@
 
     native void nativeHandleEvent(AWTEvent e);
 
+    @SuppressWarnings("fallthrough")
     public void handleEvent(AWTEvent e) {
         int id = e.getID();
 
@@ -549,6 +550,7 @@
     // fallback default font object
     final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
 
+    @SuppressWarnings("deprecation")
     public Graphics getGraphics() {
         if (isDisposed()) {
             return null;
@@ -656,6 +658,7 @@
     }
 
     // TODO: consider moving it to KeyboardFocusManagerPeerImpl
+    @SuppressWarnings("deprecation")
     public boolean requestFocus(Component lightweightChild, boolean temporary,
                                 boolean focusedWindowChangeAllowed, long time,
                                 CausedFocusEvent.Cause cause)
@@ -1058,6 +1061,7 @@
     // in the browser on Vista when DWM is enabled.
     // @return true if the toplevel container is not an EmbeddedFrame or
     // if this EmbeddedFrame is acceleration capable, false otherwise
+    @SuppressWarnings("deprecation")
     private static final boolean isContainingTopLevelAccelCapable(Component c) {
         while (c != null && !(c instanceof WEmbeddedFrame)) {
             c = c.getParent();
@@ -1072,6 +1076,7 @@
      * Applies the shape to the native component window.
      * @since 1.7
      */
+    @SuppressWarnings("deprecation")
     public void applyShape(Region shape) {
         if (shapeLog.isLoggable(PlatformLogger.FINER)) {
             shapeLog.finer(
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -107,13 +107,15 @@
         "DIBV5"
     };
 
-    private static final Map predefinedClipboardNameMap;
+    private static final Map <String, Long> predefinedClipboardNameMap;
     static {
-        Map tempMap = new HashMap(predefinedClipboardNames.length, 1.0f);
+        Map <String,Long> tempMap =
+            new HashMap <> (predefinedClipboardNames.length, 1.0f);
         for (int i = 1; i < predefinedClipboardNames.length; i++) {
             tempMap.put(predefinedClipboardNames[i], Long.valueOf(i));
         }
-        predefinedClipboardNameMap = Collections.synchronizedMap(tempMap);
+        predefinedClipboardNameMap =
+            Collections.synchronizedMap(tempMap);
     }
 
     /**
@@ -135,7 +137,7 @@
     public static final long CF_FILEGROUPDESCRIPTORA = registerClipboardFormat("FileGroupDescriptor");
     //CF_FILECONTENTS supported as mandatory associated clipboard
 
-    private static final Long L_CF_LOCALE = (Long)
+    private static final Long L_CF_LOCALE =
       predefinedClipboardNameMap.get(predefinedClipboardNames[CF_LOCALE]);
 
     private static final DirectColorModel directColorModel =
@@ -168,8 +170,11 @@
         return transferer;
     }
 
-    public SortedMap getFormatsForFlavors(DataFlavor[] flavors, FlavorTable map) {
-        SortedMap retval = super.getFormatsForFlavors(flavors, map);
+    public SortedMap <Long, DataFlavor> getFormatsForFlavors(
+        DataFlavor[] flavors, FlavorTable map)
+    {
+        SortedMap <Long, DataFlavor> retval =
+            super.getFormatsForFlavors(flavors, map);
 
         // The Win32 native code does not support exporting LOCALE data, nor
         // should it.
@@ -266,7 +271,7 @@
     }
 
     protected Long getFormatForNativeAsLong(String str) {
-        Long format = (Long)predefinedClipboardNameMap.get(str);
+        Long format = predefinedClipboardNameMap.get(str);
         if (format == null) {
             format = Long.valueOf(registerClipboardFormat(str));
         }
--- a/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WDesktopProperties.java	Mon Dec 19 16:44:36 2011 +0400
@@ -238,6 +238,7 @@
      * Called by WToolkit when Windows settings change-- we (re)load properties and
      * set new values.
      */
+    @SuppressWarnings("unchecked")
     synchronized Map<String, Object> getProperties() {
         ThemeReader.flush();
 
--- a/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -87,6 +87,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void hide() {
         Dialog dlg = (Dialog)target;
         if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
--- a/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Mon Dec 19 16:44:36 2011 +0400
@@ -27,14 +27,12 @@
 
 import sun.awt.*;
 import java.awt.*;
-import java.awt.event.*;
 import java.awt.peer.ComponentPeer;
-import java.util.*;
-import java.awt.color.*;
 import java.awt.image.*;
 import sun.awt.image.ByteInterleavedRaster;
 import sun.security.action.GetPropertyAction;
-import java.lang.reflect.*;
+import java.security.PrivilegedAction;
+import  java.security.AccessController;
 
 public class WEmbeddedFrame extends EmbeddedFrame {
 
@@ -52,8 +50,8 @@
     private static int pScale = 0;
     private static final int MAX_BAND_SIZE = (1024*30);
 
-    private static String printScale = (String) java.security.AccessController
-       .doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
+    private static String printScale = AccessController.doPrivileged(
+        new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
 
     public WEmbeddedFrame() {
         this((long)0);
@@ -75,6 +73,7 @@
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         if (getPeer() == null) {
             WToolkit toolkit = (WToolkit)Toolkit.getDefaultToolkit();
@@ -134,8 +133,8 @@
 
             bandHeight = Math.min(MAX_BAND_SIZE/bandWidth, frameHeight);
 
-            imgWid = (int)(bandWidth * xscale);
-            imgHgt = (int)(bandHeight * yscale);
+            imgWid = bandWidth * xscale;
+            imgHgt = bandHeight * yscale;
             bandImage = new BufferedImage(imgWid, imgHgt,
                                           BufferedImage.TYPE_3BYTE_BGR);
         }
@@ -159,7 +158,7 @@
             if ((bandTop+bandHeight) > frameHeight) {
                 // last band
                 currBandHeight = frameHeight - bandTop;
-                currImgHeight = (int)(currBandHeight*yscale);
+                currImgHeight = currBandHeight*yscale;
 
                 // multiply by 3 because the image is a 3 byte BGR
                 imageOffset = imgWid*(imgHgt-currImgHeight)*3;
@@ -179,9 +178,9 @@
         if (printScale == null) {
             // if no system property is specified,
             // check for environment setting
-            printScale = (String) java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                    public Object run() {
+            printScale = AccessController.doPrivileged(
+                new PrivilegedAction<String>() {
+                    public String run() {
                         return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE");
                     }
                 }
@@ -226,6 +225,7 @@
     public void activateEmbeddingTopLevel() {
     }
 
+    @SuppressWarnings("deprecation")
     public void synthesizeWindowActivation(final boolean doActivate) {
         if (!doActivate || EventQueue.isDispatchThread()) {
             ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate);
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -167,7 +167,7 @@
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
              public void run() {
-                 fileDialog.hide();
+                 fileDialog.setVisible(false);
              }
         });
     } // handleSelected()
@@ -182,16 +182,16 @@
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
              public void run() {
-                 fileDialog.hide();
+                 fileDialog.setVisible(false);
              }
         });
     } // handleCancel()
 
     //This whole static block is a part of 4152317 fix
     static {
-        String filterString = (String) AccessController.doPrivileged(
-            new PrivilegedAction() {
-                public Object run() {
+        String filterString = AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                public String run() {
                     try {
                         ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
                         return rb.getString("allFiles");
--- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -24,25 +24,12 @@
  */
 package sun.awt.windows;
 
-import java.util.Vector;
-
 import java.awt.*;
 import java.awt.peer.*;
-import java.awt.image.ImageObserver;
-
-import java.awt.image.Raster;
-import java.awt.image.DataBuffer;
-import java.awt.image.DataBufferInt;
-import java.awt.image.BufferedImage;
-
-import java.awt.image.ColorModel;
-
-import sun.awt.image.ImageRepresentation;
-import sun.awt.image.IntegerComponentRaster;
-import sun.awt.image.ToolkitImage;
-import sun.awt.im.*;
-import sun.awt.Win32GraphicsDevice;
 import sun.awt.AWTAccessor;
+import sun.awt.im.InputMethodManager;
+import java.security.AccessController;
+import sun.security.action.GetPropertyAction;
 
 class WFramePeer extends WWindowPeer implements FramePeer {
 
@@ -71,9 +58,9 @@
     private native void clearMaximizedBounds();
 
     private static final boolean keepOnMinimize = "true".equals(
-        (String)java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction(
-                "sun.awt.keepWorkingSetOnMinimize")));
+        AccessController.doPrivileged(
+            new GetPropertyAction(
+            "sun.awt.keepWorkingSetOnMinimize")));
 
     public void setMaximizedBounds(Rectangle b) {
         if (b == null) {
--- a/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WInputMethod.java	Mon Dec 19 16:44:36 2011 +0400
@@ -82,12 +82,12 @@
     private final static boolean COMMIT_INPUT           = true;
     private final static boolean DISCARD_INPUT          = false;
 
-    private static Map[] highlightStyles;
+    private static Map<TextAttribute,Object> [] highlightStyles;
 
     // Initialize highlight mapping table
     static {
-        Map styles[] = new Map[4];
-        HashMap map;
+        Map<TextAttribute,Object> styles[] = new Map[4];
+        HashMap<TextAttribute,Object> map;
 
         // UNSELECTED_RAW_TEXT_HIGHLIGHT
         map = new HashMap(1);
@@ -410,7 +410,7 @@
     /**
      * @see java.awt.Toolkit#mapInputMethodHighlight
      */
-    static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
+    static Map<TextAttribute,?> mapInputMethodHighlight(InputMethodHighlight highlight) {
         int index;
         int state = highlight.getState();
         if (state == InputMethodHighlight.RAW_TEXT) {
--- a/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WMenuItemPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -158,9 +158,9 @@
     private static Font defaultMenuFont;
 
     static {
-        defaultMenuFont = (Font) AccessController.doPrivileged(
-            new PrivilegedAction() {
-                public Object run() {
+        defaultMenuFont = AccessController.doPrivileged(
+            new PrivilegedAction <Font> () {
+                public Font run() {
                     try {
                         ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
                         return Font.decode(rb.getString("menuFont"));
--- a/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialog.java	Mon Dec 19 16:44:36 2011 +0400
@@ -55,6 +55,7 @@
         this.painter = painter;
     }
 
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized(getTreeLock()) {
             Container parent = getParent();
--- a/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WPageDialogPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -49,7 +49,7 @@
                      // but if it is we need to trap it so the thread does
                      // not hide is called and the thread doesn't hang.
                     }
-                    ((WPrintDialog)target).hide();
+                    ((WPrintDialog)target).setVisible(false);
                 }
             }).start();
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialog.java	Mon Dec 19 16:44:36 2011 +0400
@@ -53,6 +53,7 @@
     // Use native code to circumvent access restrictions on Component.peer
     protected native void setPeer(ComponentPeer peer);
 
+    @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized(getTreeLock()) {
             Container parent = getParent();
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -73,7 +73,7 @@
                     // but if it is we need to trap it so the thread does
                     // not hide is called and the thread doesn't hang.
                 }
-                ((WPrintDialog)target).hide();
+                ((WPrintDialog)target).setVisible(false);
             }
         }).start();
     }
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Mon Dec 19 16:44:36 2011 +0400
@@ -74,7 +74,7 @@
     WClipboard clipboard;
 
     // cache of font peers
-    private Hashtable cacheFontPeer;
+    private Hashtable<String,FontPeer> cacheFontPeer;
 
     // Windows properties
     private WDesktopProperties  wprops;
@@ -110,10 +110,10 @@
             log.fine("Win version: " + getWindowsVersion());
         }
 
-        java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction()
+        AccessController.doPrivileged(
+            new PrivilegedAction <Void> ()
         {
-            public Object run() {
+            public Void run() {
                 String browserProp = System.getProperty("browser");
                 if (browserProp != null && browserProp.equals("sun.plugin")) {
                     disableCustomPalette();
@@ -261,8 +261,8 @@
     }
 
     private final void registerShutdownHook() {
-        AccessController.doPrivileged(new PrivilegedAction() {
-            public Object run() {
+        AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            public Void run() {
                 ThreadGroup currentTG =
                     Thread.currentThread().getThreadGroup();
                 ThreadGroup parentTG = currentTG.getParent();
@@ -399,6 +399,7 @@
         return peer;
     }
 
+    @SuppressWarnings("deprecation")
     public void disableBackgroundErase(Canvas canvas) {
         WCanvasPeer peer = (WCanvasPeer)canvas.getPeer();
         if (peer == null) {
@@ -592,7 +593,7 @@
         FontPeer retval = null;
         String lcName = name.toLowerCase();
         if (null != cacheFontPeer) {
-            retval = (FontPeer)cacheFontPeer.get(lcName + style);
+            retval = cacheFontPeer.get(lcName + style);
             if (null != retval) {
                 return retval;
             }
@@ -600,7 +601,7 @@
         retval = new WFontPeer(name, style);
         if (retval != null) {
             if (null == cacheFontPeer) {
-                cacheFontPeer = new Hashtable(5, (float)0.9);
+                cacheFontPeer = new Hashtable<>(5, 0.9f);
             }
             if (null != cacheFontPeer) {
                 cacheFontPeer.put(lcName + style, retval);
@@ -698,7 +699,9 @@
     /**
      * Returns a style map for the input method highlight.
      */
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
+    public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
+        InputMethodHighlight highlight)
+    {
         return WInputMethod.mapInputMethodHighlight(highlight);
     }
 
@@ -968,12 +971,14 @@
         return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
     }
 
+    @SuppressWarnings("deprecation")
     public void grab(Window w) {
         if (w.getPeer() != null) {
             ((WWindowPeer)w.getPeer()).grab();
         }
     }
 
+    @SuppressWarnings("deprecation")
     public void ungrab(Window w) {
         if (w.getPeer() != null) {
            ((WWindowPeer)w.getPeer()).ungrab();
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Mon Dec 19 15:21:35 2011 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Mon Dec 19 16:44:36 2011 +0400
@@ -92,7 +92,7 @@
     }
 
     // WComponentPeer overrides
-
+    @SuppressWarnings("unchecked")
     protected void disposeImpl() {
         AppContext appContext = SunToolkit.targetToAppContext(target);
         synchronized (appContext) {
@@ -378,6 +378,7 @@
         return modalBlocker != null;
     }
 
+     @SuppressWarnings("deprecation")
     public void setModalBlocked(Dialog dialog, boolean blocked) {
         synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
         {
@@ -417,6 +418,7 @@
      * The list is sorted by the time of activation, so the latest
      * active window is always at the end.
      */
+    @SuppressWarnings("unchecked")
     public static long[] getActiveWindowHandles() {
         AppContext appContext = AppContext.getAppContext();
         synchronized (appContext) {
@@ -571,6 +573,7 @@
         super.print(g);
     }
 
+    @SuppressWarnings("deprecation")
     private void replaceSurfaceDataRecursively(Component c) {
         if (c instanceof Container) {
             for (Component child : ((Container)c).getComponents()) {
@@ -691,13 +694,13 @@
             // its shape only. To restore the correct visual appearance
             // of the window (i.e. w/ the correct shape) we have to reset
             // the shape.
-            Shape shape = ((Window)target).getShape();
+            Shape shape = target.getShape();
             if (shape != null) {
-                ((Window)target).setShape(shape);
+                target.setShape(shape);
             }
         }
 
-        if (((Window)target).isVisible()) {
+        if (target.isVisible()) {
             updateWindow(true);
         }
     }
@@ -730,6 +733,7 @@
      * then the method registers ActiveWindowListener, GuiDisposedListener listeners;
      * it executes the initilialization only once per AppContext.
      */
+    @SuppressWarnings("unchecked")
     private static void initActiveWindowsTracking(Window w) {
         AppContext appContext = AppContext.getAppContext();
         synchronized (appContext) {
@@ -774,6 +778,7 @@
      * updates the list of active windows per AppContext, so the latest active
      * window is always at the end of the list. The list is stored in AppContext.
      */
+    @SuppressWarnings( value = {"deprecation", "unchecked"})
     private static class ActiveWindowListener implements PropertyChangeListener {
         public void propertyChange(PropertyChangeEvent e) {
             Window w = (Window)e.getNewValue();