changeset 10011:73e09a1f1f3f

Merge
author wetmore
date Fri, 23 May 2014 23:55:14 +0000
parents 069b9bde2729 e48e3e902f4c
children 182b5d527267
files src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine src/share/classes/sun/misc/ThreadGroupUtils.java src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine src/solaris/native/sun/awt/awt_Plugin.c src/solaris/native/sun/awt/awt_Plugin.h
diffstat 294 files changed, 12379 insertions(+), 2230 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu May 22 20:24:42 2014 +0000
+++ b/.hgtags	Fri May 23 23:55:14 2014 +0000
@@ -256,3 +256,4 @@
 47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
 83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12
 c7c8002d02721e02131d104549ebeb8b379fb8d2 jdk9-b13
+5c7a17a81afd0906b53ee31d95a3211c96ff6b25 jdk9-b14
--- a/make/CopyIntoClasses.gmk	Thu May 22 20:24:42 2014 +0000
+++ b/make/CopyIntoClasses.gmk	Fri May 23 23:55:14 2014 +0000
@@ -111,20 +111,8 @@
   ALL_META-INF_DIRS := $(ALL_META-INF_DIRS_share)
 endif
 
-ifndef OPENJDK
-  ALL_META-INF_DIRS += $(JDK_TOPDIR)/src/closed/share/classes/sun/java2d/cmm/kcms/META-INF
-endif
-
 SRC_SERVICES_FILES := $(wildcard $(addsuffix /services/*, $(ALL_META-INF_DIRS)))
 
-ifdef OPENJDK
-  SRC_SERVICES_FILES := $(filter-out %sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES))
-  SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
-else
-  SRC_SERVICES_FILES := $(filter-out %sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES))
-  SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
-endif
-
 # The number of services files are relatively few. If the increase in numbers, then
 # we have to use ListPathsSafelyNow here.
 # Change $(JDK_TOPDIR)/src/.../META-INF/services/yyyy into $(JDK_OUTPUTDIR)/classes/META-INF/services/yyyy
--- a/make/lib/Awt2dLibraries.gmk	Thu May 22 20:24:42 2014 +0000
+++ b/make/lib/Awt2dLibraries.gmk	Fri May 23 23:55:14 2014 +0000
@@ -318,7 +318,7 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
+  LIBAWT_FILES += awt_LoadLibrary.c
   LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
 endif
 
@@ -606,7 +606,6 @@
         debug_mem.c \
         debug_trace.c \
         debug_util.c \
-        awt_Plugin.c \
         gnome_interface.c \
         gtk2_interface.c \
         swing_GTKEngine.c \
@@ -657,17 +656,34 @@
 
 ##########################################################################################
 
+LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms
+
+ifeq ($(USE_EXTERNAL_LCMS), true)
+  # If we're using an external library, we'll just need the wrapper part.
+  # By including it explicitely, all other files will be excluded.
+  BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
+  BUILD_LIBLCMS_HEADERS :=
+else
+  BUILD_LIBLCMS_INCLUDE_FILES :=
+  # If we're using the bundled library, we'll need to include it in the
+  # include path explicitly. Otherwise the system headers will be used.
+  BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR)
+endif
+
 # TODO: Update awt lib path when awt is converted
 $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
     LIBRARY := lcms, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
+    SRC := $(LIBLCMS_DIR), \
+    INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
     LANG := C, \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
         $(SHARED_LIBRARY_FLAGS) \
         -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
-        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
+        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+        $(BUILD_LIBLCMS_HEADERS) \
+        $(LCMS_CFLAGS), \
     CFLAGS_solaris := -xc99=no_lib, \
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
@@ -675,10 +691,10 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
     LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
-    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
-    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
-    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
-    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\
+    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
+    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \
+    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \
+    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
     RC_FLAGS := $(RC_FLAGS) \
         -D "JDK_FNAME=lcms.dll" \
--- a/make/mapfiles/libawt/mapfile-mawt-vers	Thu May 22 20:24:42 2014 +0000
+++ b/make/mapfiles/libawt/mapfile-mawt-vers	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2014, 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
@@ -249,11 +249,6 @@
 		Java_sun_awt_motif_XsessionWMcommand;
 		Java_sun_awt_motif_XsessionWMcommand_New;
 
-		# Java Plugin
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		AWTCountFonts;
--- a/make/mapfiles/libawt/mapfile-vers	Thu May 22 20:24:42 2014 +0000
+++ b/make/mapfiles/libawt/mapfile-vers	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, 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
@@ -173,13 +173,6 @@
 		Java_sun_awt_motif_XsessionWMcommand;
 		Java_sun_awt_motif_XsessionWMcommand_New;
 
-		# Java Plugin
-                # This is in awt_LoadLibrary.c and falls through to libmawt.
-                # Evidently plugin needs this for backward compatability.
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		GrPrim_Sg2dGetCompInfo;
--- a/make/mapfiles/libawt/mapfile-vers-linux	Thu May 22 20:24:42 2014 +0000
+++ b/make/mapfiles/libawt/mapfile-vers-linux	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, 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
@@ -152,13 +152,6 @@
                 # Evidently CDE needs this for backward compatability.
 		Java_sun_awt_motif_XsessionWMcommand;
 
-		# Java Plugin
-                # This is in awt_LoadLibrary.c and falls through to libmawt.
-                # Evidently plugin needs this for backward compatability.
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		GrPrim_Sg2dGetCompInfo;
@@ -283,11 +276,6 @@
 		# CDE private entry point
 		Java_sun_awt_motif_XsessionWMcommand;
 
-		# Java Plugin
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		AWTCountFonts;
--- a/make/mapfiles/libawt_xawt/mapfile-vers	Thu May 22 20:24:42 2014 +0000
+++ b/make/mapfiles/libawt_xawt/mapfile-vers	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, 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
@@ -449,12 +449,6 @@
         awt_Lock;
         awt_GetComponent;
 
-        # Java Plugin
-        # This is in awt_LoadLibrary.c and falls through to libmawt.
-        # Evidently plugin needs this for backward compatability.
-        getAwtLockFunctions;
-        getAwtData;
-        getAwtDisplay;
         #XAWT entry point for CDE
         Java_sun_awt_motif_XsessionWMcommand;
         Java_sun_awt_motif_XsessionWMcommand_New;
--- a/make/mapfiles/libjpeg/mapfile-vers-closed	Thu May 22 20:24:42 2014 +0000
+++ b/make/mapfiles/libjpeg/mapfile-vers-closed	Fri May 23 23:55:14 2014 +0000
@@ -31,10 +31,6 @@
 
 		Java_sun_awt_image_JPEGImageDecoder_initIDs;
 		Java_sun_awt_image_JPEGImageDecoder_readImage;
-		Java_sun_awt_image_codec_JPEGImageDecoderImpl_initDecoder;
-		Java_sun_awt_image_codec_JPEGImageDecoderImpl_readJPEGStream;
-		Java_sun_awt_image_codec_JPEGImageEncoderImpl_initEncoder;
-		Java_sun_awt_image_codec_JPEGImageEncoderImpl_writeJPEGStream;
 
                 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs;
                 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader;
--- a/make/profile-rtjar-includes.txt	Thu May 22 20:24:42 2014 +0000
+++ b/make/profile-rtjar-includes.txt	Fri May 23 23:55:14 2014 +0000
@@ -239,6 +239,4 @@
     META-INF/services/javax.sound.sampled.spi.AudioFileReader \
     META-INF/services/javax.sound.sampled.spi.AudioFileWriter \
     META-INF/services/javax.sound.sampled.spi.FormatConversionProvider \
-    META-INF/services/javax.sound.sampled.spi.MixerProvider \
-    META-INF/services/sun.java2d.cmm.PCMM \
-    META-INF/services/sun.java2d.pipe.RenderingEngine
+    META-INF/services/javax.sound.sampled.spi.MixerProvider
--- a/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Fri May 23 23:55:14 2014 +0000
@@ -121,6 +121,10 @@
     public void show() {
         final int startItemCount = comboBox.getItemCount();
 
+        if (startItemCount == 0) {
+            return;
+        }
+
         final Rectangle popupBounds = adjustPopupAndGetBounds();
         if (popupBounds == null) return; // null means don't show
 
--- a/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Fri May 23 23:55:14 2014 +0000
@@ -46,10 +46,8 @@
 import com.apple.laf.AquaIcon.SystemIcon;
 import com.apple.laf.AquaUtils.RecyclableObject;
 import com.apple.laf.AquaUtils.RecyclableSingleton;
-import java.util.Arrays;
-import java.util.List;
-import sun.awt.image.MultiResolutionBufferedImage;
 import sun.awt.image.MultiResolutionImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 public class AquaImageFactory {
     public static IconUIResource getConfirmImageIcon() {
@@ -57,7 +55,7 @@
 
         return new IconUIResource(new AquaIcon.CachingScalingIcon(kAlertIconSize, kAlertIconSize) {
             Image createImage() {
-                return getThisApplicationsIcon(kAlertIconSize, kAlertIconSize);
+                return getGenericJavaIcon();
             }
         });
     }
@@ -83,24 +81,6 @@
         return getAppIconCompositedOn(lockIcon);
     }
 
-    static Image getThisApplicationsIcon(final int width, final int height) {
-        final String path = getPathToThisApplication();
-
-        if (path == null) {
-            return getGenericJavaIcon();
-        }
-
-        if (path.endsWith("/Home/bin")) {
-            return getGenericJavaIcon();
-        }
-
-        if (path.startsWith("/usr/bin")) {
-            return getGenericJavaIcon();
-        }
-
-        return AquaUtils.getCImageCreator().createImageOfFile(path, height, width);
-    }
-
     static Image getGenericJavaIcon() {
         return java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
             public Image run() {
@@ -125,9 +105,9 @@
     private static final int kAlertIconSize = 64;
     static IconUIResource getAppIconCompositedOn(final Image background) {
 
-        if (background instanceof MultiResolutionBufferedImage) {
+        if (background instanceof MultiResolutionCachedImage) {
             int width = background.getWidth(null);
-            Image mrIconImage = ((MultiResolutionBufferedImage) background).map(
+            Image mrIconImage = ((MultiResolutionCachedImage) background).map(
                     rv -> getAppIconImageCompositedOn(rv, rv.getWidth(null) / width));
             return new IconUIResource(new ImageIcon(mrIconImage));
         }
@@ -144,7 +124,7 @@
         final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(
                 kAlertSubIconSize, kAlertSubIconSize) {
                     Image createImage() {
-                        return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
+                        return getGenericJavaIcon();
                     }
                 };
 
@@ -306,21 +286,7 @@
     private static Image getNSIcon(String imageName) {
         Image icon = Toolkit.getDefaultToolkit()
                 .getImage("NSImage://" + imageName);
-
-        if (icon instanceof MultiResolutionImage) {
-            return icon;
-        }
-
-        int w = icon.getWidth(null);
-        int h = icon.getHeight(null);
-
-        Dimension[] sizes = new Dimension[]{
-            new Dimension(w, h), new Dimension(2 * w, 2 * h)
-        };
-
-        return new MultiResolutionBufferedImage(icon, sizes, (width, height) ->
-                AquaUtils.getCImageCreator().createImageFromName(
-                        imageName, width, height));
+        return icon;
     }
 
     public static class NineSliceMetrics {
@@ -530,4 +496,4 @@
     public static Color getSelectionInactiveForegroundColorUIResource() {
         return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
     }
-}
\ No newline at end of file
+}
--- a/src/macosx/classes/com/apple/laf/AquaPainter.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/com/apple/laf/AquaPainter.java	Fri May 23 23:55:14 2014 +0000
@@ -174,11 +174,7 @@
                                                         bounds, controlState);
             Image img = cache.getImage(key);
             if (img == null) {
-
-                Image baseImage = createImage(imgX, imgY, imgW, imgH, bounds,
-                                              control, controlState);
-
-                img = new MultiResolutionBufferedImage(baseImage,
+                img = new MultiResolutionCachedImage(imgW, imgH,
                         (rvWidth, rvHeight) -> createImage(imgX, imgY,
                          rvWidth, rvHeight, bounds, control, controlState));
 
--- a/src/macosx/classes/com/apple/laf/AquaUtils.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/com/apple/laf/AquaUtils.java	Fri May 23 23:55:14 2014 +0000
@@ -48,7 +48,7 @@
 import sun.swing.SwingUtilities2;
 
 import com.apple.laf.AquaImageFactory.SlicedImageControl;
-import sun.awt.image.MultiResolutionBufferedImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 final class AquaUtils {
 
@@ -124,8 +124,8 @@
 
     static Image generateLightenedImage(final Image image, final int percent) {
         final GrayFilter filter = new GrayFilter(true, percent);
-        return (image instanceof MultiResolutionBufferedImage)
-                ? ((MultiResolutionBufferedImage) image).map(
+        return (image instanceof MultiResolutionCachedImage)
+                ? ((MultiResolutionCachedImage) image).map(
                         rv -> generateLightenedImage(rv, filter))
                 : generateLightenedImage(image, filter);
     }
--- a/src/macosx/classes/sun/font/CFontManager.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/font/CFontManager.java	Fri May 23 23:55:14 2014 +0000
@@ -40,7 +40,7 @@
 
 import sun.awt.FontConfiguration;
 import sun.awt.HeadlessToolkit;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.lwawt.macosx.*;
 
 public class CFontManager extends SunFontManager {
--- a/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Fri May 23 23:55:14 2014 +0000
@@ -171,7 +171,9 @@
             SwingUtilities.invokeLater(() -> {
                 JPopupMenu popupMenu = getPopupMenu();
                 // Need to override the invoker for proper grab handling
-                if (popupMenu != null && popupMenu.getInvoker() != getTarget()) {
+                if (popupMenu != null
+                        && popupMenu.isShowing()
+                        && popupMenu.getInvoker() != getTarget()) {
                     // The popup is now visible with correct location
                     // Save it and restore after toggling visibility and changing invoker
                     Point loc = popupMenu.getLocationOnScreen();
--- a/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -63,8 +63,6 @@
 import javax.swing.SwingUtilities;
 import javax.swing.RepaintManager;
 
-import sun.lwawt.macosx.CDropTarget;
-
 import com.sun.java.swing.SwingUtilities3;
 
 public abstract class LWComponentPeer<T extends Component, D extends JComponent>
@@ -137,7 +135,7 @@
     private final Object dropTargetLock = new Object();
 
     private int fNumDropTargets = 0;
-    private CDropTarget fDropTarget = null;
+    private PlatformDropTarget fDropTarget = null;
 
     private final PlatformComponent platformComponent;
 
@@ -1063,11 +1061,11 @@
                 // if it's the first (or last) one for the component. Otherwise this call is a no-op.
                 if (++fNumDropTargets == 1) {
                     // Having a non-null drop target would be an error but let's check just in case:
-                    if (fDropTarget != null)
-                        System.err.println("CComponent.addDropTarget(): current drop target is non-null.");
-
+                    if (fDropTarget != null) {
+                        throw new IllegalStateException("Current drop target is not null");
+                    }
                     // Create a new drop target:
-                    fDropTarget = CDropTarget.createDropTarget(dt, target, this);
+                    fDropTarget = LWToolkit.getLWToolkit().createDropTarget(dt, target, this);
                 }
             }
         }
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Fri May 23 23:55:14 2014 +0000
@@ -28,6 +28,7 @@
 import java.awt.*;
 import java.awt.List;
 import java.awt.datatransfer.*;
+import java.awt.dnd.DropTarget;
 import java.awt.image.*;
 import java.awt.peer.*;
 import java.security.*;
@@ -35,7 +36,7 @@
 
 import sun.awt.*;
 import sun.print.*;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 import static sun.lwawt.LWWindowPeer.PeerType;
 
@@ -440,6 +441,10 @@
 
     protected abstract FileDialogPeer createFileDialogPeer(FileDialog target);
 
+    protected abstract PlatformDropTarget createDropTarget(DropTarget dropTarget,
+                                                           Component component,
+                                                           LWComponentPeer<?, ?> peer);
+
     // ---- UTILITY METHODS ---- //
 
     /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/macosx/classes/sun/lwawt/PlatformDropTarget.java	Fri May 23 23:55:14 2014 +0000
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, 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.lwawt;
+
+public interface PlatformDropTarget {
+
+    /**
+     * Release native dragging destination, if any
+     */
+    void dispose();
+}
--- a/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Fri May 23 23:55:14 2014 +0000
@@ -31,6 +31,7 @@
 
 import java.io.*;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.text.Normalizer;
 import java.text.Normalizer.Form;
 import java.util.*;
@@ -126,7 +127,7 @@
 
             if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
             {
-                String charset = getDefaultTextCharset();
+                String charset = Charset.defaultCharset().name();
                 if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
                     try {
                         charset = new String((byte[])transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
--- a/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java	Fri May 23 23:55:14 2014 +0000
@@ -25,54 +25,37 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.Component;
-import java.awt.peer.ComponentPeer;
+import sun.lwawt.LWComponentPeer;
+import sun.lwawt.PlatformDropTarget;
+
+import java.awt.*;
 import java.awt.dnd.DropTarget;
 
-import sun.lwawt.LWComponentPeer;
-import sun.lwawt.PlatformWindow;
 
+final class CDropTarget implements PlatformDropTarget {
+    private long fNativeDropTarget;
 
-public final class CDropTarget {
-
-    Component        fComponent;
-    ComponentPeer    fPeer;
-    DropTarget        fDropTarget;
-    private long    fNativeDropTarget;
-
-    public static CDropTarget createDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) {
-        return new CDropTarget(dropTarget, component, peer);
-    }
-
-    private CDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) {
-        super();
-
-        fDropTarget = dropTarget;
-        fComponent = component;
-        fPeer = peer;
-
-        long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
+    CDropTarget(DropTarget dropTarget, Component component, LWComponentPeer<?, ?> peer) {
+        long nativePeer = CPlatformWindow.getNativeViewPtr(peer.getPlatformWindow());
         if (nativePeer == 0L) return; // Unsupported for a window without a native view (plugin)
 
         // Create native dragging destination:
-        fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
+        fNativeDropTarget = createNativeDropTarget(dropTarget, component, nativePeer);
         if (fNativeDropTarget == 0) {
             throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed.");
         }
     }
 
-    public DropTarget getDropTarget() {
-        return fDropTarget;
-    }
-
+    @Override
     public void dispose() {
-        // Release native dragging destination, if any:
         if (fNativeDropTarget != 0) {
-            this.releaseNativeDropTarget(fNativeDropTarget);
+            releaseNativeDropTarget(fNativeDropTarget);
             fNativeDropTarget = 0;
         }
     }
 
-    protected native long createNativeDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer, long nativePeer);
+    protected native long createNativeDropTarget(DropTarget dropTarget,
+                                                 Component component,
+                                                 long nativePeer);
     protected native void releaseNativeDropTarget(long nativeDropTarget);
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CImage.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/macosx/CImage.java	Fri May 23 23:55:14 2014 +0000
@@ -32,7 +32,7 @@
 import java.util.Arrays;
 import java.util.List;
 import sun.awt.image.MultiResolutionImage;
-import sun.awt.image.MultiResolutionBufferedImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 import sun.awt.image.SunWritableRaster;
 
@@ -62,41 +62,41 @@
         // This is used to create a CImage with an NSImage pointer. It MUST be a CFRetained
         // NSImage, and the CImage takes ownership of the non-GC retain. If callers need the
         // NSImage themselves, they MUST call retain on the NSImage themselves.
-        public BufferedImage createImageUsingNativeSize(final long image) {
+        public Image createImageUsingNativeSize(final long image) {
             if (image == 0) return null;
             final Dimension2D size = nativeGetNSImageSize(image);
-            return createBufferedImage(image, size.getWidth(), size.getHeight());
+            return createImage(image, size.getWidth(), size.getHeight());
         }
 
         // the width and height passed in as a parameter could differ than the width and the height of the NSImage (image), in that case, the image will be scaled
-        BufferedImage createBufferedImage(long image, double width, double height) {
+        Image createImage(long image, double width, double height) {
             if (image == 0) throw new Error("Unable to instantiate CImage with null native image reference.");
             return createImageWithSize(image, width, height);
         }
 
-        public BufferedImage createImageWithSize(final long image, final double width, final double height) {
+        public Image createImageWithSize(final long image, final double width, final double height) {
             final CImage img = new CImage(image);
             img.resize(width, height);
             return img.toImage();
         }
 
         // This is used to create a CImage that represents the icon of the given file.
-        public BufferedImage createImageOfFile(final String file, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
+        public Image createImageOfFile(final String file, final int width, final int height) {
+            return createImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
         }
 
-        public BufferedImage createImageFromFile(final String file, final double width, final double height) {
+        public Image createImageFromFile(final String file, final double width, final double height) {
             final long image = nativeCreateNSImageFromFileContents(file);
             nativeSetNSImageSize(image, width, height);
-            return createBufferedImage(image, width, height);
+            return createImage(image, width, height);
         }
 
-        public BufferedImage createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
+        public Image createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
+            return createImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
         }
 
         public Image createImageFromName(final String name, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageFromImageName(name), width, height);
+            return createImage(nativeCreateNSImageFromImageName(name), width, height);
         }
 
         public Image createImageFromName(final String name) {
@@ -232,7 +232,7 @@
     }
 
     /** @return A MultiResolution image created from nsImagePtr, or null. */
-    private BufferedImage toImage() {
+    private Image toImage() {
         if (ptr == 0) return null;
 
         final Dimension2D size = nativeGetNSImageSize(ptr);
@@ -243,11 +243,11 @@
                 = nativeGetNSImageRepresentationSizes(ptr,
                         size.getWidth(), size.getHeight());
 
-        BufferedImage baseImage = toImage(w, h, w, h);
-
-        return sizes == null || sizes.length < 2 ? baseImage
-                : new MultiResolutionBufferedImage(baseImage, sizes,
-                        (width, height) -> toImage(w, h, width, height));
+        return sizes == null || sizes.length < 2 ?
+                new MultiResolutionCachedImage(w, h, (width, height)
+                        -> toImage(w, h, width, height))
+                : new MultiResolutionCachedImage(w, h, sizes, (width, height)
+                        -> toImage(w, h, width, height));
     }
 
     private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
--- a/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Fri May 23 23:55:14 2014 +0000
@@ -309,6 +309,10 @@
     @Override
     public void dispose() {
         cancelTasks();
+        SurfaceData surfaceData = contentView.getSurfaceData();
+        if (surfaceData != null) {
+            surfaceData.invalidate();
+        }
         super.dispose();
     }
 
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri May 23 23:55:14 2014 +0000
@@ -611,19 +611,20 @@
     }
 
     /**
-     * Kicks an event over to the appropriate eventqueue and waits for it to
+     * Kicks an event over to the appropriate event queue and waits for it to
      * finish To avoid deadlocking, we manually run the NSRunLoop while waiting
      * Any selector invoked using ThreadUtilities performOnMainThread will be
      * processed in doAWTRunLoop The InvocationEvent will call
      * LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
-     * runloop Does not dispatch native events while in the loop
+     * run loop. Does not dispatch native events while in the loop
      */
     public static void invokeAndWait(Runnable runnable, Component component)
             throws InvocationTargetException {
-        final long mediator = createAWTRunLoopMediator();
+        Objects.requireNonNull(component, "Null component provided to invokeAndWait");
 
+        long mediator = createAWTRunLoopMediator();
         InvocationEvent invocationEvent =
-                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(),
+                new InvocationEvent(component,
                         runnable,
                         () -> {
                             if (mediator != 0) {
@@ -632,49 +633,42 @@
                         },
                         true);
 
-        if (component != null) {
-            AppContext appContext = SunToolkit.targetToAppContext(component);
-            SunToolkit.postEvent(appContext, invocationEvent);
-
-            // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
-            SunToolkit.flushPendingEvents(appContext);
-        } else {
-            // This should be the equivalent to EventQueue.invokeAndWait
-            ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
-        }
-
+        AppContext appContext = SunToolkit.targetToAppContext(component);
+        SunToolkit.postEvent(appContext, invocationEvent);
+        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
+        SunToolkit.flushPendingEvents(appContext);
         doAWTRunLoop(mediator, false);
 
-        Throwable eventException = invocationEvent.getException();
-        if (eventException != null) {
-            if (eventException instanceof UndeclaredThrowableException) {
-                eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
-            }
-            throw new InvocationTargetException(eventException);
-        }
+        checkException(invocationEvent);
     }
 
     public static void invokeLater(Runnable event, Component component)
             throws InvocationTargetException {
-        final InvocationEvent invocationEvent =
-                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
+        Objects.requireNonNull(component, "Null component provided to invokeLater");
 
-        if (component != null) {
-            final AppContext appContext = SunToolkit.targetToAppContext(component);
-            SunToolkit.postEvent(appContext, invocationEvent);
+        InvocationEvent invocationEvent = new InvocationEvent(component, event);
 
-            // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
-            SunToolkit.flushPendingEvents(appContext);
-        } else {
-            // This should be the equivalent to EventQueue.invokeAndWait
-            ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
-        }
+        AppContext appContext = SunToolkit.targetToAppContext(component);
+        SunToolkit.postEvent(SunToolkit.targetToAppContext(component), invocationEvent);
+        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
+        SunToolkit.flushPendingEvents(appContext);
 
-        final Throwable eventException = invocationEvent.getException();
+        checkException(invocationEvent);
+    }
+
+    /**
+     * Checks if exception occurred while {@code InvocationEvent} was processed and rethrows it as
+     * an {@code InvocationTargetException}
+     *
+     * @param event the event to check for an exception
+     * @throws InvocationTargetException if exception occurred when event was processed
+     */
+    private static void checkException(InvocationEvent event) throws InvocationTargetException {
+        Throwable eventException = event.getException();
         if (eventException == null) return;
 
         if (eventException instanceof UndeclaredThrowableException) {
-            throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
+            eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
         }
         throw new InvocationTargetException(eventException);
     }
@@ -686,11 +680,6 @@
      */
     native static void performOnMainThreadAfterDelay(Runnable r, long delay);
 
-    // This exists purely to get around permissions issues with getSystemEventQueueImpl
-    EventQueue getSystemEventQueueForInvokeAndWait() {
-        return getSystemEventQueueImpl();
-    }
-
 // DnD support
 
     @Override
@@ -712,7 +701,14 @@
         return (T)dgr;
     }
 
-// InputMethodSupport Method
+    @Override
+    protected PlatformDropTarget createDropTarget(DropTarget dropTarget,
+                                                  Component component,
+                                                  LWComponentPeer<?, ?> peer) {
+        return new CDropTarget(dropTarget, component, peer);
+    }
+
+    // InputMethodSupport Method
     /**
      * Returns the default keyboard locale of the underlying operating system
      */
--- a/src/macosx/native/sun/awt/AWTView.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/AWTView.m	Fri May 23 23:55:14 2014 +0000
@@ -27,6 +27,7 @@
 
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 #import <JavaRuntimeSupport/JavaRuntimeSupport.h>
+#import "jni_util.h"
 
 #import "ThreadUtilities.h"
 #import "AWTView.h"
@@ -391,14 +392,12 @@
                                   (jint)absP.x, (jint)absP.y,
                                   [event deltaY],
                                   [event deltaX]);
-    if (jEvent == nil) {
-        // Unable to create event by some reason.
-        return;
-    }
+    CHECK_NULL(jEvent);
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
+    (*env)->DeleteLocalRef(env, jEvent);
 }
 
 - (void) resetTrackingArea {
@@ -447,20 +446,22 @@
 
     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
-    jobject jevent = JNFNewObject(env, jctor_NSEvent,
+    jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
                                   [event modifierFlags],
                                   [event keyCode],
                                   characters);
+    CHECK_NULL(jEvent);
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
                             "deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
-    JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
+    JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jEvent);
 
     if (characters != NULL) {
         (*env)->DeleteLocalRef(env, characters);
     }
+    (*env)->DeleteLocalRef(env, jEvent);
 }
 
 -(void) deliverResize: (NSRect) rect {
--- a/src/macosx/native/sun/awt/AWTWindow.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/AWTWindow.m	Fri May 23 23:55:14 2014 +0000
@@ -261,7 +261,8 @@
 
 // returns id for the topmost window under mouse
 + (NSInteger) getTopmostWindowUnderMouseID {
-
+    NSInteger result = -1;
+    
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSPoint nsMouseLocation = [NSEvent mouseLocation];
     CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
@@ -274,11 +275,13 @@
             CGRect rect;
             CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
             if (CGRectContainsPoint(rect, cgMouseLocation)) {
-                return [[window objectForKey:(id)kCGWindowNumber] integerValue];
+                result = [[window objectForKey:(id)kCGWindowNumber] integerValue];
+                break;
             }
         }
     }
-    return -1;
+    [windows release];
+    return result;
 }
 
 // checks that this window is under the mouse cursor and this point is not overlapped by others windows
--- a/src/macosx/native/sun/awt/CDropTarget.h	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/CDropTarget.h	Fri May 23 23:55:14 2014 +0000
@@ -48,7 +48,7 @@
 + (CDropTarget *) currentDropTarget;
 
 // Common methods:
-- (id)init:(jobject)dropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control;
+- (id)init:(jobject)dropTarget component:(jobject)jcomponent control:(id)control;
 - (void)controlModelControlValid;
 - (void)removeFromView:(JNIEnv *)env;
 
--- a/src/macosx/native/sun/awt/CDropTarget.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/CDropTarget.m	Fri May 23 23:55:14 2014 +0000
@@ -65,7 +65,7 @@
     return sCurrentDropTarget;
 }
 
-- (id)init:(jobject)jdropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control
+- (id)init:(jobject)jdropTarget component:(jobject)jcomponent control:(id)control
 {
     self = [super init];
     DLog2(@"[CDropTarget init]: %@\n", self);
@@ -714,13 +714,13 @@
  * Signature: (Ljava/awt/dnd/DropTarget;Ljava/awt/Component;Ljava/awt/peer/ComponentPeer;J)J
  */
 JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDropTarget_createNativeDropTarget
-  (JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jobject jpeer, jlong jnativepeer)
+  (JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jlong jnativepeer)
 {
     CDropTarget* dropTarget = nil;
 
 JNF_COCOA_ENTER(env);
     id controlObj = (id) jlong_to_ptr(jnativepeer);
-    dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent peer:jpeer control:controlObj];
+    dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent control:controlObj];
 JNF_COCOA_EXIT(env);
 
     return ptr_to_jlong(dropTarget);
--- a/src/macosx/native/sun/awt/CGraphicsDevice.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/CGraphicsDevice.m	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -66,7 +66,8 @@
             CFArrayAppendValue(validModes, cRef);
         }
     }
-
+    CFRelease(allModes);
+    
     CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(displayID);
 
     BOOL containsCurrentMode = NO;
@@ -81,6 +82,7 @@
     if (!containsCurrentMode) {
         CFArrayAppendValue(validModes, currentMode);
     }
+    CGDisplayModeRelease(currentMode);
 
     return validModes;
 }
@@ -154,14 +156,12 @@
 Java_sun_awt_CGraphicsDevice_nativeGetXResolution
   (JNIEnv *env, jclass class, jint displayID)
 {
-    // TODO: this is the physically correct answer, but we probably want
-    // to use NSScreen API instead...
+    // CGDisplayScreenSize can return 0 if displayID is invalid
     CGSize size = CGDisplayScreenSize(displayID);
     CGRect rect = CGDisplayBounds(displayID);
     // 1 inch == 25.4 mm
     jfloat inches = size.width / 25.4f;
-    jfloat dpi = rect.size.width / inches;
-    return dpi;
+    return inches > 0 ? rect.size.width / inches : 72;
 }
 
 /*
@@ -173,14 +173,12 @@
 Java_sun_awt_CGraphicsDevice_nativeGetYResolution
   (JNIEnv *env, jclass class, jint displayID)
 {
-    // TODO: this is the physically correct answer, but we probably want
-    // to use NSScreen API instead...
+    // CGDisplayScreenSize can return 0 if displayID is invalid
     CGSize size = CGDisplayScreenSize(displayID);
     CGRect rect = CGDisplayBounds(displayID);
     // 1 inch == 25.4 mm
     jfloat inches = size.height / 25.4f;
-    jfloat dpi = rect.size.height / inches;
-    return dpi;
+    return inches > 0 ? rect.size.height / inches : 72;
 }
 
 /*
@@ -235,17 +233,19 @@
 {
     JNF_COCOA_ENTER(env);
     CFArrayRef allModes = getAllValidDisplayModes(displayID);
-
     CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate);
+    
     __block CGError retCode = kCGErrorSuccess;
     if (closestMatch != NULL) {
-        [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+        CGDisplayModeRetain(closestMatch);
+        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
             CGDisplayConfigRef config;
             retCode = CGBeginDisplayConfiguration(&config);
             if (retCode == kCGErrorSuccess) {
                 CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL);
                 retCode = CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
             }
+            CGDisplayModeRelease(closestMatch);
         }];
     } else {
         [JNFException raise:env as:kIllegalArgumentException reason:"Invalid display mode"];
@@ -253,8 +253,7 @@
 
     if (retCode != kCGErrorSuccess){
         [JNFException raise:env as:kIllegalArgumentException reason:"Unable to set display mode!"];
-    }    
-
+    }
     CFRelease(allModes);
     JNF_COCOA_EXIT(env);
 }
--- a/src/macosx/native/sun/awt/CImage.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/CImage.m	Fri May 23 23:55:14 2014 +0000
@@ -76,17 +76,17 @@
 
 static NSBitmapImageRep* CImage_CreateImageRep(JNIEnv *env, jintArray buffer, jint width, jint height)
 {
-    NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
-                                                                         pixelsWide:width
-                                                                         pixelsHigh:height
-                                                                      bitsPerSample:8
-                                                                    samplesPerPixel:4
-                                                                           hasAlpha:YES
-                                                                           isPlanar:NO
-                                                                     colorSpaceName:NSDeviceRGBColorSpace
-                                                                       bitmapFormat:NSAlphaFirstBitmapFormat
-                                                                        bytesPerRow:width*4 // TODO: use explicit scanStride
-                                                                       bitsPerPixel:32];
+    NSBitmapImageRep* imageRep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
+                                                                          pixelsWide:width
+                                                                          pixelsHigh:height
+                                                                       bitsPerSample:8
+                                                                     samplesPerPixel:4
+                                                                            hasAlpha:YES
+                                                                            isPlanar:NO
+                                                                      colorSpaceName:NSDeviceRGBColorSpace
+                                                                        bitmapFormat:NSAlphaFirstBitmapFormat
+                                                                         bytesPerRow:width*4 // TODO: use explicit scanStride
+                                                                        bitsPerPixel:32] autorelease];
 
     jint *imgData = (jint *)[imageRep bitmapData];
     if (imgData == NULL) return 0L;
@@ -115,9 +115,8 @@
     
     NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height);
     if (imageRep) {
-        NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] retain];
+        NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
         [nsImage addRepresentation:imageRep];
-        [imageRep release];
         result = ptr_to_jlong(nsImage);
     }
 
@@ -160,7 +159,7 @@
         (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
     }
     if ([reps count]) {
-        NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(0, 0)] retain];
+        NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)];
         [nsImage addRepresentations: reps];
         result = ptr_to_jlong(nsImage);
     }
@@ -184,7 +183,7 @@
 
     IconRef iconRef;
     if (noErr == GetIconRef(kOnSystemDisk, kSystemIconsCreator, selector, &iconRef)) {
-        image = [[[NSImage alloc] initWithIconRef:iconRef] retain];
+        image = [[NSImage alloc] initWithIconRef:iconRef];
         ReleaseIconRef(iconRef);
     }
 
@@ -206,7 +205,7 @@
 JNF_COCOA_ENTER(env);
 
     NSString *path = JNFNormalizedNSStringForPath(env, file);
-    image = [[[NSImage alloc] initByReferencingFile:path] retain];
+    image = [[NSImage alloc] initByReferencingFile:path];
 
 JNF_COCOA_EXIT(env);
 
@@ -435,7 +434,7 @@
 
     JNF_COCOA_ENTER(env);
 
-    NSBitmapImageRep* imageRep = [CImage_CreateImageRep(env, buffer, width, height) autorelease];
+    NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height);
     if (imageRep) {
         NSData *tiffImage = [imageRep TIFFRepresentation];
         jsize tiffSize = (jsize)[tiffImage length];
--- a/src/macosx/native/sun/awt/CTrayIcon.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/CTrayIcon.m	Fri May 23 23:55:14 2014 +0000
@@ -25,6 +25,7 @@
 
 #import <AppKit/AppKit.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import "jni_util.h"
 
 #import "CTrayIcon.h"
 #import "ThreadUtilities.h"
@@ -146,14 +147,12 @@
                                   (jint)absP.x, (jint)absP.y,
                                   [event deltaY],
                                   [event deltaX]);
-    if (jEvent == nil) {
-        // Unable to create event by some reason.
-        return;
-    }
+    CHECK_NULL(jEvent);
 
     static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
     static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
+    (*env)->DeleteLocalRef(env, jEvent);
 }
 
 @end //AWTTrayIcon
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -157,61 +157,6 @@
 JNF_COCOA_EXIT(env);
 }
 
-static JNF_CLASS_CACHE(jc_Component, "java/awt/Component");
-static JNF_MEMBER_CACHE(jf_Component_appContext, jc_Component, "appContext", "Lsun/awt/AppContext;");
-static JNF_CLASS_CACHE(jc_MenuComponent, "java/awt/MenuComponent");
-static JNF_MEMBER_CACHE(jf_MenuComponent_appContext, jc_MenuComponent, "appContext", "Lsun/awt/AppContext;");
-
-/*
- * Class:     sun_awt_SunToolkit
- * Method:    getAppContext
- * Signature: (Ljava/awt/Object;)Lsun/awt/AppContext;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_awt_SunToolkit_getAppContext
-(JNIEnv *env, jclass cls, jobject obj)
-{
-    jobject appContext = NULL;
-
-JNF_COCOA_ENTER(env);
-
-    if (JNFIsInstanceOf(env, obj, &jc_Component)) {
-        appContext = JNFGetObjectField(env, obj, jf_Component_appContext);
-    } else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) {
-        appContext = JNFGetObjectField(env, obj, jf_MenuComponent_appContext);
-    }
-
-JNF_COCOA_EXIT(env);
-
-    return appContext;
-}
-
-/*
- * Class:     sun_awt_SunToolkit
- * Method:    setAppContext
- * Signature: (Ljava/lang/Object;Lsun/awt/AppContext;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_SunToolkit_setAppContext
-(JNIEnv *env, jclass cls, jobject obj, jobject appContext)
-{
-    jboolean isComponent;
-
-JNF_COCOA_ENTER(env);
-
-    if (JNFIsInstanceOf(env, obj, &jc_Component)) {
-        JNFSetObjectField(env, obj, jf_Component_appContext, appContext);
-        isComponent = JNI_TRUE;
-    } else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) {
-        JNFSetObjectField(env, obj, jf_MenuComponent_appContext, appContext);
-        isComponent = JNI_FALSE;
-    }
-
-JNF_COCOA_EXIT(env);
-
-    return isComponent;
-}
-
 /*
  * Class:     sun_lwawt_macosx_LWCToolkit
  * Method:    beep
--- a/src/macosx/native/sun/awt/awt.m	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/awt/awt.m	Fri May 23 23:55:14 2014 +0000
@@ -435,7 +435,7 @@
         forceEmbeddedMode = YES;
     }
     JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
-    jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/misc/ThreadGroupUtils");
+    jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/awt/util/ThreadGroupUtils");
     jmethodID sjm_getRootThreadGroup = (*env)->GetStaticMethodID(env, jc_ThreadGroupUtils, "getRootThreadGroup", "()Ljava/lang/ThreadGroup;");
     jobject rootThreadGroup = (*env)->CallStaticObjectMethod(env, jc_ThreadGroupUtils, sjm_getRootThreadGroup);
     [ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, rootThreadGroup)];
--- a/src/macosx/native/sun/osxapp/AWT_debug.h	Thu May 22 20:24:42 2014 +0000
+++ b/src/macosx/native/sun/osxapp/AWT_debug.h	Fri May 23 23:55:14 2014 +0000
@@ -32,9 +32,10 @@
 #define kInternalError "java/lang/InternalError"
 
 #define AWT_DEBUG_LOG(str) \
-    NSLog(@"Cocoa AWT: %@ %@", str, [NSThread callStackSymbols])
+    NSLog(@"\tCocoa AWT: %@ %@", str, [NSThread callStackSymbols])
 
 #define AWT_DEBUG_BUG_REPORT_MESSAGE \
-    NSLog(@"\tPlease file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.")
+    NSLog(@"\tPlease file a bug report at http://bugreport.java.com/bugreport \
+with this message and a reproducible test case.")
 
 #endif
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Fri May 23 23:55:14 2014 +0000
@@ -664,6 +664,12 @@
             try {
                 while (true) {
                     int chunkLength = stream.readInt();
+
+                    // verify the chunk length first
+                    if (chunkLength < 0 || chunkLength + 4 < 0) {
+                        throw new IIOException("Invalid chunk length " + chunkLength);
+                    }
+
                     int chunkType = stream.readInt();
 
                     if (chunkType == IDAT_TYPE) {
@@ -692,7 +698,7 @@
 
                 // verify the chunk length
                 if (chunkLength < 0) {
-                    throw new IIOException("Invalid chunk lenght " + chunkLength);
+                    throw new IIOException("Invalid chunk length " + chunkLength);
                 };
 
                 try {
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Fri May 23 23:55:14 2014 +0000
@@ -1683,6 +1683,7 @@
      * adjustments that windows/metal do.  This is because gtk doesn't
      * provide margins/insets for checkbox/radiobuttons.
      */
+    @SuppressWarnings("fallthrough")
     private static class GnomeLayoutStyle extends DefaultLayoutStyle {
         private static GnomeLayoutStyle INSTANCE = new GnomeLayoutStyle();
 
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri May 23 23:55:14 2014 +0000
@@ -2409,6 +2409,7 @@
 
     // Windows LayoutStyle.  From:
     // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
+    @SuppressWarnings("fallthrough")
     private class WindowsLayoutStyle extends DefaultLayoutStyle {
         @Override
         public int getPreferredGap(JComponent component1,
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java	Fri May 23 23:55:14 2014 +0000
@@ -51,6 +51,8 @@
 public class WindowsScrollBarUI extends BasicScrollBarUI {
     private Grid thumbGrid;
     private Grid highlightGrid;
+    private Dimension horizontalThumbSize;
+    private Dimension verticalThumbSize;
 
     /**
      * Creates a UI for a JScrollBar.
@@ -65,11 +67,32 @@
     protected void installDefaults() {
         super.installDefaults();
 
-        if (XPStyle.getXP() != null) {
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null) {
             scrollbar.setBorder(null);
+            horizontalThumbSize = getSize(scrollbar, xp, Part.SBP_THUMBBTNHORZ);
+            verticalThumbSize = getSize(scrollbar, xp, Part.SBP_THUMBBTNVERT);
+        } else {
+            horizontalThumbSize = null;
+            verticalThumbSize = null;
         }
     }
 
+    private static Dimension getSize(Component component, XPStyle xp, Part part) {
+        Skin skin = xp.getSkin(component, part);
+        return new Dimension(skin.getWidth(), skin.getHeight());
+    }
+
+    @Override
+    protected Dimension getMinimumThumbSize() {
+        if ((horizontalThumbSize == null) || (verticalThumbSize == null)) {
+            return super.getMinimumThumbSize();
+        }
+        return JScrollBar.HORIZONTAL == scrollbar.getOrientation()
+                ? horizontalThumbSize
+                : verticalThumbSize;
+    }
+
     public void uninstallUI(JComponent c) {
         super.uninstallUI(c);
         thumbGrid = highlightGrid = null;
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Fri May 23 23:55:14 2014 +0000
@@ -182,7 +182,6 @@
                 if (sortOrder != null) {
                      switch(sortOrder) {
                      case ASCENDING:
-                         /* falls through */
                      case DESCENDING:
                          switch (state) {
                          case NORMAL:
@@ -197,6 +196,7 @@
                          default:
                              /* do nothing */
                          }
+                         break;
                      default :
                          /* do nothing */
                      }
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/jndi/ldap/Connection.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -459,10 +459,10 @@
                             // will be woken up before readTimeout only if reply is
                             // available
                             ldr.wait(readTimeout);
-                            waited = true;
                         } else {
                             ldr.wait(15 * 1000); // 15 second timeout
                         }
+                        waited = true;
                     } else {
                         break;
                     }
@@ -474,7 +474,7 @@
         }
 
         if ((rber == null) && waited) {
-            removeRequest(ldr);
+            abandonRequest(ldr, null);
             throw new NamingException("LDAP response read timed out, timeout used:"
                             + readTimeout + "ms." );
 
--- a/src/share/classes/com/sun/media/sound/AbstractLine.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/AbstractLine.java	Fri May 23 23:55:14 2014 +0000
@@ -48,7 +48,7 @@
     protected Control[] controls;
     AbstractMixer mixer;
     private boolean open     = false;
-    private final Vector listeners = new Vector();
+    private final Vector<Object> listeners = new Vector<>();
 
     /**
      * Contains event dispatcher per thread group.
--- a/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Fri May 23 23:55:14 2014 +0000
@@ -70,7 +70,7 @@
 
     /** List of Receivers and Transmitters that opened the device implicitely.
      */
-    private List openKeepingObjects;
+    private List<Object> openKeepingObjects;
 
     /**
      * This is the device handle returned from native code
@@ -284,6 +284,7 @@
     }
 
 
+    @SuppressWarnings("unchecked") // Cast of result of clone
     public final List<Receiver> getReceivers() {
         List<Receiver> recs;
         synchronized (traRecLock) {
@@ -313,6 +314,7 @@
     }
 
 
+    @SuppressWarnings("unchecked") // Cast of result of clone
     public final List<Transmitter> getTransmitters() {
         List<Transmitter> tras;
         synchronized (traRecLock) {
@@ -372,9 +374,9 @@
 
     /** Return the list of objects that have opened the device implicitely.
      */
-    private synchronized List getOpenKeepingObjects() {
+    private synchronized List<Object> getOpenKeepingObjects() {
         if (openKeepingObjects == null) {
-            openKeepingObjects = new ArrayList();
+            openKeepingObjects = new ArrayList<>();
         }
         return openKeepingObjects;
     }
--- a/src/share/classes/com/sun/media/sound/AbstractMixer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/AbstractMixer.java	Fri May 23 23:55:14 2014 +0000
@@ -90,13 +90,13 @@
     /**
      * Source lines (ports) currently open
      */
-    private final Vector sourceLines = new Vector();
+    private final Vector<Line> sourceLines = new Vector<>();
 
 
     /**
      * Target lines currently open.
      */
-    private final Vector targetLines = new Vector();
+    private final Vector<Line> targetLines = new Vector<>();
 
 
     /**
@@ -151,7 +151,7 @@
     public final Line.Info[] getSourceLineInfo(Line.Info info) {
 
         int i;
-        Vector vec = new Vector();
+        Vector<Line.Info> vec = new Vector<>();
 
         for (i = 0; i < sourceLineInfo.length; i++) {
 
@@ -162,7 +162,7 @@
 
         Line.Info[] returnedArray = new Line.Info[vec.size()];
         for (i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vec.elementAt(i);
+            returnedArray[i] = vec.elementAt(i);
         }
 
         return returnedArray;
@@ -172,7 +172,7 @@
     public final Line.Info[] getTargetLineInfo(Line.Info info) {
 
         int i;
-        Vector vec = new Vector();
+        Vector<Line.Info> vec = new Vector<>();
 
         for (i = 0; i < targetLineInfo.length; i++) {
 
@@ -183,7 +183,7 @@
 
         Line.Info[] returnedArray = new Line.Info[vec.size()];
         for (i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vec.elementAt(i);
+            returnedArray[i] = vec.elementAt(i);
         }
 
         return returnedArray;
@@ -231,7 +231,7 @@
             localLines = new Line[sourceLines.size()];
 
             for (int i = 0; i < localLines.length; i++) {
-                localLines[i] = (Line)sourceLines.elementAt(i);
+                localLines[i] = sourceLines.elementAt(i);
             }
         }
 
@@ -248,7 +248,7 @@
             localLines = new Line[targetLines.size()];
 
             for (int i = 0; i < localLines.length; i++) {
-                localLines[i] = (Line)targetLines.elementAt(i);
+                localLines[i] = targetLines.elementAt(i);
             }
         }
 
@@ -453,7 +453,8 @@
             return;
         }
 
-        Vector localSourceLines = (Vector)sourceLines.clone();
+        @SuppressWarnings("unchecked")
+        Vector<Line> localSourceLines = (Vector<Line>)sourceLines.clone();
         for (int i = 0; i < localSourceLines.size(); i++) {
 
             // if any other open line is running, return
@@ -468,7 +469,8 @@
             }
         }
 
-        Vector localTargetLines = (Vector)targetLines.clone();
+        @SuppressWarnings("unchecked")
+        Vector<Line> localTargetLines = (Vector<Line>)targetLines.clone();
         for (int i = 0; i < localTargetLines.size(); i++) {
 
             // if any other open line is running, return
--- a/src/share/classes/com/sun/media/sound/AlawCodec.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/AlawCodec.java	Fri May 23 23:55:14 2014 +0000
@@ -213,7 +213,7 @@
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
 
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat format;
 
         if ( AudioFormat.Encoding.PCM_SIGNED.equals(inputFormat.getEncoding())) {
@@ -248,7 +248,7 @@
 
         AudioFormat[] formatArray = new AudioFormat[formats.size()];
         for (int i = 0; i < formatArray.length; i++) {
-            formatArray[i] = (AudioFormat)(formats.elementAt(i));
+            formatArray[i] = formats.elementAt(i);
         }
         return formatArray;
     }
--- a/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Fri May 23 23:55:14 2014 +0000
@@ -68,7 +68,7 @@
      * The <code>valueClass</code> field specifies class
      * used in <code>value</code> field.
      */
-    public Class valueClass = null;
+    public Class<?> valueClass = null;
     /**
      * An array of possible values if the value for the field
      * <code>AudioSynthesizerPropertyInfo.value</code> may be selected
--- a/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Fri May 23 23:55:14 2014 +0000
@@ -94,7 +94,7 @@
     }
 
     private DirectDLI createDataLineInfo(boolean isSource) {
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat[] hardwareFormatArray = null;
         AudioFormat[] formatArray = null;
 
@@ -107,7 +107,7 @@
                 int formatArraySize = size;
                 hardwareFormatArray = new AudioFormat[size];
                 for (int i = 0; i < size; i++) {
-                    AudioFormat format = (AudioFormat)formats.elementAt(i);
+                    AudioFormat format = formats.elementAt(i);
                     hardwareFormatArray[i] = format;
                     int bits = format.getSampleSizeInBits();
                     boolean isSigned = format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED);
@@ -265,7 +265,7 @@
         return ((DirectAudioDeviceProvider.DirectAudioDeviceInfo) getMixerInfo()).getMaxSimulLines();
     }
 
-    private static void addFormat(Vector v, int bits, int frameSizeInBytes, int channels, float sampleRate,
+    private static void addFormat(Vector<AudioFormat> v, int bits, int frameSizeInBytes, int channels, float sampleRate,
                                   int encoding, boolean signed, boolean bigEndian) {
         AudioFormat.Encoding enc = null;
         switch (encoding) {
@@ -338,7 +338,7 @@
     private static final class DirectDLI extends DataLine.Info {
         final AudioFormat[] hardwareFormats;
 
-        private DirectDLI(Class clazz, AudioFormat[] formatArray,
+        private DirectDLI(Class<?> clazz, AudioFormat[] formatArray,
                           AudioFormat[] hardwareFormatArray,
                           int minBuffer, int maxBuffer) {
             super(clazz, formatArray, minBuffer, maxBuffer);
@@ -1457,7 +1457,7 @@
 
     } // class DirectBAOS
 
-
+    @SuppressWarnings("rawtypes")
     private static native void nGetFormats(int mixerIndex, int deviceID,
                                            boolean isSource, Vector formats);
 
--- a/src/share/classes/com/sun/media/sound/EventDispatcher.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/EventDispatcher.java	Fri May 23 23:55:14 2014 +0000
@@ -57,7 +57,7 @@
     /**
      * List of events
      */
-    private final ArrayList eventQueue = new ArrayList();
+    private final ArrayList<EventInfo> eventQueue = new ArrayList<>();
 
 
     /**
@@ -186,7 +186,7 @@
             }
             if (eventQueue.size() > 0) {
                 // Remove the event from the queue and dispatch it to the listeners.
-                eventInfo = (EventInfo) eventQueue.remove(0);
+                eventInfo = eventQueue.remove(0);
             }
 
         } // end of synchronized
@@ -230,7 +230,7 @@
     /**
      * Send audio and MIDI events.
      */
-    void sendAudioEvents(Object event, List listeners) {
+    void sendAudioEvents(Object event, List<Object> listeners) {
         if ((listeners == null)
             || (listeners.size() == 0)) {
             // nothing to do
@@ -392,7 +392,7 @@
          * @param event the event to be dispatched
          * @param listeners listener list; will be copied
          */
-        EventInfo(Object event, List listeners) {
+        EventInfo(Object event, List<Object> listeners) {
             this.event = event;
             this.listeners = listeners.toArray();
         }
--- a/src/share/classes/com/sun/media/sound/JDK13Services.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/JDK13Services.java	Fri May 23 23:55:14 2014 +0000
@@ -118,7 +118,7 @@
         (the part before the hash sign), if available. If the property is
         not set or the value has no provider class name part, null is returned.
      */
-    public static synchronized String getDefaultProviderClassName(Class typeClass) {
+    public static synchronized String getDefaultProviderClassName(Class<?> typeClass) {
         String value = null;
         String defaultProviderSpec = getDefaultProvider(typeClass);
         if (defaultProviderSpec != null) {
@@ -144,7 +144,7 @@
         part after the hash sign), if available. If the property is not set
         or the value has no instance name part, null is returned.
      */
-    public static synchronized String getDefaultInstanceName(Class typeClass) {
+    public static synchronized String getDefaultInstanceName(Class<?> typeClass) {
         String value = null;
         String defaultProviderSpec = getDefaultProvider(typeClass);
         if (defaultProviderSpec != null) {
@@ -165,7 +165,7 @@
         @return The complete value of the property, if available.
         If the property is not set, null is returned.
      */
-    private static synchronized String getDefaultProvider(Class typeClass) {
+    private static synchronized String getDefaultProvider(Class<?> typeClass) {
         if (!SourceDataLine.class.equals(typeClass)
                 && !TargetDataLine.class.equals(typeClass)
                 && !Clip.class.equals(typeClass)
--- a/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Fri May 23 23:55:14 2014 +0000
@@ -106,9 +106,9 @@
      * the new instance will not reflect that state...
      */
     static final class MidiInDeviceInfo extends AbstractMidiDeviceProvider.Info {
-        private final Class providerClass;
+        private final Class<?> providerClass;
 
-        private MidiInDeviceInfo(int index, Class providerClass) {
+        private MidiInDeviceInfo(int index, Class<?> providerClass) {
             super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
             this.providerClass = providerClass;
         }
--- a/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Fri May 23 23:55:14 2014 +0000
@@ -104,9 +104,9 @@
      * the new instance will not reflect that state...
      */
     static final class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info {
-        private final Class providerClass;
+        private final Class<?> providerClass;
 
-        private MidiOutDeviceInfo(int index, Class providerClass) {
+        private MidiOutDeviceInfo(int index, Class<?> providerClass) {
             super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
             this.providerClass = providerClass;
         }
--- a/src/share/classes/com/sun/media/sound/MidiUtils.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/MidiUtils.java	Fri May 23 23:55:14 2014 +0000
@@ -295,7 +295,7 @@
 
 
         public synchronized void refresh(Sequence seq) {
-            ArrayList list = new ArrayList();
+            ArrayList<MidiEvent> list = new ArrayList<>();
             Track[] tracks = seq.getTracks();
             if (tracks.length > 0) {
                 // tempo events only occur in track 0
@@ -313,7 +313,7 @@
             int size = list.size() + 1;
             firstTempoIsFake = true;
             if ((size > 1)
-                && (((MidiEvent) list.get(0)).getTick() == 0)) {
+                && (list.get(0).getTick() == 0)) {
                 // do not need to add an initial tempo event at the beginning
                 size--;
                 firstTempoIsFake = false;
@@ -328,7 +328,7 @@
                 e++;
             }
             for (int i = 0; i < list.size(); i++, e++) {
-                MidiEvent evt = (MidiEvent) list.get(i);
+                MidiEvent evt = list.get(i);
                 ticks[e] = evt.getTick();
                 tempos[e] = getTempoMPQ(evt.getMessage());
             }
--- a/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Fri May 23 23:55:14 2014 +0000
@@ -91,7 +91,7 @@
         // filter out targetEncoding from the old getOutputFormats( sourceFormat ) method
 
         AudioFormat[] formats = getOutputFormats( sourceFormat );
-        Vector newFormats = new Vector();
+        Vector<AudioFormat> newFormats = new Vector<>();
         for(int i=0; i<formats.length; i++ ) {
             if( formats[i].getEncoding().equals( targetEncoding ) ) {
                 newFormats.addElement( formats[i] );
@@ -101,7 +101,7 @@
         AudioFormat[] formatArray = new AudioFormat[newFormats.size()];
 
         for (int i = 0; i < formatArray.length; i++) {
-            formatArray[i] = (AudioFormat)(newFormats.elementAt(i));
+            formatArray[i] = newFormats.elementAt(i);
         }
 
         return formatArray;
@@ -181,7 +181,7 @@
     /*  public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat format;
 
         int sampleSize = inputFormat.getSampleSizeInBits();
@@ -335,7 +335,7 @@
 
             for (int i = 0; i < formatArray.length; i++) {
 
-                formatArray[i] = (AudioFormat)(formats.elementAt(i));
+                formatArray[i] = formats.elementAt(i);
             }
         }
 
--- a/src/share/classes/com/sun/media/sound/PortMixer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/PortMixer.java	Fri May 23 23:55:14 2014 +0000
@@ -253,12 +253,12 @@
             long newID = ((PortMixer) mixer).getID();
             if ((id == 0) || (newID != id) || (controls.length == 0)) {
                 id = newID;
-                Vector vector = new Vector();
+                Vector<Control> vector = new Vector<>();
                 synchronized (vector) {
                     nGetControls(id, portIndex, vector);
                     controls = new Control[vector.size()];
                     for (int i = 0; i < controls.length; i++) {
-                        controls[i] = (Control) vector.elementAt(i);
+                        controls[i] = vector.elementAt(i);
                     }
                 }
             } else {
@@ -494,6 +494,7 @@
     private static native String nGetPortName(long id, int portIndex);
 
     // fills the vector with the controls for this port
+    @SuppressWarnings("rawtypes")
     private static native void nGetControls(long id, int portIndex, Vector vector);
 
     // getters/setters for controls
--- a/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Fri May 23 23:55:14 2014 +0000
@@ -122,7 +122,7 @@
     /**
      * List of tracks to which we're recording
      */
-    private final List recordingTracks = new ArrayList();
+    private final List<RecordingTrack> recordingTracks = new ArrayList<>();
 
 
     private long loopStart = 0;
@@ -133,13 +133,13 @@
     /**
      * Meta event listeners
      */
-    private final ArrayList metaEventListeners = new ArrayList();
+    private final ArrayList<Object> metaEventListeners = new ArrayList<>();
 
 
     /**
      * Control change listeners
      */
-    private final ArrayList controllerEventListeners = new ArrayList();
+    private final ArrayList<ControllerListElement> controllerEventListeners = new ArrayList<>();
 
 
     /** automatic connection support */
@@ -645,7 +645,7 @@
             boolean flag = false;
             for(int i=0; i < controllerEventListeners.size(); i++) {
 
-                cve = (ControllerListElement) controllerEventListeners.get(i);
+                cve = controllerEventListeners.get(i);
 
                 if (cve.listener.equals(listener)) {
                     cve.addControllers(controllers);
@@ -669,7 +669,7 @@
             ControllerListElement cve = null;
             boolean flag = false;
             for (int i=0; i < controllerEventListeners.size(); i++) {
-                cve = (ControllerListElement) controllerEventListeners.get(i);
+                cve = controllerEventListeners.get(i);
                 if (cve.listener.equals(listener)) {
                     cve.removeControllers(controllers);
                     flag = true;
@@ -940,9 +940,9 @@
         }
         ShortMessage msg = (ShortMessage) message;
         int controller = msg.getData1();
-        List sendToListeners = new ArrayList();
+        List<Object> sendToListeners = new ArrayList<>();
         for (int i = 0; i < size; i++) {
-            ControllerListElement cve = (ControllerListElement) controllerEventListeners.get(i);
+            ControllerListElement cve = controllerEventListeners.get(i);
             for(int j = 0; j < cve.controllers.length; j++) {
                 if (cve.controllers[j] == controller) {
                     sendToListeners.add(cve.listener);
@@ -1213,13 +1213,13 @@
             this.channel = channel;
         }
 
-        static RecordingTrack get(List recordingTracks, Track track) {
+        static RecordingTrack get(List<RecordingTrack> recordingTracks, Track track) {
 
             synchronized(recordingTracks) {
                 int size = recordingTracks.size();
 
                 for (int i = 0; i < size; i++) {
-                    RecordingTrack current = (RecordingTrack)recordingTracks.get(i);
+                    RecordingTrack current = recordingTracks.get(i);
                     if (current.track == track) {
                         return current;
                     }
@@ -1228,12 +1228,12 @@
             return null;
         }
 
-        static Track get(List recordingTracks, int channel) {
+        static Track get(List<RecordingTrack> recordingTracks, int channel) {
 
             synchronized(recordingTracks) {
                 int size = recordingTracks.size();
                 for (int i = 0; i < size; i++) {
-                    RecordingTrack current = (RecordingTrack)recordingTracks.get(i);
+                    RecordingTrack current = recordingTracks.get(i);
                     if ((current.channel == channel) || (current.channel == -1)) {
                         return current.track;
                     }
--- a/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Fri May 23 23:55:14 2014 +0000
@@ -949,7 +949,7 @@
             Object v = (info == null) ? null : info.get(item2.name);
             v = (v != null) ? v : storedProperties.getProperty(item2.name);
             if (v != null) {
-                Class c = (item2.valueClass);
+                Class<?> c = (item2.valueClass);
                 if (c.isInstance(v))
                     item2.value = v;
                 else if (v instanceof String) {
--- a/src/share/classes/com/sun/media/sound/UlawCodec.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/com/sun/media/sound/UlawCodec.java	Fri May 23 23:55:14 2014 +0000
@@ -198,7 +198,7 @@
     /*  public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat format;
 
         if ((inputFormat.getSampleSizeInBits() == 16)
@@ -235,7 +235,7 @@
 
         AudioFormat[] formatArray = new AudioFormat[formats.size()];
         for (int i = 0; i < formatArray.length; i++) {
-            formatArray[i] = (AudioFormat)(formats.elementAt(i));
+            formatArray[i] = formats.elementAt(i);
         }
         return formatArray;
     }
--- a/src/share/classes/java/awt/AWTKeyStroke.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/AWTKeyStroke.java	Fri May 23 23:55:14 2014 +0000
@@ -86,7 +86,8 @@
      * Must be called under locked AWTKeyStro
      */
     private static Class<AWTKeyStroke> getAWTKeyStrokeClass() {
-        Class<AWTKeyStroke> clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+        @SuppressWarnings("unchecked")
+        Class<AWTKeyStroke> clazz = (Class<AWTKeyStroke>)AppContext.getAppContext().get(AWTKeyStroke.class);
         if (clazz == null) {
             clazz = AWTKeyStroke.class;
             AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
@@ -182,6 +183,7 @@
             throw new IllegalArgumentException("subclass cannot be null");
         }
         synchronized (AWTKeyStroke.class) {
+            @SuppressWarnings("unchecked")
             Class<AWTKeyStroke> keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
             if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){
                 // Already registered
@@ -192,7 +194,7 @@
             throw new ClassCastException("subclass is not derived from AWTKeyStroke");
         }
 
-        Constructor ctor = getCtor(subclass);
+        Constructor<?> ctor = getCtor(subclass);
 
         String couldNotInstantiate = "subclass could not be instantiated";
 
@@ -227,12 +229,12 @@
        threat as accessible flag is set only for this Constructor object,
        not for Class constructor.
      */
-    private static Constructor getCtor(final Class clazz)
+    private static Constructor<?> getCtor(final Class<?> clazz)
     {
-        Constructor ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor>() {
-            public Constructor run() {
+        Constructor<?> ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor<?>>() {
+            public Constructor<?> run() {
                 try {
-                    Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
+                    Constructor<?> ctor = clazz.getDeclaredConstructor((Class<?>[]) null);
                     if (ctor != null) {
                         ctor.setAccessible(true);
                     }
@@ -249,6 +251,7 @@
     private static synchronized AWTKeyStroke getCachedStroke
         (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
     {
+        @SuppressWarnings("unchecked")
         Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
         AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);
 
--- a/src/share/classes/java/awt/CardLayout.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/CardLayout.java	Fri May 23 23:55:14 2014 +0000
@@ -560,6 +560,7 @@
     /**
      * Reads serializable fields from stream.
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
--- a/src/share/classes/java/awt/Component.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/Component.java	Fri May 23 23:55:14 2014 +0000
@@ -6184,7 +6184,7 @@
     /**
      * Parameter types of coalesceEvents(AWTEvent,AWTEVent).
      */
-    private static final Class[] coalesceEventsParams = {
+    private static final Class<?>[] coalesceEventsParams = {
         AWTEvent.class, AWTEvent.class
     };
 
--- a/src/share/classes/java/awt/GraphicsEnvironment.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/GraphicsEnvironment.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -95,18 +95,18 @@
         String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
         try {
 //          long t0 = System.currentTimeMillis();
-            Class<GraphicsEnvironment> geCls;
+            Class<?> geCls;
             try {
                 // First we try if the bootclassloader finds the requested
                 // class. This way we can avoid to run in a privileged block.
-                geCls = (Class<GraphicsEnvironment>)Class.forName(nm);
+                geCls = Class.forName(nm);
             } catch (ClassNotFoundException ex) {
                 // If the bootclassloader fails, we try again with the
                 // application classloader.
                 ClassLoader cl = ClassLoader.getSystemClassLoader();
-                geCls = (Class<GraphicsEnvironment>)Class.forName(nm, true, cl);
+                geCls = Class.forName(nm, true, cl);
             }
-            ge = geCls.newInstance();
+            ge = (GraphicsEnvironment)geCls.newInstance();
 //          long t1 = System.currentTimeMillis();
 //          System.out.println("GE creation took " + (t1-t0)+ "ms.");
             if (isHeadless()) {
--- a/src/share/classes/java/awt/KeyboardFocusManager.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/KeyboardFocusManager.java	Fri May 23 23:55:14 2014 +0000
@@ -348,6 +348,7 @@
      * Component of those Windows that has no such array of its own explicitly
      * set.
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private Set<AWTKeyStroke>[] defaultFocusTraversalKeys = new Set[4];
 
     /**
@@ -422,7 +423,7 @@
             targetSet.add(AWTKeyStroke.getAWTKeyStroke(tokens.nextToken()));
         }
         return (targetSet.isEmpty())
-            ? Collections.EMPTY_SET
+            ? Collections.emptySet()
             : Collections.unmodifiableSet(targetSet);
     }
 
@@ -436,7 +437,7 @@
                 work_set.add(defaultFocusTraversalKeyStrokes[i][j]);
             }
             defaultFocusTraversalKeys[i] = (work_set.isEmpty())
-                ? Collections.EMPTY_SET
+                ? Collections.emptySet()
                 : Collections.unmodifiableSet(work_set);
         }
         initPeer();
@@ -1750,11 +1751,12 @@
      * @see #addKeyEventDispatcher
      * @see #removeKeyEventDispatcher
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     protected synchronized java.util.List<KeyEventDispatcher>
         getKeyEventDispatchers()
     {
         return (keyEventDispatchers != null)
-            ? (java.util.List)keyEventDispatchers.clone()
+            ? (java.util.List<KeyEventDispatcher>)keyEventDispatchers.clone()
             : null;
     }
 
@@ -1841,11 +1843,12 @@
      * @see #addKeyEventPostProcessor
      * @see #removeKeyEventPostProcessor
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     protected java.util.List<KeyEventPostProcessor>
         getKeyEventPostProcessors()
     {
         return (keyEventPostProcessors != null)
-            ? (java.util.List)keyEventPostProcessors.clone()
+            ? (java.util.List<KeyEventPostProcessor>)keyEventPostProcessors.clone()
             : null;
     }
 
@@ -1907,8 +1910,7 @@
      * javax.swing.JComponent.runInputVerifier() using reflection.
      */
     static synchronized Component getMostRecentFocusOwner(Window window) {
-        WeakReference<Component> weakValue =
-            (WeakReference)mostRecentFocusOwners.get(window);
+        WeakReference<Component> weakValue = mostRecentFocusOwners.get(window);
         return weakValue == null ? null : weakValue.get();
     }
 
--- a/src/share/classes/java/awt/Menu.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/Menu.java	Fri May 23 23:55:14 2014 +0000
@@ -66,7 +66,7 @@
 
         AWTAccessor.setMenuAccessor(
             new AWTAccessor.MenuAccessor() {
-                public Vector<MenuComponent> getItems(Menu menu) {
+                public Vector<MenuItem> getItems(Menu menu) {
                     return menu.items;
                 }
             });
@@ -78,7 +78,7 @@
      * @serial
      * @see #countItems()
      */
-    Vector<MenuComponent> items = new Vector<>();
+    Vector<MenuItem> items = new Vector<>();
 
     /**
      * This field indicates whether the menu has the
@@ -252,7 +252,7 @@
      * be called on the toolkit thread.
      */
     final MenuItem getItemImpl(int index) {
-        return (MenuItem)items.elementAt(index);
+        return items.elementAt(index);
     }
 
     /**
@@ -544,7 +544,7 @@
       // HeadlessException will be thrown from MenuComponent's readObject
       s.defaultReadObject();
       for(int i = 0; i < items.size(); i++) {
-        MenuItem item = (MenuItem)items.elementAt(i);
+        MenuItem item = items.elementAt(i);
         item.parent = this;
       }
     }
--- a/src/share/classes/java/awt/SystemTray.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/SystemTray.java	Fri May 23 23:55:14 2014 +0000
@@ -259,7 +259,9 @@
         Vector<TrayIcon> icons = null;
         synchronized (this) {
             oldArray = systemTray.getTrayIcons();
-            icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
+            @SuppressWarnings("unchecked")
+            Vector<TrayIcon> tmp = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
+            icons = tmp;
             if (icons == null) {
                 icons = new Vector<TrayIcon>(3);
                 AppContext.getAppContext().put(TrayIcon.class, icons);
@@ -304,6 +306,7 @@
         TrayIcon[] oldArray = null, newArray = null;
         synchronized (this) {
             oldArray = systemTray.getTrayIcons();
+            @SuppressWarnings("unchecked")
             Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
             // TrayIcon with no peer is not contained in the array.
             if (icons == null || !icons.remove(trayIcon)) {
@@ -335,6 +338,7 @@
      * @see TrayIcon
      */
     public TrayIcon[] getTrayIcons() {
+        @SuppressWarnings("unchecked")
         Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
         if (icons != null) {
             return icons.toArray(new TrayIcon[icons.size()]);
--- a/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Fri May 23 23:55:14 2014 +0000
@@ -296,14 +296,14 @@
     /**
      * @return a clone of this object
      */
-
+    @SuppressWarnings("unchecked") // Cast from clone
      public Object clone() {
          MimeTypeParameterList newObj = null;
          try {
              newObj = (MimeTypeParameterList)super.clone();
          } catch (CloneNotSupportedException cannotHappen) {
          }
-         newObj.parameters = (Hashtable)parameters.clone();
+         newObj.parameters = (Hashtable<String, String>)parameters.clone();
          return newObj;
      }
 
--- a/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Fri May 23 23:55:14 2014 +0000
@@ -38,13 +38,14 @@
 import java.net.MalformedURLException;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
-import java.util.WeakHashMap;
 
 import sun.awt.AppContext;
 import sun.awt.datatransfer.DataTransferer;
@@ -102,19 +103,11 @@
     private static final String HTML_TEXT_BASE_TYPE = "text/html";
 
     /**
-     * This constant is passed to flavorToNativeLookup() to indicate that a
-     * a native should be synthesized, stored, and returned by encoding the
-     * DataFlavor's MIME type in case if the DataFlavor is not found in
-     * 'flavorToNative' map.
-     */
-    private static final boolean SYNTHESIZE_IF_NOT_FOUND = true;
-
-    /**
      * Maps native Strings to Lists of DataFlavors (or base type Strings for
      * text DataFlavors).
      * Do not use the field directly, use getNativeToFlavor() instead.
      */
-    private final Map<String, List<DataFlavor>> nativeToFlavor = new HashMap<>();
+    private final Map<String, LinkedHashSet<DataFlavor>> nativeToFlavor = new HashMap<>();
 
     /**
      * Accessor to nativeToFlavor map.  Since we use lazy initialization we must
@@ -123,7 +116,7 @@
      *
      * @return nativeToFlavor
      */
-    private Map<String, List<DataFlavor>> getNativeToFlavor() {
+    private Map<String, LinkedHashSet<DataFlavor>> getNativeToFlavor() {
         if (!isMapInitialized) {
             initSystemFlavorMap();
         }
@@ -135,7 +128,7 @@
      * native Strings.
      * Do not use the field directly, use getFlavorToNative() instead.
      */
-    private final Map<DataFlavor, List<String>> flavorToNative = new HashMap<>();
+    private final Map<DataFlavor, LinkedHashSet<String>> flavorToNative = new HashMap<>();
 
     /**
      * Accessor to flavorToNative map.  Since we use lazy initialization we must
@@ -144,7 +137,7 @@
      *
      * @return flavorToNative
      */
-    private synchronized Map<DataFlavor, List<String>> getFlavorToNative() {
+    private synchronized Map<DataFlavor, LinkedHashSet<String>> getFlavorToNative() {
         if (!isMapInitialized) {
             initSystemFlavorMap();
         }
@@ -152,21 +145,44 @@
     }
 
     /**
+     * Maps a text DataFlavor primary mime-type to the native. Used only to store
+     * standard mappings registered in the flavormap.properties
+     * Do not use this field directly, use getTextTypeToNative() instead.
+     */
+    private Map<String, LinkedHashSet<String>> textTypeToNative = new HashMap<>();
+
+    /**
      * Shows if the object has been initialized.
      */
     private boolean isMapInitialized = false;
 
     /**
+     * An accessor to textTypeToNative map.  Since we use lazy initialization we
+     * must use this accessor instead of direct access to the field which may not
+     * be initialized yet. This method will initialize the field if needed.
+     *
+     * @return textTypeToNative
+     */
+    private synchronized Map<String, LinkedHashSet<String>> getTextTypeToNative() {
+        if (!isMapInitialized) {
+            initSystemFlavorMap();
+            // From this point the map should not be modified
+            textTypeToNative = Collections.unmodifiableMap(textTypeToNative);
+        }
+        return textTypeToNative;
+    }
+
+    /**
      * Caches the result of getNativesForFlavor(). Maps DataFlavors to
-     * SoftReferences which reference Lists of String natives.
+     * SoftReferences which reference LinkedHashSet of String natives.
      */
-    private Map<DataFlavor, SoftReference<List<String>>> getNativesForFlavorCache = new HashMap<>();
+    private final SoftCache<DataFlavor, String> nativesForFlavorCache = new SoftCache<>();
 
     /**
      * Caches the result getFlavorsForNative(). Maps String natives to
-     * SoftReferences which reference Lists of DataFlavors.
+     * SoftReferences which reference LinkedHashSet of DataFlavors.
      */
-    private Map<String, SoftReference<List<DataFlavor>>> getFlavorsForNativeCache = new HashMap<>();
+    private final SoftCache<String, DataFlavor> flavorsForNativeCache = new SoftCache<>();
 
     /**
      * Dynamic mapping generation used for text mappings should not be applied
@@ -174,7 +190,7 @@
      * explicitly specified with setFlavorsForNative() or
      * setNativesForFlavor(). This keeps all such keys.
      */
-    private Set disabledMappingGenerationKeys = new HashSet();
+    private Set<Object> disabledMappingGenerationKeys = new HashSet<>();
 
     /**
      * Returns the default FlavorMap for this thread's ClassLoader.
@@ -404,7 +420,7 @@
                         flavor = new DataFlavor(value);
                     } catch (Exception e) {
                         try {
-                            flavor = new DataFlavor(value, (String)null);
+                            flavor = new DataFlavor(value, null);
                         } catch (Exception ee) {
                             ee.printStackTrace();
                             continue;
@@ -412,11 +428,11 @@
                     }
 
                     final LinkedHashSet<DataFlavor> dfs = new LinkedHashSet<>();
-
                     dfs.add(flavor);
 
                     if ("text".equals(flavor.getPrimaryType())) {
                         dfs.addAll(convertMimeTypeToDataFlavors(value));
+                        store(flavor.mimeType.getBaseType(), key, getTextTypeToNative());
                     }
 
                     for (DataFlavor df : dfs) {
@@ -505,10 +521,10 @@
      * the appropriate Map location, but rather will be appended to a List
      * stored in that location.
      */
-    private <H, L> void store(H hashed, L listed, Map<H, List<L>> map) {
-        List<L> list = map.get(hashed);
+    private <H, L> void store(H hashed, L listed, Map<H, LinkedHashSet<L>> map) {
+        LinkedHashSet<L> list = map.get(hashed);
         if (list == null) {
-            list = new ArrayList<>(1);
+            list = new LinkedHashSet<>(1);
             map.put(hashed, list);
         }
         if (!list.contains(listed)) {
@@ -522,17 +538,16 @@
      * case, a new DataFlavor is synthesized, stored, and returned, if and
      * only if the specified native is encoded as a Java MIME type.
      */
-    private List<DataFlavor> nativeToFlavorLookup(String nat) {
-        List<DataFlavor> flavors = getNativeToFlavor().get(nat);
+    private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
+        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
 
         if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
-                List<DataFlavor> platformFlavors =
+                LinkedHashSet<DataFlavor> platformFlavors =
                         transferer.getPlatformMappingsForNative(nat);
                 if (!platformFlavors.isEmpty()) {
                     if (flavors != null) {
-                        platformFlavors.removeAll(new HashSet<>(flavors));
                         // Prepending the platform-specific mappings ensures
                         // that the flavors added with
                         // addFlavorForUnencodedNative() are at the end of
@@ -558,24 +573,22 @@
             }
 
             if (flavor != null) {
-                flavors = new ArrayList<>(1);
+                flavors = new LinkedHashSet<>(1);
                 getNativeToFlavor().put(nat, flavors);
                 flavors.add(flavor);
-                getFlavorsForNativeCache.remove(nat);
-                getFlavorsForNativeCache.remove(null);
+                flavorsForNativeCache.remove(nat);
 
-                List<String> natives = getFlavorToNative().get(flavor);
+                LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
                 if (natives == null) {
-                    natives = new ArrayList<>(1);
+                    natives = new LinkedHashSet<>(1);
                     getFlavorToNative().put(flavor, natives);
                 }
                 natives.add(nat);
-                getNativesForFlavorCache.remove(flavor);
-                getNativesForFlavorCache.remove(null);
+                nativesForFlavorCache.remove(flavor);
             }
         }
 
-        return (flavors != null) ? flavors : new ArrayList<>(0);
+        return (flavors != null) ? flavors : new LinkedHashSet<>(0);
     }
 
     /**
@@ -586,18 +599,18 @@
      * encoding the DataFlavor's MIME type. Otherwise an empty List is returned
      * and 'flavorToNative' remains unaffected.
      */
-    private List<String> flavorToNativeLookup(final DataFlavor flav,
-                                              final boolean synthesize) {
-        List<String> natives = getFlavorToNative().get(flav);
+    private LinkedHashSet<String> flavorToNativeLookup(final DataFlavor flav,
+                                                       final boolean synthesize) {
+
+        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
 
         if (flav != null && !disabledMappingGenerationKeys.contains(flav)) {
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
-                List<String> platformNatives =
+                LinkedHashSet<String> platformNatives =
                     transferer.getPlatformMappingsForFlavor(flav);
                 if (!platformNatives.isEmpty()) {
                     if (natives != null) {
-                        platformNatives.removeAll(new HashSet<>(natives));
                         // Prepend the platform-specific mappings to ensure
                         // that the natives added with
                         // addUnencodedNativeForFlavor() are at the end of
@@ -612,26 +625,25 @@
         if (natives == null) {
             if (synthesize) {
                 String encoded = encodeDataFlavor(flav);
-                natives = new ArrayList<>(1);
+                natives = new LinkedHashSet<>(1);
                 getFlavorToNative().put(flav, natives);
                 natives.add(encoded);
-                getNativesForFlavorCache.remove(flav);
-                getNativesForFlavorCache.remove(null);
 
-                List<DataFlavor> flavors = getNativeToFlavor().get(encoded);
+                LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(encoded);
                 if (flavors == null) {
-                    flavors = new ArrayList<>(1);
+                    flavors = new LinkedHashSet<>(1);
                     getNativeToFlavor().put(encoded, flavors);
                 }
                 flavors.add(flav);
-                getFlavorsForNativeCache.remove(encoded);
-                getFlavorsForNativeCache.remove(null);
+
+                nativesForFlavorCache.remove(flav);
+                flavorsForNativeCache.remove(encoded);
             } else {
-                natives = new ArrayList<>(0);
+                natives = new LinkedHashSet<>(0);
             }
         }
 
-        return natives;
+        return new LinkedHashSet<>(natives);
     }
 
     /**
@@ -659,103 +671,63 @@
      * @see #encodeDataFlavor
      * @since 1.4
      */
+    @Override
     public synchronized List<String> getNativesForFlavor(DataFlavor flav) {
-        List<String> retval = null;
-
-        // Check cache, even for null flav
-        SoftReference<List<String>> ref = getNativesForFlavorCache.get(flav);
-        if (ref != null) {
-            retval = ref.get();
-            if (retval != null) {
-                // Create a copy, because client code can modify the returned
-                // list.
-                return new ArrayList<>(retval);
-            }
+        LinkedHashSet<String> retval = nativesForFlavorCache.check(flav);
+        if (retval != null) {
+            return new ArrayList<>(retval);
         }
 
         if (flav == null) {
-            retval = new ArrayList<>(getNativeToFlavor().keySet());
+            retval = new LinkedHashSet<>(getNativeToFlavor().keySet());
         } else if (disabledMappingGenerationKeys.contains(flav)) {
             // In this case we shouldn't synthesize a native for this flavor,
             // since its mappings were explicitly specified.
-            retval = flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
+            retval = flavorToNativeLookup(flav, false);
         } else if (DataTransferer.isFlavorCharsetTextType(flav)) {
+            retval = new LinkedHashSet<>(0);
 
             // For text/* flavors, flavor-to-native mappings specified in
             // flavormap.properties are stored per flavor's base type.
             if ("text".equals(flav.getPrimaryType())) {
-                retval = getAllNativesForType(flav.mimeType.getBaseType());
-                if (retval != null) {
-                    // To prevent the List stored in the map from modification.
-                    retval = new ArrayList(retval);
+                LinkedHashSet<String> textTypeNatives =
+                        getTextTypeToNative().get(flav.mimeType.getBaseType());
+                if (textTypeNatives != null) {
+                    retval.addAll(textTypeNatives);
                 }
             }
 
             // Also include text/plain natives, but don't duplicate Strings
-            List<String> textPlainList = getAllNativesForType(TEXT_PLAIN_BASE_TYPE);
-
-            if (textPlainList != null && !textPlainList.isEmpty()) {
-                // To prevent the List stored in the map from modification.
-                // This also guarantees that removeAll() is supported.
-                textPlainList = new ArrayList<>(textPlainList);
-                if (retval != null && !retval.isEmpty()) {
-                    // Use HashSet to get constant-time performance for search.
-                    textPlainList.removeAll(new HashSet<>(retval));
-                    retval.addAll(textPlainList);
-                } else {
-                    retval = textPlainList;
-                }
+            LinkedHashSet<String> textTypeNatives =
+                    getTextTypeToNative().get(TEXT_PLAIN_BASE_TYPE);
+            if (textTypeNatives != null) {
+                retval.addAll(textTypeNatives);
             }
 
-            if (retval == null || retval.isEmpty()) {
-                retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
+            if (retval.isEmpty()) {
+                retval = flavorToNativeLookup(flav, true);
             } else {
                 // In this branch it is guaranteed that natives explicitly
                 // listed for flav's MIME type were added with
                 // addUnencodedNativeForFlavor(), so they have lower priority.
-                List<String> explicitList =
-                    flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
-
-                // flavorToNativeLookup() never returns null.
-                // It can return an empty List, however.
-                if (!explicitList.isEmpty()) {
-                    // To prevent the List stored in the map from modification.
-                    // This also guarantees that removeAll() is supported.
-                    explicitList = new ArrayList<>(explicitList);
-                    // Use HashSet to get constant-time performance for search.
-                    explicitList.removeAll(new HashSet<>(retval));
-                    retval.addAll(explicitList);
-                }
+                retval.addAll(flavorToNativeLookup(flav, false));
             }
         } else if (DataTransferer.isFlavorNoncharsetTextType(flav)) {
-            retval = getAllNativesForType(flav.mimeType.getBaseType());
+            retval = getTextTypeToNative().get(flav.mimeType.getBaseType());
 
             if (retval == null || retval.isEmpty()) {
-                retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
+                retval = flavorToNativeLookup(flav, true);
             } else {
                 // In this branch it is guaranteed that natives explicitly
                 // listed for flav's MIME type were added with
                 // addUnencodedNativeForFlavor(), so they have lower priority.
-                List<String> explicitList =
-                    flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
-
-                // flavorToNativeLookup() never returns null.
-                // It can return an empty List, however.
-                if (!explicitList.isEmpty()) {
-                    // To prevent the List stored in the map from modification.
-                    // This also guarantees that add/removeAll() are supported.
-                    retval = new ArrayList<>(retval);
-                    explicitList = new ArrayList<>(explicitList);
-                    // Use HashSet to get constant-time performance for search.
-                    explicitList.removeAll(new HashSet<>(retval));
-                    retval.addAll(explicitList);
-                }
+                retval.addAll(flavorToNativeLookup(flav, false));
             }
         } else {
-            retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
+            retval = flavorToNativeLookup(flav, true);
         }
 
-        getNativesForFlavorCache.put(flav, new SoftReference<>(retval));
+        nativesForFlavorCache.put(flav, retval);
         // Create a copy, because client code can modify the returned list.
         return new ArrayList<>(retval);
     }
@@ -791,62 +763,38 @@
      * @see #encodeJavaMIMEType
      * @since 1.4
      */
+    @Override
     public synchronized List<DataFlavor> getFlavorsForNative(String nat) {
+        LinkedHashSet<DataFlavor> returnValue = flavorsForNativeCache.check(nat);
+        if (returnValue != null) {
+            return new ArrayList<>(returnValue);
+        } else {
+            returnValue = new LinkedHashSet<>();
+        }
 
-        // Check cache, even for null nat
-        SoftReference<List<DataFlavor>> ref = getFlavorsForNativeCache.get(nat);
-        if (ref != null) {
-            List<DataFlavor> retval = ref.get();
-            if (retval != null) {
-                return new ArrayList<>(retval);
+        if (nat == null) {
+            for (String n : getNativesForFlavor(null)) {
+                returnValue.addAll(getFlavorsForNative(n));
+            }
+        } else {
+            final LinkedHashSet<DataFlavor> flavors = nativeToFlavorLookup(nat);
+            if (disabledMappingGenerationKeys.contains(nat)) {
+                return new ArrayList<>(flavors);
+            }
+
+            final LinkedHashSet<DataFlavor> flavorsWithSynthesized =
+                    nativeToFlavorLookup(nat);
+
+            for (DataFlavor df : flavorsWithSynthesized) {
+                returnValue.add(df);
+                if ("text".equals(df.getPrimaryType())) {
+                    String baseType = df.mimeType.getBaseType();
+                    returnValue.addAll(convertMimeTypeToDataFlavors(baseType));
+                }
             }
         }
-
-        final LinkedHashSet <DataFlavor> returnValue =
-            new LinkedHashSet<>();
-
-        if (nat == null) {
-            final List<String> natives = getNativesForFlavor(null);
-
-            for (String n : natives)
-            {
-                final List<DataFlavor> flavors = getFlavorsForNative(n);
-
-                for (DataFlavor df : flavors)
-                {
-                    returnValue.add(df);
-                }
-            }
-        } else {
-
-            final List<DataFlavor> flavors = nativeToFlavorLookup(nat);
-
-            if (disabledMappingGenerationKeys.contains(nat)) {
-                return flavors;
-            }
-
-            final List<DataFlavor> flavorsAndBaseTypes =
-                nativeToFlavorLookup(nat);
-
-            for (DataFlavor df : flavorsAndBaseTypes) {
-                returnValue.add(df);
-                if ("text".equals(df.getPrimaryType())) {
-                    try {
-                        returnValue.addAll(
-                                convertMimeTypeToDataFlavors(
-                                        new MimeType(df.getMimeType()
-                                        ).getBaseType()));
-                    } catch (MimeTypeParseException e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-
-        }
-
-        final List<DataFlavor> arrayList = new ArrayList<>(returnValue);
-        getFlavorsForNativeCache.put(nat, new SoftReference<>(arrayList));
-        return new ArrayList<>(arrayList);
+        flavorsForNativeCache.put(nat, returnValue);
+        return new ArrayList<>(returnValue);
     }
 
     private static Set<DataFlavor> convertMimeTypeToDataFlavors(
@@ -862,7 +810,6 @@
         } catch (MimeTypeParseException mtpe) {
             // Cannot happen, since we checked all mappings
             // on load from flavormap.properties.
-            assert(false);
         }
 
         if (DataTransferer.doesSubtypeSupportCharset(subType, null)) {
@@ -941,10 +888,10 @@
     }
 
     private static final String [] htmlDocumntTypes =
-        new String [] {"all", "selection", "fragment"};
+            new String [] {"all", "selection", "fragment"};
 
-    private static LinkedHashSet<String> handleHtmlMimeTypes(
-        String baseType, String mimeType) {
+    private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
+                                                             String mimeType) {
 
         LinkedHashSet<String> returnValues = new LinkedHashSet<>();
 
@@ -981,14 +928,14 @@
      * @see #getNativesForFlavor
      * @see #encodeDataFlavor
      */
-    public synchronized Map<DataFlavor,String>
-        getNativesForFlavors(DataFlavor[] flavors)
+    @Override
+    public synchronized Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors)
     {
         // Use getNativesForFlavor to generate extra natives for text flavors
         // and stringFlavor
 
         if (flavors == null) {
-            List flavor_list = getFlavorsForNative(null);
+            List<DataFlavor> flavor_list = getFlavorsForNative(null);
             flavors = new DataFlavor[flavor_list.size()];
             flavor_list.toArray(flavors);
         }
@@ -1027,15 +974,14 @@
      * @see #getFlavorsForNative
      * @see #encodeJavaMIMEType
      */
-    public synchronized Map<String,DataFlavor>
-        getFlavorsForNatives(String[] natives)
+    @Override
+    public synchronized Map<String,DataFlavor> getFlavorsForNatives(String[] natives)
     {
         // Use getFlavorsForNative to generate extra flavors for text natives
-
         if (natives == null) {
-            List native_list = getNativesForFlavor(null);
-            natives = new String[native_list.size()];
-            native_list.toArray(natives);
+            List<String> nativesList = getNativesForFlavor(null);
+            natives = new String[nativesList.size()];
+            nativesList.toArray(natives);
         }
 
         Map<String, DataFlavor> retval = new HashMap<>(natives.length, 1.0f);
@@ -1044,7 +990,6 @@
             DataFlavor flav = (flavors.isEmpty())? null : flavors.get(0);
             retval.put(aNative, flav);
         }
-
         return retval;
     }
 
@@ -1070,20 +1015,16 @@
      */
     public synchronized void addUnencodedNativeForFlavor(DataFlavor flav,
                                                          String nat) {
-        if (flav == null || nat == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flav, "Null flavor not permitted");
 
-        List<String> natives = getFlavorToNative().get(flav);
+        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
         if (natives == null) {
-            natives = new ArrayList<>(1);
+            natives = new LinkedHashSet<>(1);
             getFlavorToNative().put(flav, natives);
-        } else if (natives.contains(nat)) {
-            return;
         }
         natives.add(nat);
-        getNativesForFlavorCache.remove(flav);
-        getNativesForFlavorCache.remove(null);
+        nativesForFlavorCache.remove(flav);
     }
 
     /**
@@ -1116,18 +1057,15 @@
      */
     public synchronized void setNativesForFlavor(DataFlavor flav,
                                                  String[] natives) {
-        if (flav == null || natives == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(natives, "Null natives not permitted");
+        Objects.requireNonNull(flav, "Null flavors not permitted");
 
         getFlavorToNative().remove(flav);
         for (String aNative : natives) {
             addUnencodedNativeForFlavor(flav, aNative);
         }
         disabledMappingGenerationKeys.add(flav);
-        // Clear the cache to handle the case of empty natives.
-        getNativesForFlavorCache.remove(flav);
-        getNativesForFlavorCache.remove(null);
+        nativesForFlavorCache.remove(flav);
     }
 
     /**
@@ -1150,20 +1088,16 @@
      */
     public synchronized void addFlavorForUnencodedNative(String nat,
                                                          DataFlavor flav) {
-        if (nat == null || flav == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flav, "Null flavor not permitted");
 
-        List<DataFlavor> flavors = getNativeToFlavor().get(nat);
+        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
         if (flavors == null) {
-            flavors = new ArrayList<>(1);
+            flavors = new LinkedHashSet<>(1);
             getNativeToFlavor().put(nat, flavors);
-        } else if (flavors.contains(flav)) {
-            return;
         }
         flavors.add(flav);
-        getFlavorsForNativeCache.remove(nat);
-        getFlavorsForNativeCache.remove(null);
+        flavorsForNativeCache.remove(nat);
     }
 
     /**
@@ -1195,18 +1129,15 @@
      */
     public synchronized void setFlavorsForNative(String nat,
                                                  DataFlavor[] flavors) {
-        if (nat == null || flavors == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flavors, "Null flavors not permitted");
 
         getNativeToFlavor().remove(nat);
         for (DataFlavor flavor : flavors) {
             addFlavorForUnencodedNative(nat, flavor);
         }
         disabledMappingGenerationKeys.add(nat);
-        // Clear the cache to handle the case of empty flavors.
-        getFlavorsForNativeCache.remove(nat);
-        getFlavorsForNativeCache.remove(null);
+        flavorsForNativeCache.remove(nat);
     }
 
     /**
@@ -1307,17 +1238,29 @@
             : null;
     }
 
-    private List<String> getAllNativesForType(String type) {
-        Set<String> retval = null;
-        for (DataFlavor dataFlavor : convertMimeTypeToDataFlavors(type)) {
-            List<String> natives = getFlavorToNative().get(dataFlavor);
-            if (natives != null && !natives.isEmpty()) {
-                if (retval == null) {
-                    retval = new LinkedHashSet<>();
-                }
-                retval.addAll(natives);
+    private static final class SoftCache<K, V> {
+        Map<K, SoftReference<LinkedHashSet<V>>> cache;
+
+        public void put(K key, LinkedHashSet<V> value) {
+            if (cache == null) {
+                cache = new HashMap<>(1);
             }
+            cache.put(key, new SoftReference<>(value));
         }
-        return retval == null ? null : new ArrayList<>(retval);
+
+        public void remove(K key) {
+            if (cache == null) return;
+            cache.remove(null);
+            cache.remove(key);
+        }
+
+        public LinkedHashSet<V> check(K key) {
+            if (cache == null) return null;
+            SoftReference<LinkedHashSet<V>> ref = cache.get(key);
+            if (ref != null) {
+                return ref.get();
+            }
+            return null;
+        }
     }
 }
--- a/src/share/classes/java/awt/dnd/DragGestureEvent.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/dnd/DragGestureEvent.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -357,6 +357,7 @@
         action = newAction;
 
         // Pre-1.4 support. 'events' was previously non-transient
+        @SuppressWarnings("rawtypes")
         List newEvents;
         try {
             newEvents = (List)f.get("events", null);
--- a/src/share/classes/java/awt/geom/Area.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/geom/Area.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -97,9 +97,9 @@
  * @since 1.2
  */
 public class Area implements Shape, Cloneable {
-    private static Vector EmptyCurves = new Vector();
+    private static Vector<Curve> EmptyCurves = new Vector<>();
 
-    private Vector curves;
+    private Vector<Curve> curves;
 
     /**
      * Default constructor which creates an empty area.
@@ -127,8 +127,8 @@
         }
     }
 
-    private static Vector pathToCurves(PathIterator pi) {
-        Vector curves = new Vector();
+    private static Vector<Curve> pathToCurves(PathIterator pi) {
+        Vector<Curve> curves = new Vector<>();
         int windingRule = pi.getWindingRule();
         // coords array is big enough for holding:
         //     coordinates returned from currentSegment (6)
@@ -334,7 +334,7 @@
      * @since 1.2
      */
     public void reset() {
-        curves = new Vector();
+        curves = new Vector<>();
         invalidateBounds();
     }
 
@@ -357,9 +357,9 @@
      * @since 1.2
      */
     public boolean isPolygonal() {
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            if (((Curve) enum_.nextElement()).getOrder() > 1) {
+            if (enum_.nextElement().getOrder() > 1) {
                 return false;
             }
         }
@@ -381,8 +381,8 @@
         if (size > 3) {
             return false;
         }
-        Curve c1 = (Curve) curves.get(1);
-        Curve c2 = (Curve) curves.get(2);
+        Curve c1 = curves.get(1);
+        Curve c2 = curves.get(2);
         if (c1.getOrder() != 1 || c2.getOrder() != 1) {
             return false;
         }
@@ -411,10 +411,10 @@
         if (curves.size() < 3) {
             return true;
         }
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         enum_.nextElement(); // First Order0 "moveto"
         while (enum_.hasMoreElements()) {
-            if (((Curve) enum_.nextElement()).getOrder() == 0) {
+            if (enum_.nextElement().getOrder() == 0) {
                 return false;
             }
         }
@@ -431,11 +431,11 @@
         }
         Rectangle2D r = new Rectangle2D.Double();
         if (curves.size() > 0) {
-            Curve c = (Curve) curves.get(0);
+            Curve c = curves.get(0);
             // First point is always an order 0 curve (moveto)
             r.setRect(c.getX0(), c.getY0(), 0, 0);
             for (int i = 1; i < curves.size(); i++) {
-                ((Curve) curves.get(i)).enlarge(r);
+                curves.get(i).enlarge(r);
             }
         }
         return (cachedBounds = r);
@@ -507,7 +507,7 @@
         if (other == null) {
             return false;
         }
-        Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
+        Vector<Curve> c = new AreaOp.XorOp().calculate(this.curves, other.curves);
         return c.isEmpty();
     }
 
@@ -555,10 +555,10 @@
         if (!getCachedBounds().contains(x, y)) {
             return false;
         }
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         int crossings = 0;
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             crossings += c.crossingsFor(x, y);
         }
         return ((crossings & 1) == 1);
@@ -658,16 +658,16 @@
 
 class AreaIterator implements PathIterator {
     private AffineTransform transform;
-    private Vector curves;
+    private Vector<Curve> curves;
     private int index;
     private Curve prevcurve;
     private Curve thiscurve;
 
-    public AreaIterator(Vector curves, AffineTransform at) {
+    public AreaIterator(Vector<Curve> curves, AffineTransform at) {
         this.curves = curves;
         this.transform = at;
         if (curves.size() >= 1) {
-            thiscurve = (Curve) curves.get(0);
+            thiscurve = curves.get(0);
         }
     }
 
@@ -689,7 +689,7 @@
             prevcurve = thiscurve;
             index++;
             if (index < curves.size()) {
-                thiscurve = (Curve) curves.get(index);
+                thiscurve = curves.get(index);
                 if (thiscurve.getOrder() != 0 &&
                     prevcurve.getX1() == thiscurve.getX0() &&
                     prevcurve.getY1() == thiscurve.getY0())
--- a/src/share/classes/java/awt/image/BufferedImage.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/BufferedImage.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -76,7 +76,7 @@
     ColorModel colorModel;
     WritableRaster raster;
     OffScreenImageSource osis;
-    Hashtable properties;
+    Hashtable<?, ?> properties;
 
     boolean    isAlphaPremultiplied;// If true, alpha has been premultiplied in
     // color channels
@@ -1106,7 +1106,7 @@
     public ImageProducer getSource() {
         if (osis == null) {
             if (properties == null) {
-                properties = new Hashtable();
+                properties = new Hashtable<>();
             }
             osis = new OffScreenImageSource(this, properties);
         }
--- a/src/share/classes/java/awt/image/CropImageFilter.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/CropImageFilter.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -79,6 +79,7 @@
      * with the filtering operation.
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         p.put("croprect", new Rectangle(cropX, cropY, cropW, cropH));
         super.setProperties(p);
--- a/src/share/classes/java/awt/image/FilteredImageSource.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/FilteredImageSource.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -68,7 +68,7 @@
         filter = imgf;
     }
 
-    private Hashtable proxies;
+    private Hashtable<ImageConsumer, ImageFilter> proxies;
 
     /**
      * Adds the specified <code>ImageConsumer</code>
@@ -94,7 +94,7 @@
      */
     public synchronized void addConsumer(ImageConsumer ic) {
         if (proxies == null) {
-            proxies = new Hashtable();
+            proxies = new Hashtable<>();
         }
         if (!proxies.containsKey(ic)) {
             ImageFilter imgf = filter.getFilterInstance(ic);
@@ -137,7 +137,7 @@
      */
     public synchronized void removeConsumer(ImageConsumer ic) {
         if (proxies != null) {
-            ImageFilter imgf = (ImageFilter) proxies.get(ic);
+            ImageFilter imgf =  proxies.get(ic);
             if (imgf != null) {
                 src.removeConsumer(imgf);
                 proxies.remove(ic);
@@ -173,9 +173,9 @@
      */
     public void startProduction(ImageConsumer ic) {
         if (proxies == null) {
-            proxies = new Hashtable();
+            proxies = new Hashtable<>();
         }
-        ImageFilter imgf = (ImageFilter) proxies.get(ic);
+        ImageFilter imgf = proxies.get(ic);
         if (imgf == null) {
             imgf = filter.getFilterInstance(ic);
             proxies.put(ic, imgf);
@@ -200,7 +200,7 @@
      */
     public void requestTopDownLeftRightResend(ImageConsumer ic) {
         if (proxies != null) {
-            ImageFilter imgf = (ImageFilter) proxies.get(ic);
+            ImageFilter imgf = proxies.get(ic);
             if (imgf != null) {
                 imgf.resendTopDownLeftRight(src);
             }
--- a/src/share/classes/java/awt/image/ImageFilter.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/ImageFilter.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -104,6 +104,7 @@
      * @exception NullPointerException if <code>props</code> is null
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         Object o = p.get("filters");
         if (o == null) {
--- a/src/share/classes/java/awt/image/MemoryImageSource.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/MemoryImageSource.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, 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
@@ -111,8 +111,8 @@
     Object pixels;
     int pixeloffset;
     int pixelscan;
-    Hashtable properties;
-    Vector theConsumers = new Vector();
+    Hashtable<?, ?> properties;
+    Vector<ImageConsumer> theConsumers = new Vector<>();
     boolean animating;
     boolean fullbuffers;
 
@@ -197,7 +197,7 @@
     }
 
     private void initialize(int w, int h, ColorModel cm,
-                            Object pix, int off, int scan, Hashtable props) {
+                            Object pix, int off, int scan, Hashtable<?,?> props) {
         width = w;
         height = h;
         model = cm;
@@ -205,7 +205,7 @@
         pixeloffset = off;
         pixelscan = scan;
         if (props == null) {
-            props = new Hashtable();
+            props = new Hashtable<>();
         }
         properties = props;
     }
@@ -343,9 +343,9 @@
     public synchronized void setAnimated(boolean animated) {
         this.animating = animated;
         if (!animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
                 if (isConsumer(ic)) {
                     ic.imageComplete(ImageConsumer.IMAGEERROR);
@@ -376,9 +376,9 @@
         }
         this.fullbuffers = fullbuffers;
         if (animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.setHints(fullbuffers
                             ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                                ImageConsumer.COMPLETESCANLINES)
@@ -474,9 +474,9 @@
             if ((w <= 0 || h <= 0) && !framenotify) {
                 return;
             }
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 if (w > 0 && h > 0) {
                     sendPixels(ic, x, y, w, h);
                 }
--- a/src/share/classes/java/awt/image/ReplicateScaleFilter.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/ReplicateScaleFilter.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -121,6 +121,7 @@
      * with the filtering operation.
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         String key = "rescale";
         String val = destWidth + "x" + destHeight;
--- a/src/share/classes/java/awt/image/renderable/ParameterBlock.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/renderable/ParameterBlock.java	Fri May 23 23:55:14 2014 +0000
@@ -153,6 +153,7 @@
      *
      * @return an Object clone of the <code>ParameterBlock</code>.
      */
+    @SuppressWarnings("unchecked") // casts from clone
     public Object clone() {
         ParameterBlock theClone;
 
@@ -164,10 +165,10 @@
         }
 
         if (sources != null) {
-            theClone.setSources((Vector)sources.clone());
+            theClone.setSources((Vector<Object>)sources.clone());
         }
         if (parameters != null) {
-            theClone.setParameters((Vector)parameters.clone());
+            theClone.setParameters((Vector<Object>)parameters.clone());
         }
         return (Object) theClone;
     }
@@ -280,7 +281,7 @@
 
     /** Clears the list of source images. */
     public void removeSources() {
-        sources = new Vector();
+        sources = new Vector<>();
     }
 
     /**
@@ -313,7 +314,7 @@
 
     /** Clears the list of parameters. */
     public void removeParameters() {
-        parameters = new Vector();
+        parameters = new Vector<>();
     }
 
     /**
@@ -696,9 +697,9 @@
      * of the parameters.
      * @return an array of <code>Class</code> objects.
      */
-    public Class [] getParamClasses() {
+    public Class<?>[] getParamClasses() {
         int numParams = getNumParameters();
-        Class [] classes = new Class[numParams];
+        Class<?>[] classes = new Class<?>[numParams];
         int i;
 
         for (i = 0; i < numParams; i++) {
--- a/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -87,11 +87,11 @@
         return getRenderableSources();
     }
 
-    private Vector getRenderableSources() {
-        Vector sources = null;
+    private Vector<RenderableImage> getRenderableSources() {
+        Vector<RenderableImage> sources = null;
 
         if (paramBlock.getNumSources() > 0) {
-            sources = new Vector();
+            sources = new Vector<>();
             int i = 0;
             while (i < paramBlock.getNumSources()) {
                 Object o = paramBlock.getSource(i);
@@ -314,19 +314,19 @@
         // contains RenderableImage sources, they will be replaced by
         // RenderedImages.
         ParameterBlock renderedParamBlock = (ParameterBlock)paramBlock.clone();
-        Vector sources = getRenderableSources();
+        Vector<? extends Object> sources = getRenderableSources();
 
         try {
             // This assumes that if there is no renderable source, that there
             // is a rendered source in paramBlock
 
             if (sources != null) {
-                Vector renderedSources = new Vector();
+                Vector<Object> renderedSources = new Vector<>();
                 for (int i = 0; i < sources.size(); i++) {
                     rcOut = myCRIF.mapRenderContext(i, renderContext,
                                                     paramBlock, this);
                     RenderedImage rdrdImage =
-                       ((RenderableImage)sources.elementAt(i)).createRendering(rcOut);
+                        ((RenderableImage)sources.elementAt(i)).createRendering(rcOut);
                     if (rdrdImage == null) {
                         return null;
                     }
--- a/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -68,7 +68,7 @@
     RenderContext rc;
 
     /** A Vector of image consumers. */
-    Vector ics = new Vector();
+    Vector<ImageConsumer> ics = new Vector<>();
 
     /**
      * Constructs a new RenderableImageProducer from a RenderableImage
@@ -177,12 +177,12 @@
         int width = raster.getWidth();
         int height = raster.getHeight();
 
-        Enumeration icList;
+        Enumeration<ImageConsumer> icList;
         ImageConsumer ic;
         // Set up the ImageConsumers
         icList = ics.elements();
         while (icList.hasMoreElements()) {
-            ic = (ImageConsumer)icList.nextElement();
+            ic = icList.nextElement();
             ic.setDimensions(width,height);
             ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT |
                         ImageConsumer.COMPLETESCANLINES |
@@ -204,7 +204,7 @@
             // Now send the scanline to the Consumers
             icList = ics.elements();
             while (icList.hasMoreElements()) {
-                ic = (ImageConsumer)icList.nextElement();
+                ic = icList.nextElement();
                 ic.setPixels(0, j, width, 1, colorModel, pix, 0, width);
             }
         }
@@ -212,7 +212,7 @@
         // Now tell the consumers we're done.
         icList = ics.elements();
         while (icList.hasMoreElements()) {
-            ic = (ImageConsumer)icList.nextElement();
+            ic = icList.nextElement();
             ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
         }
     }
--- a/src/share/classes/java/awt/print/Book.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/print/Book.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -47,7 +47,7 @@
     /**
      * The set of pages that make up the Book.
      */
-    private Vector mPages;
+    private Vector<BookPage> mPages;
 
  /* Instance Methods */
 
@@ -55,7 +55,7 @@
      *  Creates a new, empty <code>Book</code>.
      */
     public Book() {
-        mPages = new Vector();
+        mPages = new Vector<>();
     }
 
     /**
@@ -167,7 +167,7 @@
     private BookPage getPage(int pageIndex)
         throws ArrayIndexOutOfBoundsException
     {
-        return (BookPage) mPages.elementAt(pageIndex);
+        return mPages.elementAt(pageIndex);
     }
 
     /**
--- a/src/share/classes/java/awt/print/PrinterJob.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/awt/print/PrinterJob.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -74,9 +74,9 @@
         if (security != null) {
             security.checkPrintJobAccess();
         }
-        return (PrinterJob) java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
-            public Object run() {
+        return java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<PrinterJob>() {
+            public PrinterJob run() {
                 String nm = System.getProperty("java.awt.printerjob", null);
                 try {
                     return (PrinterJob)Class.forName(nm).newInstance();
--- a/src/share/classes/java/beans/MethodDescriptor.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/java/beans/MethodDescriptor.java	Fri May 23 23:55:14 2014 +0000
@@ -162,6 +162,16 @@
                 : null;
     }
 
+    private static Method resolve(Method oldMethod, Method newMethod) {
+        if (oldMethod == null) {
+            return newMethod;
+        }
+        if (newMethod == null) {
+            return oldMethod;
+        }
+        return !oldMethod.isSynthetic() && newMethod.isSynthetic() ? oldMethod : newMethod;
+    }
+
     /*
      * Package-private constructor
      * Merge two method descriptors.  Where they conflict, give the
@@ -173,8 +183,7 @@
     MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
         super(x, y);
 
-        Method method = y.methodRef.get();
-        this.methodRef.set(null != method ? method : x.methodRef.get());
+        this.methodRef.set(resolve(x.methodRef.get(), y.methodRef.get()));
         params = x.params;
         if (y.params != null) {
             params = y.params;
--- a/src/share/classes/javax/accessibility/AccessibleContext.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/accessibility/AccessibleContext.java	Fri May 23 23:55:14 2014 +0000
@@ -25,6 +25,9 @@
 
 package javax.accessibility;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AppContext;
+
 import java.util.Locale;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
@@ -79,6 +82,26 @@
  */
 public abstract class AccessibleContext {
 
+    /**
+     * The AppContext that should be used to dispatch events for this
+     * AccessibleContext
+     */
+    private volatile AppContext targetAppContext;
+
+    static {
+        AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() {
+            @Override
+            public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) {
+                accessibleContext.targetAppContext = appContext;
+            }
+
+            @Override
+            public AppContext getAppContext(AccessibleContext accessibleContext) {
+                return accessibleContext.targetAppContext;
+            }
+        });
+    }
+
    /**
     * Constant used to determine when the accessibleName property has
     * changed.  The old value in the PropertyChangeEvent will be the old
--- a/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -35,7 +35,7 @@
 import javax.sound.sampled.UnsupportedAudioFileException;
 
 /**
- * Provider for audio file reading services.  Classes providing concrete
+ * Provider for audio file reading services. Classes providing concrete
  * implementations can parse the format information from one or more types of
  * audio file, and can produce audio input streams from files of these types.
  *
@@ -45,93 +45,106 @@
 public abstract class AudioFileReader {
 
     /**
-     * Obtains the audio file format of the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file readers may
+     * Obtains the audio file format of the input stream provided. The stream
+     * must point to valid audio file data. In general, audio file readers may
      * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an <code>IOException</code>.
-     * @param stream the input stream from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
+     * support it. These parsers must be able to mark the stream, read enough
+     * data to determine whether they support the stream, and, if not, reset the
+     * stream's read pointer to its original position. If the input stream does
+     * not support this, this method may fail with an {@code IOException}.
+     *
+     * @param  stream the input stream from which file format information should
+     *         be extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the stream does not point to
+     *         valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @see InputStream#markSupported
      * @see InputStream#mark
      */
-    public abstract AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioFileFormat getAudioFileFormat(InputStream stream)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains the audio file format of the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the URL provided. The URL must point to
+     * valid audio file data.
+     *
+     * @param  url the URL from which file format information should be
+     *         extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the URL does not point to valid
+     *         audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioFileFormat getAudioFileFormat(URL url)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains the audio file format of the <code>File</code> provided.  The <code>File</code> must
-     * point to valid audio file data.
-     * @param file the <code>File</code> from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the {@code File} provided.
+     * The {@code File} must point to valid audio file data.
+     *
+     * @param  file the {@code File} from which file format information
+     *         should be extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the {@code File} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioFileFormat getAudioFileFormat(File file)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file readers may
+     * Obtains an audio input stream from the input stream provided. The stream
+     * must point to valid audio file data. In general, audio file readers may
      * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an <code>IOException</code>.
-     * @param stream the input stream from which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data contained
-     * in the input stream.
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
+     * support it. These parsers must be able to mark the stream, read enough
+     * data to determine whether they support the stream, and, if not, reset the
+     * stream's read pointer to its original position. If the input stream does
+     * not support this, this method may fail with an {@code IOException}.
+     *
+     * @param  stream the input stream from which the {@code AudioInputStream}
+     *         should be constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         contained in the input stream.
+     * @throws UnsupportedAudioFileException if the stream does not point to
+     *         valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @see InputStream#markSupported
      * @see InputStream#mark
      */
-    public abstract AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioInputStream getAudioInputStream(InputStream stream)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
+     * Obtains an audio input stream from the URL provided. The URL must point
+     * to valid audio file data.
+     *
+     * @param  url the URL for which the {@code AudioInputStream} should be
+     *         constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         pointed to by the URL
+     * @throws UnsupportedAudioFileException if the URL does not point to valid
+     *         audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioInputStream getAudioInputStream(URL url)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the <code>File</code> provided.  The <code>File</code> must
-     * point to valid audio file data.
-     * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the File
-     * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
-     * file data recognized by the system
+     * Obtains an audio input stream from the {@code File} provided.
+     * The {@code File} must point to valid audio file data.
+     *
+     * @param  file the {@code File} for which the {@code AudioInputStream}
+     *         should be constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         pointed to by the File
+     * @throws UnsupportedAudioFileException if the {@code File} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioInputStream getAudioInputStream(File file)
+            throws UnsupportedAudioFileException, IOException;
 }
--- a/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -26,16 +26,15 @@
 package javax.sound.sampled.spi;
 
 import java.io.File;
-import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioInputStream;
 
+import static javax.sound.sampled.AudioFileFormat.Type;
 
 /**
- * Provider for audio file writing services.  Classes providing concrete
+ * Provider for audio file writing services. Classes providing concrete
  * implementations can write one or more types of audio file from an audio
  * stream.
  *
@@ -47,22 +46,23 @@
     /**
      * Obtains the file types for which file writing support is provided by this
      * audio file writer.
-     * @return array of file types.  If no file types are supported,
-     * an array of length 0 is returned.
+     *
+     * @return array of file types. If no file types are supported, an array of
+     *         length 0 is returned.
      */
-    public abstract AudioFileFormat.Type[] getAudioFileTypes();
-
+    public abstract Type[] getAudioFileTypes();
 
     /**
-     * Indicates whether file writing support for the specified file type is provided
-     * by this audio file writer.
-     * @param fileType the file type for which write capabilities are queried
-     * @return <code>true</code> if the file type is supported,
-     * otherwise <code>false</code>
+     * Indicates whether file writing support for the specified file type is
+     * provided by this audio file writer.
+     *
+     * @param  fileType the file type for which write capabilities are queried
+     * @return {@code true} if the file type is supported, otherwise
+     *         {@code false}
      */
-    public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
+    public boolean isFileTypeSupported(Type fileType) {
 
-        AudioFileFormat.Type types[] = getAudioFileTypes();
+        Type types[] = getAudioFileTypes();
 
         for(int i=0; i<types.length; i++) {
             if( fileType.equals( types[i] ) ) {
@@ -72,29 +72,29 @@
         return false;
     }
 
-
     /**
      * Obtains the file types that this audio file writer can write from the
      * audio input stream specified.
-     * @param stream the audio input stream for which audio file type support
-     * is queried
-     * @return array of file types.  If no file types are supported,
-     * an array of length 0 is returned.
+     *
+     * @param  stream the audio input stream for which audio file type support
+     *         is queried
+     * @return array of file types. If no file types are supported, an array of
+     *         length 0 is returned.
      */
-    public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream);
-
+    public abstract Type[] getAudioFileTypes(AudioInputStream stream);
 
     /**
-     * Indicates whether an audio file of the type specified can be written
-     * from the audio input stream indicated.
-     * @param fileType file type for which write capabilities are queried
-     * @param stream for which file writing support is queried
-     * @return <code>true</code> if the file type is supported for this audio input stream,
-     * otherwise <code>false</code>
+     * Indicates whether an audio file of the type specified can be written from
+     * the audio input stream indicated.
+     *
+     * @param  fileType file type for which write capabilities are queried
+     * @param  stream for which file writing support is queried
+     * @return {@code true} if the file type is supported for this audio input
+     *         stream, otherwise {@code false}
      */
-    public boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream) {
+    public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) {
 
-        AudioFileFormat.Type types[] = getAudioFileTypes( stream );
+        Type types[] = getAudioFileTypes( stream );
 
         for(int i=0; i<types.length; i++) {
             if( fileType.equals( types[i] ) ) {
@@ -104,44 +104,44 @@
         return false;
     }
 
-
     /**
      * Writes a stream of bytes representing an audio file of the file type
-     * indicated to the output stream provided.  Some file types require that
+     * indicated to the output stream provided. Some file types require that
      * the length be written into the file header, and cannot be written from
-     * start to finish unless the length is known in advance.  An attempt
-     * to write such a file type will fail with an IOException if the length in
-     * the audio file format is
-     * {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED AudioSystem.NOT_SPECIFIED}.
-     * @param stream the audio input stream containing audio data to be
-     * written to the output stream
-     * @param fileType file type to be written to the output stream
-     * @param out stream to which the file data should be written
+     * start to finish unless the length is known in advance. An attempt to
+     * write such a file type will fail with an IOException if the length in the
+     * audio file format is {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED
+     * AudioSystem.NOT_SPECIFIED}.
+     *
+     * @param  stream the audio input stream containing audio data to be written
+     *         to the output stream
+     * @param  fileType file type to be written to the output stream
+     * @param  out stream to which the file data should be written
      * @return the number of bytes written to the output stream
      * @throws IOException if an I/O exception occurs
-     * @throws IllegalArgumentException if the file type is not supported by
-     * the system
-     * @see #isFileTypeSupported(AudioFileFormat.Type, AudioInputStream)
+     * @throws IllegalArgumentException if the file type is not supported by the
+     *         system
+     * @see #isFileTypeSupported(Type, AudioInputStream)
      * @see #getAudioFileTypes
      */
-    public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException;
-
+    public abstract int write(AudioInputStream stream, Type fileType,
+                              OutputStream out) throws IOException;
 
     /**
      * Writes a stream of bytes representing an audio file of the file format
      * indicated to the external file provided.
-     * @param stream the audio input stream containing audio data to be
-     * written to the file
-     * @param fileType file type to be written to the file
-     * @param out external file to which the file data should be written
+     *
+     * @param  stream the audio input stream containing audio data to be written
+     *         to the file
+     * @param  fileType file type to be written to the file
+     * @param  out external file to which the file data should be written
      * @return the number of bytes written to the file
      * @throws IOException if an I/O exception occurs
      * @throws IllegalArgumentException if the file format is not supported by
-     * the system
+     *         the system
      * @see #isFileTypeSupported
      * @see #getAudioFileTypes
      */
-    public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException;
-
-
+    public abstract int write(AudioInputStream stream, Type fileType, File out)
+            throws IOException;
 }
--- a/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -25,63 +25,62 @@
 
 package javax.sound.sampled.spi;
 
-import java.io.InputStream;
-
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
 
+import static javax.sound.sampled.AudioFormat.Encoding;
+
 /**
- * A format conversion provider provides format conversion services
- * from one or more input formats to one or more output formats.
- * Converters include codecs, which encode and/or decode audio data,
- * as well as transcoders, etc.  Format converters provide methods for
- * determining what conversions are supported and for obtaining an audio
- * stream from which converted data can be read.
+ * A format conversion provider provides format conversion services from one or
+ * more input formats to one or more output formats. Converters include codecs,
+ * which encode and/or decode audio data, as well as transcoders, etc. Format
+ * converters provide methods for determining what conversions are supported and
+ * for obtaining an audio stream from which converted data can be read.
  * <p>
- * The source format represents the format of the incoming
- * audio data, which will be converted.
+ * The source format represents the format of the incoming audio data, which
+ * will be converted.
  * <p>
- * The target format represents the format of the processed, converted
- * audio data.  This is the format of the data that can be read from
- * the stream returned by one of the <code>getAudioInputStream</code> methods.
+ * The target format represents the format of the processed, converted audio
+ * data. This is the format of the data that can be read from the stream
+ * returned by one of the {@code getAudioInputStream} methods.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public abstract class FormatConversionProvider {
 
-
-    // NEW METHODS
+    /**
+     * Obtains the set of source format encodings from which format conversion
+     * services are provided by this provider.
+     *
+     * @return array of source format encodings. If for some reason provider
+     *         does not provide any conversion services, an array of length 0 is
+     *         returned.
+     */
+    public abstract Encoding[] getSourceEncodings();
 
     /**
-     * Obtains the set of source format encodings from which format
-     * conversion services are provided by this provider.
-     * @return array of source format encodings. If for some reason provider
-     * does not provide any conversion services, an array of length 0 is
-     * returned.
+     * Obtains the set of target format encodings to which format conversion
+     * services are provided by this provider.
+     *
+     * @return array of target format encodings. If for some reason provider
+     *         does not provide any conversion services, an array of length 0 is
+     *         returned.
      */
-    public abstract AudioFormat.Encoding[] getSourceEncodings();
-
-
-    /**
-     * Obtains the set of target format encodings to which format
-     * conversion services are provided by this provider.
-     * @return array of target format encodings. If for some reason provider
-     * does not provide any conversion services, an array of length 0 is
-     * returned.
-     */
-    public abstract AudioFormat.Encoding[] getTargetEncodings();
-
+    public abstract Encoding[] getTargetEncodings();
 
     /**
      * Indicates whether the format converter supports conversion from the
      * specified source format encoding.
-     * @param sourceEncoding the source format encoding for which support is queried
-     * @return <code>true</code> if the encoding is supported, otherwise <code>false</code>
+     *
+     * @param  sourceEncoding the source format encoding for which support is
+     *         queried
+     * @return {@code true} if the encoding is supported, otherwise
+     *         {@code false}
      */
-    public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding){
+    public boolean isSourceEncodingSupported(Encoding sourceEncoding) {
 
-        AudioFormat.Encoding sourceEncodings[] = getSourceEncodings();
+        Encoding sourceEncodings[] = getSourceEncodings();
 
         for(int i=0; i<sourceEncodings.length; i++) {
             if( sourceEncoding.equals( sourceEncodings[i]) ) {
@@ -91,16 +90,18 @@
         return false;
     }
 
-
     /**
      * Indicates whether the format converter supports conversion to the
      * specified target format encoding.
-     * @param targetEncoding the target format encoding for which support is queried
-     * @return <code>true</code> if the encoding is supported, otherwise <code>false</code>
+     *
+     * @param  targetEncoding the target format encoding for which support is
+     *         queried
+     * @return {@code true} if the encoding is supported, otherwise
+     *         {@code false}
      */
-    public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding){
+    public boolean isTargetEncodingSupported(Encoding targetEncoding) {
 
-        AudioFormat.Encoding targetEncodings[] = getTargetEncodings();
+        Encoding targetEncodings[] = getTargetEncodings();
 
         for(int i=0; i<targetEncodings.length; i++) {
             if( targetEncoding.equals( targetEncodings[i]) ) {
@@ -110,28 +111,29 @@
         return false;
     }
 
+    /**
+     * Obtains the set of target format encodings supported by the format
+     * converter given a particular source format. If no target format encodings
+     * are supported for this source format, an array of length 0 is returned.
+     *
+     * @param  sourceFormat format of the incoming data
+     * @return array of supported target format encodings.
+     */
+    public abstract Encoding[] getTargetEncodings(AudioFormat sourceFormat);
 
     /**
-     * Obtains the set of target format encodings supported by the format converter
-     * given a particular source format.
-     * If no target format encodings are supported for this source format,
-     * an array of length 0 is returned.
-     * @param sourceFormat format of the incoming data
-     * @return array of supported target format encodings.
+     * Indicates whether the format converter supports conversion to a
+     * particular encoding from a particular format.
+     *
+     * @param  targetEncoding desired encoding of the outgoing data
+     * @param  sourceFormat format of the incoming data
+     * @return {@code true} if the conversion is supported, otherwise
+     *         {@code false}
      */
-    public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat);
+    public boolean isConversionSupported(Encoding targetEncoding,
+                                         AudioFormat sourceFormat) {
 
-
-    /**
-     * Indicates whether the format converter supports conversion to a particular encoding
-     * from a particular format.
-     * @param targetEncoding desired encoding of the outgoing data
-     * @param sourceFormat format of the incoming data
-     * @return <code>true</code> if the conversion is supported, otherwise <code>false</code>
-     */
-    public boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
-
-        AudioFormat.Encoding targetEncodings[] = getTargetEncodings(sourceFormat);
+        Encoding targetEncodings[] = getTargetEncodings(sourceFormat);
 
         for(int i=0; i<targetEncodings.length; i++) {
             if( targetEncoding.equals( targetEncodings[i]) ) {
@@ -141,27 +143,29 @@
         return false;
     }
 
-
     /**
-     * Obtains the set of target formats with the encoding specified
-     * supported by the format converter
-     * If no target formats with the specified encoding are supported
-     * for this source format, an array of length 0 is returned.
-     * @param targetEncoding desired encoding of the stream after processing
-     * @param sourceFormat format of the incoming data
+     * Obtains the set of target formats with the encoding specified supported
+     * by the format converter If no target formats with the specified encoding
+     * are supported for this source format, an array of length 0 is returned.
+     *
+     * @param  targetEncoding desired encoding of the stream after processing
+     * @param  sourceFormat format of the incoming data
      * @return array of supported target formats.
      */
-    public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat);
-
+    public abstract AudioFormat[] getTargetFormats(Encoding targetEncoding,
+                                                   AudioFormat sourceFormat);
 
     /**
      * Indicates whether the format converter supports conversion to one
      * particular format from another.
-     * @param targetFormat desired format of outgoing data
-     * @param sourceFormat format of the incoming data
-     * @return <code>true</code> if the conversion is supported, otherwise <code>false</code>
+     *
+     * @param  targetFormat desired format of outgoing data
+     * @param  sourceFormat format of the incoming data
+     * @return {@code true} if the conversion is supported, otherwise
+     *         {@code false}
      */
-    public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){
+    public boolean isConversionSupported(AudioFormat targetFormat,
+                                         AudioFormat sourceFormat) {
 
         AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat );
 
@@ -173,28 +177,33 @@
         return false;
     }
 
+    /**
+     * Obtains an audio input stream with the specified encoding from the given
+     * audio input stream.
+     *
+     * @param  targetEncoding desired encoding of the stream after processing
+     * @param  sourceStream stream from which data to be processed should be
+     *         read
+     * @return stream from which processed data with the specified target
+     *         encoding may be read
+     * @throws IllegalArgumentException if the format combination supplied is
+     *         not supported.
+     */
+    public abstract AudioInputStream getAudioInputStream(
+            Encoding targetEncoding, AudioInputStream sourceStream);
 
     /**
-     * Obtains an audio input stream with the specified encoding from the given audio
-     * input stream.
-     * @param targetEncoding desired encoding of the stream after processing
-     * @param sourceStream stream from which data to be processed should be read
-     * @return stream from which processed data with the specified target encoding may be read
+     * Obtains an audio input stream with the specified format from the given
+     * audio input stream.
+     *
+     * @param  targetFormat desired data format of the stream after processing
+     * @param  sourceStream stream from which data to be processed should be
+     *         read
+     * @return stream from which processed data with the specified format may be
+     *         read
      * @throws IllegalArgumentException if the format combination supplied is
-     * not supported.
+     *         not supported.
      */
-    public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream);
-
-
-    /**
-     * Obtains an audio input stream with the specified format from the given audio
-     * input stream.
-     * @param targetFormat desired data format of the stream after processing
-     * @param sourceStream stream from which data to be processed should be read
-     * @return stream from which processed data with the specified format may be read
-     * @throws IllegalArgumentException if the format combination supplied is
-     * not supported.
-     */
-    public abstract AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream);
-
+    public abstract AudioInputStream getAudioInputStream(
+            AudioFormat targetFormat, AudioInputStream sourceStream);
 }
--- a/src/share/classes/javax/sound/sampled/spi/MixerProvider.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/sound/sampled/spi/MixerProvider.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -28,28 +28,27 @@
 import javax.sound.sampled.Mixer;
 
 /**
- * A provider or factory for a particular mixer type.
- * This mechanism allows the implementation to determine
- * how resources are managed in creation / management of
- * a mixer.
+ * A provider or factory for a particular mixer type. This mechanism allows the
+ * implementation to determine how resources are managed in creation /
+ * management of a mixer.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public abstract class MixerProvider {
 
-
     /**
      * Indicates whether the mixer provider supports the mixer represented by
      * the specified mixer info object.
      * <p>
-     * The full set of mixer info objects that represent the mixers supported
-     * by this {@code MixerProvider} may be obtained
-     * through the {@code getMixerInfo} method.
+     * The full set of mixer info objects that represent the mixers supported by
+     * this {@code MixerProvider} may be obtained through the
+     * {@code getMixerInfo} method.
      *
-     * @param info an info object that describes the mixer for which support is queried
-     * @return {@code true} if the specified mixer is supported,
-     *     otherwise {@code false}
+     * @param  info an info object that describes the mixer for which support is
+     *         queried
+     * @return {@code true} if the specified mixer is supported, otherwise
+     *         {@code false}
      * @see #getMixerInfo()
      */
     public boolean isMixerSupported(Mixer.Info info) {
@@ -64,38 +63,34 @@
         return false;
     }
 
-
     /**
-     * Obtains the set of info objects representing the mixer
-     * or mixers provided by this MixerProvider.
+     * Obtains the set of info objects representing the mixer or mixers provided
+     * by this MixerProvider.
      * <p>
-     * The {@code isMixerSupported} method returns {@code true}
-     * for all the info objects returned by this method.
-     * The corresponding mixer instances for the info objects
-     * are returned by the {@code getMixer} method.
+     * The {@code isMixerSupported} method returns {@code true} for all the info
+     * objects returned by this method. The corresponding mixer instances for
+     * the info objects are returned by the {@code getMixer} method.
      *
      * @return a set of mixer info objects
-     * @see #getMixer(javax.sound.sampled.Mixer.Info) getMixer(Mixer.Info)
-     * @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)
+     * @see #getMixer(Mixer.Info)
+     * @see #isMixerSupported(Mixer.Info)
      */
     public abstract Mixer.Info[] getMixerInfo();
 
-
     /**
      * Obtains an instance of the mixer represented by the info object.
      * <p>
      * The full set of the mixer info objects that represent the mixers
-     * supported by this {@code MixerProvider} may be obtained
-     * through the {@code getMixerInfo} method.
-     * Use the {@code isMixerSupported} method to test whether
-     * this {@code MixerProvider} supports a particular mixer.
+     * supported by this {@code MixerProvider} may be obtained through the
+     * {@code getMixerInfo} method. Use the {@code isMixerSupported} method to
+     * test whether this {@code MixerProvider} supports a particular mixer.
      *
-     * @param info an info object that describes the desired mixer
+     * @param  info an info object that describes the desired mixer
      * @return mixer instance
      * @throws IllegalArgumentException if the info object specified does not
-     *     match the info object for a mixer supported by this MixerProvider.
+     *         match the info object for a mixer supported by this MixerProvider
      * @see #getMixerInfo()
-     * @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)
+     * @see #isMixerSupported(Mixer.Info)
      */
     public abstract Mixer getMixer(Mixer.Info info);
 }
--- a/src/share/classes/javax/swing/JComponent.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/JComponent.java	Fri May 23 23:55:14 2014 +0000
@@ -3986,7 +3986,18 @@
          * @see AccessibleKeyBinding
          * @since 1.4
          */
-        public AccessibleKeyBinding getAccessibleKeyBinding() {
+        public AccessibleKeyBinding getAccessibleKeyBinding(){
+            // Try to get the linked label's mnemonic if it exists
+            Object o = getClientProperty(JLabel.LABELED_BY_PROPERTY);
+            if (o instanceof Accessible){
+                AccessibleContext ac = ((Accessible) o).getAccessibleContext();
+                if (ac != null){
+                    AccessibleComponent comp = ac.getAccessibleComponent();
+                    if (! (comp instanceof AccessibleExtendedComponent))
+                        return null;
+                    return ((AccessibleExtendedComponent)comp).getAccessibleKeyBinding();
+                }
+            }
             return null;
         }
     } // inner class AccessibleJComponent
--- a/src/share/classes/javax/swing/border/LineBorder.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/border/LineBorder.java	Fri May 23 23:55:14 2014 +0000
@@ -144,8 +144,8 @@
             int offs = this.thickness;
             int size = offs + offs;
             if (this.roundedCorners) {
-                int arc = offs + size;
-                outer = new RoundRectangle2D.Float(x, y, width, height, arc, arc);
+                float arc = .2f * offs;
+                outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
                 inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
             }
             else {
--- a/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Fri May 23 23:55:14 2014 +0000
@@ -2271,6 +2271,7 @@
 
     // From the JLF Design Guidelines:
     // http://www.oracle.com/technetwork/java/jlf-135985.html
+    @SuppressWarnings("fallthrough")
     private static class MetalLayoutStyle extends DefaultLayoutStyle {
         private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
 
@@ -2407,4 +2408,4 @@
             return 0;
         }
     }
-}
\ No newline at end of file
+}
--- a/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Fri May 23 23:55:14 2014 +0000
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 2014, 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
@@ -13424,10 +13424,10 @@
             <state stateKeys="Selected">
                 <style>
                    <textForeground>
-                      <matte red="255" green="255" blue="255" alpha="255" uiDefaultParentName="nimbusLightBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                      <matte red="255" green="255" blue="255" alpha="255" uiDefaultParentName="nimbusLightBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textForeground>
                    <textBackground>
-                      <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                      <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textBackground>
                    <background/>
                    <inherit-textForeground>false</inherit-textForeground>
@@ -13453,7 +13453,7 @@
                 <style>
                    <textForeground/>
                    <textBackground>
-                       <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                       <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textBackground>
                    <background/>
                    <inherit-textBackground>false</inherit-textBackground>
@@ -13477,7 +13477,7 @@
             <state stateKeys="Disabled">
                 <style>
                    <textForeground>
-                      <matte red="142" green="143" blue="145" alpha="255" uiDefaultParentName="nimbusDisabledText" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                      <matte red="142" green="143" blue="145" alpha="255" uiDefaultParentName="nimbusDisabledText" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textForeground>
                    <textBackground/>
                    <background/>
@@ -13520,7 +13520,7 @@
                         </textForeground>
                         <textBackground/>
                         <background>
-                           <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                           <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                         </background>
                         <inherit-textForeground>false</inherit-textForeground>
                         <inherit-background>false</inherit-background>
--- a/src/share/classes/javax/swing/text/JTextComponent.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/text/JTextComponent.java	Fri May 23 23:55:14 2014 +0000
@@ -4473,6 +4473,7 @@
     // composed(uncommitted) text is done here after all input
     // method listeners get called for stealing the events.
     //
+    @SuppressWarnings("fallthrough")
     protected void processInputMethodEvent(InputMethodEvent e) {
         // let listeners handle the events
         super.processInputMethodEvent(e);
--- a/src/share/classes/javax/swing/text/html/StyleSheet.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/text/html/StyleSheet.java	Fri May 23 23:55:14 2014 +0000
@@ -2324,6 +2324,7 @@
          * @param itemNum number to format
          * @param type    type of ordered list
          */
+        @SuppressWarnings("fallthrough")
         String formatItemNum(int itemNum, char type) {
             String numStyle = "1";
 
--- a/src/share/classes/javax/swing/text/html/parser/ContentModelState.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/text/html/parser/ContentModelState.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -92,12 +92,14 @@
      * tokens required in the input stream.
      * @return true if the model can terminate without further input
      */
+    @SuppressWarnings("fallthrough")
     public boolean terminate() {
         switch (model.type) {
           case '+':
             if ((value == 0) && !(model).empty()) {
                 return false;
             }
+            // Fall through
           case '*':
           case '?':
             return (next == null) || next.terminate();
--- a/src/share/classes/javax/swing/text/html/parser/Parser.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/text/html/parser/Parser.java	Fri May 23 23:55:14 2014 +0000
@@ -906,6 +906,7 @@
             if (lower) {
                 ch = 'a' + (ch - 'A');
             }
+            break;
 
           case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
           case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -930,6 +931,7 @@
                 if (lower) {
                     ch = 'a' + (ch - 'A');
                 }
+                break;
 
               case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
               case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -1268,6 +1270,7 @@
     /**
      * Parse attribute value. [33] 331:1
      */
+    @SuppressWarnings("fallthrough")
     String parseAttributeValue(boolean lower) throws IOException {
         int delim = -1;
 
@@ -1312,6 +1315,7 @@
               case '\t':
                   if (delim < 0)
                       c = ' ';
+                  // Fall through
               case ' ':
                 ch = readCh();
                 if (delim < 0) {
@@ -1621,6 +1625,7 @@
     /**
      * Parse a start or end tag.
      */
+    @SuppressWarnings("fallthrough")
     void parseTag() throws IOException {
         Element elem;
         boolean net = false;
@@ -1664,6 +1669,7 @@
                         continue;
                       case '>':
                         ch = readCh();
+                        return;
                       case -1:
                         return;
                       default:
@@ -1688,6 +1694,7 @@
                     switch(ch) {
                       case '>':
                         ch = readCh();
+                        // Fall through
                       case -1:
                         error("invalid.markup");
                         return;
@@ -1719,6 +1726,7 @@
             switch (ch = readCh()) {
               case '>':
                 ch = readCh();
+                // Fall through
               case '<':
                 // empty end tag. either </> or </<
                 if (recent == null) {
@@ -1737,6 +1745,7 @@
                 switch (ch) {
                   case '>':
                     ch = readCh();
+                    break;
                   case '<':
                     break;
 
@@ -1937,6 +1946,7 @@
         switch (ch) {
           case '/':
             net = true;
+            // Fall through
           case '>':
             ch = readCh();
             if (ch == '>' && net) {
--- a/src/share/classes/javax/swing/text/rtf/RTFGenerator.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/text/rtf/RTFGenerator.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -868,6 +868,7 @@
     afterKeyword = false;
 }
 
+@SuppressWarnings("fallthrough")
 public void writeCharacter(char ch)
     throws IOException
 {
--- a/src/share/classes/javax/swing/text/rtf/RTFParser.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/javax/swing/text/rtf/RTFParser.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -148,6 +148,7 @@
       handleText(s);
   }
 
+  @SuppressWarnings("fallthrough")
   public void write(char ch)
     throws IOException
   {
--- a/src/share/classes/sun/awt/AWTAccessor.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/AWTAccessor.java	Fri May 23 23:55:14 2014 +0000
@@ -27,6 +27,7 @@
 
 import sun.misc.Unsafe;
 
+import javax.accessibility.AccessibleContext;
 import java.awt.*;
 import java.awt.KeyboardFocusManager;
 import java.awt.DefaultKeyboardFocusManager;
@@ -620,7 +621,7 @@
         /**
          * Returns menus
          */
-        Vector getMenus(MenuBar menuBar);
+        Vector<Menu> getMenus(MenuBar menuBar);
     }
 
     /**
@@ -662,7 +663,7 @@
         /**
          * Returns vector of the items that are part of the Menu
          */
-        Vector getItems(Menu menu);
+        Vector<MenuItem> getItems(Menu menu);
     }
 
     /**
@@ -762,6 +763,14 @@
     }
 
     /*
+     * An accessor object for the AccessibleContext class
+     */
+    public interface AccessibleContextAccessor {
+        void setAppContext(AccessibleContext accessibleContext, AppContext appContext);
+        AppContext getAppContext(AccessibleContext accessibleContext);
+    }
+
+    /*
      * Accessor instances are initialized in the static initializers of
      * corresponding AWT classes by using setters defined below.
      */
@@ -791,6 +800,7 @@
     private static ToolkitAccessor toolkitAccessor;
     private static InvocationEventAccessor invocationEventAccessor;
     private static SystemColorAccessor systemColorAccessor;
+    private static AccessibleContextAccessor accessibleContextAccessor;
 
     /*
      * Set an accessor object for the java.awt.Component class.
@@ -1234,4 +1244,21 @@
      public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
          AWTAccessor.systemColorAccessor = systemColorAccessor;
      }
+
+    /*
+     * Get the accessor object for the javax.accessibility.AccessibleContext class.
+     */
+    public static AccessibleContextAccessor getAccessibleContextAccessor() {
+        if (accessibleContextAccessor == null) {
+            unsafe.ensureClassInitialized(AccessibleContext.class);
+        }
+        return accessibleContextAccessor;
+    }
+
+   /*
+    * Set the accessor object for the javax.accessibility.AccessibleContext class.
+    */
+    public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) {
+        AWTAccessor.accessibleContextAccessor = accessor;
+    }
 }
--- a/src/share/classes/sun/awt/AWTAutoShutdown.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/AWTAutoShutdown.java	Fri May 23 23:55:14 2014 +0000
@@ -35,7 +35,7 @@
 import java.util.Set;
 
 import sun.util.logging.PlatformLogger;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 /**
  * This class is to let AWT shutdown automatically when a user is done
--- a/src/share/classes/sun/awt/AppContext.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/AppContext.java	Fri May 23 23:55:14 2014 +0000
@@ -890,6 +890,7 @@
             Supplier<T> supplier) {
 
         final AppContext appContext = AppContext.getAppContext();
+        @SuppressWarnings("unchecked")
         SoftReference<T> ref = (SoftReference<T>) appContext.get(key);
         if (ref != null) {
             final T object = ref.get();
--- a/src/share/classes/sun/awt/FontConfiguration.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/FontConfiguration.java	Fri May 23 23:55:14 2014 +0000
@@ -64,7 +64,7 @@
     protected static String osName;
     protected static String encoding; // canonical name of default nio charset
     protected static Locale startupLocale = null;
-    protected static Hashtable localeMap = null;
+    protected static Hashtable<String, String> localeMap = null;
     private static FontConfiguration fontConfig;
     private static PlatformLogger logger;
     protected static boolean isProperties = true;
@@ -159,15 +159,15 @@
         short fontNameID = compFontNameIDs[0][0][0];
         short fileNameID = getComponentFileID(fontNameID);
         final String fileName = mapFileName(getComponentFileName(fileNameID));
-        Boolean exists = (Boolean)java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
-                 public Object run() {
+        Boolean exists = java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Boolean>() {
+                 public Boolean run() {
                      try {
                          File f = new File(fileName);
                          return Boolean.valueOf(f.exists());
                      }
                      catch (Exception e) {
-                         return false;
+                         return Boolean.FALSE;
                      }
                  }
                 });
@@ -534,11 +534,11 @@
    private short remapLocaleMap(int fontIndex, int styleIndex, short scriptID, short fontID) {
         String scriptName = getString(table_scriptIDs[scriptID]);
 
-        String value = (String)localeMap.get(scriptName);
+        String value = localeMap.get(scriptName);
         if (value == null) {
             String fontName = fontNames[fontIndex];
             String styleName = styleNames[styleIndex];
-            value = (String)localeMap.get(fontName + "." + styleName + "." + scriptName);
+            value = localeMap.get(fontName + "." + styleName + "." + scriptName);
         }
         if (value == null) {
             return fontID;
@@ -746,7 +746,7 @@
     /* Mappings from file encoding to font config name for font supporting
      * the corresponding language. This is filled in by initReorderMap()
      */
-    protected HashMap reorderMap = null;
+    protected HashMap<String, Object> reorderMap = null;
 
     /* Platform-specific mappings */
     protected abstract void initReorderMap();
@@ -777,7 +777,7 @@
         if (fontConfig.reorderMap == null) {
              fontConfig.initReorderMap();
         }
-        HashMap reorderMap = fontConfig.reorderMap;
+        HashMap<String, Object> reorderMap = fontConfig.reorderMap;
 
         /* Find the most specific mapping */
         String language = startupLocale.getLanguage();
@@ -817,9 +817,9 @@
         }
     }
 
-    private static Vector splitSequence(String sequence) {
+    private static Vector<String> splitSequence(String sequence) {
         //String.split would be more convenient, but incurs big performance penalty
-        Vector parts = new Vector();
+        Vector<String> parts = new Vector<>();
         int start = 0;
         int end;
         while ((end = sequence.indexOf(',', start)) >= 0) {
@@ -833,14 +833,14 @@
     }
 
     protected String[] split(String sequence) {
-        Vector v = splitSequence(sequence);
-        return (String[])v.toArray(new String[0]);
+        Vector<String> v = splitSequence(sequence);
+        return v.toArray(new String[0]);
     }
 
     ////////////////////////////////////////////////////////////////////////
     // Methods for extracting information from the fontconfig data for AWT//
     ////////////////////////////////////////////////////////////////////////
-    private Hashtable charsetRegistry = new Hashtable(5);
+    private Hashtable<String, Charset> charsetRegistry = new Hashtable<>(5);
 
     /**
      * Returns FontDescriptors describing the physical fonts used for the
@@ -932,9 +932,9 @@
 
         Charset fc = null;
         if (charsetName.equals("default")) {
-            fc = (Charset) charsetRegistry.get(fontName);
+            fc = charsetRegistry.get(fontName);
         } else {
-            fc = (Charset) charsetRegistry.get(charsetName);
+            fc = charsetRegistry.get(charsetName);
         }
         if (fc != null) {
             return fc.newEncoder();
@@ -943,8 +943,8 @@
         if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
             fc = Charset.forName(charsetName);
         } else {
-            Class fcc = (Class) AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+            Class<?> fcc = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
+                    public Class<?> run() {
                         try {
                             return Class.forName(charsetName, true,
                                                  ClassLoader.getSystemClassLoader());
@@ -1377,9 +1377,9 @@
 
         //This method will only be called during build time, do we
         //need do PrivilegedAction?
-        String osName = (String)java.security.AccessController.doPrivileged(
-                            new java.security.PrivilegedAction() {
-            public Object run() {
+        String osName = java.security.AccessController.doPrivileged(
+                            new java.security.PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty("os.name");
             }
         });
@@ -2139,7 +2139,7 @@
                 boolean has1252 = false;
 
                 //get the scriptID list
-                String[] ss = (String[])splitSequence(value).toArray(EMPTY_STRING_ARRAY);
+                String[] ss = splitSequence(value).toArray(EMPTY_STRING_ARRAY);
                 short [] sa = new short[ss.length];
                 for (int i = 0; i < ss.length; i++) {
                     if ("alphabetic/default".equals(ss[i])) {
--- a/src/share/classes/sun/awt/HToolkit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/HToolkit.java	Fri May 23 23:55:14 2014 +0000
@@ -214,7 +214,8 @@
         throw new HeadlessException();
     }
 
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+    public Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlight(
+            InputMethodHighlight highlight)
         throws HeadlessException {
         throw new HeadlessException();
     }
--- a/src/share/classes/sun/awt/HeadlessToolkit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/HeadlessToolkit.java	Fri May 23 23:55:14 2014 +0000
@@ -29,6 +29,7 @@
 import java.awt.dnd.*;
 import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.event.*;
+import java.awt.font.TextAttribute;
 import java.awt.im.InputMethodHighlight;
 import java.awt.image.*;
 import java.awt.datatransfer.Clipboard;
@@ -224,7 +225,7 @@
         throw new HeadlessException();
     }
 
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+    public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
         throws HeadlessException {
         throw new HeadlessException();
     }
--- a/src/share/classes/sun/awt/PlatformFont.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/PlatformFont.java	Fri May 23 23:55:14 2014 +0000
@@ -143,7 +143,7 @@
         if (len < 1) {
             return new CharsetString[0];
         }
-        Vector mcs = null;
+        Vector<CharsetString> mcs = null;
         char[] tmpStr = new char[len];
         char tmpChar = defaultChar;
         boolean encoded = false;
@@ -198,7 +198,7 @@
             }
             if (currentFont != fd){
                 if (mcs == null) {
-                    mcs = new Vector(3);
+                    mcs = new Vector<>(3);
                 }
                 mcs.addElement(new CharsetString(tmpStr, lastIndex,
                                                  i-lastIndex, currentFont));
@@ -209,16 +209,13 @@
         }
         CharsetString[] result;
         CharsetString cs = new CharsetString(tmpStr, lastIndex,
-                                            len-lastIndex, currentFont);
+                                             len-lastIndex, currentFont);
         if (mcs == null) {
             result = new CharsetString[1];
             result[0] = cs;
         } else {
             mcs.addElement(cs);
-            result = new CharsetString[mcs.size()];
-            for (int i = 0; i < mcs.size(); i++){
-                result[i] = (CharsetString)mcs.elementAt(i);
-            }
+            result = mcs.toArray(new CharsetString[mcs.size()]);
         }
         return result;
     }
--- a/src/share/classes/sun/awt/SunToolkit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/SunToolkit.java	Fri May 23 23:55:14 2014 +0000
@@ -1915,6 +1915,7 @@
 
     public synchronized void setWindowDeactivationTime(Window w, long time) {
         AppContext ctx = getAppContext(w);
+        @SuppressWarnings("unchecked")
         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
         if (map == null) {
             map = new WeakHashMap<Window, Long>();
@@ -1925,6 +1926,7 @@
 
     public synchronized long getWindowDeactivationTime(Window w) {
         AppContext ctx = getAppContext(w);
+        @SuppressWarnings("unchecked")
         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
         if (map == null) {
             return -1;
--- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Fri May 23 23:55:14 2014 +0000
@@ -57,6 +57,7 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.StandardCharsets;
 import java.nio.charset.UnsupportedCharsetException;
 
 import java.lang.reflect.Constructor;
@@ -70,22 +71,7 @@
 import java.security.PrivilegedExceptionAction;
 import java.security.ProtectionDomain;
 
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.Set;
-import java.util.Stack;
-import java.util.TreeMap;
-import java.util.TreeSet;
+import java.util.*;
 
 import sun.util.logging.PlatformLogger;
 
@@ -164,7 +150,7 @@
             tempSet.add("UTF-16BE");
             tempSet.add("UTF-16LE");
             tempSet.add("UTF-16");
-            tempSet.add(getDefaultTextCharset());
+            tempSet.add(Charset.defaultCharset().name());
             return Collections.unmodifiableSortedSet(tempSet);
         }
     }
@@ -178,12 +164,6 @@
     private static final Map<String, Boolean> textMIMESubtypeCharsetSupport;
 
     /**
-     * Cache of the platform default encoding as specified in the
-     * "file.encoding" system property.
-     */
-    private static String defaultEncoding;
-
-    /**
      * A collection of all natives listed in flavormap.properties with
      * a primary MIME type of "text".
      */
@@ -281,17 +261,7 @@
 
         String encoding = flavor.getParameter("charset");
 
-        return (encoding != null) ? encoding : getDefaultTextCharset();
-    }
-
-    /**
-     * Returns the platform's default character encoding.
-     */
-    public static String getDefaultTextCharset() {
-        if (defaultEncoding != null) {
-            return defaultEncoding;
-        }
-        return defaultEncoding = Charset.defaultCharset().name();
+        return (encoding != null) ? encoding : Charset.defaultCharset().name();
     }
 
     /**
@@ -354,7 +324,7 @@
             return false;
         }
 
-        Class rep_class = flavor.getRepresentationClass();
+        Class<?> rep_class = flavor.getRepresentationClass();
 
         if (flavor.isRepresentationClassReader() ||
             String.class.equals(rep_class) ||
@@ -485,7 +455,7 @@
 
         textNatives.add(format);
         nativeCharsets.put(format, (charset != null && charset.length() != 0)
-                ? charset : getDefaultTextCharset());
+                ? charset : Charset.defaultCharset().name());
         if (eoln != null && eoln.length() != 0 && !eoln.equals("\n")) {
             nativeEOLNs.put(format, eoln);
         }
@@ -726,7 +696,7 @@
      *            DataFlavors and data formats
      * @throws NullPointerException if formats or map is <code>null</code>
      */
-    public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
+    public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
         Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
 
         for (long format : formats) {
@@ -786,19 +756,17 @@
      * clipboard string encoding/decoding, basing on clipboard
      * format and localeTransferable(on decoding, if available)
      */
-    private String getBestCharsetForTextFormat(Long lFormat,
+    protected String getBestCharsetForTextFormat(Long lFormat,
         Transferable localeTransferable) throws IOException
     {
         String charset = null;
         if (localeTransferable != null &&
             isLocaleDependentTextFormat(lFormat) &&
-            localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor))
-        {
+            localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
             try {
-                charset = new String(
-                    (byte[])localeTransferable.getTransferData(javaTextEncodingFlavor),
-                    "UTF-8"
-                );
+                byte[] charsetNameBytes = (byte[])localeTransferable
+                        .getTransferData(javaTextEncodingFlavor);
+                charset = new String(charsetNameBytes, StandardCharsets.UTF_8);
             } catch (UnsupportedFlavorException cannotHappen) {
             }
         } else {
@@ -806,7 +774,7 @@
         }
         if (charset == null) {
             // Only happens when we have a custom text type.
-            charset = getDefaultTextCharset();
+            charset = Charset.defaultCharset().name();
         }
         return charset;
     }
@@ -1117,7 +1085,7 @@
                 throw new IOException("data translation failed");
             }
 
-            final List list = (List)obj;
+            final List<?> list = (List<?>)obj;
 
             final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
 
@@ -1145,7 +1113,7 @@
             if (targetCharset == null) {
                 targetCharset = "UTF-8";
             }
-            final List list = (List)obj;
+            final List<?> list = (List<?>)obj;
             final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
             final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
             final ArrayList<String> uriList = new ArrayList<>(fileList.size());
@@ -1290,7 +1258,7 @@
         return true;
     }
 
-    private ArrayList<String> castToFiles(final List files,
+    private ArrayList<String> castToFiles(final List<?> files,
                                           final ProtectionDomain userProtectionDomain) throws IOException {
         try {
             return AccessController.doPrivileged((PrivilegedExceptionAction<ArrayList<String>>) () -> {
@@ -1668,7 +1636,7 @@
      * instance of the Class as its sole parameter.
      */
     private Object constructFlavoredObject(Object arg, DataFlavor flavor,
-                                           Class clazz)
+                                           Class<?> clazz)
         throws IOException
     {
         final Class<?> dfrc = flavor.getRepresentationClass();
@@ -1676,19 +1644,19 @@
         if (clazz.equals(dfrc)) {
             return arg; // simple case
         } else {
-            Constructor[] constructors;
+            Constructor<?>[] constructors;
 
             try {
                 constructors = AccessController.doPrivileged(
-                        (PrivilegedAction<Constructor[]>) dfrc::getConstructors);
+                        (PrivilegedAction<Constructor<?>[]>) dfrc::getConstructors);
             } catch (SecurityException se) {
                 throw new IOException(se.getMessage());
             }
 
-            Constructor constructor = Stream.of(constructors)
+            Constructor<?> constructor = Stream.of(constructors)
                     .filter(c -> Modifier.isPublic(c.getModifiers()))
                     .filter(c -> {
-                        Class[] ptypes = c.getParameterTypes();
+                        Class<?>[] ptypes = c.getParameterTypes();
                         return ptypes != null
                                 && ptypes.length == 1
                                 && clazz.equals(ptypes[0]);
@@ -1731,28 +1699,8 @@
         {
             Long lFormat = format;
 
-            String sourceEncoding = null;
-            if (isLocaleDependentTextFormat(format) &&
-                localeTransferable != null &&
-                localeTransferable.
-                    isDataFlavorSupported(javaTextEncodingFlavor))
-            {
-                try {
-                    sourceEncoding = new String((byte[])localeTransferable.
-                                       getTransferData(javaTextEncodingFlavor),
-                                       "UTF-8");
-                } catch (UnsupportedFlavorException cannotHappen) {
-                }
-            } else {
-                sourceEncoding = getCharsetForTextFormat(lFormat);
-            }
-
-            if (sourceEncoding == null) {
-                // Only happens when we have a custom text type.
-                sourceEncoding = getDefaultTextCharset();
-            }
-            wrapped = new BufferedReader
-                (new InputStreamReader(bytestream, sourceEncoding));
+            String sourceEncoding = getBestCharsetForTextFormat(format, localeTransferable);
+            wrapped = new BufferedReader(new InputStreamReader(bytestream, sourceEncoding));
 
             if (targetEncoding == null) {
                 // Throw NullPointerException for compatibility with the former
@@ -1917,7 +1865,8 @@
         byte[] bytes, String mimeType) throws IOException
     {
 
-        Iterator readerIterator = ImageIO.getImageReadersByMIMEType(mimeType);
+        Iterator<ImageReader> readerIterator =
+            ImageIO.getImageReadersByMIMEType(mimeType);
 
         if (!readerIterator.hasNext()) {
             throw new IOException("No registered service provider can decode " +
@@ -1927,7 +1876,7 @@
         IOException ioe = null;
 
         while (readerIterator.hasNext()) {
-            ImageReader imageReader = (ImageReader)readerIterator.next();
+            ImageReader imageReader = readerIterator.next();
             try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
                 try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) {
                     ImageReadParam param = imageReader.getDefaultReadParam();
@@ -1970,7 +1919,8 @@
       throws IOException {
         IOException originalIOE = null;
 
-        Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType);
+        Iterator<ImageWriter> writerIterator =
+            ImageIO.getImageWritersByMIMEType(mimeType);
 
         if (!writerIterator.hasNext()) {
             throw new IOException("No registered service provider can encode " +
@@ -2029,7 +1979,8 @@
                                               String mimeType)
         throws IOException {
 
-        Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType);
+        Iterator<ImageWriter> writerIterator =
+            ImageIO.getImageWritersByMIMEType(mimeType);
 
         ImageTypeSpecifier typeSpecifier =
             new ImageTypeSpecifier(renderedImage);
@@ -2038,7 +1989,7 @@
         IOException ioe = null;
 
         while (writerIterator.hasNext()) {
-            ImageWriter imageWriter = (ImageWriter)writerIterator.next();
+            ImageWriter imageWriter = writerIterator.next();
             ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider();
 
             if (!writerSpi.canEncodeImage(typeSpecifier)) {
@@ -2122,7 +2073,7 @@
     public byte[] convertData(final Object source,
                               final Transferable contents,
                               final long format,
-                              final Map formatMap,
+                              final Map<Long, DataFlavor> formatMap,
                               final boolean isToolkitThread)
         throws IOException
     {
@@ -2145,7 +2096,7 @@
                     }
                     byte[] data = null;
                     try {
-                        DataFlavor flavor = (DataFlavor)formatMap.get(format);
+                        DataFlavor flavor = formatMap.get(format);
                         if (flavor != null) {
                             data = translateTransferable(contents, flavor, format);
                         }
@@ -2186,7 +2137,7 @@
         } finally {
             getToolkitThreadBlockedHandler().unlock();
         } else {
-            DataFlavor flavor = (DataFlavor)formatMap.get(format);
+            DataFlavor flavor = formatMap.get(format);
             if (flavor != null) {
                 ret = translateTransferable(contents, flavor, format);
             }
@@ -2235,7 +2186,7 @@
      * Helper function to convert a Set of DataFlavors to a sorted array.
      * The array will be sorted according to <code>DataFlavorComparator</code>.
      */
-    public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) {
+    public static DataFlavor[] setToSortedDataFlavorArray(Set<DataFlavor> flavorsSet) {
         DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
         flavorsSet.toArray(flavors);
         final Comparator<DataFlavor> comparator =
@@ -2267,8 +2218,8 @@
      * If there are no platform-specific mappings for this native, the method
      * returns an empty <code>List</code>.
      */
-    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
-        return new ArrayList<>();
+    public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat) {
+        return new LinkedHashSet<>();
     }
 
     /**
@@ -2276,8 +2227,8 @@
      * If there are no platform-specific mappings for this flavor, the method
      * returns an empty <code>List</code>.
      */
-    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
-        return new ArrayList<>();
+    public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        return new LinkedHashSet<>();
     }
 
     /**
@@ -2333,7 +2284,6 @@
      */
     public static class CharsetComparator extends IndexedComparator<String> {
         private static final Map<String, Integer> charsets;
-        private static final String defaultEncoding;
 
         private static final Integer DEFAULT_CHARSET_INDEX = 2;
         private static final Integer OTHER_CHARSET_INDEX = 1;
@@ -2354,8 +2304,7 @@
             // US-ASCII is the worst charset supported
             charsetsMap.put(canonicalName("US-ASCII"), WORST_CHARSET_INDEX);
 
-            defaultEncoding = DataTransferer.canonicalName(DataTransferer.getDefaultTextCharset());
-            charsetsMap.putIfAbsent(defaultEncoding, DEFAULT_CHARSET_INDEX);
+            charsetsMap.putIfAbsent(Charset.defaultCharset().name(), DEFAULT_CHARSET_INDEX);
 
             charsetsMap.put(UNSUPPORTED_CHARSET, UNSUPPORTED_CHARSET_INDEX);
 
@@ -2598,12 +2547,12 @@
             String primaryType1 = flavor1.getPrimaryType();
             String subType1 = flavor1.getSubType();
             String mimeType1 = primaryType1 + "/" + subType1;
-            Class class1 = flavor1.getRepresentationClass();
+            Class<?> class1 = flavor1.getRepresentationClass();
 
             String primaryType2 = flavor2.getPrimaryType();
             String subType2 = flavor2.getSubType();
             String mimeType2 = primaryType2 + "/" + subType2;
-            Class class2 = flavor2.getRepresentationClass();
+            Class<?> class2 = flavor2.getRepresentationClass();
 
             if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) {
                 // First, compare MIME types
--- a/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Fri May 23 23:55:14 2014 +0000
@@ -78,7 +78,7 @@
      * this clipboard. It is used for tracking changes
      * of <code>DataFlavor</code>s available on this clipboard.
      */
-    private volatile Set currentDataFlavors;
+    private volatile Set<DataFlavor> currentDataFlavors;
 
 
     public SunClipboard(String name) {
@@ -338,7 +338,7 @@
     protected abstract byte[] getClipboardData(long format) throws IOException;
 
 
-    private static Set formatArrayAsDataFlavorSet(long[] formats) {
+    private static Set<DataFlavor> formatArrayAsDataFlavorSet(long[] formats) {
         return (formats == null) ? null :
                 DataTransferer.getInstance().
                 getFlavorsForFormatsAsSet(formats, getDefaultFlavorTable());
@@ -417,7 +417,7 @@
      *        this clipboard
      */
     public void checkChange(long[] formats) {
-        Set prevDataFlavors = currentDataFlavors;
+        Set<DataFlavor> prevDataFlavors = currentDataFlavors;
         currentDataFlavors = formatArrayAsDataFlavorSet(formats);
 
         if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
--- a/src/share/classes/sun/awt/datatransfer/TransferableProxy.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/datatransfer/TransferableProxy.java	Fri May 23 23:55:14 2014 +0000
@@ -111,9 +111,9 @@
     }
 
     protected void annotateClass(final Class<?> cl) throws IOException {
-        ClassLoader classLoader =
-            (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+        ClassLoader classLoader = AccessController.doPrivileged(
+            new PrivilegedAction<ClassLoader>() {
+                public ClassLoader run() {
                     return cl.getClassLoader();
                 }
             });
@@ -124,14 +124,14 @@
         map.put(s, classLoader);
     }
     protected void annotateProxyClass(final Class<?> cl) throws IOException {
-        ClassLoader classLoader =
-            (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+        ClassLoader classLoader = AccessController.doPrivileged(
+            new PrivilegedAction<ClassLoader>() {
+                public ClassLoader run() {
                     return cl.getClassLoader();
                 }
             });
 
-        Class[] interfaces = cl.getInterfaces();
+        Class<?>[] interfaces = cl.getInterfaces();
         Set<String> s = new HashSet<String>(interfaces.length);
         for (int i = 0; i < interfaces.length; i++) {
             s.add(interfaces[i].getName());
@@ -141,7 +141,7 @@
     }
 
     Map<Set<String>, ClassLoader> getClassLoaderMap() {
-        return new HashMap(map);
+        return new HashMap<>(map);
     }
 }
 
@@ -191,9 +191,9 @@
         boolean hasNonPublicInterface = false;
 
         // define proxy in class loader of non-public interface(s), if any
-        Class[] classObjs = new Class[interfaces.length];
+        Class<?>[] classObjs = new Class<?>[interfaces.length];
         for (int i = 0; i < interfaces.length; i++) {
-            Class cl = Class.forName(interfaces[i], false, classLoader);
+            Class<?> cl = Class.forName(interfaces[i], false, classLoader);
             if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
                 if (hasNonPublicInterface) {
                     if (nonPublicLoader != cl.getClassLoader()) {
--- a/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -146,7 +146,7 @@
     }
 
     protected abstract void startDrag(Transferable trans,
-                                      long[] formats, Map formatMap);
+                                      long[] formats, Map<Long, DataFlavor> formatMap);
 
     /**
      * set cursor
--- a/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -239,17 +239,24 @@
 
         if (localTransferable != null) {
             return localTransferable.getTransferData(df);
+        } else if (df.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) {
+            // Workaround to JDK-8024061: Exception thrown when drag and drop
+            //      between two components is executed quickly.
+            // It is expected localTransferable is not null if javaJVMLocalObjectMimeType
+            // is used. Executing further results in ClassCastException, so null is
+            // returned here as no transfer data is available in this case.
+            return null;
         }
 
         if (dropStatus != STATUS_ACCEPT || dropComplete) {
             throw new InvalidDnDOperationException("No drop current");
         }
 
-        Map flavorMap = DataTransferer.getInstance().getFlavorsForFormats
-            (currentT, DataTransferer.adaptFlavorMap
+        Map<DataFlavor, Long> flavorMap = DataTransferer.getInstance()
+            .getFlavorsForFormats(currentT, DataTransferer.adaptFlavorMap
                 (currentDT.getFlavorMap()));
 
-        lFormat = (Long)flavorMap.get(df);
+        lFormat = flavorMap.get(df);
         if (lFormat == null) {
             throw new UnsupportedFlavorException(df);
         }
@@ -738,7 +745,7 @@
         // dispatcher state fields
         private int returnValue = 0;
         // set of events to be dispatched by this dispatcher
-        private final HashSet eventSet = new HashSet(3);
+        private final HashSet<SunDropTargetEvent> eventSet = new HashSet<>(3);
 
         static final ToolkitThreadBlockedHandler handler =
             DataTransferer.getInstance().getToolkitThreadBlockedHandler();
--- a/src/share/classes/sun/awt/geom/AreaOp.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/geom/AreaOp.java	Fri May 23 23:55:14 2014 +0000
@@ -152,36 +152,36 @@
 
     public abstract int getState();
 
-    public Vector calculate(Vector left, Vector right) {
-        Vector edges = new Vector();
+    public Vector<Curve> calculate(Vector<Curve> left, Vector<Curve> right) {
+        Vector<Edge> edges = new Vector<>();
         addEdges(edges, left, AreaOp.CTAG_LEFT);
         addEdges(edges, right, AreaOp.CTAG_RIGHT);
-        edges = pruneEdges(edges);
+        Vector<Curve> curves = pruneEdges(edges);
         if (false) {
             System.out.println("result: ");
-            int numcurves = edges.size();
-            Curve[] curvelist = (Curve[]) edges.toArray(new Curve[numcurves]);
+            int numcurves = curves.size();
+            Curve[] curvelist = curves.toArray(new Curve[numcurves]);
             for (int i = 0; i < numcurves; i++) {
                 System.out.println("curvelist["+i+"] = "+curvelist[i]);
             }
         }
-        return edges;
+        return curves;
     }
 
-    private static void addEdges(Vector edges, Vector curves, int curvetag) {
-        Enumeration enum_ = curves.elements();
+    private static void addEdges(Vector<Edge> edges, Vector<Curve> curves, int curvetag) {
+        Enumeration<Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.getOrder() > 0) {
                 edges.add(new Edge(c, curvetag));
             }
         }
     }
 
-    private static Comparator YXTopComparator = new Comparator() {
-        public int compare(Object o1, Object o2) {
-            Curve c1 = ((Edge) o1).getCurve();
-            Curve c2 = ((Edge) o2).getCurve();
+    private static Comparator<Edge> YXTopComparator = new Comparator<Edge>() {
+        public int compare(Edge o1, Edge o2) {
+            Curve c1 = o1.getCurve();
+            Curve c2 = o2.getCurve();
             double v1, v2;
             if ((v1 = c1.getYTop()) == (v2 = c2.getYTop())) {
                 if ((v1 = c1.getXTop()) == (v2 = c2.getXTop())) {
@@ -195,12 +195,13 @@
         }
     };
 
-    private Vector pruneEdges(Vector edges) {
+    private Vector<Curve> pruneEdges(Vector<Edge> edges) {
         int numedges = edges.size();
         if (numedges < 2) {
-            return edges;
+            // empty vector is expected with less than 2 edges
+            return new Vector<>();
         }
-        Edge[] edgelist = (Edge[]) edges.toArray(new Edge[numedges]);
+        Edge[] edgelist = edges.toArray(new Edge[numedges]);
         Arrays.sort(edgelist, YXTopComparator);
         if (false) {
             System.out.println("pruning: ");
@@ -214,9 +215,9 @@
         int cur = 0;
         int next = 0;
         double yrange[] = new double[2];
-        Vector subcurves = new Vector();
-        Vector chains = new Vector();
-        Vector links = new Vector();
+        Vector<CurveLink> subcurves = new Vector<>();
+        Vector<ChainEnd> chains = new Vector<>();
+        Vector<CurveLink> links = new Vector<>();
         // Active edges are between left (inclusive) and right (exclusive)
         while (left < numedges) {
             double y = yrange[0];
@@ -385,7 +386,7 @@
             if (false) {
                 System.out.println("new links:");
                 for (int i = 0; i < links.size(); i++) {
-                    CurveLink link = (CurveLink) links.elementAt(i);
+                    CurveLink link = links.elementAt(i);
                     System.out.println("  "+link.getSubCurve());
                 }
             }
@@ -396,10 +397,10 @@
             yrange[0] = yend;
         }
         finalizeSubCurves(subcurves, chains);
-        Vector ret = new Vector();
-        Enumeration enum_ = subcurves.elements();
+        Vector<Curve> ret = new Vector<>();
+        Enumeration<CurveLink> enum_ = subcurves.elements();
         while (enum_.hasMoreElements()) {
-            CurveLink link = (CurveLink) enum_.nextElement();
+            CurveLink link = enum_.nextElement();
             ret.add(link.getMoveto());
             CurveLink nextlink = link;
             while ((nextlink = nextlink.getNext()) != null) {
@@ -413,7 +414,8 @@
         return ret;
     }
 
-    public static void finalizeSubCurves(Vector subcurves, Vector chains) {
+    public static void finalizeSubCurves(Vector<CurveLink> subcurves,
+                                         Vector<ChainEnd> chains) {
         int numchains = chains.size();
         if (numchains == 0) {
             return;
@@ -437,9 +439,9 @@
     private static CurveLink[] EmptyLinkList = new CurveLink[2];
     private static ChainEnd[] EmptyChainList = new ChainEnd[2];
 
-    public static void resolveLinks(Vector subcurves,
-                                    Vector chains,
-                                    Vector links)
+    public static void resolveLinks(Vector<CurveLink> subcurves,
+                                    Vector<ChainEnd> chains,
+                                    Vector<CurveLink> links)
     {
         int numlinks = links.size();
         CurveLink[] linklist;
--- a/src/share/classes/sun/awt/geom/Crossings.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/geom/Crossings.java	Fri May 23 23:55:14 2014 +0000
@@ -77,14 +77,14 @@
 
     public abstract boolean covers(double ystart, double yend);
 
-    public static Crossings findCrossings(Vector curves,
+    public static Crossings findCrossings(Vector<? extends Curve> curves,
                                           double xlo, double ylo,
                                           double xhi, double yhi)
     {
         Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi);
-        Enumeration enum_ = curves.elements();
+        Enumeration<? extends Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(cross)) {
                 return null;
             }
@@ -237,7 +237,7 @@
         return false;
     }
 
-    private Vector tmp = new Vector();
+    private Vector<Curve> tmp = new Vector<>();
 
     public boolean accumulateQuad(double x0, double y0, double coords[]) {
         if (y0 < ylo && coords[1] < ylo && coords[3] < ylo) {
@@ -258,9 +258,9 @@
             return false;
         }
         Curve.insertQuad(tmp, x0, y0, coords);
-        Enumeration enum_ = tmp.elements();
+        Enumeration<Curve> enum_ = tmp.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(this)) {
                 return true;
             }
@@ -296,9 +296,9 @@
             return false;
         }
         Curve.insertCubic(tmp, x0, y0, coords);
-        Enumeration enum_ = tmp.elements();
+        Enumeration<Curve> enum_ = tmp.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(this)) {
                 return true;
             }
--- a/src/share/classes/sun/awt/geom/Curve.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/geom/Curve.java	Fri May 23 23:55:14 2014 +0000
@@ -38,11 +38,11 @@
 
     protected int direction;
 
-    public static void insertMove(Vector curves, double x, double y) {
+    public static void insertMove(Vector<Curve> curves, double x, double y) {
         curves.add(new Order0(x, y));
     }
 
-    public static void insertLine(Vector curves,
+    public static void insertLine(Vector<Curve> curves,
                                   double x0, double y0,
                                   double x1, double y1)
     {
@@ -59,7 +59,7 @@
         }
     }
 
-    public static void insertQuad(Vector curves,
+    public static void insertQuad(Vector<Curve> curves,
                                   double x0, double y0,
                                   double coords[])
     {
@@ -82,7 +82,7 @@
         }
     }
 
-    public static void insertCubic(Vector curves,
+    public static void insertCubic(Vector<Curve> curves,
                                    double x0, double y0,
                                    double coords[])
     {
--- a/src/share/classes/sun/awt/geom/Order2.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/geom/Order2.java	Fri May 23 23:55:14 2014 +0000
@@ -47,7 +47,7 @@
     private double ycoeff1;
     private double ycoeff2;
 
-    public static void insert(Vector curves, double tmp[],
+    public static void insert(Vector<Curve> curves, double tmp[],
                               double x0, double y0,
                               double cx0, double cy0,
                               double x1, double y1,
@@ -74,7 +74,7 @@
                     tmp[i1 + 4], tmp[i1 + 5], direction);
     }
 
-    public static void addInstance(Vector curves,
+    public static void addInstance(Vector<Curve> curves,
                                    double x0, double y0,
                                    double cx0, double cy0,
                                    double x1, double y1,
--- a/src/share/classes/sun/awt/geom/Order3.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/geom/Order3.java	Fri May 23 23:55:14 2014 +0000
@@ -53,7 +53,7 @@
     private double ycoeff2;
     private double ycoeff3;
 
-    public static void insert(Vector curves, double tmp[],
+    public static void insert(Vector<Curve> curves, double tmp[],
                               double x0, double y0,
                               double cx0, double cy0,
                               double cx1, double cy1,
@@ -105,7 +105,7 @@
         }
     }
 
-    public static void addInstance(Vector curves,
+    public static void addInstance(Vector<Curve> curves,
                                    double x0, double y0,
                                    double cx0, double cy0,
                                    double cx1, double cy1,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java	Fri May 23 23:55:14 2014 +0000
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2014, 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.image;
+
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.image.*;
+
+/**
+ * This class provides default implementations for the
+ * <code>MultiResolutionImage</code> interface. The developer needs only
+ * to subclass this abstract class and define the <code>getResolutionVariant</code>,
+ * <code>getResolutionVariants</code>, and <code>getBaseImage</code> methods.
+ *
+ *
+ * For example,
+ * {@code
+ * public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {
+ *
+ *     int baseImageIndex;
+ *     Image[] resolutionVariants;
+ *
+ *     public CustomMultiResolutionImage(int baseImageIndex,
+ *             Image... resolutionVariants) {
+ *          this.baseImageIndex = baseImageIndex;
+ *          this.resolutionVariants = resolutionVariants;
+ *     }
+ *
+ *     @Override
+ *     public Image getResolutionVariant(float logicalDPIX, float logicalDPIY,
+ *             float baseImageWidth, float baseImageHeight,
+ *             float destImageWidth, float destImageHeight) {
+ *         // return a resolution variant based on the given logical DPI,
+ *         // base image size, or destination image size
+ *     }
+ *
+ *     @Override
+ *     public List<Image> getResolutionVariants() {
+ *         return Arrays.asList(resolutionVariants);
+ *     }
+ *
+ *     protected Image getBaseImage() {
+ *         return resolutionVariants[baseImageIndex];
+ *     }
+ * }
+ * }
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.MultiResolutionImage
+ *
+ * @since 1.9
+ */
+public abstract class AbstractMultiResolutionImage extends java.awt.Image
+        implements MultiResolutionImage {
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public int getWidth(ImageObserver observer) {
+        return getBaseImage().getWidth(null);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public int getHeight(ImageObserver observer) {
+        return getBaseImage().getHeight(null);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public ImageProducer getSource() {
+        return getBaseImage().getSource();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public Graphics getGraphics() {
+        return getBaseImage().getGraphics();
+
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public Object getProperty(String name, ImageObserver observer) {
+        return getBaseImage().getProperty(name, observer);
+    }
+
+    /**
+     * @return base image
+     */
+    protected abstract Image getBaseImage();
+}
--- a/src/share/classes/sun/awt/image/BufImgSurfaceData.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/BufImgSurfaceData.java	Fri May 23 23:55:14 2014 +0000
@@ -51,7 +51,7 @@
     private BufferedImageGraphicsConfig graphicsConfig;
     RenderLoops solidloops;
 
-    private static native void initIDs(Class ICM, Class ICMColorData);
+    private static native void initIDs(Class<?> ICM, Class<?> ICMColorData);
 
     private static final int DCM_RGBX_RED_MASK   = 0xff000000;
     private static final int DCM_RGBX_GREEN_MASK = 0x00ff0000;
--- a/src/share/classes/sun/awt/image/GifImageDecoder.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/GifImageDecoder.java	Fri May 23 23:55:14 2014 +0000
@@ -61,7 +61,7 @@
     int trans_pixel = -1;
     IndexColorModel global_model;
 
-    Hashtable props = new Hashtable();
+    Hashtable<String, Object> props = new Hashtable<>();
 
     byte[] saved_image;
     IndexColorModel saved_model;
--- a/src/share/classes/sun/awt/image/ImageDecoder.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/ImageDecoder.java	Fri May 23 23:55:14 2014 +0000
@@ -83,7 +83,7 @@
         return count;
     }
 
-    protected int setProperties(Hashtable props) {
+    protected int setProperties(Hashtable<?,?> props) {
         ImageConsumerQueue cq = null;
         int count = 0;
         while ((cq = nextConsumer(cq)) != null) {
@@ -164,7 +164,7 @@
         source.doneDecoding(this);
         close();
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 feeder.interrupt();
                 return null;
--- a/src/share/classes/sun/awt/image/ImageFetcher.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/ImageFetcher.java	Fri May 23 23:55:14 2014 +0000
@@ -152,7 +152,7 @@
                         info.numWaiting--;
                     }
                 }
-                src = (ImageFetchable) info.waitList.elementAt(0);
+                src = info.waitList.elementAt(0);
                 info.waitList.removeElement(src);
             }
             return src;
@@ -303,26 +303,25 @@
        final ThreadGroup fetcherGroup = fetcherThreadGroup;
 
        java.security.AccessController.doPrivileged(
-         new java.security.PrivilegedAction() {
-         public Object run() {
-             for (int i = 0; i < info.fetchers.length; i++) {
-               if (info.fetchers[i] == null) {
-                   ImageFetcher f = new ImageFetcher(
-                           fetcherGroup, i);
-                   try {
-                       f.start();
-                       info.fetchers[i] = f;
-                       info.numFetchers++;
-                       break;
-                   } catch (Error e) {
+           new java.security.PrivilegedAction<Object>() {
+               public Object run() {
+                   for (int i = 0; i < info.fetchers.length; i++) {
+                       if (info.fetchers[i] == null) {
+                           ImageFetcher f = new ImageFetcher(fetcherGroup, i);
+                       try {
+                           f.start();
+                           info.fetchers[i] = f;
+                           info.numFetchers++;
+                           break;
+                       } catch (Error e) {
+                       }
                    }
+                 }
+                 return null;
                }
-             }
-          return null;
-        }
-       });
-      return;
-    }
+           });
+       return;
+   }
 
 }
 
@@ -337,13 +336,13 @@
     Thread[] fetchers;
     int numFetchers;
     int numWaiting;
-    Vector waitList;
+    Vector<ImageFetchable> waitList;
 
     private FetcherInfo() {
         fetchers = new Thread[MAX_NUM_FETCHERS_PER_APPCONTEXT];
         numFetchers = 0;
         numWaiting = 0;
-        waitList = new Vector();
+        waitList = new Vector<>();
     }
 
     /* The key to put()/get() the FetcherInfo into/from the AppContext. */
--- a/src/share/classes/sun/awt/image/ImageRepresentation.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/ImageRepresentation.java	Fri May 23 23:55:14 2014 +0000
@@ -185,7 +185,7 @@
     protected BufferedImage createImage(ColorModel cm,
                                         WritableRaster raster,
                                         boolean isRasterPremultiplied,
-                                        Hashtable properties)
+                                        Hashtable<?,?> properties)
     {
         BufferedImage bi =
             new BufferedImage(cm, raster, isRasterPremultiplied, null);
--- a/src/share/classes/sun/awt/image/ImagingLib.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/ImagingLib.java	Fri May 23 23:55:14 2014 +0000
@@ -61,7 +61,7 @@
     private static final int AFFINE_OP   = 1;
     private static final int CONVOLVE_OP = 2;
 
-    private static Class[] nativeOpClass = new Class[NUM_NATIVE_OPS];
+    private static Class<?>[] nativeOpClass = new Class<?>[NUM_NATIVE_OPS];
 
     /**
      * Returned value indicates whether the library initailization was
@@ -134,7 +134,7 @@
 
     }
 
-    private static int getNativeOpIndex(Class opClass) {
+    private static int getNativeOpIndex(Class<?> opClass) {
         //
         // Search for this class in cached list of
         // classes supplying native acceleration
--- a/src/share/classes/sun/awt/image/JPEGImageDecoder.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/JPEGImageDecoder.java	Fri May 23 23:55:14 2014 +0000
@@ -47,8 +47,8 @@
     private static ColorModel ARGBcolormodel;
     private static ColorModel Graycolormodel;
 
-    private static final Class InputStreamClass = InputStream.class;
-    private static native void initIDs(Class InputStreamClass);
+    private static final Class<?> InputStreamClass = InputStream.class;
+    private static native void initIDs(Class<?> InputStreamClass);
 
     private ColorModel colormodel;
 
@@ -73,7 +73,7 @@
     private native void readImage(InputStream is, byte buf[])
         throws ImageFormatException, IOException;
 
-    Hashtable props = new Hashtable();
+    Hashtable<String, Object> props = new Hashtable<>();
 
     public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
         super(src, is);
--- a/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java	Thu May 22 20:24:42 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2014, 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.image;
-
-import java.awt.Dimension;
-import java.awt.Image;
-import java.awt.Graphics;
-import java.awt.geom.Dimension2D;
-import java.awt.image.BufferedImage;
-import java.awt.image.ImageObserver;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Function;
-import java.util.function.BiFunction;
-import java.util.stream.Collectors;
-
-public class MultiResolutionBufferedImage extends BufferedImage
-        implements MultiResolutionImage {
-
-    private final BiFunction<Integer, Integer, Image> mapper;
-    private final Dimension2D[] sizes;
-    private int availableInfo;
-
-    public MultiResolutionBufferedImage(Image baseImage,
-            BiFunction<Integer, Integer, Image> mapper) {
-        this(baseImage, new Dimension[]{new Dimension(
-            baseImage.getWidth(null), baseImage.getHeight(null))
-        }, mapper);
-    }
-
-    public MultiResolutionBufferedImage(Image baseImage,
-            Dimension2D[] sizes, BiFunction<Integer, Integer, Image> mapper) {
-        super(baseImage.getWidth(null), baseImage.getHeight(null),
-                BufferedImage.TYPE_INT_ARGB_PRE);
-        this.sizes = sizes;
-        this.mapper = mapper;
-        this.availableInfo = getInfo(baseImage);
-        Graphics g = getGraphics();
-        g.drawImage(baseImage, 0, 0, null);
-        g.dispose();
-    }
-
-    @Override
-    public Image getResolutionVariant(int width, int height) {
-        int baseWidth = getWidth();
-        int baseHeight = getHeight();
-
-        if (baseWidth == width && baseHeight == height) {
-            return this;
-        }
-
-        ImageCache cache = ImageCache.getInstance();
-        ImageCacheKey key = new ImageCacheKey(this, width, height);
-        Image resolutionVariant = cache.getImage(key);
-        if (resolutionVariant == null) {
-            resolutionVariant = mapper.apply(width, height);
-            cache.setImage(key, resolutionVariant);
-            preload(resolutionVariant, availableInfo);
-        }
-
-        return resolutionVariant;
-    }
-
-    @Override
-    public List<Image> getResolutionVariants() {
-        return Arrays.stream(sizes).map((Function<Dimension2D, Image>) size
-                -> getResolutionVariant((int) size.getWidth(),
-                        (int) size.getHeight())).collect(Collectors.toList());
-    }
-
-    public MultiResolutionBufferedImage map(Function<Image, Image> mapper) {
-        return new MultiResolutionBufferedImage(mapper.apply(this), sizes,
-                (width, height) ->
-                        mapper.apply(getResolutionVariant(width, height)));
-    }
-
-    @Override
-    public int getWidth(ImageObserver observer) {
-        availableInfo |= ImageObserver.WIDTH;
-        return super.getWidth(observer);
-    }
-
-    @Override
-    public int getHeight(ImageObserver observer) {
-        availableInfo |= ImageObserver.HEIGHT;
-        return super.getHeight(observer);
-    }
-
-    @Override
-    public Object getProperty(String name, ImageObserver observer) {
-        availableInfo |= ImageObserver.PROPERTIES;
-        return super.getProperty(name, observer);
-    }
-
-    private static int getInfo(Image image) {
-        if (image instanceof ToolkitImage) {
-            return ((ToolkitImage) image).getImageRep().check(
-                    (img, infoflags, x, y, w, h) -> false);
-        }
-        return 0;
-    }
-
-    private static void preload(Image image, int availableInfo) {
-        if (availableInfo != 0 && image instanceof ToolkitImage) {
-            ((ToolkitImage) image).preload(new ImageObserver() {
-                int flags = availableInfo;
-
-                @Override
-                public boolean imageUpdate(Image img, int infoflags,
-                        int x, int y, int width, int height) {
-                    flags &= ~infoflags;
-                    return (flags != 0) && ((infoflags
-                            & (ImageObserver.ERROR | ImageObserver.ABORT)) == 0);
-                }
-            });
-        }
-    }
-
-    private static class ImageCacheKey implements ImageCache.PixelsKey {
-
-        private final int pixelCount;
-        private final int hash;
-
-        private final int w;
-        private final int h;
-        private final Image baseImage;
-
-        ImageCacheKey(final Image baseImage,
-                final int w, final int h) {
-            this.baseImage = baseImage;
-            this.w = w;
-            this.h = h;
-            this.pixelCount = w * h;
-            hash = hash();
-        }
-
-        @Override
-        public int getPixelCount() {
-            return pixelCount;
-        }
-
-        private int hash() {
-            int hash = baseImage.hashCode();
-            hash = 31 * hash + w;
-            hash = 31 * hash + h;
-            return hash;
-        }
-
-        @Override
-        public int hashCode() {
-            return hash;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof ImageCacheKey) {
-                ImageCacheKey key = (ImageCacheKey) obj;
-                return baseImage == key.baseImage && w == key.w && h == key.h;
-            }
-            return false;
-        }
-    }
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/awt/image/MultiResolutionCachedImage.java	Fri May 23 23:55:14 2014 +0000
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2014, 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.image;
+
+import java.awt.Dimension;
+import java.awt.Image;
+import java.awt.geom.Dimension2D;
+import java.awt.image.ImageObserver;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.BiFunction;
+import java.util.stream.Collectors;
+
+public class MultiResolutionCachedImage extends AbstractMultiResolutionImage {
+
+    private final int baseImageWidth;
+    private final int baseImageHeight;
+    private final Dimension2D[] sizes;
+    private final BiFunction<Integer, Integer, Image> mapper;
+    private int availableInfo;
+
+    public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight,
+            BiFunction<Integer, Integer, Image> mapper) {
+        this(baseImageWidth, baseImageHeight, new Dimension[]{new Dimension(
+            baseImageWidth, baseImageHeight)
+        }, mapper);
+    }
+
+    public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight,
+            Dimension2D[] sizes, BiFunction<Integer, Integer, Image> mapper) {
+        this.baseImageWidth = baseImageWidth;
+        this.baseImageHeight = baseImageHeight;
+        this.sizes = sizes;
+        this.mapper = mapper;
+    }
+
+    @Override
+    public Image getResolutionVariant(int width, int height) {
+        ImageCache cache = ImageCache.getInstance();
+        ImageCacheKey key = new ImageCacheKey(this, width, height);
+        Image resolutionVariant = cache.getImage(key);
+        if (resolutionVariant == null) {
+            resolutionVariant = mapper.apply(width, height);
+            cache.setImage(key, resolutionVariant);
+        }
+        preload(resolutionVariant, availableInfo);
+        return resolutionVariant;
+    }
+
+    @Override
+    public List<Image> getResolutionVariants() {
+        return Arrays.stream(sizes).map((Function<Dimension2D, Image>) size
+                -> getResolutionVariant((int) size.getWidth(),
+                        (int) size.getHeight())).collect(Collectors.toList());
+    }
+
+    public MultiResolutionCachedImage map(Function<Image, Image> mapper) {
+        return new MultiResolutionCachedImage(baseImageWidth, baseImageHeight,
+                sizes, (width, height) ->
+                        mapper.apply(getResolutionVariant(width, height)));
+    }
+
+    @Override
+    public int getWidth(ImageObserver observer) {
+        updateInfo(observer, ImageObserver.WIDTH);
+        return super.getWidth(observer);
+    }
+
+    @Override
+    public int getHeight(ImageObserver observer) {
+        updateInfo(observer, ImageObserver.HEIGHT);
+        return super.getHeight(observer);
+    }
+
+    @Override
+    public Object getProperty(String name, ImageObserver observer) {
+        updateInfo(observer, ImageObserver.PROPERTIES);
+        return super.getProperty(name, observer);
+    }
+
+    @Override
+    protected Image getBaseImage() {
+        return getResolutionVariant(baseImageWidth, baseImageHeight);
+    }
+
+    private void updateInfo(ImageObserver observer, int info) {
+        availableInfo |= (observer == null) ? ImageObserver.ALLBITS : info;
+    }
+
+    private static int getInfo(Image image) {
+        if (image instanceof ToolkitImage) {
+            return ((ToolkitImage) image).getImageRep().check(
+                    (img, infoflags, x, y, w, h) -> false);
+        }
+        return 0;
+    }
+
+    private static void preload(Image image, int availableInfo) {
+        if (availableInfo != 0 && image instanceof ToolkitImage) {
+            ((ToolkitImage) image).preload(new ImageObserver() {
+                int flags = availableInfo;
+
+                @Override
+                public boolean imageUpdate(Image img, int infoflags,
+                        int x, int y, int width, int height) {
+                    flags &= ~infoflags;
+                    return (flags != 0) && ((infoflags
+                            & (ImageObserver.ERROR | ImageObserver.ABORT)) == 0);
+                }
+            });
+        }
+    }
+
+    private static class ImageCacheKey implements ImageCache.PixelsKey {
+
+        private final int pixelCount;
+        private final int hash;
+
+        private final int w;
+        private final int h;
+        private final Image baseImage;
+
+        ImageCacheKey(final Image baseImage,
+                final int w, final int h) {
+            this.baseImage = baseImage;
+            this.w = w;
+            this.h = h;
+            this.pixelCount = w * h;
+            hash = hash();
+        }
+
+        @Override
+        public int getPixelCount() {
+            return pixelCount;
+        }
+
+        private int hash() {
+            int hash = baseImage.hashCode();
+            hash = 31 * hash + w;
+            hash = 31 * hash + h;
+            return hash;
+        }
+
+        @Override
+        public int hashCode() {
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof ImageCacheKey) {
+                ImageCacheKey key = (ImageCacheKey) obj;
+                return baseImage == key.baseImage && w == key.w && h == key.h;
+            }
+            return false;
+        }
+    }
+}
\ No newline at end of file
--- a/src/share/classes/sun/awt/image/OffScreenImageSource.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/OffScreenImageSource.java	Fri May 23 23:55:14 2014 +0000
@@ -40,15 +40,15 @@
     BufferedImage image;
     int width;
     int height;
-    Hashtable properties;
+    Hashtable<?, ?> properties;
 
     public OffScreenImageSource(BufferedImage image,
-                                Hashtable properties) {
+                                Hashtable<?, ?> properties) {
         this.image = image;
         if (properties != null) {
             this.properties = properties;
         } else {
-            this.properties = new Hashtable();
+            this.properties = new Hashtable<String, Object>();
         }
         width  = image.getWidth();
         height = image.getHeight();
--- a/src/share/classes/sun/awt/image/PNGImageDecoder.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/PNGImageDecoder.java	Fri May 23 23:55:14 2014 +0000
@@ -68,7 +68,7 @@
     private int filterMethod;
     private int interlaceMethod;
     private int gamma = 100000;
-    private java.util.Hashtable properties;
+    private java.util.Hashtable<String, Object> properties;
   /* this is not needed
     ImageConsumer target;
     */
@@ -83,7 +83,7 @@
 
     private void property(String key,Object value) {
         if(value==null) return;
-        if(properties==null) properties=new java.util.Hashtable();
+        if(properties==null) properties=new java.util.Hashtable<>();
         properties.put(key,value);
     }
     private void property(String key,float value) {
--- a/src/share/classes/sun/awt/image/ToolkitImage.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/image/ToolkitImage.java	Fri May 23 23:55:14 2014 +0000
@@ -79,7 +79,7 @@
 
     private int width = -1;
     private int height = -1;
-    private Hashtable properties;
+    private Hashtable<?, ?> properties;
 
     private int availinfo;
 
@@ -254,9 +254,9 @@
         addInfo(ImageObserver.WIDTH | ImageObserver.HEIGHT);
     }
 
-    void setProperties(Hashtable props) {
+    void setProperties(Hashtable<?, ?> props) {
         if (props == null) {
-            props = new Hashtable();
+            props = new Hashtable<String, Object>();
         }
         properties = props;
         addInfo(ImageObserver.PROPERTIES);
--- a/src/share/classes/sun/awt/shell/ShellFolder.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/shell/ShellFolder.java	Fri May 23 23:55:14 2014 +0000
@@ -127,14 +127,14 @@
         File[] files = super.listFiles();
 
         if (!includeHiddenFiles) {
-            Vector v = new Vector();
+            Vector<File> v = new Vector<>();
             int nameCount = (files == null) ? 0 : files.length;
             for (int i = 0; i < nameCount; i++) {
                 if (!files[i].isHidden()) {
                     v.addElement(files[i]);
                 }
             }
-            files = (File[])v.toArray(new File[v.size()]);
+            files = v.toArray(new File[v.size()]);
         }
 
         return files;
@@ -208,7 +208,7 @@
     static {
         String managerClassName = (String)Toolkit.getDefaultToolkit().
                                       getDesktopProperty("Shell.shellFolderManager");
-        Class managerClass = null;
+        Class<?> managerClass = null;
         try {
             managerClass = ReflectUtil.forName(managerClassName);
         // swallow the exceptions below and use default shell folder
@@ -554,7 +554,7 @@
     /**
      * Provides a default comparator for the default column set
      */
-    private static final Comparator DEFAULT_COMPARATOR = new Comparator() {
+    private static final Comparator<Object> DEFAULT_COMPARATOR = new Comparator<Object>() {
         public int compare(Object o1, Object o2) {
             int gt;
 
@@ -565,7 +565,9 @@
             } else if (o1 == null && o2 != null) {
                 gt = -1;
             } else if (o1 instanceof Comparable) {
-                gt = ((Comparable) o1).compareTo(o2);
+                @SuppressWarnings("unchecked")
+                Comparable<Object> o = (Comparable<Object>) o1;
+                gt = o.compareTo(o2);
             } else {
                 gt = 0;
             }
--- a/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java	Fri May 23 23:55:14 2014 +0000
@@ -38,7 +38,7 @@
      */
     private Integer alignment;
     private SortOrder sortOrder;
-    private Comparator comparator;
+    private Comparator<?> comparator;
     /**
      * <code>false</code> (default) if the {@link comparator} expects folders as arguments,
      * and <code>true</code> if folder's column values. The first option is used default for comparison
@@ -49,7 +49,7 @@
 
     public ShellFolderColumnInfo(String title, Integer width,
                                  Integer alignment, boolean visible,
-                                 SortOrder sortOrder, Comparator comparator,
+                                 SortOrder sortOrder, Comparator<?> comparator,
                                  boolean compareByColumn) {
         this.title = title;
         this.width = width;
@@ -62,7 +62,7 @@
 
     public ShellFolderColumnInfo(String title, Integer width,
                                  Integer alignment, boolean visible,
-                                 SortOrder sortOrder, Comparator comparator) {
+                                 SortOrder sortOrder, Comparator<?> comparator) {
         this(title, width, alignment, visible, sortOrder, comparator, false);
     }
 
@@ -115,11 +115,11 @@
         this.sortOrder = sortOrder;
     }
 
-    public Comparator getComparator() {
+    public Comparator<?> getComparator() {
         return comparator;
     }
 
-    public void setComparator(Comparator comparator) {
+    public void setComparator(Comparator<?> comparator) {
         this.comparator = comparator;
     }
 
--- a/src/share/classes/sun/awt/util/IdentityArrayList.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/util/IdentityArrayList.java	Fri May 23 23:55:14 2014 +0000
@@ -285,6 +285,7 @@
      *         this list
      * @throws NullPointerException if the specified array is null
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
         if (a.length < size)
             // Make a new array of a's runtime type, but my contents:
@@ -307,7 +308,9 @@
     public E get(int index) {
         rangeCheck(index);
 
-        return (E) elementData[index];
+        @SuppressWarnings("unchecked")
+        E rv = (E) elementData[index];
+        return rv;
     }
 
     /**
@@ -322,6 +325,7 @@
     public E set(int index, E element) {
         rangeCheck(index);
 
+        @SuppressWarnings("unchecked")
         E oldValue = (E) elementData[index];
         elementData[index] = element;
         return oldValue;
@@ -371,6 +375,7 @@
         rangeCheck(index);
 
         modCount++;
+        @SuppressWarnings("unchecked")
         E oldValue = (E) elementData[index];
 
         int numMoved = size - index - 1;
--- a/src/share/classes/sun/awt/util/IdentityLinkedList.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/awt/util/IdentityLinkedList.java	Fri May 23 23:55:14 2014 +0000
@@ -280,7 +280,9 @@
         Entry<E> successor = (index==size ? header : entry(index));
         Entry<E> predecessor = successor.previous;
         for (int i=0; i<numNew; i++) {
-            Entry<E> e = new Entry<E>((E)a[i], successor, predecessor);
+            @SuppressWarnings("unchecked")
+            E tmp = (E) a[i];
+            Entry<E> e = new Entry<E>(tmp, successor, predecessor);
             predecessor.next = e;
             predecessor = e;
         }
@@ -396,7 +398,7 @@
      */
     public int indexOf(Object o) {
         int index = 0;
-        for (Entry e = header.next; e != header; e = e.next) {
+        for (Entry<E> e = header.next; e != header; e = e.next) {
             if (o == e.element) {
                 return index;
             }
@@ -418,7 +420,7 @@
      */
     public int lastIndexOf(Object o) {
         int index = size;
-        for (Entry e = header.previous; e != header; e = e.previous) {
+        for (Entry<E> e = header.previous; e != header; e = e.previous) {
             index--;
             if (o == e.element) {
                 return index;
@@ -787,7 +789,7 @@
     }
 
     /** Adapter to provide descending iterators via ListItr.previous */
-    private class DescendingIterator implements Iterator {
+    private class DescendingIterator implements Iterator<E> {
         final ListItr itr = new ListItr(size());
         public boolean hasNext() {
             return itr.hasPrevious();
@@ -860,6 +862,7 @@
      *         this list
      * @throws NullPointerException if the specified array is null
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
         if (a.length < size)
             a = (T[])java.lang.reflect.Array.newInstance(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/awt/util/ThreadGroupUtils.java	Fri May 23 23:55:14 2014 +0000
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.util;
+
+/**
+ * A utility class needed to access the root {@code ThreadGroup}
+ *
+ * The class should not depend on any others, because it' called from JNI_OnLoad of the AWT
+ * native library. Triggering class loading could lead to a deadlock.
+ */
+public final class ThreadGroupUtils {
+
+    private ThreadGroupUtils() {
+        // Avoid instantiation
+    }
+
+    /**
+     * Returns a root thread group.
+     * Should be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION}
+     *
+     * @return a root {@code ThreadGroup}
+     */
+    public static ThreadGroup getRootThreadGroup() {
+        ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
+        ThreadGroup parentTG = currentTG.getParent();
+        while (parentTG != null) {
+            currentTG = parentTG;
+            parentTG = currentTG.getParent();
+        }
+        return currentTG;
+    }
+}
--- a/src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine	Thu May 22 20:24:42 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#  Ductus Rendering Engine module
-sun.dc.DuctusRenderingEngine
--- a/src/share/classes/sun/font/CreatedFontTracker.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/font/CreatedFontTracker.java	Fri May 23 23:55:14 2014 +0000
@@ -35,7 +35,7 @@
 import java.util.concurrent.TimeUnit;
 
 import sun.awt.AppContext;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 public class CreatedFontTracker {
 
--- a/src/share/classes/sun/font/SunFontManager.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/font/SunFontManager.java	Fri May 23 23:55:14 2014 +0000
@@ -52,7 +52,7 @@
 import sun.awt.AppContext;
 import sun.awt.FontConfiguration;
 import sun.awt.SunToolkit;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.FontSupport;
 import sun.util.logging.PlatformLogger;
 
@@ -1161,6 +1161,7 @@
             case FONTFORMAT_NATIVE:
                 NativeFont nf = new NativeFont(fileName, false);
                 physicalFont = addToFontList(nf, fontRank);
+                break;
             default:
 
             }
--- a/src/share/classes/sun/font/TrueTypeGlyphMapper.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/font/TrueTypeGlyphMapper.java	Fri May 23 23:55:14 2014 +0000
@@ -109,6 +109,7 @@
         cmap = CMap.theNullCmap;
     }
 
+    @SuppressWarnings("fallthrough")
     private final char remapJAChar(char unicode) {
         switch (unicode) {
         case REVERSE_SOLIDUS:
@@ -123,6 +124,7 @@
         default: return unicode;
         }
     }
+    @SuppressWarnings("fallthrough")
     private final int remapJAIntChar(int unicode) {
         switch (unicode) {
         case REVERSE_SOLIDUS:
--- a/src/share/classes/sun/java2d/Disposer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/Disposer.java	Fri May 23 23:55:14 2014 +0000
@@ -25,7 +25,7 @@
 
 package sun.java2d;
 
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
--- a/src/share/classes/sun/java2d/Spans.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/Spans.java	Fri May 23 23:55:14 2014 +0000
@@ -49,7 +49,7 @@
      * Holds a list of individual
      * Span instances.
      */
-    private List mSpans = new Vector(kMaxAddsSinceSort);
+    private List<Span> mSpans = new Vector<>(kMaxAddsSinceSort);
 
     /**
      * The number of <code>Span</code>
@@ -144,7 +144,7 @@
         Collections.sort(mSpans);
         mAddsSinceSort = 0;
 
-        Iterator iter = mSpans.iterator();
+        Iterator<Span> iter = mSpans.iterator();
 
         /* Have 'span' start at the first span in
          * the collection. The collection may be empty
@@ -152,7 +152,7 @@
          */
         Span span = null;
         if (iter.hasNext()) {
-            span = (Span) iter.next();
+            span = iter.next();
         }
 
         /* Loop over the spans collapsing those that intersect
@@ -160,7 +160,7 @@
          */
         while (iter.hasNext()) {
 
-            Span nextSpan = (Span) iter.next();
+            Span nextSpan = iter.next();
 
             /* The spans are in ascending start position
              * order and so the next span's starting point
@@ -202,9 +202,9 @@
     private void printSpans() {
         System.out.println("----------");
         if (mSpans != null) {
-            Iterator iter = mSpans.iterator();
+            Iterator<Span> iter = mSpans.iterator();
             while (iter.hasNext()) {
-                Span span = (Span) iter.next();
+                Span span = iter.next();
                 System.out.println(span);
             }
         }
@@ -216,7 +216,7 @@
     /**
      * Holds a single half-open interval.
      */
-    static class Span implements Comparable {
+    static class Span implements Comparable<Span> {
 
         /**
          * The span includes the starting point.
@@ -315,8 +315,7 @@
          * position. The end position is ignored
          * in this ranking.
          */
-        public int compareTo(Object o) {
-            Span otherSpan = (Span) o;
+        public int compareTo(Span otherSpan) {
             float otherStart = otherSpan.getStart();
             int result;
 
@@ -345,7 +344,7 @@
      * <code>SpanIntersection.instance</code> to
      * get the single instance of this class.
      */
-    static class SpanIntersection implements Comparator {
+    static class SpanIntersection implements Comparator<Span> {
 
         /**
          * This class is a Singleton and the following
@@ -361,10 +360,8 @@
 
         }
 
-        public int compare(Object o1, Object o2) {
+        public int compare(Span span1, Span span2) {
             int result;
-            Span span1 = (Span) o1;
-            Span span2 = (Span) o2;
 
             /* Span 1 is entirely to the left of span2.
              * span1:   <-----<
--- a/src/share/classes/sun/java2d/SunGraphics2D.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/SunGraphics2D.java	Fri May 23 23:55:14 2014 +0000
@@ -1430,8 +1430,11 @@
         }
     }
 
-    RenderingHints makeHints(Map hints) {
-        RenderingHints model = new RenderingHints(hints);
+    RenderingHints makeHints(Map<?,?> hints) {
+        RenderingHints model = new RenderingHints(null);
+        if (hints != null) {
+            model.putAll(hints);
+        }
         model.put(SunHints.KEY_RENDERING,
                   SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                      renderHint));
--- a/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Fri May 23 23:55:14 2014 +0000
@@ -82,7 +82,7 @@
 
     public SunGraphicsEnvironment() {
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
                     String version = System.getProperty("os.version", "0.0");
                     try {
--- a/src/share/classes/sun/java2d/cmm/CMSManager.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/cmm/CMSManager.java	Fri May 23 23:55:14 2014 +0000
@@ -34,7 +34,6 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import sun.security.action.GetPropertyAction;
-import java.util.ServiceLoader;
 
 public class CMSManager {
     public static ColorSpace GRAYspace;       // These two fields allow access
@@ -52,35 +51,28 @@
             return cmmImpl;
         }
 
-        CMMServiceProvider spi = AccessController.doPrivileged(
-                new PrivilegedAction<CMMServiceProvider>() {
-                    public CMMServiceProvider run() {
-                        String cmmClass = System.getProperty(
-                            "sun.java2d.cmm", "sun.java2d.cmm.lcms.LcmsServiceProvider");
+        GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm");
+        String cmmProviderClass = AccessController.doPrivileged(gpa);
+        CMMServiceProvider provider = null;
+        if (cmmProviderClass != null) {
+            try {
+                Class<?> cls = Class.forName(cmmProviderClass);
+                provider = (CMMServiceProvider)cls.newInstance();
+            } catch (ReflectiveOperationException e) {
+            }
+        }
+        if (provider == null) {
+            provider = new sun.java2d.cmm.lcms.LcmsServiceProvider();
+        }
 
-                    ServiceLoader<CMMServiceProvider> cmmLoader
-                    = ServiceLoader.loadInstalled(CMMServiceProvider.class);
-
-                CMMServiceProvider spi = null;
-
-                for (CMMServiceProvider cmm : cmmLoader) {
-                    spi = cmm;
-                    if (cmm.getClass().getName().equals(cmmClass)) {
-                        break;
-                    }
-                }
-                return spi;
-            }
-        });
-
-        cmmImpl = spi.getColorManagementModule();
+        cmmImpl = provider.getColorManagementModule();
 
         if (cmmImpl == null) {
             throw new CMMException("Cannot initialize Color Management System."+
                                    "No CM module found");
         }
 
-        GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm.trace");
+        gpa = new GetPropertyAction("sun.java2d.cmm.trace");
         String cmmTrace = AccessController.doPrivileged(gpa);
         if (cmmTrace != null) {
             cmmImpl = new CMMTracer(cmmImpl);
--- a/src/share/classes/sun/java2d/cmm/lcms/LCMS.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/cmm/lcms/LCMS.java	Fri May 23 23:55:14 2014 +0000
@@ -189,7 +189,7 @@
                                            LCMSImageLayout dest);
     public static native void freeTransform(long ID);
 
-    public static native void initLCMS(Class Trans, Class IL, Class Pf);
+    public static native void initLCMS(Class<?> Trans, Class<?> IL, Class<?> Pf);
 
     private LCMS() {};
 
@@ -201,7 +201,7 @@
         }
 
         java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                     public Object run() {
                         /* We need to load awt here because of usage trace and
                          * disposer frameworks
--- a/src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider	Thu May 22 20:24:42 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#  Little CMS color management module
-sun.java2d.cmm.lcms.LcmsServiceProvider
--- a/src/share/classes/sun/java2d/loops/Blit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/loops/Blit.java	Fri May 23 23:55:14 2014 +0000
@@ -217,8 +217,8 @@
         Blit performop;
         Blit convertresult;
 
-        WeakReference srcTmp;
-        WeakReference dstTmp;
+        WeakReference<SurfaceData> srcTmp;
+        WeakReference<SurfaceData> dstTmp;
 
         public GeneralXorBlit(SurfaceType srctype,
                               CompositeType comptype,
@@ -257,14 +257,14 @@
             } else {
                 SurfaceData cachedSrc = null;
                 if (srcTmp != null) {
-                    cachedSrc = (SurfaceData) srcTmp.get();
+                    cachedSrc = srcTmp.get();
                 }
                 src = convertFrom(convertsrc, srcData, srcx, srcy,
                                   width, height, cachedSrc);
                 sx = 0;
                 sy = 0;
                 if (src != cachedSrc) {
-                    srcTmp = new WeakReference(src);
+                    srcTmp = new WeakReference<>(src);
                 }
             }
 
@@ -277,7 +277,7 @@
                 // assert: convertresult != null
                 SurfaceData cachedDst = null;
                 if (dstTmp != null) {
-                    cachedDst = (SurfaceData) dstTmp.get();
+                    cachedDst = dstTmp.get();
                 }
                 dst = convertFrom(convertdst, dstData, dstx, dsty,
                                   width, height, cachedDst);
@@ -285,7 +285,7 @@
                 dy = 0;
                 opclip = null;
                 if (dst != cachedDst) {
-                    dstTmp = new WeakReference(dst);
+                    dstTmp = new WeakReference<>(dst);
                 }
             }
 
--- a/src/share/classes/sun/java2d/loops/CustomComponent.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/loops/CustomComponent.java	Fri May 23 23:55:14 2014 +0000
@@ -50,7 +50,7 @@
     public static void register() {
         // REMIND: This does not work for all destinations yet since
         // the screen SurfaceData objects do not implement getRaster
-        Class owner = CustomComponent.class;
+        Class<?> owner = CustomComponent.class;
         GraphicsPrimitive[] primitives = {
             new GraphicsPrimitiveProxy(owner, "OpaqueCopyAnyToArgb",
                                        Blit.methodSignature,
--- a/src/share/classes/sun/java2d/loops/GeneralRenderer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/loops/GeneralRenderer.java	Fri May 23 23:55:14 2014 +0000
@@ -50,7 +50,7 @@
 
 public final class GeneralRenderer {
     public static void register() {
-        Class owner = GeneralRenderer.class;
+        Class<?> owner = GeneralRenderer.class;
         GraphicsPrimitive[] primitives = {
             new  GraphicsPrimitiveProxy(owner, "SetFillRectANY",
                                         FillRect.methodSignature,
--- a/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Fri May 23 23:55:14 2014 +0000
@@ -316,7 +316,7 @@
 
     public abstract GraphicsPrimitive traceWrap();
 
-    static HashMap traceMap;
+    static HashMap<Object, int[]> traceMap;
 
     public static int traceflags;
     public static String tracefile;
@@ -427,13 +427,14 @@
 
         public void run() {
             PrintStream ps = getTraceOutputFile();
-            Iterator iterator = traceMap.entrySet().iterator();
+            Iterator<Map.Entry<Object, int[]>> iterator =
+                traceMap.entrySet().iterator();
             long total = 0;
             int numprims = 0;
             while (iterator.hasNext()) {
-                Map.Entry me = (Map.Entry) iterator.next();
+                Map.Entry<Object, int[]> me = iterator.next();
                 Object prim = me.getKey();
-                int[] count = (int[]) me.getValue();
+                int[] count = me.getValue();
                 if (count[0] == 1) {
                     ps.print("1 call to ");
                 } else {
@@ -455,15 +456,15 @@
     public synchronized static void tracePrimitive(Object prim) {
         if ((traceflags & TRACECOUNTS) != 0) {
             if (traceMap == null) {
-                traceMap = new HashMap();
+                traceMap = new HashMap<>();
                 TraceReporter.setShutdownHook();
             }
-            Object o = traceMap.get(prim);
+            int[] o = traceMap.get(prim);
             if (o == null) {
                 o = new int[1];
                 traceMap.put(prim, o);
             }
-            ((int[]) o)[0]++;
+            o[0]++;
         }
         if ((traceflags & TRACELOG) != 0) {
             PrintStream ps = getTraceOutputFile();
--- a/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java	Fri May 23 23:55:14 2014 +0000
@@ -45,11 +45,11 @@
     private static GraphicsPrimitive generalPrimitives[];
     private static boolean needssort = true;
 
-    private static native void initIDs(Class GP, Class ST, Class CT,
-                                       Class SG2D, Class Color, Class AT,
-                                       Class XORComp, Class AlphaComp,
-                                       Class Path2D, Class Path2DFloat,
-                                       Class SHints);
+    private static native void initIDs(Class<?> GP, Class<?> ST, Class<?> CT,
+                                       Class<?> SG2D, Class<?> Color, Class<?> AT,
+                                       Class<?> XORComp, Class<?> AlphaComp,
+                                       Class<?> Path2D, Class<?> Path2DFloat,
+                                       Class<?> SHints);
     private static native void registerNativeLoops();
 
     static {
@@ -73,16 +73,17 @@
         public int uniqueID;
     }
 
-    private static Comparator primSorter = new Comparator() {
-        public int compare(Object o1, Object o2) {
-            int id1 = ((GraphicsPrimitive) o1).getUniqueID();
-            int id2 = ((GraphicsPrimitive) o2).getUniqueID();
+    private static Comparator<GraphicsPrimitive> primSorter =
+            new Comparator<GraphicsPrimitive>() {
+        public int compare(GraphicsPrimitive o1, GraphicsPrimitive o2) {
+            int id1 = o1.getUniqueID();
+            int id2 = o2.getUniqueID();
 
             return (id1 == id2 ? 0 : (id1 < id2 ? -1 : 1));
         }
     };
 
-    private static Comparator primFinder = new Comparator() {
+    private static Comparator<Object> primFinder = new Comparator<Object>() {
         public int compare(Object o1, Object o2) {
             int id1 = ((GraphicsPrimitive) o1).getUniqueID();
             int id2 = ((PrimitiveSpec) o2).uniqueID;
--- a/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java	Fri May 23 23:55:14 2014 +0000
@@ -41,7 +41,7 @@
  */
 public class GraphicsPrimitiveProxy extends GraphicsPrimitive {
 
-    private Class owner;
+    private Class<?> owner;
     private String relativeClassName;
 
     /**
@@ -53,7 +53,7 @@
      * @param relativeClassName  The name of the class this is a proxy for.
      *          This should not include the package.
      */
-    public GraphicsPrimitiveProxy(Class owner, String relativeClassName,
+    public GraphicsPrimitiveProxy(Class<?> owner, String relativeClassName,
                                   String methodSignature,
                                   int primID,
                                   SurfaceType srctype,
@@ -80,7 +80,7 @@
         String name = getPackageName(owner.getName()) + "."
                         + relativeClassName;
         try {
-            Class clazz = Class.forName(name);
+            Class<?> clazz = Class.forName(name);
             GraphicsPrimitive p = (GraphicsPrimitive) clazz.newInstance();
             if (!satisfiesSameAs(p)) {
                 throw new RuntimeException("Primitive " + p
--- a/src/share/classes/sun/java2d/loops/MaskBlit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/loops/MaskBlit.java	Fri May 23 23:55:14 2014 +0000
@@ -143,8 +143,8 @@
         MaskBlit performop;
         Blit convertresult;
 
-        WeakReference srcTmp;
-        WeakReference dstTmp;
+        WeakReference<SurfaceData> srcTmp;
+        WeakReference<SurfaceData> dstTmp;
 
         public General(SurfaceType srctype,
                        CompositeType comptype,
@@ -184,14 +184,14 @@
             } else {
                 SurfaceData cachedSrc = null;
                 if (srcTmp != null) {
-                    cachedSrc = (SurfaceData) srcTmp.get();
+                    cachedSrc = srcTmp.get();
                 }
                 src = convertFrom(convertsrc, srcData, srcx, srcy,
                                   width, height, cachedSrc);
                 sx = 0;
                 sy = 0;
                 if (src != cachedSrc) {
-                    srcTmp = new WeakReference(src);
+                    srcTmp = new WeakReference<>(src);
                 }
             }
 
@@ -204,7 +204,7 @@
                 // assert: convertresult != null
                 SurfaceData cachedDst = null;
                 if (dstTmp != null) {
-                    cachedDst = (SurfaceData) dstTmp.get();
+                    cachedDst = dstTmp.get();
                 }
                 dst = convertFrom(convertdst, dstData, dstx, dsty,
                                   width, height, cachedDst);
@@ -212,7 +212,7 @@
                 dy = 0;
                 opclip = null;
                 if (dst != cachedDst) {
-                    dstTmp = new WeakReference(dst);
+                    dstTmp = new WeakReference<>(dst);
                 }
             }
 
--- a/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Fri May 23 23:55:14 2014 +0000
@@ -728,7 +728,7 @@
 class OGLGeneralBlit extends Blit {
 
     private Blit performop;
-    private WeakReference srcTmp;
+    private WeakReference<SurfaceData> srcTmp;
 
     OGLGeneralBlit(SurfaceType dstType,
                    CompositeType compType,
@@ -750,7 +750,7 @@
         SurfaceData cachedSrc = null;
         if (srcTmp != null) {
             // use cached intermediate surface, if available
-            cachedSrc = (SurfaceData)srcTmp.get();
+            cachedSrc = srcTmp.get();
         }
 
         // convert source to IntArgbPre
@@ -763,7 +763,7 @@
 
         if (src != cachedSrc) {
             // cache the intermediate surface
-            srcTmp = new WeakReference(src);
+            srcTmp = new WeakReference<>(src);
         }
     }
 }
@@ -802,7 +802,7 @@
 
         if (dstBuffer != cachedDst) {
             // cache the intermediate surface
-            dstTmp = new WeakReference(dstBuffer);
+            dstTmp = new WeakReference<>(dstBuffer);
         }
 
         // now blit the buffer back to the destination
--- a/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Fri May 23 23:55:14 2014 +0000
@@ -25,7 +25,7 @@
 
 package sun.java2d.opengl;
 
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
 import static sun.java2d.pipe.BufferedOpCodes.*;
--- a/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java	Fri May 23 23:55:14 2014 +0000
@@ -48,16 +48,16 @@
  * SunGraphics2D.
  */
 public class AlphaPaintPipe implements CompositePipe {
-    static WeakReference cachedLastRaster;
-    static WeakReference cachedLastColorModel;
-    static WeakReference cachedLastData;
+    static WeakReference<Raster> cachedLastRaster;
+    static WeakReference<ColorModel> cachedLastColorModel;
+    static WeakReference<SurfaceData> cachedLastData;
 
     static class TileContext {
         SunGraphics2D sunG2D;
         PaintContext paintCtxt;
         ColorModel paintModel;
-        WeakReference lastRaster;
-        WeakReference lastData;
+        WeakReference<Raster> lastRaster;
+        WeakReference<SurfaceData> lastData;
         MaskBlit lastMask;
         Blit     lastBlit;
         SurfaceData dstData;
@@ -105,8 +105,8 @@
         SurfaceData srcData = null;
         Raster lastRas = null;
         if (context.lastData != null && context.lastRaster != null) {
-            srcData = (SurfaceData) context.lastData.get();
-            lastRas = (Raster) context.lastRaster.get();
+            srcData = context.lastData.get();
+            lastRas = context.lastRaster.get();
             if (srcData == null || lastRas == null) {
                 srcData = null;
                 lastRas = null;
@@ -127,7 +127,7 @@
                 }
                 if (lastRas != srcRaster) {
                     lastRas = srcRaster;
-                    context.lastRaster = new WeakReference(lastRas);
+                    context.lastRaster = new WeakReference<>(lastRas);
                     // REMIND: This will fail for a non-Writable raster!
                     BufferedImage bImg =
                         new BufferedImage(paintModel,
@@ -135,7 +135,7 @@
                                           paintModel.isAlphaPremultiplied(),
                                           null);
                     srcData = BufImgSurfaceData.createData(bImg);
-                    context.lastData = new WeakReference(srcData);
+                    context.lastData = new WeakReference<>(srcData);
                     context.lastMask = null;
                     context.lastBlit = null;
                 }
@@ -197,7 +197,7 @@
                 {
                     // Avoid creating new WeakReference if possible
                     cachedLastColorModel =
-                        new WeakReference(context.paintModel);
+                        new WeakReference<>(context.paintModel);
                 }
                 cachedLastData = context.lastData;
             }
--- a/src/share/classes/sun/java2d/pipe/RenderQueue.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/pipe/RenderQueue.java	Fri May 23 23:55:14 2014 +0000
@@ -81,10 +81,10 @@
      * A Set containing hard references to Objects that must stay alive until
      * the queue has been completely flushed.
      */
-    protected Set refSet;
+    protected Set<Object> refSet;
 
     protected RenderQueue() {
-        refSet = new HashSet();
+        refSet = new HashSet<>();
         buf = RenderBuffer.allocate(BUFFER_SIZE);
     }
 
--- a/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Fri May 23 23:55:14 2014 +0000
@@ -32,7 +32,6 @@
 
 import java.security.PrivilegedAction;
 import java.security.AccessController;
-import java.util.ServiceLoader;
 import sun.security.action.GetPropertyAction;
 
 import sun.awt.geom.PathConsumer2D;
@@ -97,12 +96,9 @@
      * </pre>
      *
      * If no specific {@code RenderingEngine} is specified on the command
-     * or Ductus renderer is specified, it will attempt loading the
-     * sun.dc.DuctusRenderingEngine class using Class.forName as a fastpath;
-     * if not found, use the ServiceLoader.
-     * If no specific {@code RenderingEngine} is specified on the command
-     * line then the last one returned by enumerating all subclasses of
-     * {@code RenderingEngine} known to the ServiceLoader is used.
+     * or Ductus renderer is specified, it will first attempt loading the
+     * sun.dc.DuctusRenderingEngine class using Class.forName, if that
+     * is not found, then it will look for Pisces.
      * <p>
      * Runtime tracing of the actions of the {@code RenderingEngine}
      * can be enabled by specifying the runtime flag:
@@ -117,42 +113,30 @@
             return reImpl;
         }
 
-        reImpl =
-            AccessController.doPrivileged(new PrivilegedAction<RenderingEngine>() {
-                public RenderingEngine run() {
-                    final String ductusREClass = "sun.dc.DuctusRenderingEngine";
-                    String reClass =
-                        System.getProperty("sun.java2d.renderer", ductusREClass);
-                    if (reClass.equals(ductusREClass)) {
-                        try {
-                            Class<?> cls = Class.forName(ductusREClass);
-                            return (RenderingEngine) cls.newInstance();
-                        } catch (ReflectiveOperationException ignored) {
-                            // not found
-                        }
-                    }
-
-                    ServiceLoader<RenderingEngine> reLoader =
-                        ServiceLoader.loadInstalled(RenderingEngine.class);
-
-                    RenderingEngine service = null;
-
-                    for (RenderingEngine re : reLoader) {
-                        service = re;
-                        if (re.getClass().getName().equals(reClass)) {
-                            break;
-                        }
-                    }
-                    return service;
-                }
-            });
+        /* Look first for ductus or an app-override renderer,
+         * if not specified or present, then look for pisces.
+         */
+        final String ductusREClass = "sun.dc.DuctusRenderingEngine";
+        final String piscesREClass = "sun.java2d.pisces.PiscesRenderingEngine";
+        GetPropertyAction gpa =
+            new GetPropertyAction("sun.java2d.renderer", ductusREClass);
+        String reClass = AccessController.doPrivileged(gpa);
+        try {
+            Class<?> cls = Class.forName(reClass);
+            reImpl = (RenderingEngine) cls.newInstance();
+        } catch (ReflectiveOperationException ignored0) {
+            try {
+                Class<?> cls = Class.forName(piscesREClass);
+                reImpl = (RenderingEngine) cls.newInstance();
+            } catch (ReflectiveOperationException ignored1) {
+            }
+        }
 
         if (reImpl == null) {
             throw new InternalError("No RenderingEngine module found");
         }
 
-        GetPropertyAction gpa =
-            new GetPropertyAction("sun.java2d.renderer.trace");
+        gpa = new GetPropertyAction("sun.java2d.renderer.trace");
         String reTrace = AccessController.doPrivileged(gpa);
         if (reTrace != null) {
             reImpl = new Tracer(reImpl);
--- a/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java	Fri May 23 23:55:14 2014 +0000
@@ -39,14 +39,14 @@
 {
     CompositePipe outpipe;
 
-    static Class RegionClass = Region.class;
-    static Class RegionIteratorClass = RegionIterator.class;
+    static Class<?> RegionClass = Region.class;
+    static Class<?> RegionIteratorClass = RegionIterator.class;
 
     static {
         initIDs(RegionClass, RegionIteratorClass);
     }
 
-    static native void initIDs(Class rc, Class ric);
+    static native void initIDs(Class<?> rc, Class<?> ric);
 
     public SpanClipRenderer(CompositePipe pipe) {
         outpipe = pipe;
--- a/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine	Thu May 22 20:24:42 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#  Pisces Rendering Engine module
-sun.java2d.pisces.PiscesRenderingEngine
--- a/src/share/classes/sun/misc/ThreadGroupUtils.java	Thu May 22 20:24:42 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2014, 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.misc;
-
-/**
- * A utility class needed to access the root {@code ThreadGroup}
- *
- * The class should not depend on any others, because it' called from JNI_OnLoad of the AWT
- * native library. Triggering class loading could could lead to a deadlock.
- */
-public final class ThreadGroupUtils {
-
-    private ThreadGroupUtils() {
-        // Avoid instantiation
-    }
-
-    /**
-     * Returns a root thread group.
-     * Should be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION}
-     *
-     * @return a root {@code ThreadGroup}
-     */
-    public static ThreadGroup getRootThreadGroup() {
-        ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
-        ThreadGroup parentTG = currentTG.getParent();
-        while (parentTG != null) {
-            currentTG = parentTG;
-            parentTG = currentTG.getParent();
-        }
-        return currentTG;
-    }
-}
--- a/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c	Fri May 23 23:55:14 2014 +0000
@@ -25,7 +25,6 @@
 
 #include "splashscreen_impl.h"
 
-#include "jinclude.h"
 #include "jpeglib.h"
 #include "jerror.h"
 
@@ -107,11 +106,11 @@
     if (cinfo->src == NULL) {   /* first time for this JPEG object? */
         cinfo->src = (struct jpeg_source_mgr *)
             (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
-            JPOOL_PERMANENT, SIZEOF(stream_source_mgr));
+            JPOOL_PERMANENT, sizeof(stream_source_mgr));
         src = (stream_src_ptr) cinfo->src;
         src->buffer = (JOCTET *)
             (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
-            JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET));
+            JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET));
     }
 
     src = (stream_src_ptr) cinfo->src;
--- a/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Fri May 23 23:55:14 2014 +0000
@@ -30,7 +30,7 @@
 #include "jni_util.h"
 #include "Trace.h"
 #include "Disposer.h"
-#include "lcms2.h"
+#include <lcms2.h>
 #include "jlong.h"
 
 
--- a/src/share/native/sun/java2d/loops/ProcessPath.c	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/native/sun/java2d/loops/ProcessPath.c	Fri May 23 23:55:14 2014 +0000
@@ -189,34 +189,34 @@
 
 #define PROCESS_POINT(hnd, fX, fY, checkBounds, pixelInfo)                  \
     do {                                                                    \
-        jint _X = (fX)>> MDP_PREC;                                          \
-        jint _Y = (fY)>> MDP_PREC;                                          \
+        jint X_ = (fX)>> MDP_PREC;                                          \
+        jint Y_ = (fY)>> MDP_PREC;                                          \
         if (checkBounds &&                                                  \
-            (hnd->dhnd->yMin > _Y  ||                                       \
-             hnd->dhnd->yMax <= _Y ||                                       \
-             hnd->dhnd->xMin > _X  ||                                       \
-             hnd->dhnd->xMax <= _X)) break;                                 \
+            (hnd->dhnd->yMin > Y_  ||                                       \
+             hnd->dhnd->yMax <= Y_ ||                                       \
+             hnd->dhnd->xMin > X_  ||                                       \
+             hnd->dhnd->xMax <= X_)) break;                                 \
 /*                                                                          \
- *       (_X,_Y) should be inside boundaries                                \
+ *       (X_,Y_) should be inside boundaries                                \
  *                                                                          \
- *       assert(hnd->dhnd->yMin <= _Y &&                                    \
- *              hnd->dhnd->yMax >  _Y &&                                    \
- *              hnd->dhnd->xMin <= _X &&                                    \
- *              hnd->dhnd->xMax >  _X);                                     \
+ *       assert(hnd->dhnd->yMin <= Y_ &&                                    \
+ *              hnd->dhnd->yMax >  Y_ &&                                    \
+ *              hnd->dhnd->xMin <= X_ &&                                    \
+ *              hnd->dhnd->xMax >  X_);                                     \
  *                                                                          \
  */                                                                         \
         if (pixelInfo[0] == 0) {                                            \
             pixelInfo[0] = 1;                                               \
-            pixelInfo[1] = _X;                                              \
-            pixelInfo[2] = _Y;                                              \
-            pixelInfo[3] = _X;                                              \
-            pixelInfo[4] = _Y;                                              \
-            hnd->dhnd->pDrawPixel(hnd->dhnd, _X, _Y);                       \
-        } else if ((_X != pixelInfo[3] || _Y != pixelInfo[4]) &&            \
-                   (_X != pixelInfo[1] || _Y != pixelInfo[2])) {            \
-            hnd->dhnd->pDrawPixel(hnd->dhnd, _X, _Y);                       \
-            pixelInfo[3] = _X;                                              \
-            pixelInfo[4] = _Y;                                              \
+            pixelInfo[1] = X_;                                              \
+            pixelInfo[2] = Y_;                                              \
+            pixelInfo[3] = X_;                                              \
+            pixelInfo[4] = Y_;                                              \
+            hnd->dhnd->pDrawPixel(hnd->dhnd, X_, Y_);                       \
+        } else if ((X_ != pixelInfo[3] || Y_ != pixelInfo[4]) &&            \
+                   (X_ != pixelInfo[1] || Y_ != pixelInfo[2])) {            \
+            hnd->dhnd->pDrawPixel(hnd->dhnd, X_, Y_);                       \
+            pixelInfo[3] = X_;                                              \
+            pixelInfo[4] = Y_;                                              \
         }                                                                   \
     } while(0)
 
--- a/src/share/native/sun/security/smartcardio/pcsc.c	Thu May 22 20:24:42 2014 +0000
+++ b/src/share/native/sun/security/smartcardio/pcsc.c	Fri May 23 23:55:14 2014 +0000
@@ -108,7 +108,7 @@
 JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext
     (JNIEnv *env, jclass thisClass, jint dwScope)
 {
-    SCARDCONTEXT context;
+    SCARDCONTEXT context = 0;
     LONG rv;
     dprintf("-establishContext\n");
     rv = CALL_SCardEstablishContext(dwScope, NULL, NULL, &context);
@@ -180,7 +180,7 @@
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
     LPTSTR mszReaders;
-    DWORD size;
+    DWORD size = 0;
     jobjectArray result;
 
     dprintf1("-context: %x\n", context);
@@ -215,8 +215,8 @@
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
     LPCTSTR readerName;
-    SCARDHANDLE card;
-    DWORD proto;
+    SCARDHANDLE card = 0;
+    DWORD proto = 0;
 
     readerName = (*env)->GetStringUTFChars(env, jReaderName, NULL);
     if (readerName == NULL) {
@@ -280,8 +280,8 @@
     DWORD readerLen = READERNAME_BUFFER_SIZE;
     unsigned char atr[ATR_BUFFER_SIZE];
     DWORD atrLen = ATR_BUFFER_SIZE;
-    DWORD state;
-    DWORD protocol;
+    DWORD state = 0;
+    DWORD protocol = 0;
     jbyteArray jArray;
     jbyte status[2];
 
--- a/src/solaris/classes/sun/awt/X11/InfoWindow.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/InfoWindow.java	Fri May 23 23:55:14 2014 +0000
@@ -207,8 +207,9 @@
                             textLabel.setText(tooltipString);
                         }
 
-                        Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() {
-                                public Object run() {
+                        Point pointer = AccessController.doPrivileged(
+                            new PrivilegedAction<Point>() {
+                                public Point run() {
                                     if (!isPointerOverTrayIcon(liveArguments.getBounds())) {
                                         return null;
                                     }
--- a/src/solaris/classes/sun/awt/X11/ListHelper.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/ListHelper.java	Fri May 23 23:55:14 2014 +0000
@@ -55,10 +55,10 @@
 
     private final int SCROLLBAR_WIDTH;  // Width of a scrollbar
 
-    private java.util.List items;        // List of items
+    private java.util.List<String> items;        // List of items
 
     // TODO: maybe this would be better as a simple int[]
-    private java.util.List selected;     // List of selected items
+    private java.util.List<Integer> selected;     // List of selected items
     private boolean multiSelect;         // Can multiple items be selected
                                          // at once?
     private int focusedIndex;
@@ -100,8 +100,8 @@
         this.peer = peer;
         this.colors = colors;
         this.multiSelect = multiSelect;
-        items = new ArrayList(initialSize);
-        selected = new ArrayList(1);
+        items = new ArrayList<>(initialSize);
+        selected = new ArrayList<>(1);
         selected.add(Integer.valueOf(-1));
 
         this.maxVisItems = maxVisItems;
@@ -190,7 +190,7 @@
     /* if called for multiselect, return -1 */
     public int getSelectedIndex() {
         if (!multiSelect) {
-            Integer val = (Integer)selected.get(0);
+            Integer val = selected.get(0);
             return val.intValue();
         }
         return -1;
@@ -217,7 +217,7 @@
     }
 
     public String getItem(int index) {
-        return (String) items.get(index);
+        return items.get(index);
     }
 
     /**********************************************************************/
@@ -576,9 +576,9 @@
     }
 
     boolean isItemSelected(int index) {
-        Iterator itr = selected.iterator();
+        Iterator<Integer> itr = selected.iterator();
         while (itr.hasNext()) {
-            Integer val = (Integer)itr.next();
+            Integer val = itr.next();
             if (val.intValue() == index) {
                 return true;
             }
--- a/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Fri May 23 23:55:14 2014 +0000
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
 
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.InvalidDnDOperationException;
@@ -65,7 +66,7 @@
     }
 
     protected void initializeDragImpl(int actions, Transferable contents,
-                                      Map formatMap, long[] formats)
+                                      Map<Long, DataFlavor> formatMap, long[] formats)
       throws InvalidDnDOperationException,
         IllegalArgumentException, XException {
 
--- a/src/solaris/classes/sun/awt/X11/Native.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/Native.java	Fri May 23 23:55:14 2014 +0000
@@ -43,13 +43,12 @@
 
     static int dataModel;
     static {
-        String dataModelProp = (String)AccessController.
-            doPrivileged(
-                         new PrivilegedAction() {
-                                 public Object run() {
-                                     return System.getProperty("sun.arch.data.model");
-                                 }
-                             });
+        String dataModelProp = AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                public String run() {
+                    return System.getProperty("sun.arch.data.model");
+                }
+            });
         try {
             dataModel = Integer.parseInt(dataModelProp);
         } catch (Exception e) {
@@ -333,9 +332,9 @@
      * Stores Java Vector of Longs into memory. Memory location is treated as array
      * of native <code>long</code>s
      */
-    static void putLong(long ptr, Vector arr) {
+    static void putLong(long ptr, Vector<Long> arr) {
         for (int i = 0; i < arr.size(); i ++, ptr += getLongSize()) {
-            putLong(ptr, ((Long)arr.elementAt(i)).longValue());
+            putLong(ptr, arr.elementAt(i).longValue());
         }
     }
 
@@ -343,9 +342,9 @@
      * Stores Java Vector of Longs into memory. Memory location is treated as array
      * of native <code>long</code>s. Array is stored in reverse order
      */
-    static void putLongReverse(long ptr, Vector arr) {
+    static void putLongReverse(long ptr, Vector<Long> arr) {
         for (int i = arr.size()-1; i >= 0; i--, ptr += getLongSize()) {
-            putLong(ptr, ((Long)arr.elementAt(i)).longValue());
+            putLong(ptr, arr.elementAt(i).longValue());
         }
     }
     /**
--- a/src/solaris/classes/sun/awt/X11/XAWTXSettings.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XAWTXSettings.java	Fri May 23 23:55:14 2014 +0000
@@ -98,7 +98,7 @@
          * should be "good enough" for most cases.
          */
 
-        Map updatedSettings = null;
+        Map<String, Object> updatedSettings = null;
         XToolkit.awtLock();
         try {
             long display = XToolkit.getDisplay();
@@ -112,7 +112,7 @@
     }
 
     private void updateXSettings(int screen, long owner) {
-        final Map updatedSettings = getUpdatedSettings(owner);
+        final Map<String, Object> updatedSettings = getUpdatedSettings(owner);
         // this method is called under awt lock and usually on toolkit thread
         // but parseXSettings() causes public code execution, so we need to transfer
         // this to EDT
@@ -123,7 +123,7 @@
         });
     }
 
-    private Map getUpdatedSettings(final long owner) {
+    private Map<String, Object> getUpdatedSettings(final long owner) {
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("owner =" + owner);
         }
@@ -131,7 +131,7 @@
             return null;
         }
 
-        Map settings = null;
+        Map<String, Object> settings = null;
         try {
             WindowPropertyGetter getter =
                 new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH,
--- a/src/solaris/classes/sun/awt/X11/XAtomList.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XAtomList.java	Fri May 23 23:55:14 2014 +0000
@@ -157,7 +157,7 @@
     public String toString() {
         StringBuffer buf = new StringBuffer();
         buf.append("[");
-        Iterator iter = atoms.iterator();
+        Iterator<XAtom> iter = atoms.iterator();
         while (iter.hasNext()) {
             buf.append(iter.next().toString());
             if (iter.hasNext()) {
--- a/src/solaris/classes/sun/awt/X11/XAwtState.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XAwtState.java	Fri May 23 23:55:14 2014 +0000
@@ -40,7 +40,7 @@
      * The mouse is over this component.
      * If the component is not disabled, it received MOUSE_ENTERED but no MOUSE_EXITED.
      */
-    private static WeakReference componentMouseEnteredRef = null;
+    private static WeakReference<Component> componentMouseEnteredRef = null;
 
     static void setComponentMouseEntered(Component component) {
         XToolkit.awtLock();
@@ -50,7 +50,7 @@
                 return;
             }
             if (component != getComponentMouseEntered()) {
-                componentMouseEnteredRef = new WeakReference(component);
+                componentMouseEnteredRef = new WeakReference<>(component);
             }
         } finally {
             XToolkit.awtUnlock();
@@ -63,7 +63,7 @@
             if (componentMouseEnteredRef == null) {
                 return null;
             }
-            return (Component)componentMouseEnteredRef.get();
+            return componentMouseEnteredRef.get();
         } finally {
             XToolkit.awtUnlock();
         }
@@ -83,7 +83,7 @@
         return inManualGrab;
     }
 
-    private static WeakReference grabWindowRef = null;
+    private static WeakReference<XBaseWindow> grabWindowRef = null;
 
     /**
      * The X Active Grab overrides any other active grab by the same
@@ -112,7 +112,7 @@
                 return;
             }
             if (grabWindow != getGrabWindow()) {
-                grabWindowRef = new WeakReference(grabWindow);
+                grabWindowRef = new WeakReference<>(grabWindow);
             }
         } finally {
             XToolkit.awtUnlock();
@@ -125,7 +125,7 @@
             if (grabWindowRef == null) {
                 return null;
             }
-            XBaseWindow xbw = (XBaseWindow)grabWindowRef.get();
+            XBaseWindow xbw = grabWindowRef.get();
             if( xbw != null && xbw.isDisposed() ) {
                 xbw = null;
                 grabWindowRef = null;
--- a/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Fri May 23 23:55:14 2014 +0000
@@ -231,7 +231,7 @@
      */
     void instantPreInit(XCreateWindowParams params) {
         super.instantPreInit(params);
-        items = new ArrayList();
+        items = new ArrayList<>();
     }
 
     /************************************************
@@ -367,10 +367,10 @@
      * Clears items vector and loads specified vector
      * @param items vector to be loaded
      */
-    public void reloadItems(Vector items) {
+    public void reloadItems(Vector<? extends MenuItem> items) {
         synchronized(getMenuTreeLock()) {
             this.items.clear();
-            MenuItem[] itemArray = (MenuItem[])items.toArray(new MenuItem[] {});
+            MenuItem[] itemArray = items.toArray(new MenuItem[] {});
             int itemCnt = itemArray.length;
             for(int i = 0; i < itemCnt; i++) {
                 addItem(itemArray[i]);
--- a/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -236,8 +236,8 @@
         return false;
     }
 
-    private static Class seClass;
-    private static Constructor seCtor;
+    private static Class<?> seClass;
+    private static Constructor<?> seCtor;
 
     final static AWTEvent wrapInSequenced(AWTEvent event) {
         try {
@@ -246,9 +246,11 @@
             }
 
             if (seCtor == null) {
-                seCtor = (Constructor) AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                        public Object run() throws Exception {
-                            Constructor ctor = seClass.getConstructor(new Class[] { AWTEvent.class });
+                seCtor = AccessController.doPrivileged(new
+                    PrivilegedExceptionAction<Constructor<?>>() {
+                        public Constructor<?> run() throws Exception {
+                            Constructor<?> ctor = seClass.getConstructor(
+                                new Class<?>[] { AWTEvent.class });
                             ctor.setAccessible(true);
                             return ctor;
                         }
@@ -1322,7 +1324,7 @@
         }
     }
 
-    private void addTree(Collection order, Set set, Container cont) {
+    private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
         for (int i = 0; i < cont.getComponentCount(); i++) {
             Component comp = cont.getComponent(i);
             ComponentPeer peer = comp.getPeer();
--- a/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java	Fri May 23 23:55:14 2014 +0000
@@ -30,7 +30,7 @@
 import java.util.Map;
 
 @SuppressWarnings("serial") // JDK-implementation class
-public class XCreateWindowParams extends HashMap {
+public class XCreateWindowParams extends HashMap<Object, Object> {
     public XCreateWindowParams() {
     }
     public XCreateWindowParams(Object[] map) {
@@ -82,9 +82,9 @@
     }
     public String toString() {
         StringBuffer buf = new StringBuffer();
-        Iterator eIter = entrySet().iterator();
+        Iterator<Map.Entry<Object, Object>> eIter = entrySet().iterator();
         while (eIter.hasNext()) {
-            Map.Entry entry = (Map.Entry)eIter.next();
+            Map.Entry<Object, Object> entry = eIter.next();
             buf.append(entry.getKey() + ": " + entry.getValue() + "\n");
         }
         return buf.toString();
--- a/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Fri May 23 23:55:14 2014 +0000
@@ -45,9 +45,11 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 
 import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
 import javax.imageio.ImageTypeSpecifier;
 import javax.imageio.ImageWriter;
 import javax.imageio.spi.ImageWriterSpi;
@@ -258,28 +260,9 @@
                                   Transferable localeTransferable)
       throws IOException {
 
-        String charset = null;
-        if (localeTransferable != null &&
-            isLocaleDependentTextFormat(format) &&
-            localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
-            try {
-                charset = new String(
-                    (byte[])localeTransferable.getTransferData(javaTextEncodingFlavor),
-                    "UTF-8"
-                );
-            } catch (UnsupportedFlavorException cannotHappen) {
-            }
-        } else {
-            charset = getCharsetForTextFormat(format);
-        }
-        if (charset == null) {
-            // Only happens when we have a custom text type.
-            charset = getDefaultTextCharset();
-        }
-
-        BufferedReader reader = null;
-        try {
-            reader = new BufferedReader(new InputStreamReader(stream, charset));
+        String charset = getBestCharsetForTextFormat(format, localeTransferable);
+        try (InputStreamReader isr = new InputStreamReader(stream, charset);
+             BufferedReader reader = new BufferedReader(isr)) {
             String line;
             ArrayList<URI> uriList = new ArrayList<>();
             URI uri;
@@ -292,9 +275,6 @@
                 uriList.add(uri);
             }
             return uriList.toArray(new URI[uriList.size()]);
-        } finally {
-            if (reader != null)
-                reader.close();
         }
     }
 
@@ -330,8 +310,8 @@
      * type can be translated by the Data Transfer subsystem.
      */
     @Override
-    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
-        List<DataFlavor> flavors = new ArrayList<>();
+    public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat) {
+        LinkedHashSet<DataFlavor> flavors = new LinkedHashSet<>();
 
         if (nat == null) {
             return flavors;
@@ -354,7 +334,7 @@
         // flavors to enable dynamic text native-to-flavor mapping generation.
         // See SystemFlavorMap.getFlavorsForNative() for details.
         if ("image".equals(primaryType)) {
-            Iterator readers = ImageIO.getImageReadersByMIMEType(baseType);
+            Iterator<ImageReader> readers = ImageIO.getImageReadersByMIMEType(baseType);
             if (readers.hasNext()) {
                 flavors.add(DataFlavor.imageFlavor);
             }
@@ -392,8 +372,8 @@
      * Transfer subsystem.
      */
     @Override
-    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
-        List<String> natives = new ArrayList<>(1);
+    public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        LinkedHashSet<String> natives = new LinkedHashSet<>(1);
 
         if (df == null) {
             return natives;
--- a/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java	Fri May 23 23:55:14 2014 +0000
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
 
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.InvalidDnDOperationException;
@@ -70,7 +71,7 @@
      * @returns true if the initialized successfully.
      */
     protected void initializeDragImpl(int actions, Transferable contents,
-                                         Map formatMap, long[] formats)
+                                      Map<Long, DataFlavor> formatMap, long[] formats)
       throws InvalidDnDOperationException,
         IllegalArgumentException, XException {
         assert XToolkit.isAWTLockHeldByCurrentThread();
--- a/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java	Fri May 23 23:55:14 2014 +0000
@@ -36,8 +36,8 @@
  * @since 1.5
  */
 final class XDragAndDropProtocols {
-    private final static List dragProtocols;
-    private final static List dropProtocols;
+    private final static List<XDragSourceProtocol> dragProtocols;
+    private final static List<XDropTargetProtocol> dropProtocols;
 
     public static final String XDnD = "XDnD";
     public static final String MotifDnD = "MotifDnD";
@@ -50,7 +50,7 @@
         XDropTargetProtocolListener dropTargetProtocolListener =
             XDropTargetContextPeer.getXDropTargetProtocolListener();
 
-        List tDragSourceProtocols = new ArrayList();
+        List<XDragSourceProtocol> tDragSourceProtocols = new ArrayList<>();
         XDragSourceProtocol xdndDragSourceProtocol =
             XDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
         tDragSourceProtocols.add(xdndDragSourceProtocol);
@@ -58,7 +58,7 @@
             MotifDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
         tDragSourceProtocols.add(motifdndDragSourceProtocol);
 
-        List tDropTargetProtocols = new ArrayList();
+        List<XDropTargetProtocol> tDropTargetProtocols = new ArrayList<>();
         XDropTargetProtocol xdndDropTargetProtocol =
             XDnDDropTargetProtocol.createInstance(dropTargetProtocolListener);
         tDropTargetProtocols.add(xdndDropTargetProtocol);
@@ -70,11 +70,11 @@
         dropProtocols = Collections.unmodifiableList(tDropTargetProtocols);
     }
 
-    static Iterator getDragSourceProtocols() {
+    static Iterator<XDragSourceProtocol> getDragSourceProtocols() {
         return dragProtocols.iterator();
     }
 
-    static Iterator getDropTargetProtocols() {
+    static Iterator<XDropTargetProtocol> getDropTargetProtocols() {
         return dropProtocols.iterator();
     }
 
@@ -88,10 +88,10 @@
             return null;
         }
 
-        Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+        Iterator<XDragSourceProtocol> dragProtocols =
+            XDragAndDropProtocols.getDragSourceProtocols();
         while (dragProtocols.hasNext()) {
-            XDragSourceProtocol dragProtocol =
-                (XDragSourceProtocol)dragProtocols.next();
+            XDragSourceProtocol dragProtocol = dragProtocols.next();
             if (dragProtocol.getProtocolName().equals(name)) {
                 return dragProtocol;
             }
@@ -110,10 +110,10 @@
             return null;
         }
 
-        Iterator dropProtocols = XDragAndDropProtocols.getDropTargetProtocols();
+        Iterator<XDropTargetProtocol> dropProtocols =
+            XDragAndDropProtocols.getDropTargetProtocols();
         while (dropProtocols.hasNext()) {
-            XDropTargetProtocol dropProtocol =
-                (XDropTargetProtocol)dropProtocols.next();
+            XDropTargetProtocol dropProtocol = dropProtocols.next();
             if (dropProtocol.getProtocolName().equals(name)) {
                 return dropProtocol;
             }
--- a/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -29,6 +29,7 @@
 import java.awt.Cursor;
 import java.awt.Window;
 
+import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 
 import java.awt.dnd.DnDConstants;
@@ -110,7 +111,7 @@
     }
 
     protected void startDrag(Transferable transferable,
-                             long[] formats, Map formatMap) {
+                             long[] formats, Map<Long, DataFlavor> formatMap) {
         Component component = getTrigger().getComponent();
         Component c = null;
         XWindowPeer wpeer = null;
@@ -161,9 +162,10 @@
 
             int dropActions = getDragSourceContext().getSourceActions();
 
-            Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+            Iterator<XDragSourceProtocol> dragProtocols =
+                XDragAndDropProtocols.getDragSourceProtocols();
             while (dragProtocols.hasNext()) {
-                XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
+                XDragSourceProtocol dragProtocol = dragProtocols.next();
                 try {
                     dragProtocol.initializeDrag(dropActions, transferable,
                                                 formatMap, formats);
@@ -313,9 +315,10 @@
             dragDropFinished(false, DnDConstants.ACTION_NONE, xRoot, yRoot);
         }
 
-        Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+        Iterator<XDragSourceProtocol> dragProtocols =
+            XDragAndDropProtocols.getDragSourceProtocols();
         while (dragProtocols.hasNext()) {
-            XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
+            XDragSourceProtocol dragProtocol = dragProtocols.next();
             try {
                 dragProtocol.cleanup();
             } catch (XException xe) {
@@ -418,9 +421,10 @@
         }
 
         if (clientWindow != 0) {
-            Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+            Iterator<XDragSourceProtocol> dragProtocols =
+                XDragAndDropProtocols.getDragSourceProtocols();
             while (dragProtocols.hasNext()) {
-                XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
+                XDragSourceProtocol dragProtocol = dragProtocols.next();
                 if (dragProtocol.attachTargetWindow(clientWindow, time)) {
                     protocol = dragProtocol;
                     break;
@@ -550,10 +554,10 @@
 
         XClientMessageEvent xclient = ev.get_xclient();
 
-        Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+        Iterator<XDragSourceProtocol> dragProtocols =
+            XDragAndDropProtocols.getDragSourceProtocols();
         while (dragProtocols.hasNext()) {
-            XDragSourceProtocol dragProtocol =
-                (XDragSourceProtocol)dragProtocols.next();
+            XDragSourceProtocol dragProtocol = dragProtocols.next();
             if (dragProtocol.processProxyModeEvent(xclient,
                                                    getProxyModeSourceWindow())) {
                 return true;
--- a/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Fri May 23 23:55:14 2014 +0000
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
 
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.InvalidDnDOperationException;
@@ -84,7 +85,7 @@
      * @throws XException if some X call failed.
      */
     public final void initializeDrag(int actions, Transferable contents,
-                                     Map formatMap, long[] formats)
+                                     Map<Long, DataFlavor> formatMap, long[] formats)
       throws InvalidDnDOperationException,
              IllegalArgumentException, XException {
         XToolkit.awtLock();
@@ -110,7 +111,8 @@
     /* The caller must hold AWT_LOCK. */
     protected abstract void initializeDragImpl(int actions,
                                                Transferable contents,
-                                               Map formatMap, long[] formats)
+                                               Map<Long, DataFlavor> formatMap,
+                                               long[] formats)
       throws InvalidDnDOperationException, IllegalArgumentException, XException;
 
     /**
--- a/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -89,12 +89,12 @@
         /* If the event was not consumed, send a response to the source. */
         try {
             if (ctxt != 0 && !e.isConsumed()) {
-                Iterator dropTargetProtocols =
+                Iterator<XDropTargetProtocol> dropTargetProtocols =
                     XDragAndDropProtocols.getDropTargetProtocols();
 
                 while (dropTargetProtocols.hasNext()) {
                     XDropTargetProtocol dropTargetProtocol =
-                        (XDropTargetProtocol)dropTargetProtocols.next();
+                        dropTargetProtocols.next();
                     if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                         returnValue)) {
                         break;
@@ -116,12 +116,12 @@
 
         if (ctxt != 0) {
             try {
-                Iterator dropTargetProtocols =
+                Iterator<XDropTargetProtocol> dropTargetProtocols =
                     XDragAndDropProtocols.getDropTargetProtocols();
 
                 while (dropTargetProtocols.hasNext()) {
                     XDropTargetProtocol dropTargetProtocol =
-                        (XDropTargetProtocol)dropTargetProtocols.next();
+                        dropTargetProtocols.next();
                     if (dropTargetProtocol.sendDropDone(ctxt, success,
                                                         dropAction)) {
                         break;
@@ -140,12 +140,12 @@
         long ctxt = getNativeDragContext();
 
         if (ctxt != 0) {
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
                 XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                    dropTargetProtocols.next();
                 // getData throws IAE if ctxt is not for this protocol.
                 try {
                     return dropTargetProtocol.getData(ctxt, format);
@@ -221,12 +221,11 @@
 
     public void forwardEventToEmbedded(long embedded, long ctxt,
                                        int eventID) {
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             if (dropTargetProtocol.forwardEventToEmbedded(embedded, ctxt,
                                                           eventID)) {
                 break;
--- a/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java	Fri May 23 23:55:14 2014 +0000
@@ -79,12 +79,11 @@
         }
 
         if (protocol == null) {
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 // Don't try to process it again with the current protocol.
                 if (dropTargetProtocol == curProtocol) {
                     continue;
--- a/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java	Fri May 23 23:55:14 2014 +0000
@@ -295,7 +295,8 @@
     }
 
     /* Access to HashMap is synchronized on this XDropTargetProtocol instance. */
-    private final HashMap embedderRegistry = new HashMap();
+    private final HashMap<Long, EmbedderRegistryEntry> embedderRegistry =
+        new HashMap<>();
 
     protected final void putEmbedderRegistryEntry(long embedder,
                                                   boolean overriden,
@@ -310,8 +311,7 @@
 
     protected final EmbedderRegistryEntry getEmbedderRegistryEntry(long embedder) {
         synchronized (this) {
-            return
-                (EmbedderRegistryEntry)embedderRegistry.get(Long.valueOf(embedder));
+            return embedderRegistry.get(Long.valueOf(embedder));
         }
     }
 
--- a/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Fri May 23 23:55:14 2014 +0000
@@ -141,10 +141,10 @@
         }
         public long[] getSites() {
             long[] ret = new long[sites.size()];
-            Iterator iter = sites.iterator();
+            Iterator<Long> iter = sites.iterator();
             int index = 0;
             while (iter.hasNext()) {
-                Long l = (Long)iter.next();
+                Long l = iter.next();
                 ret[index++] = l.longValue();
             }
             return ret;
@@ -199,14 +199,13 @@
     private EmbeddedDropSiteEntry registerEmbedderDropSite(long embedder) {
         assert XToolkit.isAWTLockHeldByCurrentThread();
 
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
         // The list of protocols supported by the embedder.
-        List<XDropTargetProtocol> embedderProtocols = new ArrayList();
+        List<XDropTargetProtocol> embedderProtocols = new ArrayList<>();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             if (dropTargetProtocol.isProtocolSupported(embedder)) {
                 embedderProtocols.add(dropTargetProtocol);
             }
@@ -262,7 +261,7 @@
 
     private void registerProtocols(long embedder, boolean protocols,
                                    List<XDropTargetProtocol> supportedProtocols) {
-        Iterator dropTargetProtocols = null;
+        Iterator<XDropTargetProtocol> dropTargetProtocols = null;
 
         /*
          * By default, we register a drop site that supports all dnd
@@ -289,8 +288,7 @@
         XlibWrapper.XGrabServer(XToolkit.getDisplay());
         try {
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 if ((protocols == XEMBED_PROTOCOLS) ==
                     dropTargetProtocol.isXEmbedSupported()) {
                     dropTargetProtocol.registerEmbedderDropSite(embedder);
@@ -310,14 +308,13 @@
 
         assert XToolkit.isAWTLockHeldByCurrentThread();
 
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
         // The list of protocols supported by the embedder.
-        List<XDropTargetProtocol> embedderProtocols = new ArrayList();
+        List<XDropTargetProtocol> embedderProtocols = new ArrayList<>();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             if (dropTargetProtocol.isProtocolSupported(embedder)) {
                 embedderProtocols.add(dropTargetProtocol);
             }
@@ -361,8 +358,7 @@
         XlibWrapper.XGrabServer(XToolkit.getDisplay());
         try {
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 if (!isXEmbedServer || !dropTargetProtocol.isXEmbedSupported()) {
                     dropTargetProtocol.registerEmbedderDropSite(embedder);
                 }
@@ -376,7 +372,7 @@
                                             EmbeddedDropSiteEntry entry) {
         assert XToolkit.isAWTLockHeldByCurrentThread();
 
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
 
         /* Grab server, since we are working with the window that belongs to
@@ -384,8 +380,7 @@
         XlibWrapper.XGrabServer(XToolkit.getDisplay());
         try {
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 dropTargetProtocol.unregisterEmbedderDropSite(embedder);
             }
 
@@ -470,14 +465,14 @@
                     registerProtocols(toplevel, XEMBED_PROTOCOLS,
                                       entry.getSupportedProtocols());
                 } else {
-                    Iterator dropTargetProtocols =
+                    Iterator<XDropTargetProtocol> dropTargetProtocols =
                         XDragAndDropProtocols.getDropTargetProtocols();
 
                     // Register the embedded window as a plain drop site with
                     // all DnD protocols that are supported by XEmbed.
                     while (dropTargetProtocols.hasNext()) {
                         XDropTargetProtocol dropTargetProtocol =
-                            (XDropTargetProtocol)dropTargetProtocols.next();
+                            dropTargetProtocols.next();
                         if (dropTargetProtocol.isXEmbedSupported()) {
                             dropTargetProtocol.registerEmbedderDropSite(window);
                         }
@@ -558,12 +553,12 @@
         }
 
         if (toplevel == window) {
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
                 XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                    dropTargetProtocols.next();
                 dropTargetProtocol.registerDropTarget(toplevel);
             }
         } else {
@@ -584,13 +579,13 @@
         long toplevel = getToplevelWindow(window);
 
         if (toplevel == window) {
-            Iterator dropProtocols =
+            Iterator<XDropTargetProtocol> dropProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             removeDelayedRegistrationEntry(window);
 
             while (dropProtocols.hasNext()) {
-                XDropTargetProtocol dropProtocol = (XDropTargetProtocol)dropProtocols.next();
+                XDropTargetProtocol dropProtocol = dropProtocols.next();
                 dropProtocol.unregisterDropTarget(window);
             }
         } else {
@@ -615,12 +610,11 @@
             }
             registerEmbeddedDropSite(canvasWindow, clientWindow);
 
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 dropTargetProtocol.registerEmbeddedDropSite(clientWindow);
             }
 
@@ -634,12 +628,11 @@
         if (logger.isLoggable(PlatformLogger.Level.FINE)) {
             logger.fine("        XEmbed drop site will be unregistered for " + Long.toHexString(clientWindow));
         }
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             dropTargetProtocol.unregisterEmbeddedDropSite(clientWindow);
         }
 
--- a/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	Fri May 23 23:55:14 2014 +0000
@@ -32,7 +32,7 @@
 import sun.awt.AWTAccessor;
 
 public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
-    HashMap children = new HashMap();
+    HashMap<Long, java.awt.peer.ComponentPeer> children = new HashMap<>();
 
     XEmbeddingContainer() {
     }
--- a/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -146,9 +146,9 @@
         savedDir = target.getDirectory();
         // Shouldn't save 'user.dir' to 'savedDir'
         // since getDirectory() will be incorrect after handleCancel
-        userDir = (String)AccessController.doPrivileged(
-            new PrivilegedAction() {
-                public Object run() {
+        userDir = AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                public String run() {
                     return System.getProperty("user.dir");
                 }
             });
--- a/src/solaris/classes/sun/awt/X11/XListPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XListPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -70,7 +70,7 @@
     ListPainter painter;
 
     // TODO: ick - Vector?
-    Vector                      items;
+    Vector<String>              items;
     boolean                     multipleSelections;
     int                         active = NONE;
 
@@ -139,7 +139,7 @@
         super.preInit(params);
 
         // Stuff that must be initialized before layout() is called
-        items = new Vector();
+        items = new Vector<>();
         createVerScrollbar();
         createHorScrollbar();
 
@@ -281,7 +281,7 @@
         int m = 0;
         int end = items.size();
         for(int i = 0 ; i < end ; i++) {
-            int l = fm.stringWidth(((String)items.elementAt(i)));
+            int l = fm.stringWidth(items.elementAt(i));
             m = Math.max(m, l);
         }
         return m;
@@ -292,7 +292,7 @@
      */
     int getItemWidth(int i) {
         FontMetrics fm = getFontMetrics(getFont());
-        return fm.stringWidth((String)items.elementAt(i));
+        return fm.stringWidth(items.elementAt(i));
     }
 
     /**
@@ -659,7 +659,7 @@
                         ( clickCount % 2 == 0 ) ) {
                 postEvent(new ActionEvent(target,
                                           ActionEvent.ACTION_PERFORMED,
-                                          (String)items.elementAt(currentIndex),
+                                          items.elementAt(currentIndex),
                                           mouseEvent.getWhen(),
                                           mouseEvent.getModifiers()));  // No ext mods
             } else if (active == WINDOW) {
@@ -986,7 +986,7 @@
               if (selected.length > 0) {
                   postEvent(new ActionEvent((List)target,
                                             ActionEvent.ACTION_PERFORMED,
-                                            (String)items.elementAt(getFocusIndex()),
+                                            items.elementAt(getFocusIndex()),
                                             e.getWhen(),
                                             e.getModifiers()));  // ActionEvent doesn't have
                   // extended modifiers.
@@ -1343,7 +1343,7 @@
      */
     public void clear() {
         selected = new int[0];
-        items = new Vector();
+        items = new Vector<>();
         currentIndex = -1;
         // Fixed 6291736: ITEM_STATE_CHANGED triggered after List.removeAll(), XToolkit
         // We should update 'focusIndex' variable more carefully
@@ -1926,7 +1926,7 @@
                     } else {
                         g.setColor(getListForeground());
                     }
-                    String str = (String)items.elementAt(index);
+                    String str = items.elementAt(index);
                     g.drawString(str, x - hsb.getValue(), y + fontAscent);
                 } else {
                     // Clear the remaining area around the item - focus area and the rest of border
--- a/src/solaris/classes/sun/awt/X11/XMSelection.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XMSelection.java	Fri May 23 23:55:14 2014 +0000
@@ -60,7 +60,7 @@
     String selectionName;
 
     /* list of listeners to be called for events */
-    Vector listeners;
+    Vector<XMSelectionListener> listeners;
 
     /* X atom array (one per screen) for this selection */
     XAtom atoms[];
@@ -75,7 +75,7 @@
 
     static XAtom XA_MANAGER;
 
-    static HashMap selectionMap;
+    static HashMap<Long, XMSelection> selectionMap;
 
     static {
         long display = XToolkit.getDisplay();
@@ -90,7 +90,7 @@
             initScreen(display,screen);
         }
 
-        selectionMap = new HashMap();
+        selectionMap = new HashMap<>();
     }
 
     static void initScreen(long display, final int screen) {
@@ -227,7 +227,7 @@
 
 
     static XMSelection getInstance(long selection) {
-        return (XMSelection) selectionMap.get(Long.valueOf(selection));
+        return selectionMap.get(Long.valueOf(selection));
     }
 
 
@@ -259,7 +259,7 @@
 
     public synchronized void addSelectionListener(XMSelectionListener listener) {
         if (listeners == null) {
-            listeners = new Vector();
+            listeners = new Vector<>();
         }
         listeners.add(listener);
     }
@@ -270,7 +270,7 @@
         }
     }
 
-    synchronized Collection getListeners() {
+    synchronized Collection<XMSelectionListener> getListeners() {
         return listeners;
     }
 
@@ -310,9 +310,9 @@
             log.fine("Selection Changed : Screen = " + screen + "Event =" + ev);
         }
         if (listeners != null) {
-            Iterator iter = listeners.iterator();
+            Iterator<XMSelectionListener> iter = listeners.iterator();
             while (iter.hasNext()) {
-                XMSelectionListener disp = (XMSelectionListener) iter.next();
+                XMSelectionListener disp = iter.next();
                 disp.selectionChanged(screen, this, ev.get_window(), ev);
             }
         }
@@ -323,9 +323,9 @@
             log.fine("Owner dead : Screen = " + screen + "Event =" + de);
         }
         if (listeners != null) {
-            Iterator iter = listeners.iterator();
+            Iterator<XMSelectionListener> iter = listeners.iterator();
             while (iter.hasNext()) {
-                XMSelectionListener disp = (XMSelectionListener) iter.next();
+                XMSelectionListener disp = iter.next();
                 disp.ownerDeath(screen, this, de.get_window());
 
             }
@@ -349,9 +349,9 @@
 
     synchronized void dispatchOwnerChangedEvent(XEvent ev, int screen, long owner, long data, long timestamp) {
         if (listeners != null) {
-            Iterator iter = listeners.iterator();
+            Iterator<XMSelectionListener> iter = listeners.iterator();
             while (iter.hasNext()) {
-                XMSelectionListener disp = (XMSelectionListener) iter.next();
+                XMSelectionListener disp = iter.next();
                 disp.ownerChanged(screen,this, owner, data, timestamp);
             }
         }
--- a/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -195,10 +195,10 @@
     void postInit(XCreateWindowParams params) {
         super.postInit(params);
         // Get menus from the target.
-        Vector targetMenuVector = AWTAccessor.getMenuBarAccessor()
-                                      .getMenus(menuBarTarget);
+        Vector<Menu> targetMenuVector = AWTAccessor.getMenuBarAccessor()
+                                                   .getMenus(menuBarTarget);
         Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor()
-                                  .getHelpMenu(menuBarTarget);
+                                         .getHelpMenu(menuBarTarget);
         reloadItems(targetMenuVector);
         if (targetHelpMenu != null) {
             addHelpMenu(targetHelpMenu);
--- a/src/solaris/classes/sun/awt/X11/XMenuPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XMenuPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -143,7 +143,7 @@
      * Access to target's fields
      *
      ************************************************/
-    Vector getTargetItems() {
+    Vector<MenuItem> getTargetItems() {
         return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget());
     }
 
--- a/src/solaris/classes/sun/awt/X11/XMenuWindow.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XMenuWindow.java	Fri May 23 23:55:14 2014 +0000
@@ -164,7 +164,7 @@
             this.menuPeer = menuPeer;
             this.target = menuPeer.getContainer().target;
             // Get menus from the target.
-            Vector targetItemVector = null;
+            Vector<MenuItem> targetItemVector = null;
             targetItemVector = getMenuTargetItems();
             reloadItems(targetItemVector);
         }
@@ -356,7 +356,7 @@
      * Reads vector of items from target
      * This function is overriden in XPopupMenuPeer
      */
-    Vector getMenuTargetItems() {
+    Vector<MenuItem> getMenuTargetItems() {
         return menuPeer.getTargetItems();
     }
 
--- a/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -134,7 +134,7 @@
     public void show(Event e) {
         target = (Component)e.target;
         // Get menus from the target.
-        Vector targetItemVector = getMenuTargetItems();
+        Vector<MenuItem> targetItemVector = getMenuTargetItems();
         if (targetItemVector != null) {
             reloadItems(targetItemVector);
             //Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang
@@ -188,7 +188,7 @@
         return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
     }
 
-    Vector getMenuTargetItems() {
+    Vector<MenuItem> getMenuTargetItems() {
         if (popupMenuTarget == null) {
             return null;
         }
--- a/src/solaris/classes/sun/awt/X11/XSelection.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XSelection.java	Fri May 23 23:55:14 2014 +0000
@@ -25,6 +25,7 @@
 
 package sun.awt.X11;
 
+import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 
 import java.io.ByteArrayOutputStream;
@@ -87,7 +88,7 @@
     /* The contents supplied by the current owner. */
     private Transferable contents = null;
     /* The format-to-flavor map for the current owner. */
-    private Map formatMap = null;
+    private Map<Long, DataFlavor> formatMap = null;
     /* The formats supported by the current owner was set. */
     private long[] formats = null;
     /* The AppContext in which the current owner was set. */
@@ -134,7 +135,8 @@
         return selectionAtom;
     }
 
-    public synchronized boolean setOwner(Transferable contents, Map formatMap,
+    public synchronized boolean setOwner(Transferable contents,
+                                         Map<Long, DataFlavor> formatMap,
                                          long[] formats, long time)
     {
         long owner = XWindow.getXAWTRootWindow().getWindow();
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java	Fri May 23 23:55:14 2014 +0000
@@ -36,6 +36,7 @@
 import java.awt.dnd.MouseDragGestureRecognizer;
 import java.awt.dnd.InvalidDnDOperationException;
 import java.awt.dnd.peer.DragSourceContextPeer;
+import java.awt.font.TextAttribute;
 import java.awt.im.InputMethodHighlight;
 import java.awt.im.spi.InputMethodDescriptor;
 import java.awt.image.ColorModel;
@@ -51,7 +52,7 @@
 import sun.font.FontConfigManager;
 import sun.java2d.SunGraphicsEnvironment;
 import sun.misc.*;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.print.PrintJob2D;
 import sun.security.action.GetPropertyAction;
 import sun.security.action.GetBooleanAction;
@@ -99,9 +100,9 @@
     private FontConfigManager fcManager = new FontConfigManager();
 
     static int arrowCursor;
-    static TreeMap winMap = new TreeMap();
-    static HashMap specialPeerMap = new HashMap();
-    static HashMap winToDispatcher = new HashMap();
+    static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
+    static HashMap<Object, Object> specialPeerMap = new HashMap<>();
+    static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
     private static long _display;
     static UIDefaults uidefaults;
     static X11GraphicsEnvironment localEnv;
@@ -358,16 +359,16 @@
     }
     static XBaseWindow windowToXWindow(long window) {
         synchronized(winMap) {
-            return (XBaseWindow) winMap.get(Long.valueOf(window));
+            return winMap.get(Long.valueOf(window));
         }
     }
 
     static void addEventDispatcher(long window, XEventDispatcher dispatcher) {
         synchronized(winToDispatcher) {
             Long key = Long.valueOf(window);
-            Collection dispatchers = (Collection)winToDispatcher.get(key);
+            Collection<XEventDispatcher> dispatchers = winToDispatcher.get(key);
             if (dispatchers == null) {
-                dispatchers = new Vector();
+                dispatchers = new Vector<>();
                 winToDispatcher.put(key, dispatchers);
             }
             dispatchers.add(dispatcher);
@@ -376,7 +377,7 @@
     static void removeEventDispatcher(long window, XEventDispatcher dispatcher) {
         synchronized(winToDispatcher) {
             Long key = Long.valueOf(window);
-            Collection dispatchers = (Collection)winToDispatcher.get(key);
+            Collection<XEventDispatcher> dispatchers = winToDispatcher.get(key);
             if (dispatchers != null) {
                 dispatchers.remove(dispatcher);
             }
@@ -493,18 +494,18 @@
         }
         XBaseWindow.dispatchToWindow(ev);
 
-        Collection dispatchers = null;
+        Collection<XEventDispatcher> dispatchers = null;
         synchronized(winToDispatcher) {
             Long key = Long.valueOf(xany.get_window());
-            dispatchers = (Collection)winToDispatcher.get(key);
+            dispatchers = winToDispatcher.get(key);
             if (dispatchers != null) { // Clone it to avoid synchronization during dispatching
-                dispatchers = new Vector(dispatchers);
+                dispatchers = new Vector<>(dispatchers);
             }
         }
         if (dispatchers != null) {
-            Iterator iter = dispatchers.iterator();
+            Iterator<XEventDispatcher> iter = dispatchers.iterator();
             while (iter.hasNext()) {
-                XEventDispatcher disp = (XEventDispatcher)iter.next();
+                XEventDispatcher disp = iter.next();
                 disp.dispatchEvent(ev);
             }
         }
@@ -764,7 +765,7 @@
 
         Insets insets = new Insets(0, 0, 0, 0);
 
-        java.util.List search = new LinkedList();
+        java.util.List<Object> search = new LinkedList<>();
         search.add(root);
         search.add(0);
         while (!search.isEmpty())
@@ -929,6 +930,7 @@
         return XDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
+    @SuppressWarnings("unchecked")
     public <T extends DragGestureRecognizer> T
     createDragGestureRecognizer(Class<T> recognizerClass,
                     DragSource ds,
@@ -1147,7 +1149,7 @@
         return 2;  // Black and white.
     }
 
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight)     {
+    public Map<TextAttribute, ?> mapInputMethodHighlight( InputMethodHighlight highlight) {
         return XInputMethod.mapInputMethodHighlight(highlight);
     }
     @Override
@@ -1338,31 +1340,25 @@
     static void dumpPeers() {
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("Mapped windows:");
-            Iterator iter = winMap.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                log.fine(entry.getKey() + "->" + entry.getValue());
-                if (entry.getValue() instanceof XComponentPeer) {
-                    Component target = (Component)((XComponentPeer)entry.getValue()).getTarget();
+            winMap.forEach((k, v) -> {
+                log.fine(k + "->" + v);
+                if (v instanceof XComponentPeer) {
+                    Component target = (Component)((XComponentPeer)v).getTarget();
                     log.fine("\ttarget: " + target);
                 }
-            }
+            });
 
             SunToolkit.dumpPeers(log);
 
             log.fine("Mapped special peers:");
-            iter = specialPeerMap.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                log.fine(entry.getKey() + "->" + entry.getValue());
-            }
+            specialPeerMap.forEach((k, v) -> {
+                log.fine(k + "->" + v);
+            });
 
             log.fine("Mapped dispatchers:");
-            iter = winToDispatcher.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                log.fine(entry.getKey() + "->" + entry.getValue());
-            }
+            winToDispatcher.forEach((k, v) -> {
+                log.fine(k + "->" + v);
+            });
         }
     }
 
@@ -1586,16 +1582,16 @@
      * <code>loadXSettings</code>.  It is called from the System EDT
      * if triggered by an XSETTINGS change.
      */
-    void parseXSettings(int screen_XXX_ignored,Map updatedSettings) {
+    void parseXSettings(int screen_XXX_ignored,Map<String, Object> updatedSettings) {
 
         if (updatedSettings == null || updatedSettings.isEmpty()) {
             return;
         }
 
-        Iterator i = updatedSettings.entrySet().iterator();
+        Iterator<Map.Entry<String, Object>> i = updatedSettings.entrySet().iterator();
         while (i.hasNext()) {
-            Map.Entry e = (Map.Entry)i.next();
-            String name = (String)e.getKey();
+            Map.Entry<String, Object> e = i.next();
+            String name = e.getKey();
 
             name = "gnome." + name;
             setDesktopProperty(name, e.getValue());
@@ -1692,7 +1688,7 @@
             long window = 0;
             try{
                 // get any application window
-                window = ((Long)(winMap.firstKey())).longValue();
+                window = winMap.firstKey().longValue();
             }catch(NoSuchElementException nex) {
                 // get root window
                 window = getDefaultRootWindow();
@@ -1798,7 +1794,7 @@
     }
 
 
-    private static SortedMap timeoutTasks;
+    private static SortedMap<Long, java.util.List<Runnable>> timeoutTasks;
 
     /**
      * Removed the task from the list of waiting-to-be called tasks.
@@ -1819,10 +1815,10 @@
                 }
                 return;
             }
-            Collection values = timeoutTasks.values();
-            Iterator iter = values.iterator();
+            Collection<java.util.List<Runnable>> values = timeoutTasks.values();
+            Iterator<java.util.List<Runnable>> iter = values.iterator();
             while (iter.hasNext()) {
-                java.util.List list = (java.util.List)iter.next();
+                java.util.List<Runnable> list = iter.next();
                 boolean removed = false;
                 if (list.contains(task)) {
                     list.remove(task);
@@ -1869,13 +1865,13 @@
             }
 
             if (timeoutTasks == null) {
-                timeoutTasks = new TreeMap();
+                timeoutTasks = new TreeMap<>();
             }
 
             Long time = Long.valueOf(System.currentTimeMillis() + interval);
-            java.util.List tasks = (java.util.List)timeoutTasks.get(time);
+            java.util.List<Runnable> tasks = timeoutTasks.get(time);
             if (tasks == null) {
-                tasks = new ArrayList(1);
+                tasks = new ArrayList<>(1);
                 timeoutTasks.put(time, tasks);
             }
             tasks.add(task);
@@ -1897,7 +1893,7 @@
             if (timeoutTasks == null || timeoutTasks.isEmpty()) {
                 return -1L;
             }
-            return (Long)timeoutTasks.firstKey();
+            return timeoutTasks.firstKey();
         } finally {
             awtUnlock();
         }
@@ -1918,13 +1914,13 @@
         }
 
         Long currentTime = Long.valueOf(System.currentTimeMillis());
-        Long time = (Long)timeoutTasks.firstKey();
+        Long time = timeoutTasks.firstKey();
 
         while (time.compareTo(currentTime) <= 0) {
-            java.util.List tasks = (java.util.List)timeoutTasks.remove(time);
+            java.util.List<Runnable> tasks = timeoutTasks.remove(time);
 
-            for (Iterator iter = tasks.iterator(); iter.hasNext();) {
-                Runnable task = (Runnable)iter.next();
+            for (Iterator<Runnable> iter = tasks.iterator(); iter.hasNext();) {
+                Runnable task = iter.next();
 
                 if (timeoutTaskLog.isLoggable(PlatformLogger.Level.FINER)) {
                     timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" +
@@ -1943,7 +1939,7 @@
             if (timeoutTasks.isEmpty()) {
                 break;
             }
-            time = (Long)timeoutTasks.firstKey();
+            time = timeoutTasks.firstKey();
         }
     }
 
--- a/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -85,7 +85,7 @@
         // Fix for 6317038: as EmbeddedFrame is instance of Frame, it is blocked
         // by modal dialogs, but in the case of TrayIcon it shouldn't. So we
         // set ModalExclusion property on it.
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 eframe.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
                 return null;
--- a/src/solaris/classes/sun/awt/X11/XWM.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XWM.java	Fri May 23 23:55:14 2014 +0000
@@ -1072,6 +1072,7 @@
      * Returns all protocols supporting given protocol interface
      */
     <T> Collection<T> getProtocols(Class<T> protocolInterface) {
+        @SuppressWarnings("unchecked")
         Collection<T> res = (Collection<T>) protocolsMap.get(protocolInterface);
         if (res != null) {
             return res;
@@ -1322,9 +1323,9 @@
         }
     }
 
-    HashMap storedInsets = new HashMap();
+    HashMap<Class<?>, Insets> storedInsets = new HashMap<>();
     Insets guessInsets(XDecoratedPeer window) {
-        Insets res = (Insets)storedInsets.get(window.getClass());
+        Insets res = storedInsets.get(window.getClass());
         if (res == null) {
             switch (WMID) {
               case ENLIGHTEN_WM:
--- a/src/solaris/classes/sun/awt/X11/XWindow.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java	Fri May 23 23:55:14 2014 +0000
@@ -59,7 +59,7 @@
     static int lastX = 0, lastY = 0;
     static long lastTime = 0;
     static long lastButton = 0;
-    static WeakReference lastWindowRef = null;
+    static WeakReference<XWindow> lastWindowRef = null;
     static int clickCount = 0;
 
     // used to check if we need to re-create surfaceData.
@@ -692,7 +692,7 @@
         if (type == XConstants.ButtonPress) {
             //Allow this mouse button to generate CLICK event on next ButtonRelease
             mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton);
-            XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
+            XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
             /*
                multiclick checking
             */
@@ -705,7 +705,7 @@
                 clickCount++;
             } else {
                 clickCount = 1;
-                lastWindowRef = new WeakReference(this);
+                lastWindowRef = new WeakReference<>(this);
                 lastButton = lbutton;
                 lastX = x;
                 lastY = y;
@@ -820,7 +820,7 @@
         */
         int x = xme.get_x();
         int y = xme.get_y();
-        XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
+        XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
 
         if (!(lastWindow == this &&
               (xme.get_time() - lastTime) < XToolkit.getMultiClickTime()  &&
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Fri May 23 23:55:14 2014 +0000
@@ -950,7 +950,7 @@
         // make new hash of toplevels of all windows from 'windows' hash.
         // FIXME: do not call them "toplevel" as it is misleading.
         //
-        HashSet toplevels = new HashSet();
+        HashSet<Long> toplevels = new HashSet<>();
         long topl = 0, mytopl = 0;
 
         for (XWindowPeer xp : windows) {
--- a/src/solaris/classes/sun/awt/X11CustomCursor.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11CustomCursor.java	Fri May 23 23:55:14 2014 +0000
@@ -47,7 +47,7 @@
     protected void createNativeCursor(Image im, int[] pixels, int width, int height,
                                       int xHotSpot, int yHotSpot) {
 
-        class CCount implements Comparable {
+        class CCount implements Comparable<CCount> {
             int color;
             int count;
 
@@ -56,8 +56,8 @@
                 count = ct;
             }
 
-            public int compareTo(Object cc) {
-                return ((CCount)cc).count - count;
+            public int compareTo(CCount cc) {
+                return cc.count - count;
             }
         }
 
--- a/src/solaris/classes/sun/awt/X11FontManager.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11FontManager.java	Fri May 23 23:55:14 2014 +0000
@@ -59,7 +59,7 @@
      * E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font
      * configuration files. We need to remove that part for comparisons.
      */
-    private static Map fontNameMap = new HashMap();
+    private static Map<String, String> fontNameMap = new HashMap<>();
 
     /*
      * xlfdMap is a map from a platform path like
@@ -72,7 +72,7 @@
      * the full XLFD string like :-
      * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0"
      */
-    private static Map xlfdMap = new HashMap();
+    private static Map<String, Vector<String>> xlfdMap = new HashMap<>();
 
     /* xFontDirsMap is also a map from a font ID to a font filepath.
      * The difference from fontNameMap is just that it does not have
@@ -88,7 +88,7 @@
      * X11 font directory, then precautions must be taken to include both
      * directories.
      */
-     private static Map xFontDirsMap;
+     private static Map<String, String> xFontDirsMap;
 
      /*
       * This is the set of font directories needed to be on the X font path
@@ -121,7 +121,7 @@
      * of the singleton GE instance is already synchronised and that is
      * the only code path that accesses this map.
      */
-     private static HashMap registeredDirs = new HashMap();
+     private static HashMap<String, Object> registeredDirs = new HashMap<>();
 
      /* Array of directories to be added to the X11 font path.
       * Used by static method called from Toolkits which use X11 fonts.
@@ -183,7 +183,7 @@
                  * Add this XLFD (platform name) to the list of known
                  * ones for this file.
                  */
-                Vector xVal = (Vector) xlfdMap.get(fileName);
+                Vector<String> xVal = xlfdMap.get(fileName);
                 if (xVal == null) {
                     /* Try to be robust on Linux distros which move fonts
                      * around by verifying that the fileName represents a
@@ -194,7 +194,7 @@
                         fileName = null;
                     }
                     if (fileName != null) {
-                        xVal = new Vector();
+                        xVal = new Vector<>();
                         xVal.add(platName);
                         xlfdMap.put(fileName, xVal);
                     }
@@ -211,7 +211,7 @@
         }
 
         if (fontID != null) {
-            fileName = (String)fontNameMap.get(fontID);
+            fileName = fontNameMap.get(fontID);
             /* On Linux check for the Lucida Oblique fonts */
             if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) {
                 if (oblmap == null) {
@@ -235,7 +235,7 @@
                     FontUtilities.getLogger()
                             .warning("** Finished registering all font paths");
                 }
-                fileName = (String)fontNameMap.get(fontID);
+                fileName = fontNameMap.get(fontID);
             }
             if (fileName == null && !isHeadless()) {
                 /* Query X11 directly to see if this font is available
@@ -245,7 +245,7 @@
             }
             if (fileName == null) {
                 fontID = switchFontIDForName(platName);
-                fileName = (String)fontNameMap.get(fontID);
+                fileName = fontNameMap.get(fontID);
             }
             if (fileName != null) {
                 fontNameMap.put(fontID, fileName);
@@ -257,8 +257,8 @@
     @Override
     protected String[] getNativeNames(String fontFileName,
             String platformName) {
-        Vector nativeNames;
-        if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) {
+        Vector<String> nativeNames;
+        if ((nativeNames=xlfdMap.get(fontFileName))==null) {
             if (platformName == null) {
                 return null;
             } else {
@@ -271,7 +271,7 @@
             }
         } else {
             int len = nativeNames.size();
-            return (String[])nativeNames.toArray(new String[len]);
+            return nativeNames.toArray(new String[len]);
         }
     }
 
@@ -366,7 +366,7 @@
                             }
                             String fontPart = st.sval.substring(breakPos+1);
                             String fontID = specificFontIDForName(fontPart);
-                            String sVal = (String) fontNameMap.get(fontID);
+                            String sVal = fontNameMap.get(fontID);
 
                             if (FontUtilities.debugFonts()) {
                                 PlatformLogger logger = FontUtilities.getLogger();
@@ -386,14 +386,14 @@
                                  * wants to use the native rasteriser.
                                  */
                                 if (xFontDirsMap == null) {
-                                    xFontDirsMap = new HashMap();
+                                    xFontDirsMap = new HashMap<>();
                                 }
                                 xFontDirsMap.put(fontID, path);
                                 fullPath = file.getCanonicalPath();
                             } catch (IOException e) {
                                 fullPath = path + File.separator + fileName;
                             }
-                            Vector xVal = (Vector) xlfdMap.get(fullPath);
+                            Vector<String> xVal = xlfdMap.get(fullPath);
                             if (FontUtilities.debugFonts()) {
                                 FontUtilities.getLogger()
                                       .info("fullPath=" + fullPath +
@@ -408,7 +408,7 @@
                                 }
                                 fontNameMap.put(fontID, fullPath);
                                 if (xVal == null) {
-                                    xVal = new Vector();
+                                    xVal = new Vector<>();
                                     xlfdMap.put (fullPath, xVal);
                                 }
                                 xVal.add(fontPart);
@@ -447,8 +447,8 @@
          * will typically not ever need to initialise it so it can be null.
          */
         xFontDirsMap = null;
-        xlfdMap = new HashMap(1);
-        fontNameMap = new HashMap(1);
+        xlfdMap = new HashMap<>(1);
+        fontNameMap = new HashMap<>(1);
     }
 
     private String getObliqueLucidaFontID(String fontID) {
@@ -579,10 +579,10 @@
         String fileName = null;
         String fontID = specificFontIDForName(name);
         if (fontID != null) {
-            fileName = (String)fontNameMap.get(fontID);
+            fileName = fontNameMap.get(fontID);
             if (fileName == null) {
                 fontID = switchFontIDForName(name);
-                fileName = (String)fontNameMap.get(fontID);
+                fileName = fontNameMap.get(fontID);
             }
             if (fileName == null) {
                 fileName = getDefaultFontFile();
@@ -685,7 +685,7 @@
         getPlatformFontPathFromFontConfig();
         if (xFontDirsMap != null) {
             String fontID = specificFontIDForName(platformName);
-            String dirName = (String)xFontDirsMap.get(fontID);
+            String dirName = xFontDirsMap.get(fontID);
             if (dirName != null) {
                 fontConfigDirs.add(dirName);
             }
--- a/src/solaris/classes/sun/awt/X11GraphicsDevice.java	Thu May 22 20:24:42 2014 +0000
+++ b/src/solaris/classes/sun/awt/X11GraphicsDevice.java	Fri May 23 23:55:14 2014 +0000
@@ -42,7 +42,7 @@
 import sun.java2d.xr.XRGraphicsConfig;
 import sun.java2d.loops.SurfaceType;
 
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 /**
  * This is an implementation of a GraphicsDevice object for a single
@@ -56,7 +56,7 @@
     implements DisplayChangedListener
 {
     int screen;
-    HashMap x11ProxyKeyMap = new HashMap();
+    HashMap<SurfaceType, Object> x11ProxyKeyMap = new HashMap<>();
 
     private static AWTPermission fullScreenExclusivePermission;
     private static Boolean xrandrExtSupported;
@@ -127,7 +127,7 @@
 
     GraphicsConfiguration[] configs;
     GraphicsConfiguration defaultConfig;
-    HashSet doubleBufferVisuals;
+    HashSet<Integer> doubleBufferVisuals;
 
     /**
      * Returns all of the graphics
@@ -159,7 +159,7 @@
 
             boolean dbeSupported = isDBESupported();
             if (dbeSupported && doubleBufferVisuals == null) {
-                doubleBufferVisuals = new HashSet();
+                doubleBufferVisuals = new HashSet<>();
                 getDoubleBufferVisuals(screen);
             }
             for ( ; i < num; i++) {
@@ -249,7 +249,7 @@
                 int depth = getConfigDepth(0, screen);
                 boolean doubleBuffer = false;
                 if (isDBESupported() && doubleBufferVisuals == null) {
-                    doubleBufferVisuals = new HashSet();
+                    doubleBufferVisuals = new HashSet<>();
                     getDoubleBufferVisuals(screen);
                     doubleBuffer =
                         doubleBufferVisuals.contains(Integer.valueOf(visNum));
--- a/src/solaris/classes/sun/