Merge
diff --git a/make/CompileJavaClasses.gmk b/make/CompileJavaClasses.gmk
index d8809a9..3221f4a 100644
--- a/make/CompileJavaClasses.gmk
+++ b/make/CompileJavaClasses.gmk
@@ -307,12 +307,6 @@
       $(JDK_TOPDIR)/src/solaris/classes/sun/nio/ch/sctp/SctpServerChannelImpl.java
 endif
 
-# The exception handling of swing beaninfo
-# These resources violates the convention of having code and resources together under
-# $(JDK_TOPDIR)/src/.../classes directories
-$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
-	$(call install-file)
-
 # The JDK_USER_DEFINED_FILTER is a poor man's incremental build: by specifying
 # JDK_FILTER at the make command line, only a subset of the JDK java files will
 # be recompiled. If multiple paths are separated by comma, convert that into a
@@ -341,6 +335,7 @@
     BIN:=$(JDK_OUTPUTDIR)/classes,\
     COPY:=$(COPY_PATTERNS),\
     COPY_FILES:=$(COPY_FILES),\
+    CLEAN_FILES:=$(CLEAN_FILES),\
     HEADERS:=$(JDK_OUTPUTDIR)/gensrc_headers,\
     ADD_JAVAC_FLAGS:=$(BUILD_JDK_SOURCEPATH)))
 
@@ -378,7 +373,8 @@
           SETUP := GENERATE_JDKBYTECODE, \
           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/32bit, \
-          BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit))
+          BIN := $(JDK_OUTPUTDIR)/classes_ab/32bit, \
+          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 
       $(BUILD_ACCESSBRIDGE_32): $(BUILD_JDK)
 
@@ -386,7 +382,8 @@
           SETUP := GENERATE_JDKBYTECODE, \
           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/legacy, \
-          BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy))
+          BIN := $(JDK_OUTPUTDIR)/classes_ab/legacy, \
+          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 
       $(BUILD_ACCESSBRIDGE_LEGACY): $(BUILD_JDK)
 
@@ -396,7 +393,8 @@
           SETUP := GENERATE_JDKBYTECODE, \
           JAVAC_FLAGS := -cp $(JDK_OUTPUTDIR)/classes, \
           SRC := $(JDK_OUTPUTDIR)/gensrc_ab/64bit, \
-          BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit))
+          BIN := $(JDK_OUTPUTDIR)/classes_ab/64bit, \
+          HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers))
 
       $(BUILD_ACCESSBRIDGE_64): $(BUILD_JDK)
 
diff --git a/make/CompileLaunchers.gmk b/make/CompileLaunchers.gmk
index 8179eb8..4eb1af7 100644
--- a/make/CompileLaunchers.gmk
+++ b/make/CompileLaunchers.gmk
@@ -32,7 +32,7 @@
 # Setup the java compilers for the JDK build.
 include Setup.gmk
 
-# Prepare the find cache. Only used on windows.
+# Prepare the find cache.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/bin))
 
 # Build tools
diff --git a/make/CompileNativeLibraries.gmk b/make/CompileNativeLibraries.gmk
index 57ef12e..c8926da 100644
--- a/make/CompileNativeLibraries.gmk
+++ b/make/CompileNativeLibraries.gmk
@@ -35,7 +35,7 @@
 # Copy files (can now depend on $(COPY_FILES))
 include CopyFiles.gmk
 
-# Prepare the find cache. Only used if running on windows.
+# Prepare the find cache.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/src))
 
 # Build tools
diff --git a/make/CopyIntoClasses.gmk b/make/CopyIntoClasses.gmk
index d46363c..6c622e1 100644
--- a/make/CopyIntoClasses.gmk
+++ b/make/CopyIntoClasses.gmk
@@ -25,121 +25,53 @@
 
 # Copy icu and _dict files used by the text break iterator
 
-COPY_PATTERNS = .icu _dict
+COPY_PATTERNS := .icu _dict .dat _options .js aliasmap .spp .wav .css \
+    .png .gif .xml .dtd .txt oqlhelp.html
 
-# Copy config files for com.sun.org.apache.xml.internal.security
+# These directories should not be copied at all
+EXCLUDES += \
+    com/sun/org/apache/xml/internal/security/resource/schema \
+    java/awt/doc-files \
+    java/lang/doc-files \
+    javax/swing/doc-files \
+    javax/swing/text/doc-files \
+    javax/swing/plaf/synth/doc-files \
+    javax/swing/undo/doc-files \
+    sun/awt/X11/doc-files \
+    sun/util/cldr/resources \
+    #
 
-XMLSECURITY_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource
-COPY_FILES += \
-    $(XMLSECURITY_RESOURCEDIR)/config.dtd \
-    $(XMLSECURITY_RESOURCEDIR)/config.xml
+# These files should never be included
+EXFILES += build.xml README.txt version.txt
 
-# Copy sun/tools related files into the classes directory.
-
-# Extra jstat files
-JSTAT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/sun/tools/jstat/resources
-COPY_FILES += \
-    $(JSTAT_RESOURCEDIR)/jstat_options \
-    $(JSTAT_RESOURCEDIR)/jstat_unsupported_options
-
-# Extra jhat files
-JHAT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/hat/resources
-COPY_FILES += \
-    $(JHAT_RESOURCEDIR)/hat.js \
-    $(JHAT_RESOURCEDIR)/oqlhelp.html \
-    $(JHAT_RESOURCEDIR)/platform_names.txt
-
-# Extra jrunscript files
-JRUNSCRIPT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell
-COPY_FILES += \
-    $(JRUNSCRIPT_RESOURCEDIR)/init.js \
-    $(JRUNSCRIPT_RESOURCEDIR)/messages.properties
-
-# Extra jvmstat files
-COPY_FILES += \
-    $(JDK_TOPDIR)/src/share/classes/sun/jvmstat/perfdata/resources/aliasmap
-
-# JConsole resources
-JCONSOLE_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources
-COPY_FILES += \
-    $(wildcard $(JCONSOLE_RESOURCES_DIR)/*.png) \
-    $(wildcard $(JCONSOLE_RESOURCES_DIR)/*.gif)
-
-# Print resources
-PRINT_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/sun/print/resources
-COPY_FILES += \
-    $(wildcard $(PRINT_RESOURCES_DIR)/*.png)
-
-# IDN resources
-COPY_FILES += \
-    $(JDK_TOPDIR)/src/share/classes/sun/net/idn/uidna.spp
-
-#
-# Swing plaf resources
-#
-SWING_PLAF_WINDOWS_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows
-COPY_FILES += \
-    $(wildcard $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/*.gif) \
-    $(wildcard $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/*.png)
+# These icons are handled in GensrcIcons.gmk
+EXFILES += \
+    sun/awt/X11/java-icon16.png \
+    sun/awt/X11/java-icon24.png \
+    sun/awt/X11/java-icon32.png \
+    sun/awt/X11/java-icon48.png \
+    $(wildcard $(JDK_TOPDIR)/src/share/classes/sun/awt/resources/*.png) \
+    #
 
 ifndef OPENJDK
-  SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/com/sun/java/swing/plaf/windows
-  # Filter out JavaCup32.png from OpenJDK
-  COPY_FILES := $(filter-out $(SWING_PLAF_WINDOWS_RESOURCES_DIR)/icons/JavaCup32.png, $(COPY_FILES))
-  # Alter JavaCup32.png from ClosedJDK
-  COPY_FILES += \
-      $(SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED)/icons/JavaCup32.png
+  # Theses icons have closed replacements
+  SWING_PLAF_MOTIF_RESOURCES_DIR := $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif
+  EXFILES += \
+      $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/icons/JavaCup32.png \
+      $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic/icons/JavaCup16.png \
+      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.gif) \
+      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.png) \
+      #
+
+  EXFILES += mib_core.txt
 endif
 
 ifeq ($(ENABLE_JFR), true)
-  JFR_CONFIGURATION_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
+  JFR_CONFIGURATION_DIR_CLOSED := $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
   COPY_FILES += \
       $(JFR_CONFIGURATION_DIR_CLOSED)/jfc.xsd
 endif
 
-SWING_PLAF_BASIC_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/basic
-COPY_FILES += \
-    $(wildcard $(SWING_PLAF_BASIC_RESOURCES_DIR)/icons/*.png)
-
-ifndef OPENJDK
-  SWING_PLAF_BASIC_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/javax/swing/plaf/basic
-  # Filter out JavaCup16.png from OpenJDK
-  COPY_FILES := $(filter-out $(SWING_PLAF_BASIC_RESOURCES_DIR)/icons/JavaCup16.png, $(COPY_FILES))
-  # Alter JavaCup16.png from ClosedJDK
-  COPY_FILES += \
-      $(SWING_PLAF_BASIC_RESOURCES_DIR_CLOSED)/icons/JavaCup16.png
-endif
-
-ifdef OPENJDK
-  SWING_PLAF_MOTIF_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif
-  COPY_FILES += \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.gif) \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR)/icons/*.png)
-else
-  SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/com/sun/java/swing/plaf/motif
-  COPY_FILES += \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED)/icons/*.gif) \
-      $(wildcard $(SWING_PLAF_MOTIF_RESOURCES_DIR_CLOSED)/icons/*.png)
-endif
-
-SWING_PLAF_METAL_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/plaf/metal
-COPY_FILES += \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/*.gif) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/*.png) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/ocean/*.gif) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/icons/ocean/*.png) \
-    $(wildcard $(SWING_PLAF_METAL_RESOURCES_DIR)/sounds/*.wav)
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  # Only copy GTK resources on Solaris/Linux
-  SWING_PLAF_GTK_RESOURCES_DIR = $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk
-  COPY_FILES += \
-      $(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/icons/*.gif) \
-      $(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/icons/*.png) \
-      $(wildcard $(SWING_PLAF_GTK_RESOURCES_DIR)/resources/metacity/SwingFallbackTheme/metacity-1/*.xml)
-endif
-# END: Swing plaf resources
-
 SWING_BEANINFO_RESOURCES_SRC_DIR = $(JDK_TOPDIR)/make/data/swingbeaninfo/images
 SWING_BEANINFO_RESOURCES_SRC = $(wildcard $(SWING_BEANINFO_RESOURCES_SRC_DIR)/*.gif)
 OUT_BEANINFO_RESOURCES = $(patsubst $(SWING_BEANINFO_RESOURCES_SRC_DIR)%, \
@@ -147,13 +79,13 @@
     $(SWING_BEANINFO_RESOURCES_SRC))
 
 COPY_EXTRA += $(OUT_BEANINFO_RESOURCES)
-# END: Swing beaninfo resources
 
-# Swing text resources
-SWING_TEXT_RESOURCEDIR = $(JDK_TOPDIR)/src/share/classes/javax/swing/text
-COPY_FILES += \
-    $(SWING_TEXT_RESOURCEDIR)/html/default.css \
-    $(wildcard $(SWING_TEXT_RESOURCEDIR)/rtf/charsets/*.txt)
+# The exception handling of swing beaninfo
+# These resources violates the convention of having code and resources together under
+# $(JDK_TOPDIR)/src/.../classes directories
+$(JDK_OUTPUTDIR)/classes/javax/swing/beaninfo/images/%.gif: \
+    $(JDK_TOPDIR)/make/data/swingbeaninfo/images/%.gif
+	$(call install-file)
 
 ##########################################################################################
 #
@@ -222,14 +154,7 @@
 COPY_EXTRA += $(OUT_SERVICES_FILES)
 COPY_EXTRA += $(OUT_SERVICES_FILES_PRINT)
 
-###
-
-$(JDK_OUTPUTDIR)/classes/sun/nio/cs/ext/sjis0213.dat: $(JDK_OUTPUTDIR)/gensrc/sun/nio/cs/ext/sjis0213.dat
-	$(call install-file)
-
-COPY_EXTRA += $(JDK_OUTPUTDIR)/classes/sun/nio/cs/ext/sjis0213.dat
-
-###
+################################################################################
 
 JAVAX_SOUND_SRC := $(JDK_TOPDIR)/src/share/classes/com/sun/media/sound/services
 
@@ -248,3 +173,30 @@
 JAVAX_SOUND_RULES := $(foreach F, $(JAVAX_SOUND_SRC_FILES), $(JDK_OUTPUTDIR)/classes/META-INF/services/$(notdir $F):$(JAVAX_SOUND_SRC)/$F)
 
 $(foreach R, $(JAVAX_SOUND_RULES), $(eval $(call addto_meta-inf_services, $R)))
+
+################################################################################
+
+CLEAN_FILES := $(wildcard \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/imageio/plugins/common/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/ldap/jndiprovider.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/rowset/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/com/sun/tools/script/shell/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/javax/sql/rowset/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources/*.properties \
+    $(JDK_TOPDIR)/src/share/classes/sun/tools/serialver/resources/*.properties \
+    )
+
+# Copy zh_HK files from zh_TW
+
+$(JDK_OUTPUTDIR)/classes/%_zh_HK.properties: $(JDK_OUTPUTDIR)/classes/%_zh_TW.properties
+	$(install-file)
+
+COPY_EXTRA += $(patsubst $(JDK_TOPDIR)/src/share/classes/%, $(JDK_OUTPUTDIR)/classes/%, \
+    $(subst _zh_TW,_zh_HK, $(filter %_zh_TW.properties, $(CLEAN_FILES))))
diff --git a/make/CreateJars.gmk b/make/CreateJars.gmk
index cda4777..91145fd 100644
--- a/make/CreateJars.gmk
+++ b/make/CreateJars.gmk
@@ -30,9 +30,6 @@
 
 default: all
 
-# Prepare the find cache. Only used if running on windows.
-$(eval $(call FillCacheFind, $(JDK_OUTPUTDIR)/classes))
-
 include Tools.gmk
 
 include Profiles.gmk
diff --git a/make/Images.gmk b/make/Images.gmk
index f5ca8a1..9789867 100644
--- a/make/Images.gmk
+++ b/make/Images.gmk
@@ -30,7 +30,7 @@
 
 default: images
 
-# Prepare the find cache. Only used if running on windows.
+# Prepare the find cache.
 $(eval $(call FillCacheFind, \
     $(wildcard $(JDK_OUTPUTDIR)/bin \
         $(JDK_OUTPUTDIR)/lib \
diff --git a/make/Import.gmk b/make/Import.gmk
index 46c64d4..92d4d1d 100644
--- a/make/Import.gmk
+++ b/make/Import.gmk
@@ -252,7 +252,7 @@
 	$(ECHO) Unzipping $(<F)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) $< > $@.tmp)
+	($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
 	$(MV) $@.tmp $@
 endef
 
diff --git a/make/Setup.gmk b/make/Setup.gmk
index fd42e76..4fb3ad2 100644
--- a/make/Setup.gmk
+++ b/make/Setup.gmk
@@ -38,7 +38,7 @@
 # boot jdk to generate tools that need to be run with the boot jdk.
 # Thus we force the target bytecode to the previous JDK version.
 $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
@@ -60,7 +60,7 @@
 # I.e. the rt.jar, but since rt.jar has not yet been generated
 # (it will be in "make images") therefore we use classes instead.
 $(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
-    JVM := $(JAVA), \
+    JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := -bootclasspath $(JDK_OUTPUTDIR)/classes $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
diff --git a/make/Tools.gmk b/make/Tools.gmk
index 52a843b..0856b64 100644
--- a/make/Tools.gmk
+++ b/make/Tools.gmk
@@ -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
@@ -23,7 +23,7 @@
 # questions.
 #
 
-# Cache all finds needed for this file. Only used on windows.
+# Cache all finds needed for this file.
 $(eval $(call FillCacheFind, $(JDK_TOPDIR)/make/src/classes))
 
 # The exception handling of swing beaninfo which have the own tool directory
@@ -48,79 +48,76 @@
 BUILD_TOOLS += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
 
 # Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
-TOOL_ADDJSUM = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.addjsum.AddJsum
 
 # The buildmetaindex tool creates a meta-index to make core class loaders lazier.
-TOOL_BUILDMETAINDEX = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.buildmetaindex.BuildMetaIndex
 
-TOOL_COMPILEFONTCONFIG = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.compilefontconfig.CompileFontConfig
 
-TOOL_COMPILEPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.compileproperties.CompileProperties
 
-TOOL_STRIPPROPERTIES = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
-    build.tools.stripproperties.StripProperties
-
-TOOL_JARREORDER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_JARREORDER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.jarreorder.JarReorder
 
-TOOL_GENERATECHARACTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecharacter.GenerateCharacter
 
-TOOL_CHARACTERNAME = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecharacter.CharacterName
 
-TOOL_DTDBUILDER = $(JAVA) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
+TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
     -cp $(JDK_OUTPUTDIR)/btclasses build.tools.dtdbuilder.DTDBuilder
 
-TOOL_GENERATEBREAKITERATORDATA = $(JAVA) \
+TOOL_GENERATEBREAKITERATORDATA = $(JAVA_SMALL) \
     -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatebreakiteratordata.GenerateBreakIteratorData
 
-TOOL_GENERATECURRENCYDATA = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatecurrencydata.GenerateCurrencyData
 
-TOOL_HASHER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_HASHER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.hasher.Hasher
 
-TOOL_TZDB = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_TZDB = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.tzdb.TzdbZoneRulesCompiler
 
 
 # TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
 # and nbproject/project.properties in the same dir. Needs to be looked at.
-TOOL_JDWPGEN = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
+TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
 
 # TODO: Lots of files in jdk/make/tools/CharsetMapping dir
-TOOL_CHARSETMAPPING = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.charsetmapping.Main $(LOG_INFO)
 
-TOOL_SPP = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
+TOOL_SPP = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
 
 # Nimbus is used somewhere in the swing build.
-TOOL_GENERATENIMBUS = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.generatenimbus.Generator
 
-TOOL_WRAPPERGENERATOR = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.x11wrappergen.WrapperGenerator
 
-TOOL_AWT_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.icondata.awt.ToBin
 
-TOOL_OSX_TOBIN = $(JAVA) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.icondata.osxapp.ToBin
 
-TOOL_CLDRCONVERTER = $(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.cldrconverter.CLDRConverter
 
-TOOL_CHECKDEPS = $(JAVA) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
+TOOL_CHECKDEPS = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
     -cp $(JDK_OUTPUTDIR)/btclasses:$(JDK_OUTPUTDIR) \
     build.tools.deps.CheckDeps
 
-TOOL_ADDTORESTRICTEDPKGS=$(JAVA) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_ADDTORESTRICTEDPKGS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
     build.tools.addtorestrictedpkgs.AddToRestrictedPkgs
 
 ##########################################################################################
diff --git a/make/data/tzdata/VERSION b/make/data/tzdata/VERSION
index 2f162e0..8ab96a7 100644
--- a/make/data/tzdata/VERSION
+++ b/make/data/tzdata/VERSION
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2013i
+tzdata2014a
diff --git a/make/data/tzdata/asia b/make/data/tzdata/asia
index 1a8f83d..dc3c94b 100644
--- a/make/data/tzdata/asia
+++ b/make/data/tzdata/asia
@@ -1113,8 +1113,13 @@
 Rule	Zion	1986	only	-	Sep	 7	0:00	0	S
 Rule	Zion	1987	only	-	Apr	15	0:00	1:00	D
 Rule	Zion	1987	only	-	Sep	13	0:00	0	S
-Rule	Zion	1988	only	-	Apr	 9	0:00	1:00	D
-Rule	Zion	1988	only	-	Sep	 3	0:00	0	S
+
+# From Avigdor Finkelstein (2014-03-05):
+# I check the Parliament (Knesset) records and there it's stated that the
+# [1988] transition should take place on Saturday night, when the Sabbath
+# ends and changes to Sunday.
+Rule	Zion	1988	only	-	Apr	10	0:00	1:00	D
+Rule	Zion	1988	only	-	Sep	 4	0:00	0	S
 
 # From Ephraim Silverberg
 # (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
diff --git a/make/data/tzdata/australasia b/make/data/tzdata/australasia
index cd6b724..a0e8b5a 100644
--- a/make/data/tzdata/australasia
+++ b/make/data/tzdata/australasia
@@ -377,16 +377,18 @@
 # http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
 
 # From the Fijian Government Media Center (2013-08-30) via David Wheeler:
-# Fiji will start daylight savings on Sunday 27th October, 2013 and end at 3am
-# on Sunday 19th January, 2014....  move clocks forward by one hour from 2am
+# Fiji will start daylight savings on Sunday 27th October, 2013 ...
+# move clocks forward by one hour from 2am
 # http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
-#
-# From Paul Eggert (2013-09-09):
+
+# From Steffen Thorsen (2013-01-10):
+# Fiji will end DST on 2014-01-19 02:00:
+# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
+
+# From Paul Eggert (2014-01-10):
 # For now, guess that Fiji springs forward the Sunday before the fourth
-# Monday in October.  This matches both recent practice and
-# timeanddate.com's current spring-forward prediction.
-# For the January 2014 transition we guessed right while timeanddate.com
-# guessed wrong, so leave the fall-back prediction alone.
+# Monday in October, and springs back the penultimate Sunday in January.
+# This is ad hoc, but matches recent practice.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
@@ -395,7 +397,8 @@
 Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	max	-	Oct	Sun>=21	2:00	1:00	S
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
-Rule	Fiji	2012	max	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2014	max	-	Jan	Sun>=18	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time
diff --git a/make/data/tzdata/europe b/make/data/tzdata/europe
index 9f574a3..585e64d 100644
--- a/make/data/tzdata/europe
+++ b/make/data/tzdata/europe
@@ -2768,14 +2768,18 @@
 # According to the articles linked below, Turkey will change into summer
 # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
 # This change is due to a nationwide exam on 27th.
-#
-# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
 # http://www.worldbulletin.net/?aType=haber&ArticleID=70872
-# </a>
 # Turkish:
-# <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
 # http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
-# </a>
+
+# From Faruk Pasin (2014-02-14):
+# The DST for Turkey has been changed for this year because of the
+# Turkish Local election....
+# http://www.sabah.com.tr/Ekonomi/2014/02/12/yaz-saatinde-onemli-degisiklik
+# ... so Turkey will move clocks forward one hour on March 31 at 3:00 a.m.
+# From Paul Eggert (2014-02-17):
+# Here is an English-language source:
+# http://www.worldbulletin.net/turkey/129016/turkey-switches-to-daylight-saving-time-march-31
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
@@ -2844,6 +2848,8 @@
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27 1:00u
 			2:00	-	EET	2011 Mar 28 1:00u
+			2:00	EU	EE%sT	2014 Mar 30 1:00u
+			2:00	-	EET	2014 Mar 31 1:00u
 			2:00	EU	EE%sT
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
@@ -2865,19 +2871,13 @@
 # approval from 266 deputies.
 #
 # Ukraine abolishes transter back to the winter time (in Russian)
-# <a href="http://news.mail.ru/politics/6861560/">
 # http://news.mail.ru/politics/6861560/
-# </a>
 #
 # The Ukrainians will no longer change the clock (in Russian)
-# <a href="http://www.segodnya.ua/news/14290482.html">
 # http://www.segodnya.ua/news/14290482.html
-# </a>
 #
 # Deputies cancelled the winter time (in Russian)
-# <a href="http://www.pravda.com.ua/rus/news/2011/09/20/6600616/">
 # http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
-# </a>
 #
 # From Philip Pizzey (2011-10-18):
 # Today my Ukrainian colleagues have informed me that the
@@ -2888,18 +2888,39 @@
 # As far as I understand, the recent change to the Ukrainian time zone
 # (Europe/Kiev) to introduce permanent daylight saving time (similar
 # to Russia) was reverted today:
-#
-# <a href="http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995">
 # http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995
-# </a>
 #
 # Also reported by Alexander Bokovoy (2011-10-18) who also noted:
 # The law documents themselves are at
-#
-# <a href="http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484">
 # http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
-# </a>
 
+# From Vladimir in Moscow via Alois Treindl re Kiev time 1991/2 (2014-02-28):
+# First in Ukraine they changed Time zone from UTC+3 to UTC+2 with DST:
+#       03 25 1990 02:00 -03.00 1       Time Zone 3 with DST
+#       07 01 1990 02:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 18.06.1990, No. 134.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/T001500.html
+#
+# They did not end DST in September, 1990 (according to the law,
+# "summer time" was still in action):
+#       09 30 1990 03:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 21.09.1990, No. 272.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/KP900272.html
+#
+# Again no change in March, 1991 ("summer time" in action):
+#       03 31 1991 02:00 -02.00 1       Time Zone 2 with DST
+#
+# DST ended in September 1991 ("summer time" ended):
+#       09 29 1991 03:00 -02.00 0       Time Zone 2, no DST
+# * Ukrainian Government's Resolution of 25.09.1991, No. 225.
+# http://www.uazakon.com/documents/date_21/pg_iwgdoc.htm
+# This is an answer.
+#
+# Since 1992 they had normal DST procedure:
+#       03 29 1992 02:00 -02.00 1       DST started
+#       09 27 1992 03:00 -02.00 0       DST ended
+# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
+# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Most of Ukraine since 1970 has been like Kiev.
@@ -2910,9 +2931,8 @@
 			2:00	-	EET	1930 Jun 21
 			3:00	-	MSK	1941 Sep 20
 			1:00	C-Eur	CE%sT	1943 Nov  6
-			3:00	Russia	MSK/MSD	1990
-			3:00	-	MSK	1990 Jul  1 2:00
-			2:00	-	EET	1992
+			3:00	Russia	MSK/MSD	1990 Jul  1 2:00
+			2:00	1:00	EEST	1991 Sep 29 3:00
 			2:00	E-Eur	EE%sT	1995
 			2:00	EU	EE%sT
 # Ruthenia used CET 1990/1991.
diff --git a/make/data/tzdata/northamerica b/make/data/tzdata/northamerica
index 9e551bb..dc0c2e9 100644
--- a/make/data/tzdata/northamerica
+++ b/make/data/tzdata/northamerica
@@ -414,9 +414,10 @@
 # US Pacific time, represented by Los Angeles
 #
 # California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
-# Idaho, Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties,
-# and the northern three-quarters of Idaho county),
-# most of Nevada, most of Oregon, and Washington
+# Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties, Idaho county
+# north of the Salmon River, and the towns of Burgdorf and Warren),
+# Nevada (except West Wendover), Oregon (except the northern 3/4 of
+# Malheur county), and Washington
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
diff --git a/make/data/tzdata/southamerica b/make/data/tzdata/southamerica
index 071f890..02bf3bb 100644
--- a/make/data/tzdata/southamerica
+++ b/make/data/tzdata/southamerica
@@ -1298,6 +1298,13 @@
 # start date is 2013-09-08 00:00....
 # http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
 
+# From Jose Miguel Garrido (2014-02-19):
+# Today appeared in the Diario Oficial a decree amending the time change
+# dates to 2014.
+# DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC)
+# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
+# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
+
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
 
@@ -1631,6 +1638,9 @@
 # From Carlos Raul Perasso (2013-03-15):
 # The change in Paraguay is now final.  Decree number 10780
 # http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
+# From Carlos Raul Perasso (2014-02-28):
+# Decree 1264 can be found at:
+# http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf
 Rule	Para	2013	max	-	Mar	Sun>=22	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1689,18 +1699,19 @@
 Zone America/Port_of_Spain -4:06:04 -	LMT	1912 Mar 2
 			-4:00	-	AST
 
+# These all agree with Trinidad and Tobago since 1970.
 Link America/Port_of_Spain America/Anguilla
 Link America/Port_of_Spain America/Dominica
 Link America/Port_of_Spain America/Grenada
 Link America/Port_of_Spain America/Guadeloupe
-Link America/Port_of_Spain America/Marigot
+Link America/Port_of_Spain America/Marigot	# St Martin (French part)
 Link America/Port_of_Spain America/Montserrat
 Link America/Port_of_Spain America/St_Barthelemy
-Link America/Port_of_Spain America/St_Kitts
+Link America/Port_of_Spain America/St_Kitts	# St Kitts & Nevis
 Link America/Port_of_Spain America/St_Lucia
-Link America/Port_of_Spain America/St_Thomas
+Link America/Port_of_Spain America/St_Thomas	# Virgin Islands (US)
 Link America/Port_of_Spain America/St_Vincent
-Link America/Port_of_Spain America/Tortola
+Link America/Port_of_Spain America/Tortola	# Virgin Islands (UK)
 
 # Uruguay
 # From Paul Eggert (1993-11-18):
diff --git a/make/gensrc/GensrcProperties.gmk b/make/gensrc/GensrcProperties.gmk
index 1ccffa1..a4a5bb5 100644
--- a/make/gensrc/GensrcProperties.gmk
+++ b/make/gensrc/GensrcProperties.gmk
@@ -23,8 +23,10 @@
 # questions.
 #
 
-# Prepare the find cache. This is only used on windows.
-$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/windows/classes))
+# Prepare the find cache.
+$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/share/classes \
+    $(JDK_TOPDIR)/src/windows/classes \
+    $(JDK_TOPDIR)/src/macosx/classes))
 
 # All .properties files to be compiled are appended to this variable.
 ALL_COMPILED_PROPSOURCES :=
@@ -33,19 +35,10 @@
 # The (very long) command line for compilation, stored in a file, prior to use.
 COMPILE_PROPCMDLINE :=
 
-# All .properties files to be cleaned are appended to this variable.
-ALL_CLEANED_PROPSOURCES :=
-# All generated cleaned .properties files from cleaning are appended to this variable.
-ALL_CLEANED_PROPOUTPUT :=
-# The (very long) command line for cleaning, stored in a file, prior to use.
-CLEAN_PROPCMDLINE :=
-
 define add_properties_to_compile
   # $1 is the name of the properties group
   # $2 is the files belonging to this group
   # $3 is the super class for the generated java file.
-  # $4 is a from pattern for translating stripped name from source to target
-  # $5 is the to pattern replacing $3 in the target
 
   # Strip away prefix and suffix,
   # leaving for example: sun/util/resources/CurrencyNames_sv
@@ -53,16 +46,14 @@
       $$(patsubst $(JDK_TOPDIR)/src/macosx/classes/%.properties, %, \
       $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties, %, $2)))
 
-  # Apply optional name transformation, example: hz_TW -> hz_HK
-  $(if $4, $1_PROPPATHS := $$(patsubst $4, $5, $$($1_PROPPATHS)))
-
   # Accumulate all found properties files.
   ALL_COMPILED_PROPSOURCES += $2
 
   # Generate the list of to be created java files.
   ALL_COMPILED_PROPJAVAS += $$(patsubst %, $(JDK_OUTPUTDIR)/gensrc/%.java, $$($1_PROPPATHS))
 
-  # Now generate a sequence of "-compile ...CurrencyNames_sv.properties ...CurrencyNames_sv.java ListResourceBundle"
+  # Now generate a sequence of 
+  # "-compile ...CurrencyNames_sv.properties ...CurrencyNames_sv.java ListResourceBundle"
   # suitable to be fed into the CompileProperties command.
   COMPILE_PROPCMDLINE += $$(subst _SPACE_,$(SPACE),$$(join $$(addprefix -compile_SPACE_, $2), \
       $$(addsuffix _SPACE_$(strip $3), \
@@ -70,290 +61,55 @@
       $$(addsuffix .java, $$($1_PROPPATHS))))))
 endef
 
-define add_properties_to_clean
-  # $1 is the name of the properties group
-  # $2 is the files belonging to this group
-  # $3 is a from pattern for translating stripped name from source to target
-  # $4 is the to pattern replacing $3 in the target
-  # $5 optional name of extra directory to put properties files in (ex: resources)
-
-  # Strip away prefix and suffix,
-  # leaving for example: sun/util/resources/CurrencyNames_sv
-  $1_PROPPATHS := $$(patsubst $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/classes/%.properties, %, \
-      $$(patsubst $(JDK_TOPDIR)/src/share/classes/%.properties, %, $2))
-
-  # Apply optional name transformation, example: hz_TW -> hz_HK
-  $(if $3, $1_PROPPATHS := $$(patsubst $3, $4, $$($1_PROPPATHS)))
-
-  # Accumulate all found properties files.
-  ALL_CLEANED_PROPSOURCES += $2
-
-  # Generate the list of to be created java files.
-  $1_PROPOUTPUT := $$(patsubst %, $(JDK_OUTPUTDIR)/classes/%.properties, $$($1_PROPPATHS))
-  # If the properties target file isn't in a "resources" dir, add one.
-  ifneq ($5, )
-    $1_PROPOUTPUT := $$(foreach p, $$($1_PROPOUTPUT), $$(dir $$p)$5/$$(notdir $$p))
-  endif
-
-  ALL_CLEANED_PROPOUTPUT += $$($1_PROPOUTPUT)
-
-  # Now generate a sequence of "-clean ...[src]...CurrencyNames_sv.properties ...[build]...CurrencyNames_sv.properties"
-  # suitable to be fed into the StripProperties command.
-  CLEAN_PROPCMDLINE += $$(subst _SPACE_,$(SPACE),$$(join $$(addprefix -clean_SPACE_,$2), \
-      $$(addprefix _SPACE_, $$($1_PROPOUTPUT))))
-endef
-
-# Some packages contain pregenerated java files instead of properties files.
-# But unfortunately not all properties should be converted, some should be
-# copied....argggghhh.
-
-# For example:
-#    sun/applet/resources
-#    sun/misc/resources
-#    sun/text/resources
-#    sun/tools/jconsole/resources
-#    sun/tools/native2ascii/resources
-#    sun/util/resources
-
+################################################################################
 # Some packages have properties that need to be converted to java source files.
+COMPILE_PROP_SRC_FILES := \
+    $(filter %.properties, $(call CacheFind, \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources \
+        $(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/awt/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/management/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/print/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources \
+        $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)) \
+    #
 
-#com/apple/laf/resources
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  $(eval $(call add_properties_to_compile,COM_APPLE_LAF, \
-      $(filter %.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources)), \
-      ListResourceBundle))
+  COMPILE_PROP_SRC_FILES += \
+      $(filter %.properties, $(call CacheFind, \
+          $(JDK_TOPDIR)/src/macosx/classes/com/apple/laf/resources \
+          $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)) \
+      #
 endif
 
-#com/sun/accessibility/internal/resources
-$(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_ACCESSIBILITY_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/accessibility/internal/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/imageio/plugins/common
-$(eval $(call add_properties_to_clean,COM_SUN_IMAGEIO, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/imageio))))
-#com/sun/java/swing/plaf/gtk/resources
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  # Only compile GTK resource bundles on Solaris/Linux
-  $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK, \
-      $(filter %.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)), \
-      ListResourceBundle))
-  $(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_GTK_HK, \
-      $(filter %.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)), \
-      ListResourceBundle, %zh_TW, %zh_HK))
-endif
-#com/sun/java/swing/plaf/motif/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_MOTIF_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/motif/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/java/swing/plaf/windows/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_WINDOWS_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/windows/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/java/util/jar/pack
-$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
-    $(JDK_TOPDIR)/src/share/classes/com/sun/java/util/jar/pack/intrinsic.properties))
-#com/sun/jndi/cosnaming
-$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
-    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties))
-#com/sun/jndi/ldap
-$(eval $(call add_properties_to_clean,JNDI_COSNAMING, \
-    $(JDK_TOPDIR)/src/share/classes/com/sun/jndi/ldap/jndiprovider.properties))
-
-#com/sun/org/apache/xml/internal/security/resource
-#FIXME: The "xmlsecurity*.properties" pattern is not ideal; we might want to find
-#a better way to select the properties files that are needed.
-$(eval $(call add_properties_to_clean,XML_SECURITY, \
-    $(filter $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity%.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/org/apache/xml/internal/security/resource))))
-
-#com/sun/rowset
-$(eval $(call add_properties_to_clean,COM_SUN_ROWSET, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/rowset))))
-$(eval $(call add_properties_to_clean,COM_SUN_ROWSET_HK, \
-    $(filter %zh_TW.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/rowset)), \
-    %zh_TW, %zh_HK))
-
-#com/sun/swing/internal/plaf/basic/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_BASIC_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/basic/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/swing/internal/plaf/metal/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_METAL_HK, \
-    $(filter %.properties, $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/metal/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#com/sun/swing/internal/plaf/synth/resources
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,COM_SUN_SWING_PLAF_SYNTH_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/swing/internal/plaf/synth/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-
-#com/sun/tools/jdi/resources
-$(eval $(call add_properties_to_compile,COM_SUN_TOOLS_JDI, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/com/sun/tools/jdi/resources)), \
-    ListResourceBundle))
-
-#com/sun/tools/script/shell
-#java/util
-#javax/sql/rowset
-$(eval $(call add_properties_to_clean,JAVAX_SQL_ROWSET, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/javax/sql/rowset))))
-#sun/awt/resources
-$(eval $(call add_properties_to_compile,SUN_AWT, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/awt/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_AWT_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/awt/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/awt/windows/
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  $(eval $(call add_properties_to_compile,SUN_AWT, \
-      $(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)), \
-      ListResourceBundle))
-  $(eval $(call add_properties_to_compile,SUN_AWT_HK, \
-      $(filter $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows/awtLocalization%.properties, \
-      $(call CacheFind, $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)), \
-      ListResourceBundle, %zh_TW, %zh_HK))
-endif
-# os x specific awt properties
-ifeq ($(OPENJDK_TARGET_OS),macosx)
-$(eval $(call add_properties_to_compile,SUN_AWT,\
-	$(filter $(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources/%.properties,\
-	$(call CacheFind,$(JDK_TOPDIR)/src/macosx/classes/sun/awt/resources)),\
-	ListResourceBundle))
+  COMPILE_PROP_SRC_FILES += \
+      $(filter %.properties, $(call CacheFind, \
+          $(JDK_TOPDIR)/src/windows/classes/sun/awt/windows)) \
+      #
+else # ! windows
+  COMPILE_PROP_SRC_FILES += \
+      $(filter %.properties, $(call CacheFind, \
+          $(JDK_TOPDIR)/src/share/classes/com/sun/java/swing/plaf/gtk/resources)) \
+      #
 endif
 
-#sun/launcher/resources
-$(eval $(call add_properties_to_compile,SUN_LAUNCHER, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_LAUNCHER_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/launcher/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/management/resources
-$(eval $(call add_properties_to_compile,SUN_MANAGEMENT, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/management/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_MANAGEMENT_KH, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/management/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/print
-#sun/print/resources
-$(eval $(call add_properties_to_compile,SUN_PRINT, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/print/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_PRINT_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/print/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-#sun/rmi/registry/resources
-$(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources))))
-$(eval $(call add_properties_to_clean,SUN_RMI_REGISTRY_HK, \
-    $(filter %zh_TW.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/registry/resources)), \
-    %zh_TW, %zh_HK))
+$(eval $(call add_properties_to_compile,LIST_RESOURCE_BUNDLE, \
+    $(COMPILE_PROP_SRC_FILES), ListResourceBundle))
 
-#sun/rmi/rmic/resources
-$(eval $(call add_properties_to_clean,SUN_RMI_RMIC, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/rmic/resources))))
-
-#sun/rmi/server/resources
-$(eval $(call add_properties_to_clean,SUN_RMI_SERVER, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources))))
-$(eval $(call add_properties_to_clean,SUN_RMI_SERVER_HK, \
-    $(filter %zh_TW.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/rmi/server/resources)), \
-    %zh_TW, %zh_HK))
-
-# sun/tools/jar/resources
-$(eval $(call add_properties_to_compile,SUN_TOOLS_JAR, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_TOOLS_JAR_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jar/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
-
-#sun/tools/javac/resources
-# It's unclear if the other localized property files here are supposed to be copied or not
-# but the old build system didn't copy them.
-$(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER, \
-    $(filter %javac.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/javac/resources))))
-
-#sun/tools/jconsole/resources
-$(eval $(call add_properties_to_clean,SUN_TOOLS_JCONSOLE, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/jconsole/resources))))
-
-#sun/tools/serialver
-$(eval $(call add_properties_to_clean,SUN_TOOLS_SERIALVER, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/tools/serialver)), , ,resources))
-
-#sun/util/logging/resources
-$(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)), \
-    ListResourceBundle))
-$(eval $(call add_properties_to_compile,SUN_UTIL_LOGGING_HK, \
-    $(filter %.properties, \
-    $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/logging/resources)), \
-    ListResourceBundle, %zh_TW, %zh_HK))
 # sun/util/resources
 $(eval $(call add_properties_to_compile,SUN_UTIL, \
     $(filter %.properties, \
     $(call CacheFind, $(JDK_TOPDIR)/src/share/classes/sun/util/resources)), \
     sun.util.resources.LocaleNamesBundle))
 
+################################################################################
 # Now setup the rule for the generation of the resource bundles.
 $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties: $(ALL_COMPILED_PROPSOURCES) $(BUILD_TOOLS)
         # Generate all output directories in advance since the build tool does not do that...
@@ -363,33 +119,31 @@
 	$(TOOL_COMPILEPROPERTIES) -quiet @$(JDK_OUTPUTDIR)/gensrc/_the.cmdline
 	$(TOUCH) $@
 
-# Now setup the rule for the generation of the cleaned properties.
-# FIXME: We currently don't handle removed properties incrementally.
-$(JDK_OUTPUTDIR)/classes/_the.cleaned_properties: $(ALL_CLEANED_PROPSOURCES) $(BUILD_TOOLS)
-	$(RM) $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
-        # Generate all output directories in advance since the build tool does not do that...
-	$(MKDIR) -p $(sort $(dir $(ALL_CLEANED_PROPOUTPUT)))
-	$(ECHO) Copying and cleaning $(words $(ALL_CLEANED_PROPSOURCES)) properties
-	$(call ListPathsSafely,CLEAN_PROPCMDLINE,\n, >> $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline)
-	$(TOOL_STRIPPROPERTIES) @$(JDK_OUTPUTDIR)/classes/_the.cleaned_properties.cmdline
-	$(TOUCH) $@
-
 $(ALL_COMPILED_PROPJAVAS): $(JDK_OUTPUTDIR)/gensrc/_the.compiled_properties
 
-$(ALL_CLEANED_PROPOUTPUT): $(JDK_OUTPUTDIR)/classes/_the.cleaned_properties
+################################################################################
+# Some zh_HK resources are just copies of zh_TW
 
+define convert_tw_to_hk
+  $(MKDIR) -p $(@D)
+  $(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
+endef
 
-# Some zh_HK resources are just copied of zh_TW
 $(JDK_OUTPUTDIR)/gensrc/%_zh_HK.java: $(JDK_TOPDIR)/src/share/classes/%_zh_TW.java
-	$(MKDIR) -p $(@D)
-	$(CAT) $< | $(SED) -e '/class/s/_zh_TW/_zh_HK/' > $@
+	$(call convert_tw_to_hk)
+
+$(JDK_OUTPUTDIR)/gensrc/%_zh_HK.java: $(JDK_OUTPUTDIR)/gensrc/%_zh_TW.java
+	$(call convert_tw_to_hk)
 
 ZH_HK_JAVA := sun/applet/resources/MsgAppletViewer_zh_HK.java \
     sun/misc/resources/Messages_zh_HK.java \
     sun/security/util/AuthResources_zh_HK.java \
     sun/security/util/Resources_zh_HK.java
 
-ZH_HK_JAVA_FILES := $(addprefix $(JDK_OUTPUTDIR)/gensrc/, $(ZH_HK_JAVA))
+ZH_HK_JAVA_FILES := $(addprefix $(JDK_OUTPUTDIR)/gensrc/, $(ZH_HK_JAVA)) \
+    $(filter-out $(JDK_OUTPUTDIR)/gensrc/sun/util/resources/zh/%, \
+    $(subst _zh_TW,_zh_HK,$(filter %_zh_TW.java, $(ALL_COMPILED_PROPJAVAS))))
 
+################################################################################
 
-GENSRC_PROPERTIES := $(ALL_COMPILED_PROPJAVAS) $(ALL_CLEANED_PROPOUTPUT) $(ZH_HK_JAVA_FILES)
+GENSRC_PROPERTIES := $(ALL_COMPILED_PROPJAVAS) $(ZH_HK_JAVA_FILES)
diff --git a/make/lib/Awt2dLibraries.gmk b/make/lib/Awt2dLibraries.gmk
index 140fff2..9f38473 100644
--- a/make/lib/Awt2dLibraries.gmk
+++ b/make/lib/Awt2dLibraries.gmk
@@ -1196,7 +1196,6 @@
 ifndef BUILD_HEADLESS_ONLY
   LIBSPLASHSCREEN_DIRS := \
     $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
-    $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
     $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
 
   ifeq ($(USE_EXTERNAL_LIBGIF), true)
@@ -1206,6 +1205,11 @@
     GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
   endif
 
+  ifeq ($(USE_EXTERNAL_LIBPNG), false)
+    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/libpng
+    LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
+  endif
+
   ifneq ($(OPENJDK_TARGET_OS), macosx)
     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
   else
@@ -1268,11 +1272,13 @@
       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
       LANG := C, \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
+      CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
+                $(GIFLIB_CFLAGS) $(PNG_CFLAGS), \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
+      LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
+                        $(GIFLIB_LDFLAGS) $(PNG_LIBS), \
       LDFLAGS_SUFFIX_solaris := -lc, \
       VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
       RC_FLAGS := $(RC_FLAGS) \
@@ -1315,6 +1321,7 @@
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := $(LIBM) $(LDFLAGS_JDKLIB_SUFFIX), \
+      LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB), \
       LDFLAGS_SUFFIX_posix := -lm, \
       VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
       RC_FLAGS := $(RC_FLAGS) \
diff --git a/make/lib/ServiceabilityLibraries.gmk b/make/lib/ServiceabilityLibraries.gmk
index d95fc7e..ef4234b 100644
--- a/make/lib/ServiceabilityLibraries.gmk
+++ b/make/lib/ServiceabilityLibraries.gmk
@@ -203,7 +203,6 @@
 ##########################################################################################
 
 LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/share/instrument \
-    $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
     $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
 
 LIBINSTRUMENT_FILES := \
@@ -218,9 +217,8 @@
     JavaExceptions.c \
     PathCharsValidator.c \
     Reentrancy.c \
-    Utilities.c \
-    canonicalize_md.c
-
+    Utilities.c
+    
 LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument
 LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
     -I$(JDK_TOPDIR)/src/share/instrument \
@@ -239,6 +237,8 @@
   LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
   # equivalent of strcasecmp is stricmp on Windows
   LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
+else
+  LIBINSTRUMENT_LDFLAGS_SUFFIX := -ljava
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
diff --git a/make/src/classes/build/tools/stripproperties/StripProperties.java b/make/src/classes/build/tools/stripproperties/StripProperties.java
deleted file mode 100644
index be45a99..0000000
--- a/make/src/classes/build/tools/stripproperties/StripProperties.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2001, 2013, 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 build.tools.stripproperties;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedWriter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * Reads a properties file from standard input and writes an equivalent
- * properties file without comments to standard output.
- */
-public class StripProperties {
-
-    private static void error(String msg, Exception e) {
-        System.err.println("ERROR: stripproperties: " + msg);
-        if ( e != null ) {
-            System.err.println("EXCEPTION: " + e.toString());
-            e.printStackTrace();
-        }
-    }
-
-    private static List<String> infiles = new ArrayList<String>();
-    private static List<String> outfiles = new ArrayList<String>();
-
-    private static boolean parseOptions(String args[]) {
-        boolean ok = true;
-
-        for ( int i = 0; i < args.length ; i++ ) {
-            if ( "-clean".equals(args[i]) && i+2 < args.length ) {
-                infiles.add(args[++i]);
-                outfiles.add(args[++i]);
-            } else if ( args[i].charAt(0)=='@') {
-                String filename = args[i].substring(1);
-                FileInputStream finput = null;
-                byte contents[] = null;
-                try {
-                    finput = new FileInputStream(filename);
-                    int byteCount = finput.available();
-                    if ( byteCount <= 0 ) {
-                        error("The @file is empty", null);
-                        ok = false;
-                    } else {
-                        contents = new byte[byteCount];
-                        int bytesRead = finput.read(contents);
-                        if ( byteCount != bytesRead ) {
-                            error("Cannot read all of @file", null);
-                            ok = false;
-                        }
-                    }
-                } catch ( IOException e ) {
-                    error("cannot open " + filename, e);
-                    ok = false;
-                }
-                if ( finput != null ) {
-                    try {
-                        finput.close();
-                    } catch ( IOException e ) {
-                        ok = false;
-                        error("cannot close " + filename, e);
-                    }
-                }
-                if ( ok && contents != null ) {
-                    String tokens[] = (new String(contents)).split("\\s+");
-                    if ( tokens.length > 0 ) {
-                        ok = parseOptions(tokens);
-                    }
-                }
-                if ( !ok ) {
-                    break;
-                }
-            } else {
-                infiles.add(args[i]);
-                outfiles.add(args[i]);
-            }
-        }
-        return ok;
-    }
-
-    private static boolean stripFiles(List<String> infiles, List<String> outfiles) {
-        boolean ok = true;
-        Iterator<String> inIter  = infiles.iterator();
-        Iterator<String> outIter = outfiles.iterator();
-
-        for (; inIter.hasNext(); ) {
-            String infile = inIter.next();
-            String outfile = outIter.next();
-
-            Properties prop = new Properties();
-            InputStream in = null;
-            try {
-                in = new BufferedInputStream(new FileInputStream(infile));
-                prop.load(in);
-            } catch ( FileNotFoundException e ) {
-                error("Cannot access file " + infile, e);
-                ok = false;
-            } catch ( IOException e ) {
-                error("IO exception processing file " + infile, e);
-                ok = false;
-            }
-            if ( in != null ) {
-                try {
-                    in.close();
-                } catch ( IOException e ) {
-                    error("IO exception closing file " + infile, e);
-                    ok = false;
-                }
-            }
-            if ( !ok ) {
-                break;
-            }
-
-            OutputStream out = null;
-            try {
-                out = new FileOutputStream(outfile);
-                storeProperties(prop, out);
-                out.flush();
-            } catch ( IOException e ) {
-                error("IO exception processing file " + outfile, e);
-                ok = false;
-            }
-            if ( out != null ) {
-                try {
-                    out.close();
-                } catch ( IOException e ) {
-                    error("IO exception closing file " + outfile, e);
-                    ok = false;
-                }
-            }
-            if ( !ok ) {
-                break;
-            }
-
-        }
-        return ok;
-    }
-
-    /**
-     * Strip the properties filenames supplied, replacing their contents.
-     * @param args Names of properties files to process and replace contents
-     */
-    public static void main(String args[]) {
-        boolean ok = parseOptions(args);
-        if ( !ok || !stripFiles(infiles, outfiles) ) {
-            System.exit(1);
-        }
-    }
-
-    // --- code below here is adapted from java.util.Properties ---
-
-    private static final String specialSaveChars = "=: \t\r\n\f#!";
-
-    /*
-     * Converts unicodes to encoded &#92;uxxxx
-     * and writes out any of the characters in specialSaveChars
-     * with a preceding slash
-     */
-    private static String saveConvert(String theString, boolean escapeSpace) {
-        int len = theString.length();
-        StringBuffer outBuffer = new StringBuffer(len*2);
-
-        for(int x=0; x<len; x++) {
-            char aChar = theString.charAt(x);
-            switch(aChar) {
-                case ' ':
-                    if (x == 0 || escapeSpace) {
-                        outBuffer.append('\\');
-                    }
-                    outBuffer.append(' ');
-                    break;
-                case '\\':
-                    outBuffer.append('\\');
-                    outBuffer.append('\\');
-                    break;
-                case '\t':
-                    outBuffer.append('\\');
-                    outBuffer.append('t');
-                    break;
-                case '\n':
-                    outBuffer.append('\\');
-                    outBuffer.append('n');
-                    break;
-                case '\r':
-                    outBuffer.append('\\');
-                    outBuffer.append('r');
-                    break;
-                case '\f':
-                    outBuffer.append('\\');
-                    outBuffer.append('f');
-                    break;
-                default:
-                    if ((aChar < 0x0020) || (aChar == 0x007e) || (aChar > 0x00ff)) {
-                        outBuffer.append('\\');
-                        outBuffer.append('u');
-                        outBuffer.append(toHex((aChar >> 12) & 0xF));
-                        outBuffer.append(toHex((aChar >>  8) & 0xF));
-                        outBuffer.append(toHex((aChar >>  4) & 0xF));
-                        outBuffer.append(toHex( aChar        & 0xF));
-                    } else {
-                        if (specialSaveChars.indexOf(aChar) != -1) {
-                            outBuffer.append('\\');
-                        }
-                        outBuffer.append(aChar);
-                    }
-            }
-        }
-        return outBuffer.toString();
-    }
-
-    /**
-     * Writes the content of <code>properties</code> to <code>out</code>.
-     * The format is that of Properties.store with the following modifications:
-     * <ul>
-     * <li>No header or date is written
-     * <li>Latin-1 characters are written as single bytes, not escape sequences
-     * <li>Line breaks are indicated by a single \n independent of platform
-     * <ul>
-     */
-    private static void storeProperties(Properties properties, OutputStream out)
-    throws IOException {
-        BufferedWriter awriter;
-        awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1"));
-        for (Enumeration<Object> e = properties.keys(); e.hasMoreElements();) {
-            String key = (String)e.nextElement();
-            String val = (String)properties.get(key);
-            key = saveConvert(key, true);
-
-            /* No need to escape embedded and trailing spaces for value, hence
-             * pass false to flag.
-             */
-            val = saveConvert(val, false);
-            writeln(awriter, key + "=" + val);
-        }
-        awriter.flush();
-    }
-
-    private static void writeln(BufferedWriter bw, String s) throws IOException {
-        bw.write(s);
-        bw.write("\n");
-    }
-
-    /**
-     * Convert a nibble to a hex character
-     * @param   nibble  the nibble to convert.
-     */
-    private static char toHex(int nibble) {
-        return hexDigit[(nibble & 0xF)];
-    }
-
-    /** A table of hex digits */
-    private static final char[] hexDigit = {
-        '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
-    };
-}
diff --git a/src/macosx/classes/apple/laf/JRSUIUtils.java b/src/macosx/classes/apple/laf/JRSUIUtils.java
index b088a12..94ef685 100644
--- a/src/macosx/classes/apple/laf/JRSUIUtils.java
+++ b/src/macosx/classes/apple/laf/JRSUIUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -28,6 +28,9 @@
 import com.apple.laf.AquaImageFactory.NineSliceMetrics;
 
 import apple.laf.JRSUIConstants.*;
+import sun.security.action.GetPropertyAction;
+
+import java.security.AccessController;
 
 public class JRSUIUtils {
     static boolean isLeopard = isMacOSXLeopard();
@@ -47,7 +50,7 @@
 
     static boolean currentMacOSXVersionMatchesGivenVersionRange(final int version, final boolean inclusive, final boolean matchBelow, final boolean matchAbove) {
         // split the "10.x.y" version number
-        String osVersion = System.getProperty("os.version");
+        String osVersion = AccessController.doPrivileged(new GetPropertyAction("os.version"));
         String[] fragments = osVersion.split("\\.");
 
         // sanity check the "10." part of the version
diff --git a/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java b/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java
index 18136da..cfa3b08 100644
--- a/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java
+++ b/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java
@@ -42,7 +42,6 @@
 import javax.swing.plaf.*;
 import javax.swing.table.*;
 
-import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 public class AquaFileChooserUI extends FileChooserUI {
@@ -1267,9 +1266,70 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return AquaFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
diff --git a/src/macosx/classes/com/apple/laf/AquaIcon.java b/src/macosx/classes/com/apple/laf/AquaIcon.java
index fbc38d8..576661b 100644
--- a/src/macosx/classes/com/apple/laf/AquaIcon.java
+++ b/src/macosx/classes/com/apple/laf/AquaIcon.java
@@ -295,7 +295,14 @@
         }
 
         Image createImage() {
-            return AquaUtils.getCImageCreator().createSystemImageFromSelector(selector, getIconWidth(), getIconHeight());
+            int w = getIconWidth();
+            int h = getIconHeight();
+            return new AquaImageFactory.MultiResolutionIconImage(
+                    AquaUtils.getCImageCreator().createSystemImageFromSelector(
+                            selector, w, h),
+                    AquaUtils.getCImageCreator().createSystemImageFromSelector(
+                            selector, 2 * w, 2 * h)
+            );
         }
     }
 }
diff --git a/src/macosx/classes/com/apple/laf/AquaImageFactory.java b/src/macosx/classes/com/apple/laf/AquaImageFactory.java
index 63ee3cf..5451abd 100644
--- a/src/macosx/classes/com/apple/laf/AquaImageFactory.java
+++ b/src/macosx/classes/com/apple/laf/AquaImageFactory.java
@@ -46,6 +46,10 @@
 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;
 
 public class AquaImageFactory {
     public static IconUIResource getConfirmImageIcon() {
@@ -120,28 +124,48 @@
 
     private static final int kAlertIconSize = 64;
     static IconUIResource getAppIconCompositedOn(final Image background) {
-        final double scaleFactor = 1.0; // revise for HiDPI
 
-        final int kAlertSubIconSize = (int)(kAlertIconSize * 0.5 * scaleFactor);
-        final int kAlertSubIconInset = (int)(kAlertIconSize * scaleFactor) - kAlertSubIconSize;
-        final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(kAlertSubIconSize, kAlertSubIconSize) {
-            Image createImage() {
-                return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
-            }
-        };
+        final BufferedImage iconImage = getAppIconImageCompositedOn(background, 1);
 
-        final BufferedImage image = new BufferedImage(kAlertIconSize, kAlertIconSize, BufferedImage.TYPE_INT_ARGB);
+        if (background instanceof MultiResolutionIconImage) {
+            BufferedImage background2x
+                    = ((MultiResolutionIconImage) background).resolutionVariant;
+            BufferedImage icon2xImage = getAppIconImageCompositedOn(background2x, 2);
+
+            return new IconUIResource(new ImageIcon(
+                    new MultiResolutionIconImage(iconImage, icon2xImage)));
+        }
+        return new IconUIResource(new ImageIcon(iconImage));
+    }
+
+    static BufferedImage getAppIconImageCompositedOn(final Image background, int scaleFactor) {
+
+        final int scaledAlertIconSize = kAlertIconSize * scaleFactor;
+        final int kAlertSubIconSize = (int) (scaledAlertIconSize * 0.5);
+        final int kAlertSubIconInset = scaledAlertIconSize - kAlertSubIconSize;
+        final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(
+                kAlertSubIconSize, kAlertSubIconSize) {
+                    Image createImage() {
+                        return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
+                    }
+                };
+
+        final BufferedImage image = new BufferedImage(scaledAlertIconSize,
+                scaledAlertIconSize, BufferedImage.TYPE_INT_ARGB);
         final Graphics g = image.getGraphics();
-        g.drawImage(background, 0, 0, (int)(kAlertIconSize * scaleFactor), (int)(kAlertIconSize * scaleFactor), null);
+        g.drawImage(background, 0, 0,
+                scaledAlertIconSize, scaledAlertIconSize, null);
         if (g instanceof Graphics2D) {
             // improves icon rendering quality in Quartz
-            ((Graphics2D)g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+            ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING,
+                    RenderingHints.VALUE_RENDER_QUALITY);
         }
 
-        smallAppIconScaled.paintIcon(null, g, kAlertSubIconInset, kAlertSubIconInset);
+        smallAppIconScaled.paintIcon(null, g,
+                kAlertSubIconInset, kAlertSubIconInset);
         g.dispose();
 
-        return new IconUIResource(new ImageIcon(image));
+        return image;
     }
 
     public static IconUIResource getTreeFolderIcon() {
@@ -207,7 +231,7 @@
 
         @Override
         protected Image getInstance() {
-            return Toolkit.getDefaultToolkit().getImage("NSImage://" + namedImage);
+            return getNSIcon(namedImage);
         }
     }
 
@@ -271,11 +295,27 @@
     }
 
     public static Icon getMenuItemCheckIcon() {
-        return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuItemSelection"), 25));
+        return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+                getNSIcon("NSMenuItemSelection"), 25));
     }
 
     public static Icon getMenuItemDashIcon() {
-        return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuMixedState"), 25));
+        return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+                getNSIcon("NSMenuMixedState"), 25));
+    }
+
+    private static Image getNSIcon(String imageName) {
+        Image icon = Toolkit.getDefaultToolkit()
+                .getImage("NSImage://" + imageName);
+
+        if (icon instanceof MultiResolutionImage) {
+            return icon;
+        }
+
+        Image icon2x = AquaUtils.getCImageCreator().createImageFromName(
+                imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null));
+        return new MultiResolutionBufferedImage(
+                BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x);
     }
 
     public static class NineSliceMetrics {
@@ -484,4 +524,29 @@
     public static Color getSelectionInactiveForegroundColorUIResource() {
         return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
     }
+
+    static class MultiResolutionIconImage extends BufferedImage
+            implements MultiResolutionImage {
+
+        BufferedImage resolutionVariant;
+
+        public MultiResolutionIconImage(BufferedImage image, BufferedImage resolutionVariant) {
+            super(image.getWidth(), image.getHeight(), image.getType());
+            this.resolutionVariant = resolutionVariant;
+            Graphics g = getGraphics();
+            g.drawImage(image, 0, 0, null);
+            g.dispose();
+        }
+
+        @Override
+        public Image getResolutionVariant(int width, int height) {
+            return ((width <= getWidth() && height <= getHeight()))
+                    ? this : resolutionVariant;
+        }
+
+        @Override
+        public List<Image> getResolutionVariants() {
+            return Arrays.asList(this, resolutionVariant);
+        }
+    }
 }
diff --git a/src/macosx/classes/com/apple/laf/AquaUtils.java b/src/macosx/classes/com/apple/laf/AquaUtils.java
index a5f5501..6a52283 100644
--- a/src/macosx/classes/com/apple/laf/AquaUtils.java
+++ b/src/macosx/classes/com/apple/laf/AquaUtils.java
@@ -48,6 +48,7 @@
 import sun.swing.SwingUtilities2;
 
 import com.apple.laf.AquaImageFactory.SlicedImageControl;
+import sun.awt.image.MultiResolutionBufferedImage;
 
 final class AquaUtils {
 
@@ -123,6 +124,13 @@
 
     static Image generateLightenedImage(final Image image, final int percent) {
         final GrayFilter filter = new GrayFilter(true, percent);
+        return (image instanceof MultiResolutionBufferedImage)
+                ? ((MultiResolutionBufferedImage) image).map(
+                        rv -> generateLightenedImage(rv, filter))
+                : generateLightenedImage(image, filter);
+    }
+
+    static Image generateLightenedImage(Image image, ImageFilter filter) {
         final ImageProducer prod = new FilteredImageSource(image.getSource(), filter);
         return Toolkit.getDefaultToolkit().createImage(prod);
     }
diff --git a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
index 5e45f4d..b5ae3b8 100644
--- a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
+++ b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
@@ -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
@@ -30,9 +30,6 @@
 import java.awt.Component;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
 import java.awt.Image;
 import java.awt.ImageCapabilities;
 import java.awt.Rectangle;
@@ -80,23 +77,34 @@
     private ContextCapabilities oglCaps;
     private OGLContext context;
     private final Object disposerReferent = new Object();
+    private final int maxTextureSize;
+
     private static native boolean initCGL();
     private static native long getCGLConfigInfo(int displayID, int visualnum,
                                                 int swapInterval);
     private static native int getOGLCapabilities(long configInfo);
 
+    /**
+     * Returns GL_MAX_TEXTURE_SIZE from the shared opengl context. Must be
+     * called under OGLRQ lock, because this method change current context.
+     *
+     * @return GL_MAX_TEXTURE_SIZE
+     */
+    private static native int nativeGetMaxTextureSize();
+
     static {
         cglAvailable = initCGL();
     }
 
     private CGLGraphicsConfig(CGraphicsDevice device, int pixfmt,
-                                long configInfo, ContextCapabilities oglCaps)
-    {
+                              long configInfo, int maxTextureSize,
+                              ContextCapabilities oglCaps) {
         super(device);
 
         this.pixfmt = pixfmt;
         this.pConfigInfo = configInfo;
         this.oglCaps = oglCaps;
+        this.maxTextureSize = maxTextureSize;
         context = new OGLContext(OGLRenderQueue.getInstance(), this);
 
         // add a record to the Disposer so that we destroy the native
@@ -126,6 +134,7 @@
         }
 
         long cfginfo = 0;
+        int textureSize = 0;
         final String ids[] = new String[1];
         OGLRenderQueue rq = OGLRenderQueue.getInstance();
         rq.lock();
@@ -138,11 +147,14 @@
             cfginfo = getCGLConfigInfo(device.getCGDisplayID(), pixfmt,
                                        kOpenGLSwapInterval);
             if (cfginfo != 0L) {
+                textureSize = nativeGetMaxTextureSize();
+                // 7160609: GL still fails to create a square texture of this
+                // size. Half should be safe enough.
+                // Explicitly not support a texture more than 2^14, see 8010999.
+                textureSize = textureSize <= 16384 ? textureSize / 2 : 8192;
                 OGLContext.setScratchSurface(cfginfo);
-                rq.flushAndInvokeNow(new Runnable() {
-                    public void run() {
-                        ids[0] = OGLContext.getOGLIdString();
-                    }
+                rq.flushAndInvokeNow(() -> {
+                    ids[0] = OGLContext.getOGLIdString();
                 });
             }
         } finally {
@@ -154,8 +166,7 @@
 
         int oglCaps = getOGLCapabilities(cfginfo);
         ContextCapabilities caps = new OGLContextCaps(oglCaps, ids[0]);
-
-        return new CGLGraphicsConfig(device, pixfmt, cfginfo, caps);
+        return new CGLGraphicsConfig(device, pixfmt, cfginfo, textureSize, caps);
     }
 
     public static boolean isCGLAvailable() {
@@ -246,8 +257,6 @@
         } finally {
             rq.unlock();
         }
-
-        updateTotalDisplayBounds();
     }
 
     @Override
@@ -421,57 +430,15 @@
         AccelDeviceEventNotifier.removeListener(l);
     }
 
-    private static final Rectangle totalDisplayBounds = new Rectangle();
-
-    private static void updateTotalDisplayBounds() {
-        synchronized (totalDisplayBounds) {
-            Rectangle virtualBounds = new Rectangle();
-            for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
-                for (GraphicsConfiguration gc : gd.getConfigurations()) {
-                    virtualBounds = virtualBounds.union(gc.getBounds());
-                }
-            }
-            totalDisplayBounds.setBounds(virtualBounds);
-        }
-    }
-
-    // 7160609: GL still fails to create a square texture of this size,
-    //          so we use this value to cap the total display bounds.
-    native private static int getMaxTextureSize();
-
     @Override
     public int getMaxTextureWidth() {
-        //Temporary disable this logic and use some magic constrain.
-        /*
-         int width;
-
-         synchronized (totalDisplayBounds) {
-         if (totalDisplayBounds.width == 0) {
-         updateTotalDisplayBounds();
-         }
-         width = totalDisplayBounds.width;
-         }
-
-         return Math.min(width, getMaxTextureSize());
-         */
-        return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
+        return Math.max(maxTextureSize / getDevice().getScaleFactor(),
+                        getBounds().width);
     }
 
     @Override
     public int getMaxTextureHeight() {
-        //Temporary disable this logic and use some magic constrain.
-        /*
-         int height;
-
-         synchronized (totalDisplayBounds) {
-         if (totalDisplayBounds.height == 0) {
-         updateTotalDisplayBounds();
-         }
-         height = totalDisplayBounds.height;
-         }
-
-         return Math.min(height, getMaxTextureSize());
-         */
-        return getMaxTextureSize() / (getDevice().getScaleFactor() * 2);
+        return Math.max(maxTextureSize / getDevice().getScaleFactor(),
+                        getBounds().height);
     }
 }
diff --git a/src/macosx/classes/sun/lwawt/LWChoicePeer.java b/src/macosx/classes/sun/lwawt/LWChoicePeer.java
index 5b78e74..bb360d6 100644
--- a/src/macosx/classes/sun/lwawt/LWChoicePeer.java
+++ b/src/macosx/classes/sun/lwawt/LWChoicePeer.java
@@ -168,16 +168,16 @@
         @Override
         public void firePopupMenuWillBecomeVisible() {
             super.firePopupMenuWillBecomeVisible();
-            SwingUtilities.invokeLater(new Runnable() {
-                @Override
-                public void run() {
-                    JPopupMenu popupMenu = getPopupMenu();
-                    if (popupMenu != null) {
-                        if (popupMenu.getInvoker() != LWChoicePeer.this.getTarget()) {
-                            popupMenu.setVisible(false);
-                            popupMenu.show(LWChoicePeer.this.getTarget(), 0, 0);
-                        }
-                    }
+            SwingUtilities.invokeLater(() -> {
+                JPopupMenu popupMenu = getPopupMenu();
+                // Need to override the invoker for proper grab handling
+                if (popupMenu != null && 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();
+                    SwingUtilities.convertPointFromScreen(loc, this);
+                    popupMenu.setVisible(false);
+                    popupMenu.show(getTarget(), loc.x, loc.y);
                 }
             });
         }
diff --git a/src/macosx/classes/sun/lwawt/LWToolkit.java b/src/macosx/classes/sun/lwawt/LWToolkit.java
index 5144712..8c7525b 100644
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java
@@ -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
@@ -28,17 +28,16 @@
 import java.awt.*;
 import java.awt.List;
 import java.awt.datatransfer.*;
-import java.awt.dnd.*;
-import java.awt.dnd.peer.*;
 import java.awt.image.*;
 import java.awt.peer.*;
 import java.security.*;
 import java.util.*;
 
 import sun.awt.*;
-import sun.lwawt.macosx.*;
 import sun.print.*;
 
+import static sun.lwawt.LWWindowPeer.PeerType;
+
 public abstract class LWToolkit extends SunToolkit implements Runnable {
 
     private final static int STATE_NONE = 0;
@@ -114,7 +113,7 @@
     /*
      * Sends a request to stop the message pump.
      */
-    public void shutdown() {
+    public final void shutdown() {
         setRunState(STATE_SHUTDOWN);
         platformShutdown();
     }
@@ -145,7 +144,7 @@
         notifyAll();
     }
 
-    public boolean isTerminating() {
+    public final boolean isTerminating() {
         return getRunState() >= STATE_SHUTDOWN;
     }
 
@@ -162,7 +161,8 @@
         }
     }
 
-    public void run() {
+    @Override
+    public final void run() {
         setRunState(STATE_INIT);
         platformInit();
         AWTAutoShutdown.notifyToolkitThreadFree();
@@ -214,80 +214,51 @@
      * Note that LWWindowPeer implements WindowPeer, FramePeer
      * and DialogPeer interfaces.
      */
-    private LWWindowPeer createDelegatedPeer(Window target, PlatformComponent platformComponent,
-                                             PlatformWindow platformWindow, LWWindowPeer.PeerType peerType)
-    {
+    protected LWWindowPeer createDelegatedPeer(Window target,
+                                               PlatformComponent platformComponent,
+                                               PlatformWindow platformWindow,
+                                               PeerType peerType) {
         LWWindowPeer peer = new LWWindowPeer(target, platformComponent, platformWindow, peerType);
         targetCreatedPeer(target, peer);
         peer.initialize();
         return peer;
     }
 
-    private LWLightweightFramePeer createDelegatedLwPeer(LightweightFrame target,
-                                                         PlatformComponent platformComponent,
-                                                         PlatformWindow platformWindow)
-    {
-        LWLightweightFramePeer peer = new LWLightweightFramePeer(target, platformComponent, platformWindow);
+    @Override
+    public final FramePeer createLightweightFrame(LightweightFrame target) {
+        PlatformComponent platformComponent = createLwPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.LW_FRAME);
+        LWLightweightFramePeer peer = new LWLightweightFramePeer(target,
+                                                                 platformComponent,
+                                                                 platformWindow);
         targetCreatedPeer(target, peer);
         peer.initialize();
         return peer;
     }
 
     @Override
-    public FramePeer createLightweightFrame(LightweightFrame target) {
-        PlatformComponent platformComponent = createLwPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.LW_FRAME);
-        return createDelegatedLwPeer(target, platformComponent, platformWindow);
+    public final WindowPeer createWindow(Window target) {
+        PlatformComponent platformComponent = createPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.SIMPLEWINDOW);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.SIMPLEWINDOW);
     }
 
     @Override
-    public WindowPeer createWindow(Window target) {
+    public final FramePeer createFrame(Frame target) {
         PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.SIMPLEWINDOW);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.SIMPLEWINDOW);
-    }
-
-    @Override
-    public FramePeer createFrame(Frame target) {
-        PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.FRAME);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.FRAME);
-    }
-
-    public LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
-        PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.EMBEDDED_FRAME);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.EMBEDDED_FRAME);
-    }
-
-    public LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
-        PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.VIEW_EMBEDDED_FRAME);
-    }
-
-
-    CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
-        PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
-        CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
-        targetCreatedPeer(target, peer);
-        return peer;
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.FRAME);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.FRAME);
     }
 
     @Override
     public DialogPeer createDialog(Dialog target) {
-        if (target instanceof CPrinterDialog) {
-            return createCPrinterDialog((CPrinterDialog)target);
-        }
-
         PlatformComponent platformComponent = createPlatformComponent();
-        PlatformWindow platformWindow = createPlatformWindow(LWWindowPeer.PeerType.DIALOG);
-        return createDelegatedPeer(target, platformComponent, platformWindow, LWWindowPeer.PeerType.DIALOG);
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.DIALOG);
     }
 
     @Override
-    public FileDialogPeer createFileDialog(FileDialog target) {
+    public final FileDialogPeer createFileDialog(FileDialog target) {
         FileDialogPeer peer = createFileDialogPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
@@ -296,7 +267,7 @@
     // ---- LIGHTWEIGHT COMPONENT PEERS ---- //
 
     @Override
-    public ButtonPeer createButton(Button target) {
+    public final ButtonPeer createButton(Button target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWButtonPeer peer = new LWButtonPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -305,7 +276,7 @@
     }
 
     @Override
-    public CheckboxPeer createCheckbox(Checkbox target) {
+    public final CheckboxPeer createCheckbox(Checkbox target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWCheckboxPeer peer = new LWCheckboxPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -314,12 +285,7 @@
     }
 
     @Override
-    public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public ChoicePeer createChoice(Choice target) {
+    public final ChoicePeer createChoice(Choice target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWChoicePeer peer = new LWChoicePeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -328,7 +294,7 @@
     }
 
     @Override
-    public LabelPeer createLabel(Label target) {
+    public final LabelPeer createLabel(Label target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWLabelPeer peer = new LWLabelPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -337,7 +303,7 @@
     }
 
     @Override
-    public CanvasPeer createCanvas(Canvas target) {
+    public final CanvasPeer createCanvas(Canvas target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWCanvasPeer<?, ?> peer = new LWCanvasPeer<>(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -346,7 +312,7 @@
     }
 
     @Override
-    public ListPeer createList(List target) {
+    public final ListPeer createList(List target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWListPeer peer = new LWListPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -355,22 +321,7 @@
     }
 
     @Override
-    public MenuPeer createMenu(Menu target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public MenuBarPeer createMenuBar(MenuBar target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public MenuItemPeer createMenuItem(MenuItem target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public PanelPeer createPanel(Panel target) {
+    public final PanelPeer createPanel(Panel target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWPanelPeer peer = new LWPanelPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -379,12 +330,7 @@
     }
 
     @Override
-    public PopupMenuPeer createPopupMenu(PopupMenu target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public ScrollPanePeer createScrollPane(ScrollPane target) {
+    public final ScrollPanePeer createScrollPane(ScrollPane target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWScrollPanePeer peer = new LWScrollPanePeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -393,7 +339,7 @@
     }
 
     @Override
-    public ScrollbarPeer createScrollbar(Scrollbar target) {
+    public final ScrollbarPeer createScrollbar(Scrollbar target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWScrollBarPeer peer = new LWScrollBarPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -402,7 +348,7 @@
     }
 
     @Override
-    public TextAreaPeer createTextArea(TextArea target) {
+    public final TextAreaPeer createTextArea(TextArea target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWTextAreaPeer peer = new LWTextAreaPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -411,7 +357,7 @@
     }
 
     @Override
-    public TextFieldPeer createTextField(TextField target) {
+    public final TextFieldPeer createTextField(TextField target) {
         PlatformComponent platformComponent = createPlatformComponent();
         LWTextFieldPeer peer = new LWTextFieldPeer(target, platformComponent);
         targetCreatedPeer(target, peer);
@@ -422,56 +368,51 @@
     // ---- NON-COMPONENT PEERS ---- //
 
     @Override
-    public ColorModel getColorModel() throws HeadlessException {
-        return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().getColorModel();
+    public final ColorModel getColorModel() throws HeadlessException {
+        return GraphicsEnvironment.getLocalGraphicsEnvironment()
+                                  .getDefaultScreenDevice()
+                                  .getDefaultConfiguration().getColorModel();
     }
 
     @Override
-    public boolean isDesktopSupported() {
+    public final boolean isDesktopSupported() {
         return true;
     }
 
     @Override
-    protected DesktopPeer createDesktopPeer(Desktop target) {
-       return new CDesktopPeer();
-    }
-
-    @Override
-    public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) {
-        DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
-
-        return dscp;
-    }
-
-    @Override
-    public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
+    public final KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
         return LWKeyboardFocusManagerPeer.getInstance();
     }
 
     @Override
-    public synchronized MouseInfoPeer getMouseInfoPeer() {
+    public final synchronized MouseInfoPeer getMouseInfoPeer() {
         if (mouseInfoPeer == null) {
             mouseInfoPeer = createMouseInfoPeerImpl();
         }
         return mouseInfoPeer;
     }
 
-    protected MouseInfoPeer createMouseInfoPeerImpl() {
+    protected final MouseInfoPeer createMouseInfoPeerImpl() {
         return new LWMouseInfoPeer();
     }
 
-    public PrintJob getPrintJob(Frame frame, String doctitle, Properties props) {
+    @Override
+    public final PrintJob getPrintJob(Frame frame, String doctitle,
+                                      Properties props) {
         return getPrintJob(frame, doctitle, null, null);
     }
 
-    public PrintJob getPrintJob(Frame frame, String doctitle, JobAttributes jobAttributes, PageAttributes pageAttributes) {
+    @Override
+    public final PrintJob getPrintJob(Frame frame, String doctitle,
+                                      JobAttributes jobAttributes,
+                                      PageAttributes pageAttributes) {
         if (GraphicsEnvironment.isHeadless()) {
             throw new IllegalArgumentException();
         }
 
         PrintJob2D printJob = new PrintJob2D(frame, doctitle, jobAttributes, pageAttributes);
 
-        if (printJob.printDialog() == false) {
+        if (!printJob.printDialog()) {
             printJob = null;
         }
 
@@ -479,27 +420,7 @@
     }
 
     @Override
-    public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public boolean isTraySupported() {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public SystemTrayPeer createSystemTray(SystemTray target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public TrayIconPeer createTrayIcon(TrayIcon target) {
-        throw new RuntimeException("not implemented");
-    }
-
-    @Override
-    public Clipboard getSystemClipboard() {
+    public final Clipboard getSystemClipboard() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
             security.checkPermission(AWTPermissions.ACCESS_CLIPBOARD_PERMISSION);
@@ -513,7 +434,8 @@
         return clipboard;
     }
 
-    protected abstract SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer);
+    protected abstract SecurityWarningWindow createSecurityWarning(
+            Window ownerWindow, LWWindowPeer ownerPeer);
 
     // ---- DELEGATES ---- //
 
@@ -522,7 +444,7 @@
     /*
      * Creates a delegate for the given peer type (window, frame, dialog, etc.)
      */
-    protected abstract PlatformWindow createPlatformWindow(LWWindowPeer.PeerType peerType);
+    protected abstract PlatformWindow createPlatformWindow(PeerType peerType);
 
     protected abstract PlatformComponent createPlatformComponent();
 
@@ -556,7 +478,7 @@
     }
 
     @Override
-    public void grab(final Window w) {
+    public final void grab(final Window w) {
         final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
         if (peer != null) {
             ((LWWindowPeer) peer).grab();
@@ -564,7 +486,7 @@
     }
 
     @Override
-    public void ungrab(final Window w) {
+    public final void ungrab(final Window w) {
         final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
         if (peer != null) {
             ((LWWindowPeer) peer).ungrab(false);
diff --git a/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/src/macosx/classes/sun/lwawt/LWWindowPeer.java
index d61dc7a..fe7596e 100644
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java
@@ -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
@@ -629,6 +629,7 @@
         final boolean isNewDevice = updateGraphicsDevice();
         if (resized || isNewDevice) {
             replaceSurfaceData();
+            updateMinimumSize();
         }
 
         // Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
@@ -1046,7 +1047,9 @@
 
     @Override
     public final void displayChanged() {
-        updateGraphicsDevice();
+        if (updateGraphicsDevice()) {
+            updateMinimumSize();
+        }
         // Replace surface unconditionally, because internal state of the
         // GraphicsDevice could be changed.
         replaceSurfaceData();
diff --git a/src/macosx/classes/sun/lwawt/macosx/CClipboard.java b/src/macosx/classes/sun/lwawt/macosx/CClipboard.java
index df5f217..ad45ce9 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CClipboard.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CClipboard.java
@@ -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
@@ -40,20 +40,23 @@
  * sun.awt.datatransfer.DataTransferer.
  */
 
-public class CClipboard extends SunClipboard {
+final class CClipboard extends SunClipboard {
 
     public CClipboard(String name) {
         super(name);
     }
 
+    @Override
     public long getID() {
         return 0;
     }
 
+    @Override
     protected void clearNativeContext() {
         // Leaving Empty, as WClipboard.clearNativeContext is empty as well.
     }
 
+    @Override
     protected void setContentsNative(Transferable contents) {
 
         // Don't use delayed Clipboard rendering for the Transferable's data.
@@ -89,6 +92,39 @@
         notifyChanged();
     }
 
+    @Override
+    protected native long[] getClipboardFormats();
+    @Override
+    protected native byte[] getClipboardData(long format) throws IOException;
+
+    // 1.5 peer method
+    @Override
+    protected void unregisterClipboardViewerChecked() {
+        // no-op because we lack OS support. This requires 4048791, which requires 4048792
+    }
+
+    // 1.5 peer method
+    @Override
+    protected void registerClipboardViewerChecked()    {
+        // no-op because we lack OS support. This requires 4048791, which requires 4048792
+    }
+
+    // 1.5 peer method
+    // no-op. This appears to be win32 specific. Filed 4048790 for investigation
+    //protected Transferable createLocaleTransferable(long[] formats) throws IOException;
+
+    private native void declareTypes(long[] formats, SunClipboard newOwner);
+    private native void setData(byte[] data, long format);
+
+    /**
+     * Invokes native check whether a change count on the general pasteboard is different
+     * than when we set it. The different count value means the current owner lost
+     * pasteboard ownership and someone else put data on the clipboard.
+     * @since 1.7
+     */
+    native void checkPasteboard();
+
+    /*** Native Callbacks ***/
     private void notifyLostOwnership() {
         lostOwnershipImpl();
     }
@@ -100,32 +136,4 @@
         }
         clipboard.checkChange(clipboard.getClipboardFormats());
     }
-
-    protected native long[] getClipboardFormats();
-    protected native byte[] getClipboardData(long format) throws IOException;
-
-    // 1.5 peer method
-    protected void unregisterClipboardViewerChecked() {
-        // no-op because we lack OS support. This requires 4048791, which requires 4048792
-    }
-
-    // 1.5 peer method
-    protected void registerClipboardViewerChecked()    {
-        // no-op because we lack OS support. This requires 4048791, which requires 4048792
-    }
-
-    // 1.5 peer method
-    // no-op. This appears to be win32 specific. Filed 4048790 for investigation
-    //protected Transferable createLocaleTransferable(long[] formats) throws IOException;
-
-    public native void declareTypes(long[] formats, SunClipboard newOwner);
-    public native void setData(byte[] data, long format);
-
-    /**
-     * Invokes native check whether a change count on the general pasteboard is different
-     * than when we set it. The different count value means the current owner lost
-     * pasteboard ownership and someone else put data on the clipboard.
-     * @since 1.7
-     */
-    public native void checkPasteboard();
 }
diff --git a/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java b/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java
index 70a0874..8e0ded6 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java
@@ -38,6 +38,8 @@
 
     Image fImage;
     Point fHotspot;
+    int fWidth;
+    int fHeight;
 
     public CCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException {
         super(name);
@@ -50,6 +52,7 @@
         // Make sure image is fully loaded.
         final Component c = new Canvas(); // for its imageUpdate method
         final MediaTracker tracker = new MediaTracker(c);
+        // MediaTracker loads resolution variants from MultiResolution Toolkit image
         tracker.addImage(fImage, 0);
         try {
             tracker.waitForAll();
@@ -67,15 +70,15 @@
             width = height = 1;
             fImage = createTransparentImage(width, height);
         } else {
-            // Scale image to nearest supported size
+            // Get the nearest supported cursor size
             final Dimension nativeSize = toolkit.getBestCursorSize(width, height);
-            if (nativeSize.width != width || nativeSize.height != height) {
-                fImage = fImage.getScaledInstance(nativeSize.width, nativeSize.height, Image.SCALE_DEFAULT);
-                width = nativeSize.width;
-                height = nativeSize.height;
-            }
+            width = nativeSize.width;
+            height = nativeSize.height;
         }
 
+        fWidth = width;
+        fHeight = height;
+
         // NOTE: this was removed for 3169146, but in 1.5 the JCK tests for an exception and fails if one isn't thrown.
         // See what JBuilder does.
         // Verify that the hotspot is within cursor bounds.
@@ -138,6 +141,7 @@
                 // failed to do its job. Return null to keep the cursor unchanged.
                 return 0L;
             } else {
+                fCImage.resizeRepresentations(fWidth, fHeight);
                 return fCImage.ptr;
             }
         } catch (IllegalArgumentException iae) {
diff --git a/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java b/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
index dcee9ce..8b2eb3d 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java
@@ -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
@@ -56,11 +56,11 @@
     };
 
     static {
-        Map<String, Long> nameMap = new HashMap<String, Long>(predefinedClipboardNames.length, 1.0f);
-        Map<Long, String> formatMap = new HashMap<Long, String>(predefinedClipboardNames.length, 1.0f);
+        Map<String, Long> nameMap = new HashMap<>(predefinedClipboardNames.length, 1.0f);
+        Map<Long, String> formatMap = new HashMap<>(predefinedClipboardNames.length, 1.0f);
         for (int i = 1; i < predefinedClipboardNames.length; i++) {
-            nameMap.put(predefinedClipboardNames[i], new Long(i));
-            formatMap.put(new Long(i), predefinedClipboardNames[i]);
+            nameMap.put(predefinedClipboardNames[i], (long) i);
+            formatMap.put((long) i, predefinedClipboardNames[i]);
         }
         predefinedClipboardNameMap = Collections.synchronizedMap(nameMap);
         predefinedClipboardFormatMap = Collections.synchronizedMap(formatMap);
@@ -77,19 +77,11 @@
     public static final int CF_PNG         = 10;
     public static final int CF_JPEG        = 11;
 
-    public static final Long L_CF_TIFF = predefinedClipboardNameMap.get(predefinedClipboardNames[CF_TIFF]);
-
-    // Image file formats with java.awt.Image representation:
-    private static final Long[] imageFormats = new Long[] {
-        L_CF_TIFF
-    };
-
-
     private CDataTransferer() {}
 
     private static CDataTransferer fTransferer;
 
-    public static synchronized CDataTransferer getInstanceImpl() {
+    static synchronized CDataTransferer getInstanceImpl() {
         if (fTransferer == null) {
             fTransferer = new CDataTransferer();
         }
@@ -97,18 +89,22 @@
         return fTransferer;
     }
 
+    @Override
     public String getDefaultUnicodeEncoding() {
         return "utf-16le";
     }
 
+    @Override
     public boolean isLocaleDependentTextFormat(long format) {
         return format == CF_STRING;
     }
 
+    @Override
     public boolean isFileFormat(long format) {
         return format == CF_FILE;
     }
 
+    @Override
     public boolean isImageFormat(long format) {
         int ifmt = (int)format;
         switch(ifmt) {
@@ -122,43 +118,12 @@
         }
     }
 
-    protected Long[] getImageFormatsAsLongArray() {
-        return imageFormats;
-    }
-
-    public byte[] translateTransferable(Transferable contents, DataFlavor flavor, long format) throws IOException
-        {
-            byte[] bytes = super.translateTransferable(contents, flavor, format);
-
-            // 9-12-02 VL: we may need to do something like Windows here.
-            //if (format == CF_HTML) {
-            //    bytes = HTMLSupport.convertToHTMLFormat(bytes);
-            //}
-
-            return bytes;
-        }
-
-    protected Object translateBytesOrStream(InputStream stream, byte[] bytes, DataFlavor flavor, long format,
-                                            Transferable transferable) throws IOException
-        {
-            // 5-28-03 VL: [Radar 3266030]
-            // We need to do like Windows does here.
-            if (format == CF_HTML && flavor.isFlavorTextType()) {
-                if (stream == null) {
-                    stream = new ByteArrayInputStream(bytes);
-                    bytes = null;
-                }
-
-                stream = new HTMLDecodingInputStream(stream);
-            }
+    @Override
+    public Object translateBytes(byte[] bytes, DataFlavor flavor,
+                                    long format, Transferable transferable) throws IOException {
 
             if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
             {
-                if (bytes == null) {
-                    bytes = inputStreamToByteArray(stream);
-                    stream = null;
-                }
-
                 String charset = getDefaultTextCharset();
                 if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
                     try {
@@ -175,9 +140,9 @@
             }
 
             return super.translateBytes(bytes, flavor, format, transferable);
-        }
+    }
 
-
+    @Override
     synchronized protected Long getFormatForNativeAsLong(String str) {
         Long format = predefinedClipboardNameMap.get(str);
 
@@ -202,6 +167,7 @@
     // Get registered native format string for an index, return null if unknown:
     private native String formatForIndex(long index);
 
+    @Override
     protected String getNativeForFormat(long format) {
         String returnValue = null;
 
@@ -209,7 +175,7 @@
         if (format >= 0 && format < predefinedClipboardNames.length) {
             returnValue = predefinedClipboardNames[(int) format];
         } else {
-            Long formatObj = new Long(format);
+            Long formatObj = format;
             returnValue = predefinedClipboardFormatMap.get(formatObj);
 
             // predefinedClipboardFormatMap may not know this format:
@@ -233,10 +199,13 @@
 
     private final ToolkitThreadBlockedHandler handler = new CToolkitThreadBlockedHandler();
 
+    @Override
     public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
         return handler;
     }
 
+    private native byte[] imageDataToPlatformImageBytes(int[] rData, int nW, int nH);
+    @Override
     protected byte[] imageToPlatformBytes(Image image, long format) {
         int w = image.getWidth(null);
         int h = image.getHeight(null);
@@ -252,32 +221,28 @@
     }
 
     private static native String[] nativeDragQueryFile(final byte[] bytes);
+    @Override
     protected String[] dragQueryFile(final byte[] bytes) {
         if (bytes == null) return null;
         if (new String(bytes).startsWith("Unsupported type")) return null;
         return nativeDragQueryFile(bytes);
     }
 
-    private native byte[] imageDataToPlatformImageBytes(int[] rData, int nW, int nH);
-
+    private native Image getImageForByteStream(byte[] bytes);
     /**
      * Translates a byte array which contains
      * platform-specific image data in the given format into an Image.
      */
-    protected Image platformImageBytesToImage(byte[] bytes, long format)
-        throws IOException
-    {
+    @Override
+    protected Image platformImageBytesToImage(byte[] bytes, long format) throws IOException {
         return getImageForByteStream(bytes);
     }
 
-    private native Image getImageForByteStream(byte[] bytes);
-
     @Override
     protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) throws IOException {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        for (int i = 0; i < fileList.size(); i++)
-        {
-            byte[] bytes = fileList.get(i).getBytes();
+        for (String file : fileList) {
+            byte[] bytes = file.getBytes();
             bos.write(bytes, 0, bytes.length);
             bos.write(0);
         }
@@ -303,246 +268,3 @@
 }
 
 
-// ---- Code borrowed from WDataTransferer: ----
-// This will come handy for supporting HTML data.
-
-final class HTMLSupport {
-    public static final String ENCODING = "UTF-8";
-
-    public static final String VERSION = "Version:";
-    public static final String START_HTML = "StartHTML:";
-    public static final String END_HTML = "EndHTML:";
-    public static final String START_FRAGMENT = "StartFragment:";
-    public static final String END_FRAGMENT = "EndFragment:";
-    public static final String START_FRAGMENT_CMT = "<!--StartFragment-->";
-    public static final String END_FRAGMENT_CMT = "<!--EndFragment-->";
-    public static final String EOLN = "\r\n";
-
-    private static final String VERSION_NUM = "0.9";
-    private static final String HTML_START_END = "-1";
-
-    private static final int PADDED_WIDTH = 10;
-
-    private static final int HEADER_LEN =
-        VERSION.length() + VERSION_NUM.length() + EOLN.length() +
-        START_HTML.length() + HTML_START_END.length() + EOLN.length() +
-        END_HTML.length() + HTML_START_END.length() + EOLN.length() +
-        START_FRAGMENT.length() + PADDED_WIDTH + EOLN.length() +
-        END_FRAGMENT.length() + PADDED_WIDTH + EOLN.length() +
-        START_FRAGMENT_CMT.length() + EOLN.length();
-    private static final String HEADER_LEN_STR =
-        toPaddedString(HEADER_LEN, PADDED_WIDTH);
-
-    private static final String TRAILER = END_FRAGMENT_CMT + EOLN + '\0';
-
-    private static String toPaddedString(int n, int width) {
-        String string = "" + n;
-        int len = string.length();
-        if (n >= 0 && len < width) {
-            char[] array = new char[width - len];
-            Arrays.fill(array, '0');
-            StringBuffer buffer = new StringBuffer();
-            buffer.append(array);
-            buffer.append(string);
-            string = buffer.toString();
-        }
-        return string;
-    }
-
-    public static byte[] convertToHTMLFormat(byte[] bytes) {
-        StringBuffer header = new StringBuffer(HEADER_LEN);
-        header.append(VERSION);
-        header.append(VERSION_NUM);
-        header.append(EOLN);
-        header.append(START_HTML);
-        header.append(HTML_START_END);
-        header.append(EOLN);
-        header.append(END_HTML);
-        header.append(HTML_START_END);
-        header.append(EOLN);
-        header.append(START_FRAGMENT);
-        header.append(HEADER_LEN_STR);
-        header.append(EOLN);
-        header.append(END_FRAGMENT);
-        // Strip terminating NUL byte from array
-        header.append(toPaddedString(HEADER_LEN + bytes.length - 1,
-                                     PADDED_WIDTH));
-        header.append(EOLN);
-        header.append(START_FRAGMENT_CMT);
-        header.append(EOLN);
-
-        byte[] headerBytes = null, trailerBytes = null;
-
-        try {
-            headerBytes = new String(header).getBytes(ENCODING);
-            trailerBytes = TRAILER.getBytes(ENCODING);
-        } catch (UnsupportedEncodingException cannotHappen) {
-        }
-
-        byte[] retval = new byte[headerBytes.length + bytes.length - 1 +
-            trailerBytes.length];
-
-        System.arraycopy(headerBytes, 0, retval, 0, headerBytes.length);
-        System.arraycopy(bytes, 0, retval, headerBytes.length,
-                         bytes.length - 1);
-        System.arraycopy(trailerBytes, 0, retval,
-                         headerBytes.length + bytes.length - 1,
-                         trailerBytes.length);
-
-        return retval;
-    }
-}
-
-/**
-* This stream takes an InputStream which provides data in CF_HTML format,
- * strips off the description and context to extract the original HTML data.
- */
-class HTMLDecodingInputStream extends InputStream {
-
-    private final BufferedInputStream bufferedStream;
-    private boolean descriptionParsed = false;
-    private boolean closed = false;
-    private int index;
-    private int end;
-
-    // InputStreamReader uses an 8K buffer. The size is not customizable.
-    public static final int BYTE_BUFFER_LEN = 8192;
-
-    // CharToByteUTF8.getMaxBytesPerChar returns 3, so we should not buffer
-    // more chars than 3 times the number of bytes we can buffer.
-    public static final int CHAR_BUFFER_LEN = BYTE_BUFFER_LEN / 3;
-
-    private static final String FAILURE_MSG =
-        "Unable to parse HTML description: ";
-    private static final String INVALID_MSG = " invalid";
-
-    public HTMLDecodingInputStream(InputStream bytestream) throws IOException {
-        bufferedStream = new BufferedInputStream(bytestream, BYTE_BUFFER_LEN);
-    }
-
-    private void parseDescription() throws IOException {
-        bufferedStream.mark(BYTE_BUFFER_LEN);
-
-        BufferedReader bufferedReader = new BufferedReader
-            (new InputStreamReader(bufferedStream, HTMLSupport.ENCODING),
-             CHAR_BUFFER_LEN);
-        String version = bufferedReader.readLine().trim();
-        if (version == null || !version.startsWith(HTMLSupport.VERSION)) {
-            // Not MS-compliant HTML text. Return raw text from read().
-            index = 0;
-            end = -1;
-            bufferedStream.reset();
-            return;
-        }
-
-        String input;
-        boolean startHTML, endHTML, startFragment, endFragment;
-        startHTML = endHTML = startFragment = endFragment = false;
-
-        try {
-            do {
-                input = bufferedReader.readLine().trim();
-                if (input == null) {
-                    close();
-                    throw new IOException(FAILURE_MSG);
-                } else if (input.startsWith(HTMLSupport.START_HTML)) {
-                    int val = Integer.parseInt
-                    (input.substring(HTMLSupport.START_HTML.length(),
-                                     input.length()).trim());
-                    if (val >= 0) {
-                        index = val;
-                        startHTML = true;
-                    } else if (val != -1) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.START_HTML +
-                                              INVALID_MSG);
-                    }
-                } else if (input.startsWith(HTMLSupport.END_HTML)) {
-                    int val = Integer.parseInt
-                    (input.substring(HTMLSupport.END_HTML.length(),
-                                     input.length()).trim());
-                    if (val >= 0) {
-                        end = val;
-                        endHTML = true;
-                    } else if (val != -1) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.END_HTML +
-                                              INVALID_MSG);
-                    }
-                } else if (!startHTML && !endHTML &&
-                           input.startsWith(HTMLSupport.START_FRAGMENT)) {
-                    index = Integer.parseInt
-                    (input.substring(HTMLSupport.START_FRAGMENT.length(),
-                                     input.length()).trim());
-                    if (index < 0) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.START_FRAGMENT +
-                                              INVALID_MSG);
-                    }
-                    startFragment = true;
-                } else if (!startHTML && !endHTML &&
-                           input.startsWith(HTMLSupport.END_FRAGMENT)) {
-                    end = Integer.parseInt
-                    (input.substring(HTMLSupport.END_FRAGMENT.length(),
-                                     input.length()).trim());
-                    if (end < 0) {
-                        close();
-                        throw new IOException(FAILURE_MSG +
-                                              HTMLSupport.END_FRAGMENT +
-                                              INVALID_MSG);
-                    }
-                    endFragment = true;
-                }
-            } while (!((startHTML && endHTML) ||
-                       (startFragment && endFragment)));
-        } catch (NumberFormatException e) {
-            close();
-            throw new IOException(FAILURE_MSG + e);
-        }
-
-        bufferedStream.reset();
-
-        for (int i = 0; i < index; i++) {
-            if (bufferedStream.read() == -1) {
-                close();
-                throw new IOException(FAILURE_MSG +
-                                      "Byte stream ends in description.");
-            }
-        }
-    }
-
-    public int read() throws IOException {
-        if (closed) {
-            throw new IOException("Stream closed");
-        }
-
-        if (!descriptionParsed) {
-            parseDescription(); // initializes 'index' and 'end'
-            descriptionParsed = true;
-        }
-
-        if (end != -1 && index >= end) {
-            return -1;
-        }
-
-        int retval = bufferedStream.read();
-        if (retval == -1) {
-            index = end = 0; // so future read() calls will fail quickly
-            return -1;
-        }
-
-        index++;
-    //    System.out.print((char)retval);
-        return retval;
-    }
-
-    public void close() throws IOException {
-        if (!closed) {
-            closed = true;
-            bufferedStream.close();
-        }
-    }
-}
diff --git a/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java b/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
index 92f2b6d..67570c1 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java
@@ -141,7 +141,7 @@
             // Create native dragging source:
             final long nativeDragSource = createNativeDragSource(component, nativeViewPtr, transferable, triggerEvent,
                 (int) (dragOrigin.getX()), (int) (dragOrigin.getY()), extModifiers,
-                clickCount, timestamp, fDragCImage, dragImageOffset.x, dragImageOffset.y,
+                clickCount, timestamp, fDragCImage != null ? fDragCImage.ptr : 0L, dragImageOffset.x, dragImageOffset.y,
                 getDragSourceContext().getSourceActions(), formats, formatMap);
 
             if (nativeDragSource == 0)
@@ -484,7 +484,7 @@
     // Native support:
     private native long createNativeDragSource(Component component, long nativePeer, Transferable transferable,
         InputEvent triggerEvent, int dragPosX, int dragPosY, int extModifiers, int clickCount, long timestamp,
-        CImage nsDragImage, int dragImageOffsetX, int dragImageOffsetY,
+        long nsDragImagePtr, int dragImageOffsetX, int dragImageOffsetY,
         int sourceActions, long[] formats, Map formatMap);
 
     private native void doDragging(long nativeDragSource);
diff --git a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
index 570a2ac..7aab0b5 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
@@ -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
@@ -23,17 +23,15 @@
  * questions.
  */
 
+
 package sun.lwawt.macosx;
 
-import sun.lwawt.LWToolkit;
-import sun.lwawt.LWWindowPeer;
-import sun.lwawt.macosx.CocoaConstants;
-import sun.lwawt.macosx.event.NSEvent;
+import java.awt.AWTKeyStroke;
+import java.awt.Point;
+import java.awt.Toolkit;
 
 import sun.awt.EmbeddedFrame;
-
-import java.awt.*;
-import java.awt.event.*;
+import sun.lwawt.LWWindowPeer;
 
 public class CEmbeddedFrame extends EmbeddedFrame {
 
@@ -48,7 +46,7 @@
 
     public void addNotify() {
         if (getPeer() == null) {
-            LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
+            LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
             LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
             setPeer(peer);
             responder = new CPlatformResponder(peer, true);
diff --git a/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java b/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
index 4702cec..cc31b53 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
@@ -46,17 +46,16 @@
         @Override
         public void run() {
             try {
-                boolean navigateApps = false;
+                boolean navigateApps = !AccessController.doPrivileged(
+                        new GetBooleanAction("apple.awt.use-file-dialog-packages"));
+                boolean chooseDirectories = AccessController.doPrivileged(
+                        new GetBooleanAction("apple.awt.fileDialogForDirectories"));
+
                 int dialogMode = target.getMode();
-
-                navigateApps = true;
-
                 String title = target.getTitle();
                 if (title == null) {
                     title = " ";
                 }
-                Boolean chooseDirectories = AccessController.doPrivileged(
-                        new GetBooleanAction("apple.awt.fileDialogForDirectories"));
 
                 String[] userFileNames = nativeRunFileDialog(title,
                         dialogMode,
diff --git a/src/macosx/classes/sun/lwawt/macosx/CImage.java b/src/macosx/classes/sun/lwawt/macosx/CImage.java
index a861133..5ea172b 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CImage.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CImage.java
@@ -31,6 +31,7 @@
 
 import java.util.Arrays;
 import java.util.List;
+import sun.awt.image.MultiResolutionImage;
 
 import sun.awt.image.SunWritableRaster;
 
@@ -44,6 +45,7 @@
     private static native void nativeCopyNSImageIntoArray(long image, int[] buffer, int w, int h);
     private static native Dimension2D nativeGetNSImageSize(long image);
     private static native void nativeSetNSImageSize(long image, double w, double h);
+    private static native void nativeResizeNSImageRepresentations(long image, double w, double h);
 
     static Creator creator = new Creator();
     static Creator getCreator() {
@@ -145,6 +147,12 @@
 
         // This is used to create a CImage from a Image
         public CImage createFromImage(final Image image) {
+            if (image instanceof MultiResolutionImage) {
+                List<Image> resolutionVariants
+                        = ((MultiResolutionImage) image).getResolutionVariants();
+                return createFromImages(resolutionVariants);
+            }
+
             int[] buffer = imageToArray(image, true);
             if (buffer == null) {
                 return null;
@@ -223,4 +231,8 @@
         if (ptr != 0) nativeSetNSImageSize(ptr, w, h);
         return this;
     }
+
+    void resizeRepresentations(double w, double h) {
+        if (ptr != 0) nativeResizeNSImageRepresentations(ptr, w, h);
+    }
 }
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
index 3c7620f..d8d1555 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
@@ -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
@@ -28,7 +28,7 @@
 import sun.awt.SunToolkit;
 import sun.lwawt.LWWindowPeer;
 import sun.lwawt.PlatformEventNotifier;
-import sun.lwawt.macosx.event.NSEvent;
+
 import java.awt.Toolkit;
 import java.awt.event.MouseEvent;
 import java.awt.event.InputEvent;
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
index ba05ab0..e81371b 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
@@ -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
@@ -31,7 +31,6 @@
 import sun.awt.CGraphicsConfig;
 import sun.awt.CGraphicsEnvironment;
 import sun.lwawt.LWWindowPeer;
-import sun.lwawt.macosx.event.NSEvent;
 
 import sun.java2d.SurfaceData;
 import sun.java2d.opengl.CGLLayer;
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index f0eebfc..a9de01d 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -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
@@ -583,7 +583,12 @@
                     // setVisible could have changed the native maximized state
                     deliverZoom(true);
                 } else {
-                    switch (((Frame)target).getExtendedState()) {
+                    int frameState = ((Frame)target).getExtendedState();
+                    if ((frameState & Frame.ICONIFIED) != 0) {
+                        // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+                        frameState = Frame.ICONIFIED;
+                    }
+                    switch (frameState) {
                         case Frame.ICONIFIED:
                             CWrapper.NSWindow.miniaturize(nsWindowPtr);
                             break;
@@ -608,9 +613,7 @@
             // Add myself as a child
             if (owner != null && owner.isVisible()) {
                 CWrapper.NSWindow.addChildWindow(owner.getNSWindowPtr(), nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
-                if (target.isAlwaysOnTop()) {
-                    CWrapper.NSWindow.setLevel(nsWindowPtr, CWrapper.NSWindow.NSFloatingWindowLevel);
-                }
+                applyWindowLevel(target);
             }
 
             // Add my own children to myself
@@ -620,9 +623,7 @@
                     CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
                     if (pw != null && pw.isVisible()) {
                         CWrapper.NSWindow.addChildWindow(nsWindowPtr, pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove);
-                        if (w.isAlwaysOnTop()) {
-                            CWrapper.NSWindow.setLevel(pw.getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel);
-                        }
+                        pw.applyWindowLevel(w);
                     }
                 }
             }
@@ -788,6 +789,10 @@
         if (prevWindowState == windowState) return;
 
         final long nsWindowPtr = getNSWindowPtr();
+        if ((windowState & Frame.ICONIFIED) != 0) {
+            // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+            windowState = Frame.ICONIFIED;
+        }
         switch (windowState) {
             case Frame.ICONIFIED:
                 if (prevWindowState == Frame.MAXIMIZED_BOTH) {
@@ -1041,8 +1046,14 @@
             CWrapper.NSWindow.addChildWindow(nsWindowOwnerPtr, nsWindowSelfPtr, CWrapper.NSWindow.NSWindowAbove);
         }
 
-        if (target.isAlwaysOnTop()) {
+        applyWindowLevel(target);
+    }
+
+    protected void applyWindowLevel(Window target) {
+        if (target.isAlwaysOnTop() && target.getType() != Window.Type.POPUP) {
             CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSFloatingWindowLevel);
+        } else if (target.getType() == Window.Type.POPUP) {
+            CWrapper.NSWindow.setLevel(getNSWindowPtr(), CWrapper.NSWindow.NSPopUpMenuWindowLevel);
         }
     }
 
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
index 80257a4..a310232 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java
@@ -41,7 +41,7 @@
 import sun.java2d.*;
 import sun.print.*;
 
-public class CPrinterJob extends RasterPrinterJob {
+final class CPrinterJob extends RasterPrinterJob {
     // NOTE: This uses RasterPrinterJob as a base, but it doesn't use
     // all of the RasterPrinterJob functions. RasterPrinterJob will
     // break down printing to pieces that aren't necessary under MacOSX
@@ -89,6 +89,7 @@
      * returns true.
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @Override
     public boolean printDialog() throws HeadlessException {
         if (GraphicsEnvironment.isHeadless()) {
             throw new HeadlessException();
@@ -131,6 +132,7 @@
      * @see java.awt.GraphicsEnvironment#isHeadless
      * @since     1.2
      */
+    @Override
     public PageFormat pageDialog(PageFormat page) throws HeadlessException {
         if (GraphicsEnvironment.isHeadless()) {
             throw new HeadlessException();
@@ -156,12 +158,14 @@
      * @return clone of <code>page</code>, altered to describe a default
      *                      <code>PageFormat</code>.
      */
+    @Override
     public PageFormat defaultPage(PageFormat page) {
         PageFormat newPage = (PageFormat)page.clone();
         getDefaultPage(newPage);
         return newPage;
     }
 
+    @Override
     protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
         super.setAttributes(attributes);
 
@@ -216,7 +220,7 @@
         }
     }
 
-
+    @Override
     public void print(PrintRequestAttributeSet attributes) throws PrinterException {
         // NOTE: Some of this code is copied from RasterPrinterJob.
 
@@ -343,6 +347,7 @@
      * Returns the resolution in dots per inch across the width
      * of the page.
      */
+    @Override
     protected double getXRes() {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -352,6 +357,7 @@
      * Returns the resolution in dots per inch down the height
      * of the page.
      */
+    @Override
     protected double getYRes() {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -362,6 +368,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableX(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -372,6 +379,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableY(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -382,6 +390,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableWidth(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -392,6 +401,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPrintableHeight(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -402,6 +412,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPageWidth(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -412,6 +423,7 @@
      * Value is in device pixels.
      * Not adjusted for orientation of the paper.
      */
+    @Override
     protected double getPhysicalPageHeight(Paper p) {
         // NOTE: This is not used in the CPrinterJob code path.
         return 0;
@@ -429,6 +441,7 @@
     /**
      * End a page.
      */
+    @Override
     protected void endPage(PageFormat format, Printable painter, int index) throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
@@ -441,6 +454,7 @@
      * page. The width and height of the band is
      * specified by the caller.
      */
+    @Override
     protected void printBand(byte[] data, int x, int y, int width, int height) throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
@@ -450,6 +464,7 @@
      * Called by the print() method at the start of
      * a print job.
      */
+    @Override
     protected void startDoc() throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
@@ -459,12 +474,14 @@
      * Called by the print() method at the end of
      * a print job.
      */
+    @Override
     protected void endDoc() throws PrinterException {
         // NOTE: This is not used in the CPrinterJob code path.
         throw new PrinterException(sShouldNotReachHere);
     }
 
     /* Called by cancelDoc */
+    @Override
     protected native void abortDoc();
 
     /**
@@ -502,10 +519,12 @@
     /**
      * validate the paper size against the current printer.
      */
+    @Override
     protected native void validatePaper(Paper origPaper, Paper newPaper );
 
     // The following methods are CPrinterJob specific.
 
+    @Override
     protected void finalize() {
         if (fNSPrintInfo != -1) {
             dispose(fNSPrintInfo);
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java b/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
index fb5d959..55da568 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -29,7 +29,7 @@
 import java.awt.*;
 import java.awt.print.*;
 
-public class CPrinterJobDialog extends CPrinterDialog {
+final class CPrinterJobDialog extends CPrinterDialog {
     private Pageable fPageable;
     private boolean fAllowPrintToFile;
 
@@ -39,5 +39,6 @@
         fAllowPrintToFile = allowPrintToFile;
     }
 
+    @Override
     protected native boolean showDialog();
 }
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java b/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
index b4bd34e..95b8e58 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -29,7 +29,7 @@
 import java.awt.*;
 import java.awt.print.*;
 
-public class CPrinterPageDialog extends CPrinterDialog {
+final class CPrinterPageDialog extends CPrinterDialog {
     private PageFormat fPage;
     private Printable fPainter;
 
@@ -39,5 +39,6 @@
         fPainter = painter;
     }
 
+    @Override
     protected native boolean showDialog();
 }
diff --git a/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java b/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
index 082568c..82f6ca9 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -40,11 +40,11 @@
 //    public static final SurfaceType IntArgbPQ = SurfaceType.IntArgb.deriveSubType(DESC_INT_ARGB_PQ);
     public static final SurfaceType IntRgbPQ = SurfaceType.IntRgb.deriveSubType(DESC_INT_RGB_PQ);
 
-    public static SurfaceData createData(PageFormat pf, long context) {
+    static SurfaceData createData(PageFormat pf, long context) {
         return new CPrinterSurfaceData(CPrinterGraphicsConfig.getConfig(pf), context);
     }
 
-    public CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
+    private CPrinterSurfaceData(GraphicsConfiguration gc, long context) {
         super(IntRgbPQ, gc.getColorModel(), gc, gc.getBounds());
         initOps(context, this.fGraphicsStates, this.fGraphicsStatesObject, gc.getBounds().width, gc.getBounds().height);
     }
diff --git a/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java b/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
index dd16615..8e2a18f 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java
@@ -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
@@ -27,7 +27,6 @@
 
 import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
-import sun.lwawt.macosx.event.NSEvent;
 
 import javax.swing.*;
 import java.awt.*;
@@ -76,8 +75,9 @@
                 menuPeer = (CPopupMenu)popup.getPeer();
                 if (menuPeer == null) {
                     popup.addNotify();
+                    menuPeer = (CPopupMenu)popup.getPeer();
                 }
-            }catch (Exception e){
+            } catch (Exception e) {
                 e.printStackTrace();
             }
         }
@@ -97,7 +97,12 @@
     //invocation from the AWTTrayIcon.m
     public long getPopupMenuModel(){
         if(popup == null) {
-            return 0L;
+            PopupMenu popupMenu = target.getPopupMenu();
+            if (popupMenu != null) {
+                popup = popupMenu;
+            } else {
+                return 0L;
+            }
         }
         return checkAndCreatePopupPeer().getModel();
     }
@@ -134,6 +139,10 @@
 
         dummyFrame.dispose();
 
+        if (popup != null) {
+            popup.removeNotify();
+        }
+
         LWCToolkit.targetDisposedPeer(target, this);
         target = null;
 
diff --git a/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java b/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java
index 6d843b8..0d12aa1 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java
@@ -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
@@ -22,14 +22,17 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+
 package sun.lwawt.macosx;
 
 import java.awt.AWTKeyStroke;
 import java.awt.Toolkit;
 import java.lang.reflect.InvocationTargetException;
+
 import sun.awt.EmbeddedFrame;
-import sun.lwawt.LWToolkit;
 import sun.lwawt.LWWindowPeer;
+
 /*
  * The CViewEmbeddedFrame class is used in the SWT_AWT bridge.
  * This is a part of public API and should not be renamed or moved
@@ -48,7 +51,7 @@
     @Override
     public void addNotify() {
         if (getPeer() == null) {
-            LWToolkit toolkit = (LWToolkit) Toolkit.getDefaultToolkit();
+            LWCToolkit toolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
             setPeer(toolkit.createEmbeddedFrame(this));
         }
         super.addNotify();
diff --git a/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java b/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
index 695bf4a..800d76f 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java
@@ -247,10 +247,7 @@
                             nsWindowPtr, CWrapper.NSWindow.NSWindowAbove);
 
                     // do not allow security warning to be obscured by other windows
-                    if (ownerWindow.isAlwaysOnTop()) {
-                        CWrapper.NSWindow.setLevel(nsWindowPtr,
-                                CWrapper.NSWindow.NSFloatingWindowLevel);
-                    }
+                    applyWindowLevel(ownerWindow);
                 }
             }
         }
diff --git a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java
index a9c5523..8c2e9c0 100644
--- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java
+++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java
@@ -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
@@ -25,73 +25,65 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.geom.Rectangle2D;
-
-public final class CWrapper {
+final class CWrapper {
     private CWrapper() { }
 
-    public static final class NSWindow {
+    static final class NSWindow {
         // NSWindowOrderingMode
-        public static final int NSWindowAbove = 1;
-        public static final int NSWindowBelow = -1;
-        public static final int NSWindowOut = 0;
+        static final int NSWindowAbove = 1;
+        static final int NSWindowBelow = -1;
+        static final int NSWindowOut = 0;
 
         // Window level constants
         // The number of supported levels: (we'll use more in the future)
-        public static final int MAX_WINDOW_LEVELS = 2;
+        static final int MAX_WINDOW_LEVELS = 3;
         // The levels: (these are NOT real constants, these are keys. See native code.)
-        public static final int NSNormalWindowLevel = 0;
-        public static final int NSFloatingWindowLevel = 1;
+        static final int NSNormalWindowLevel = 0;
+        static final int NSFloatingWindowLevel = 1;
+        static final int NSPopUpMenuWindowLevel = 2;
 
         // 'level' is one of the keys defined above
-        public static native void setLevel(long window, int level);
+        static native void setLevel(long window, int level);
 
-        public static native void makeKeyAndOrderFront(long window);
-        public static native void makeKeyWindow(long window);
-        public static native void makeMainWindow(long window);
-        public static native boolean canBecomeMainWindow(long window);
-        public static native boolean isKeyWindow(long window);
+        static native void makeKeyAndOrderFront(long window);
+        static native void makeKeyWindow(long window);
+        static native void makeMainWindow(long window);
+        static native boolean canBecomeMainWindow(long window);
+        static native boolean isKeyWindow(long window);
 
-        public static native void orderFront(long window);
-        public static native void orderFrontRegardless(long window);
-        public static native void orderWindow(long window, int ordered, long relativeTo);
-        public static native void orderOut(long window);
+        static native void orderFront(long window);
+        static native void orderFrontRegardless(long window);
+        static native void orderWindow(long window, int ordered, long relativeTo);
+        static native void orderOut(long window);
 
-        public static native void addChildWindow(long parent, long child, int ordered);
-        public static native void removeChildWindow(long parent, long child);
+        static native void addChildWindow(long parent, long child, int ordered);
+        static native void removeChildWindow(long parent, long child);
 
-        public static native void setFrame(long window, int x, int y, int w, int h, boolean display);
+        static native void setAlphaValue(long window, float alpha);
+        static native void setOpaque(long window, boolean opaque);
+        static native void setBackgroundColor(long window, long color);
 
-        public static native void setAlphaValue(long window, float alpha);
-        public static native void setOpaque(long window, boolean opaque);
-        public static native void setBackgroundColor(long window, long color);
+        static native void miniaturize(long window);
+        static native void deminiaturize(long window);
+        static native boolean isZoomed(long window);
+        static native void zoom(long window);
 
-        public static native void miniaturize(long window);
-        public static native void deminiaturize(long window);
-        public static native boolean isZoomed(long window);
-        public static native void zoom(long window);
-
-        public static native void makeFirstResponder(long window, long responder);
+        static native void makeFirstResponder(long window, long responder);
     }
 
-    public static final class NSView {
-        public static native void addSubview(long view, long subview);
-        public static native void removeFromSuperview(long view);
+    static final class NSView {
+        static native void addSubview(long view, long subview);
+        static native void removeFromSuperview(long view);
 
-        public static native void setFrame(long view, int x, int y, int w, int h);
-        public static native Rectangle2D frame(long view);
-        public static native long window(long view);
+        static native void setFrame(long view, int x, int y, int w, int h);
+        static native long window(long view);
 
-        public static native void setHidden(long view, boolean hidden);
+        static native void setHidden(long view, boolean hidden);
 
-        public static native void setToolTip(long view, String msg);
+        static native void setToolTip(long view, String msg);
     }
 
-    public static final class NSObject {
-        public static native void release(long object);
-    }
-
-    public static final class NSColor {
-        public static native long clearColor();
+    static final class NSColor {
+        static native long clearColor();
     }
 }
diff --git a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
index 959b038..fc587f2 100644
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
@@ -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
@@ -33,20 +33,25 @@
 import java.awt.event.InvocationEvent;
 import java.awt.event.KeyEvent;
 import java.awt.im.InputMethodHighlight;
+import java.awt.im.spi.InputMethodDescriptor;
 import java.awt.peer.*;
 import java.lang.reflect.*;
+import java.net.URL;
 import java.security.*;
 import java.util.*;
 import java.util.concurrent.Callable;
+import java.net.MalformedURLException;
 
 import sun.awt.*;
+import sun.awt.datatransfer.DataTransferer;
 import sun.lwawt.*;
 import sun.lwawt.LWWindowPeer.PeerType;
 import sun.security.action.GetBooleanAction;
+import sun.awt.image.MultiResolutionImage;
 
 import sun.util.CoreResourceBundleControl;
 
-class NamedCursor extends Cursor {
+final class NamedCursor extends Cursor {
     NamedCursor(String name) {
         super(name);
     }
@@ -72,6 +77,7 @@
 
         ResourceBundle platformResources = java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<ResourceBundle>() {
+            @Override
             public ResourceBundle run() {
                 ResourceBundle platformResources = null;
                 try {
@@ -109,8 +115,6 @@
     private static final boolean inAWT;
 
     public LWCToolkit() {
-        SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer");
-
         areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
         //set system property if not yet assigned
         System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
@@ -131,18 +135,20 @@
 
     private native void loadNativeColors(final int[] systemColors, final int[] appleColors);
 
+    @Override
     protected void loadSystemColors(final int[] systemColors) {
         if (systemColors == null) return;
         loadNativeColors(systemColors, appleColors);
     }
 
     private static class AppleSpecificColor extends Color {
-        int index;
-        public AppleSpecificColor(int index) {
+        private final int index;
+        AppleSpecificColor(int index) {
             super(appleColors[index]);
             this.index = index;
         }
 
+        @Override
         public int getRGB() {
             return appleColors[index];
         }
@@ -150,31 +156,19 @@
 
     /**
      * Returns Apple specific colors that we may expose going forward.
-     *
      */
     public static Color getAppleColor(int color) {
         return new AppleSpecificColor(color);
     }
 
+    // This is only called from native code.
     static void systemColorsChanged() {
-        // This is only called from native code.
-        EventQueue.invokeLater(new Runnable() {
-            public void run() {
-                AccessController.doPrivileged (new PrivilegedAction<Object>() {
-                    public Object run() {
-                        try {
-                            final Method updateColorsMethod = SystemColor.class.getDeclaredMethod("updateSystemColors", new Class[0]);
-                            updateColorsMethod.setAccessible(true);
-                            updateColorsMethod.invoke(null, new Object[0]);
-                        } catch (final Throwable e) {
-                            e.printStackTrace();
-                            // swallow this if something goes horribly wrong
-                        }
-                        return null;
-                    }
-                });
-            }
-           });
+        EventQueue.invokeLater(() -> {
+            AccessController.doPrivileged ((PrivilegedAction<Object>) () -> {
+                AWTAccessor.getSystemColorAccessor().updateSystemColors();
+                return null;
+            });
+        });
     }
 
     public static LWCToolkit getLWCToolkit() {
@@ -190,13 +184,44 @@
         } else if (peerType == PeerType.LW_FRAME) {
             return new CPlatformLWWindow();
         } else {
-            assert (peerType == PeerType.SIMPLEWINDOW || peerType == PeerType.DIALOG || peerType == PeerType.FRAME);
+            assert (peerType == PeerType.SIMPLEWINDOW
+                    || peerType == PeerType.DIALOG
+                    || peerType == PeerType.FRAME);
             return new CPlatformWindow();
         }
     }
 
+    LWWindowPeer createEmbeddedFrame(CEmbeddedFrame target) {
+        PlatformComponent platformComponent = createPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.EMBEDDED_FRAME);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.EMBEDDED_FRAME);
+    }
+
+    LWWindowPeer createEmbeddedFrame(CViewEmbeddedFrame target) {
+        PlatformComponent platformComponent = createPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.VIEW_EMBEDDED_FRAME);
+        return createDelegatedPeer(target, platformComponent, platformWindow, PeerType.VIEW_EMBEDDED_FRAME);
+    }
+
+    private CPrinterDialogPeer createCPrinterDialog(CPrinterDialog target) {
+        PlatformComponent platformComponent = createPlatformComponent();
+        PlatformWindow platformWindow = createPlatformWindow(PeerType.DIALOG);
+        CPrinterDialogPeer peer = new CPrinterDialogPeer(target, platformComponent, platformWindow);
+        targetCreatedPeer(target, peer);
+        return peer;
+    }
+
     @Override
-    protected SecurityWarningWindow createSecurityWarning(Window ownerWindow, LWWindowPeer ownerPeer) {
+    public DialogPeer createDialog(Dialog target) {
+        if (target instanceof CPrinterDialog) {
+            return createCPrinterDialog((CPrinterDialog)target);
+        }
+        return super.createDialog(target);
+    }
+
+    @Override
+    protected SecurityWarningWindow createSecurityWarning(Window ownerWindow,
+                                                          LWWindowPeer ownerPeer) {
         return new CWarningWindow(ownerWindow, ownerPeer);
     }
 
@@ -248,13 +273,11 @@
         PopupMenuPeer peer = new CPopupMenu(target);
         targetCreatedPeer(target, peer);
         return peer;
-
     }
 
     @Override
     public SystemTrayPeer createSystemTray(SystemTray target) {
-        SystemTrayPeer peer = new CSystemTray();
-        return peer;
+        return new CSystemTray();
     }
 
     @Override
@@ -265,56 +288,63 @@
     }
 
     @Override
+    protected DesktopPeer createDesktopPeer(Desktop target) {
+        return new CDesktopPeer();
+    }
+
+    @Override
     public LWCursorManager getCursorManager() {
         return CCursorManager.getInstance();
     }
 
     @Override
-    public Cursor createCustomCursor(final Image cursor, final Point hotSpot, final String name) throws IndexOutOfBoundsException, HeadlessException {
+    public Cursor createCustomCursor(final Image cursor, final Point hotSpot,
+                                     final String name)
+            throws IndexOutOfBoundsException, HeadlessException {
         return new CCustomCursor(cursor, hotSpot, name);
     }
 
     @Override
-    public Dimension getBestCursorSize(final int preferredWidth, final int preferredHeight) throws HeadlessException {
+    public Dimension getBestCursorSize(final int preferredWidth,
+                                       final int preferredHeight)
+            throws HeadlessException {
         return CCustomCursor.getBestCursorSize(preferredWidth, preferredHeight);
     }
 
     @Override
     protected void platformCleanup() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
     protected void platformInit() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
     protected void platformRunMessage() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
     protected void platformShutdown() {
         // TODO Auto-generated method stub
-
     }
 
     class OSXPlatformFont extends sun.awt.PlatformFont
     {
-        public OSXPlatformFont(String name, int style)
+        OSXPlatformFont(String name, int style)
         {
             super(name, style);
         }
+        @Override
         protected char getMissingGlyphCharacter()
         {
             // Follow up for real implementation
             return (char)0xfff8; // see http://developer.apple.com/fonts/LastResortFont/
         }
     }
+    @Override
     public FontPeer getFontPeer(String name, int style) {
         return new OSXPlatformFont(name, style);
     }
@@ -334,7 +364,7 @@
     @Override
     protected void initializeDesktopProperties() {
         super.initializeDesktopProperties();
-        Map <Object, Object> fontHints = new HashMap<Object, Object>();
+        Map <Object, Object> fontHints = new HashMap<>();
         fontHints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
         fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
         desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
@@ -355,14 +385,8 @@
         desktopProperties.put("DnD.Cursor.CopyNoDrop", new NamedCursor("DnD.Cursor.CopyNoDrop"));
         desktopProperties.put("DnD.Cursor.MoveNoDrop", new NamedCursor("DnD.Cursor.MoveNoDrop"));
         desktopProperties.put("DnD.Cursor.LinkNoDrop", new NamedCursor("DnD.Cursor.LinkNoDrop"));
-
     }
 
-
-/*
- * The method returns true if some events were processed during that timeout.
- * @see sun.awt.SunToolkit#syncNativeQueue(long)
- */
     @Override
     protected boolean syncNativeQueue(long timeout) {
         return nativeSyncQueue(timeout);
@@ -386,7 +410,6 @@
     @Override
     public void sync() {
         // TODO Auto-generated method stub
-
     }
 
     @Override
@@ -406,6 +429,7 @@
      * as Num Lock on PC keyboards is called Clear, doesn't lock
      * anything and is used for entirely different purpose.
      */
+    @Override
     public boolean getLockingKeyState(int keyCode) throws UnsupportedOperationException {
         switch (keyCode) {
             case KeyEvent.VK_NUM_LOCK:
@@ -425,10 +449,12 @@
     //Set to true by default.
     private static boolean areExtraMouseButtonsEnabled = true;
 
+    @Override
     public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
         return areExtraMouseButtonsEnabled;
     }
 
+    @Override
     public int getNumberOfButtons(){
         return BUTTONS;
     }
@@ -439,6 +465,11 @@
     }
 
     @Override
+    public DataTransferer getDataTransferer() {
+        return CDataTransferer.getInstanceImpl();
+    }
+
+    @Override
     public boolean isAlwaysOnTopSupported() {
         return true;
     }
@@ -482,6 +513,7 @@
      * @see       java.awt.MenuShortcut
      * @since     JDK1.1
      */
+    @Override
     public int getMenuShortcutKeyMask() {
         return Event.META_MASK;
     }
@@ -489,13 +521,34 @@
     @Override
     public Image getImage(final String filename) {
         final Image nsImage = checkForNSImage(filename);
-        if (nsImage != null) return nsImage;
+        if (nsImage != null) {
+            return nsImage;
+        }
 
-        return super.getImage(filename);
+        if (imageCached(filename)) {
+            return super.getImage(filename);
+        }
+
+        String fileneame2x = getScaledImageName(filename);
+        return (imageExists(fileneame2x))
+                ? getImageWithResolutionVariant(filename, fileneame2x)
+                : super.getImage(filename);
     }
 
-    static final String nsImagePrefix = "NSImage://";
-    protected Image checkForNSImage(final String imageName) {
+    @Override
+    public Image getImage(URL url) {
+
+        if (imageCached(url)) {
+            return super.getImage(url);
+        }
+
+        URL url2x = getScaledImageURL(url);
+        return (imageExists(url2x))
+                ? getImageWithResolutionVariant(url, url2x) : super.getImage(url);
+    }
+
+    private static final String nsImagePrefix = "NSImage://";
+    private Image checkForNSImage(final String imageName) {
         if (imageName == null) return null;
         if (!imageName.startsWith(nsImagePrefix)) return null;
         return CImage.getCreator().createImageFromName(imageName.substring(nsImagePrefix.length()));
@@ -514,8 +567,9 @@
         synchronized(ret) { return ret[0]; }
     }
 
-    public static <T> T invokeAndWait(final Callable<T> callable, Component component) throws Exception {
-        final CallableWrapper<T> wrapper = new CallableWrapper<T>(callable);
+    public static <T> T invokeAndWait(final Callable<T> callable,
+                                      Component component) throws Exception {
+        final CallableWrapper<T> wrapper = new CallableWrapper<>(callable);
         invokeAndWait(wrapper, component);
         return wrapper.getResult();
     }
@@ -525,10 +579,11 @@
         T object;
         Exception e;
 
-        public CallableWrapper(final Callable<T> callable) {
+        CallableWrapper(final Callable<T> callable) {
             this.callable = callable;
         }
 
+        @Override
         public void run() {
             try {
                 object = callable.call();
@@ -543,12 +598,16 @@
         }
     }
 
-    // Kicks an event over to the appropriate eventqueue 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
-    public static void invokeAndWait(Runnable runnable, Component component) throws InvocationTargetException {
+    /**
+     * Kicks an event over to the appropriate eventqueue 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
+     */
+    public static void invokeAndWait(Runnable runnable, Component component)
+            throws InvocationTargetException {
         final long mediator = createAWTRunLoopMediator();
 
         InvocationEvent invocationEvent =
@@ -583,7 +642,8 @@
         }
     }
 
-    public static void invokeLater(Runnable event, Component component) throws InvocationTargetException {
+    public static void invokeLater(Runnable event, Component component)
+            throws InvocationTargetException {
         final InvocationEvent invocationEvent =
                 new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
 
@@ -612,16 +672,18 @@
         return getSystemEventQueueImpl();
     }
 
-
 // DnD support
 
-    public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
-        DragSourceContextPeer dscp = CDragSourceContextPeer.createDragSourceContextPeer(dge);
-
-        return dscp;
+    @Override
+    public DragSourceContextPeer createDragSourceContextPeer(
+            DragGestureEvent dge) throws InvalidDnDOperationException {
+        return CDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
-    public <T extends DragGestureRecognizer> T createDragGestureRecognizer(Class<T> abstractRecognizerClass, DragSource ds, Component c, int srcActions, DragGestureListener dgl) {
+    @Override
+    public <T extends DragGestureRecognizer> T createDragGestureRecognizer(
+            Class<T> abstractRecognizerClass, DragSource ds, Component c,
+            int srcActions, DragGestureListener dgl) {
         DragGestureRecognizer dgr = null;
 
         // Create a new mouse drag gesture recognizer if we have a class match:
@@ -635,6 +697,7 @@
     /**
      * Returns the default keyboard locale of the underlying operating system
      */
+    @Override
     public Locale getDefaultKeyboardLocale() {
         Locale locale = CInputMethod.getNativeLocale();
 
@@ -645,7 +708,8 @@
         return locale;
     }
 
-    public java.awt.im.spi.InputMethodDescriptor getInputMethodAdapterDescriptor() {
+    @Override
+    public InputMethodDescriptor getInputMethodAdapterDescriptor() {
         if (sInputMethodDescriptor == null)
             sInputMethodDescriptor = new CInputMethodDescriptor();
 
@@ -661,12 +725,14 @@
      * @return style attribute map, or null
      * @since 1.3
      */
+    @Override
     public Map mapInputMethodHighlight(InputMethodHighlight highlight) {
         return CInputMethod.mapInputMethodHighlight(highlight);
     }
 
     /**
-     * Returns key modifiers used by Swing to set up a focus accelerator key stroke.
+     * Returns key modifiers used by Swing to set up a focus accelerator key
+     * stroke.
      */
     @Override
     public int getFocusAcceleratorKeyMask() {
@@ -674,8 +740,8 @@
     }
 
     /**
-     * Tests whether specified key modifiers mask can be used to enter a printable
-     * character.
+     * Tests whether specified key modifiers mask can be used to enter a
+     * printable character.
      */
     @Override
     public boolean isPrintableCharacterModifiersMask(int mods) {
@@ -696,19 +762,18 @@
      * Returns the value of "sun.awt.disableCALayers" property. Default
      * value is {@code false}.
      */
-    public synchronized static boolean getSunAwtDisableCALayers() {
+    public static synchronized boolean getSunAwtDisableCALayers() {
         if (sunAwtDisableCALayers == null) {
             sunAwtDisableCALayers = AccessController.doPrivileged(
                 new GetBooleanAction("sun.awt.disableCALayers"));
         }
-        return sunAwtDisableCALayers.booleanValue();
+        return sunAwtDisableCALayers;
     }
 
-
     /*
      * Returns true if the application (one of its windows) owns keyboard focus.
      */
-    public native boolean isApplicationActive();
+    native boolean isApplicationActive();
 
     /************************
      * Native methods section
@@ -729,7 +794,7 @@
     static void doAWTRunLoop(long mediator, boolean processEvents) {
         doAWTRunLoopImpl(mediator, processEvents, inAWT);
     }
-    static private native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
+    private static native void doAWTRunLoopImpl(long mediator, boolean processEvents, boolean inAWT);
     static native void stopAWTRunLoop(long mediator);
 
     private native boolean nativeSyncQueue(long timeout);
@@ -773,6 +838,7 @@
         return true;
     }
 
+    @Override
     public boolean isSwingBackbufferTranslucencySupported() {
         return true;
     }
@@ -781,4 +847,36 @@
     public boolean enableInputMethodsForTextComponent() {
         return true;
     }
+
+    private static URL getScaledImageURL(URL url) {
+        try {
+            String scaledImagePath = getScaledImageName(url.getPath());
+            return scaledImagePath == null ? null : new URL(url.getProtocol(),
+                    url.getHost(), url.getPort(), scaledImagePath);
+        } catch (MalformedURLException e) {
+            return null;
+        }
+    }
+
+    private static String getScaledImageName(String path) {
+        if (!isValidPath(path)) {
+            return null;
+        }
+
+        int slash = path.lastIndexOf('/');
+        String name = (slash < 0) ? path : path.substring(slash + 1);
+
+        if (name.contains("@2x")) {
+            return null;
+        }
+
+        int dot = name.lastIndexOf('.');
+        String name2x = (dot < 0) ? name + "@2x"
+                : name.substring(0, dot) + "@2x" + name.substring(dot);
+        return (slash < 0) ? name2x : path.substring(0, slash + 1) + name2x;
+    }
+
+    private static boolean isValidPath(String path) {
+        return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".");
+    }
 }
diff --git a/src/macosx/classes/sun/lwawt/macosx/event/NSEvent.java b/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
similarity index 84%
rename from src/macosx/classes/sun/lwawt/macosx/event/NSEvent.java
rename to src/macosx/classes/sun/lwawt/macosx/NSEvent.java
index 31e2498..ddb74d4 100644
--- a/src/macosx/classes/sun/lwawt/macosx/event/NSEvent.java
+++ b/src/macosx/classes/sun/lwawt/macosx/NSEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -23,16 +23,15 @@
  * questions.
  */
 
-package sun.lwawt.macosx.event;
+package sun.lwawt.macosx;
 
-import sun.lwawt.macosx.CocoaConstants;
 import java.awt.event.*;
 
 /**
  * A class representing Cocoa NSEvent class with the fields only necessary for
  * JDK functionality.
  */
-public final class NSEvent {
+final class NSEvent {
     private int type;
     private int modifierFlags;
 
@@ -50,14 +49,16 @@
     private short keyCode;
     private String charactersIgnoringModifiers;
 
-    public NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
+    // Called from native
+    NSEvent(int type, int modifierFlags, short keyCode, String charactersIgnoringModifiers) {
         this.type = type;
         this.modifierFlags = modifierFlags;
         this.keyCode = keyCode;
         this.charactersIgnoringModifiers = charactersIgnoringModifiers;
     }
 
-    public NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
+    // Called from native
+    NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
                    int x, int y, int absX, int absY,
                    double scrollDeltaY, double scrollDeltaX) {
         this.type = type;
@@ -72,51 +73,51 @@
         this.scrollDeltaX = scrollDeltaX;
     }
 
-    public int getType() {
+    int getType() {
         return type;
     }
 
-    public int getModifierFlags() {
+    int getModifierFlags() {
         return modifierFlags;
     }
 
-    public int getClickCount() {
+    int getClickCount() {
         return clickCount;
     }
 
-    public int getButtonNumber() {
+    int getButtonNumber() {
         return buttonNumber;
     }
 
-    public int getX() {
+    int getX() {
         return x;
     }
 
-    public int getY() {
+    int getY() {
         return y;
     }
 
-    public double getScrollDeltaY() {
+    double getScrollDeltaY() {
         return scrollDeltaY;
     }
 
-    public double getScrollDeltaX() {
+    double getScrollDeltaX() {
         return scrollDeltaX;
     }
 
-    public int getAbsX() {
+    int getAbsX() {
         return absX;
     }
 
-    public int getAbsY() {
+    int getAbsY() {
         return absY;
     }
 
-    public short getKeyCode() {
+    short getKeyCode() {
         return keyCode;
     }
 
-    public String getCharactersIgnoringModifiers() {
+    String getCharactersIgnoringModifiers() {
         return charactersIgnoringModifiers;
     }
 
@@ -131,7 +132,7 @@
     /*
      * Converts an NSEvent button number to a MouseEvent constant.
      */
-    public static int nsToJavaButton(int buttonNumber) {
+    static int nsToJavaButton(int buttonNumber) {
         int jbuttonNumber = buttonNumber + 1;
         switch (buttonNumber) {
             case CocoaConstants.kCGMouseButtonLeft:
@@ -150,7 +151,7 @@
     /*
      * Converts NPCocoaEvent types to AWT event types.
      */
-    public static int npToJavaEventType(int npEventType) {
+    static int npToJavaEventType(int npEventType) {
         int jeventType = 0;
         switch (npEventType) {
             case CocoaConstants.NPCocoaEventMouseDown:
@@ -184,7 +185,7 @@
     /*
      * Converts NSEvent types to AWT event types.
      */
-    public static int nsToJavaEventType(int nsEventType) {
+    static int nsToJavaEventType(int nsEventType) {
         int jeventType = 0;
         switch (nsEventType) {
             case CocoaConstants.NSLeftMouseDown:
@@ -227,31 +228,31 @@
     /*
      * Converts NSEvent mouse modifiers to AWT mouse modifiers.
      */
-    public static native int nsToJavaMouseModifiers(int buttonNumber,
+    static native int nsToJavaMouseModifiers(int buttonNumber,
                                                     int modifierFlags);
 
     /*
      * Converts NSEvent key modifiers to AWT key modifiers.
      */
-    public static native int nsToJavaKeyModifiers(int modifierFlags);
+    static native int nsToJavaKeyModifiers(int modifierFlags);
 
     /*
      * Converts NSEvent key info to AWT key info.
      */
-    public static native boolean nsToJavaKeyInfo(int[] in, int[] out);
+    static native boolean nsToJavaKeyInfo(int[] in, int[] out);
 
     /*
      * Converts NSEvent key modifiers to AWT key info.
      */
-    public static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
+    static native void nsKeyModifiersToJavaKeyInfo(int[] in, int[] out);
 
     /*
      * There is a small number of NS characters that need to be converted
      * into other characters before we pass them to AWT.
      */
-    public static native char nsToJavaChar(char nsChar, int modifierFlags);
+    static native char nsToJavaChar(char nsChar, int modifierFlags);
 
-    public static boolean isPopupTrigger(int jmodifiers) {
+    static boolean isPopupTrigger(int jmodifiers) {
         final boolean isRightButtonDown = ((jmodifiers & InputEvent.BUTTON3_DOWN_MASK) != 0);
         final boolean isLeftButtonDown = ((jmodifiers & InputEvent.BUTTON1_DOWN_MASK) != 0);
         final boolean isControlDown = ((jmodifiers & InputEvent.CTRL_DOWN_MASK) != 0);
diff --git a/src/macosx/lib/flavormap.properties b/src/macosx/lib/flavormap.properties
index b00f2c2..8f17d95 100644
--- a/src/macosx/lib/flavormap.properties
+++ b/src/macosx/lib/flavormap.properties
@@ -79,3 +79,5 @@
 TIFF=image/x-java-image;class=java.awt.Image
 RICH_TEXT=text/rtf
 HTML=text/html;charset=utf-8;eoln="\r\n";terminators=1
+URL=application/x-java-url;class=java.net.URL
+URL=text/uri-list;eoln="\r\n";terminators=1
diff --git a/src/macosx/native/com/apple/laf/AquaFileView.m b/src/macosx/native/com/apple/laf/AquaFileView.m
index f044a94..55607d3 100644
--- a/src/macosx/native/com/apple/laf/AquaFileView.m
+++ b/src/macosx/native/com/apple/laf/AquaFileView.m
@@ -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
@@ -23,6 +23,9 @@
  * questions.
  */
 
+
+#include <jni_util.h>
+
 #import "com_apple_laf_AquaFileView.h"
 
 #import <sys/param.h> // for MAXPATHLEN
@@ -98,6 +101,7 @@
 JNF_COCOA_ENTER(env);
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, absolutePath);
 
     // Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@@ -138,6 +142,7 @@
 JNF_COCOA_ENTER(env);
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, absolutePath, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, absolutePath);
 
     // Can't assume that byteArray is NULL terminated and FSPathMakeRef doesn't
@@ -153,7 +158,9 @@
     Boolean isDirectory = (isDir == JNI_TRUE ? true : false);
     FSRef ref;
 
-    OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy, kFSPathMakeRefDoNotFollowLeafSymlink, &ref, &isDirectory);
+    OSErr theErr = FSPathMakeRefWithOptions((const UInt8 *)&arrayCopy,
+                                            kFSPathMakeRefDoNotFollowLeafSymlink,
+                                            &ref, &isDirectory);
     if (theErr == noErr) {
         CFStringRef displayName = NULL;
 
@@ -190,6 +197,7 @@
     size_t maxPathLen = sizeof(pathCString) - 1;
 
     jbyte *byteArray = (*env)->GetByteArrayElements(env, pathToAlias, NULL);
+    CHECK_NULL_RETURN(byteArray, returnValue);
     jsize length = (*env)->GetArrayLength(env, pathToAlias);
 
     if (length > maxPathLen) {
@@ -205,7 +213,8 @@
     OSErr theErr = FSPathMakeRef(pathCString, &fileRef, &isDirectory);
 
     Boolean ignored;
-    theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored, &ignored, kResolveAliasFileNoUI);
+    theErr = FSResolveAliasFileWithMountFlags(&fileRef, false, &ignored,
+                                              &ignored, kResolveAliasFileNoUI);
     if (theErr == noErr) {
         UInt8 resolvedPath[MAXPATHLEN];
         theErr = FSRefMakePath(&fileRef, resolvedPath, MAXPATHLEN);
diff --git a/src/macosx/native/sun/awt/AWTEvent.m b/src/macosx/native/sun/awt/AWTEvent.m
index c6bda77..3a7aab4 100644
--- a/src/macosx/native/sun/awt/AWTEvent.m
+++ b/src/macosx/native/sun/awt/AWTEvent.m
@@ -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
@@ -633,12 +633,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaMouseModifiers
  * Signature: (II)I
  */
 JNIEXPORT jint JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaMouseModifiers
+Java_sun_lwawt_macosx_NSEvent_nsToJavaMouseModifiers
 (JNIEnv *env, jclass cls, jint buttonNumber, jint modifierFlags)
 {
     jint jmodifiers = 0;
@@ -653,12 +653,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaKeyModifiers
  * Signature: (I)I
  */
 JNIEXPORT jint JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyModifiers
+Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyModifiers
 (JNIEnv *env, jclass cls, jint modifierFlags)
 {
     jint jmodifiers = 0;
@@ -673,12 +673,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaKeyInfo
  * Signature: ([I[I)Z
  */
 JNIEXPORT jboolean JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyInfo
+Java_sun_lwawt_macosx_NSEvent_nsToJavaKeyInfo
 (JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
 {
     BOOL postsTyped = NO;
@@ -715,12 +715,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsKeyModifiersToJavaKeyInfo
  * Signature: ([I[I)V
  */
 JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsKeyModifiersToJavaKeyInfo
+Java_sun_lwawt_macosx_NSEvent_nsKeyModifiersToJavaKeyInfo
 (JNIEnv *env, jclass cls, jintArray inData, jintArray outData)
 {
 JNF_COCOA_ENTER(env);
@@ -753,12 +753,12 @@
 }
 
 /*
- * Class:     sun_lwawt_macosx_event_NSEvent
+ * Class:     sun_lwawt_macosx_NSEvent
  * Method:    nsToJavaChar
  * Signature: (CI)C
  */
 JNIEXPORT jint JNICALL
-Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar
+Java_sun_lwawt_macosx_NSEvent_nsToJavaChar
 (JNIEnv *env, jclass cls, jchar nsChar, jint modifierFlags)
 {
     jchar javaChar = 0;
diff --git a/src/macosx/native/sun/awt/AWTView.h b/src/macosx/native/sun/awt/AWTView.h
index 58e4f6e..592235b 100644
--- a/src/macosx/native/sun/awt/AWTView.h
+++ b/src/macosx/native/sun/awt/AWTView.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -29,7 +29,7 @@
 #import "CDragSource.h"
 #import "CDropTarget.h"
 
-@interface AWTView : NSView<NSTextInputClient> {
+@interface AWTView : NSView<NSTextInputClient, CDragSourceHolder, CDropTargetHolder> {
 @private
     jobject m_cPlatformView;
 
@@ -61,14 +61,8 @@
 
 - (id) initWithRect:(NSRect) rect platformView:(jobject)cPlatformView windowLayer:(CALayer*)windowLayer;
 - (void) deliverJavaMouseEvent: (NSEvent *) event;
-- (void) resetTrackingArea;
-- (void) deliverJavaKeyEventHelper: (NSEvent *) event;
 - (jobject) awtComponent:(JNIEnv *)env;
 
-- (void) setDragSource:(CDragSource *)source;
-- (void) setDropTarget:(CDropTarget *)target;
-
-
 // Input method-related events
 - (void)setInputMethod:(jobject)inputMethod;
 - (void)abandonInput;
diff --git a/src/macosx/native/sun/awt/AWTView.m b/src/macosx/native/sun/awt/AWTView.m
index 0356ebc..8b4d06a 100644
--- a/src/macosx/native/sun/awt/AWTView.m
+++ b/src/macosx/native/sun/awt/AWTView.m
@@ -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
@@ -42,6 +42,10 @@
 @interface AWTView()
 @property (retain) CDropTarget *_dropTarget;
 @property (retain) CDragSource *_dragSource;
+
+-(void) deliverResize: (NSRect) rect;
+-(void) resetTrackingArea;
+-(void) deliverJavaKeyEventHelper: (NSEvent*) event;
 @end
 
 // Uncomment this line to see fprintfs of each InputMethod API being called on this View
@@ -363,7 +367,7 @@
     // TODO: need consitent way for doing that both with global as well as with local coordinates.
     // The reason to do it here is one more native method for getting screen dimension otherwise.
 
-    NSRect screenRect = [[NSScreen mainScreen] frame];
+    NSRect screenRect = [[[NSScreen screens] objectAtIndex:0] frame];
     absP.y = screenRect.size.height - absP.y;
     jint clickCount;
 
@@ -376,7 +380,7 @@
         clickCount = [event clickCount];
     }
 
-    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
+    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
@@ -393,7 +397,7 @@
     }
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
-    static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
+    static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
 }
 
@@ -441,7 +445,7 @@
         characters = JNFNSToJavaString(env, [event characters]);
     }
 
-    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
+    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,
                                   [event type],
@@ -451,7 +455,7 @@
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
-                            "deliverKeyEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
+                            "deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
 
     if (characters != NULL) {
diff --git a/src/macosx/native/sun/awt/CDataTransferer.m b/src/macosx/native/sun/awt/CDataTransferer.m
index 5e997bf..d648e92 100644
--- a/src/macosx/native/sun/awt/CDataTransferer.m
+++ b/src/macosx/native/sun/awt/CDataTransferer.m
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -28,6 +28,7 @@
 
 #import <AppKit/AppKit.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import "jni_util.h"
 
 #include "ThreadUtilities.h"
 
@@ -172,7 +173,9 @@
         NSData *tiffImage = [imageRep TIFFRepresentation];
         jsize tiffSize = (jsize)[tiffImage length]; // #warning 64-bit: -length returns NSUInteger, but NewByteArray takes jsize
         returnValue = (*env)->NewByteArray(env, tiffSize);
+        CHECK_NULL_RETURN(returnValue, nil);
         jbyte *tiffData = (jbyte *)(*env)->GetPrimitiveArrayCritical(env, returnValue, 0);
+        CHECK_NULL_RETURN(tiffData, nil);
         [tiffImage getBytes:tiffData];
         (*env)->ReleasePrimitiveArrayCritical(env, returnValue, tiffData, 0); // Do not use JNI_COMMIT, as that will not free the buffer copy when +ProtectJavaHeap is on.
         [imageRep release];
@@ -184,12 +187,13 @@
 
 static jobject getImageForByteStream(JNIEnv *env, jbyteArray sourceData)
 {
-    if (sourceData == NULL) return NULL;
+    CHECK_NULL_RETURN(sourceData, NULL);
 
     jsize sourceSize = (*env)->GetArrayLength(env, sourceData);
     if (sourceSize == 0) return NULL;
 
     jbyte *sourceBytes = (*env)->GetPrimitiveArrayCritical(env, sourceData, NULL);
+    CHECK_NULL_RETURN(sourceBytes, NULL);
     NSData *rawData = [NSData dataWithBytes:sourceBytes length:sourceSize];
 
     NSImage *newImage = [[NSImage alloc] initWithData:rawData];
@@ -197,8 +201,7 @@
     [newImage release];
 
     (*env)->ReleasePrimitiveArrayCritical(env, sourceData, sourceBytes, JNI_ABORT);
-
-    if (newImage == nil) return NULL;
+    CHECK_NULL_RETURN(newImage, NULL);
 
     // The ownership of the NSImage is passed to the new CImage jobject. No need to release it.
     static JNF_CLASS_CACHE(jc_CImage, "sun/lwawt/macosx/CImage");
@@ -231,7 +234,8 @@
     if (filenameCount == 0) return nil;
 
     // Get the java.lang.String class object:
-    jclass stringClazz = (*env)->FindClass(env, "java/lang/String"); // can't be null
+    jclass stringClazz = (*env)->FindClass(env, "java/lang/String");
+    CHECK_NULL_RETURN(stringClazz, nil);
     jobject jfilenameArray = (*env)->NewObjectArray(env, filenameCount, stringClazz, NULL); // AWT_THREADING Safe (known object)
     if ((*env)->ExceptionOccurred(env)) {
         (*env)->ExceptionDescribe(env);
diff --git a/src/macosx/native/sun/awt/CDragSource.h b/src/macosx/native/sun/awt/CDragSource.h
index 96e0e68..9cc9b78 100644
--- a/src/macosx/native/sun/awt/CDragSource.h
+++ b/src/macosx/native/sun/awt/CDragSource.h
@@ -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
@@ -29,9 +29,15 @@
 #import <Cocoa/Cocoa.h>
 #include <jni.h>
 
+@class CDragSource;
+
+@protocol CDragSourceHolder
+- (void) setDragSource:(CDragSource *)source;
+@end
+
 @interface CDragSource : NSObject {
 @private
-    NSView*        fView;
+    NSView<CDragSourceHolder>* fView;
     jobject            fComponent;
     jobject            fDragSourceContextPeer;
 
@@ -53,8 +59,6 @@
     jint                     fDragMouseModifiers;
 }
 
-+ (CDragSource *) currentDragSource;
-
 // Common methods:
 - (id)        init:(jobject)jDragSourceContextPeer
          component:(jobject)jComponent
@@ -66,7 +70,7 @@
          modifiers:(jint)extModifiers
         clickCount:(jint)clickCount
          timeStamp:(jlong)timeStamp
-         dragImage:(jobject)jDragImage
+         dragImage:(jlong)nsDragImagePtr
   dragImageOffsetX:(jint)jDragImageOffsetX
   dragImageOffsetY:(jint)jDragImageOffsetY
      sourceActions:(jint)jSourceActions
@@ -84,13 +88,6 @@
 - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint;
 - (BOOL)ignoreModifierKeysWhileDragging;
 
-// Updates from the destination to the source
-- (void) postDragEnter;
-- (void) postDragExit;
-
-// Utility
-- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point;
-
 @end
 
 #endif // CDragSource_h
diff --git a/src/macosx/native/sun/awt/CDragSource.m b/src/macosx/native/sun/awt/CDragSource.m
index 7459a80..992092a 100644
--- a/src/macosx/native/sun/awt/CDragSource.m
+++ b/src/macosx/native/sun/awt/CDragSource.m
@@ -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
@@ -75,14 +75,17 @@
 static NSDragOperation    sDragOperation;
 static NSPoint            sDraggingLocation;
 
-static CDragSource*        sCurrentDragSource;
 static BOOL                sNeedsEnter;
 
-@implementation CDragSource
+@interface CDragSource ()
+// Updates from the destination to the source
+- (void) postDragEnter;
+- (void) postDragExit;
+// Utility
+- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point;
+@end
 
-+ (CDragSource *) currentDragSource {
-    return sCurrentDragSource;
-}
+@implementation CDragSource
 
 - (id)        init:(jobject)jDragSourceContextPeer
          component:(jobject)jComponent
@@ -94,7 +97,7 @@
          modifiers:(jint)extModifiers
         clickCount:(jint)clickCount
          timeStamp:(jlong)timeStamp
-         dragImage:(jobject)jDragImage
+         dragImage:(jlong)nsDragImagePtr
   dragImageOffsetX:(jint)jDragImageOffsetX
   dragImageOffsetY:(jint)jDragImageOffsetY
      sourceActions:(jint)jSourceActions
@@ -109,26 +112,21 @@
 
     // Construct the object if we have a valid model for it:
     if (control != nil) {
-        JNIEnv *env = [ThreadUtilities getJNIEnv];
-        fComponent = JNFNewGlobalRef(env, jComponent);
-        fDragSourceContextPeer = JNFNewGlobalRef(env, jDragSourceContextPeer);
+        fComponent = jComponent;
+        fDragSourceContextPeer = jDragSourceContextPeer;
+        fTransferable = jTransferable;
+        fTriggerEvent = jTrigger;
 
-        fTransferable = JNFNewGlobalRef(env, jTransferable);
-        fTriggerEvent = JNFNewGlobalRef(env, jTrigger);
-
-        if (jDragImage) {
-            JNF_MEMBER_CACHE(nsImagePtr, CImageClass, "ptr", "J");
-            jlong imgPtr = JNFGetLongField(env, jDragImage, nsImagePtr);
-            fDragImage = (NSImage*) jlong_to_ptr(imgPtr); // Double-casting prevents compiler 'd$|//
-
+        if (nsDragImagePtr) {
+            fDragImage = (NSImage*) jlong_to_ptr(nsDragImagePtr);
             [fDragImage retain];
         }
 
         fDragImageOffset = NSMakePoint(jDragImageOffsetX, jDragImageOffsetY);
 
         fSourceActions = jSourceActions;
-        fFormats = JNFNewGlobalRef(env, jFormats);
-        fFormatMap = JNFNewGlobalRef(env, jFormatMap);
+        fFormats = jFormats;
+        fFormatMap = jFormatMap;
 
         fTriggerEventTimeStamp = timeStamp;
         fDragPos = NSMakePoint(dragPosX, dragPosY);
@@ -515,8 +513,6 @@
     fDragKeyModifiers = [DnDUtilities extractJavaExtKeyModifiersFromJavaExtModifiers:fModifiers];
     fDragMouseModifiers = [DnDUtilities extractJavaExtMouseModifiersFromJavaExtModifiers:fModifiers];
 
-    // Set the current DragSource
-    sCurrentDragSource = self;
     sNeedsEnter = YES;
 
     @try {
@@ -566,8 +562,6 @@
                 JNF_MEMBER_CACHE(resetHoveringMethod, CDragSourceContextPeerClass, "resetHovering", "()V");
         JNFCallVoidMethod(env, fDragSourceContextPeer, resetHoveringMethod); // Hust reset static variable
     } @finally {
-        // Clear the current DragSource
-        sCurrentDragSource = nil;
         sNeedsEnter = NO;
     }
 
diff --git a/src/macosx/native/sun/awt/CDragSourceContextPeer.m b/src/macosx/native/sun/awt/CDragSourceContextPeer.m
index e1a7ab3..2b9f6e0 100644
--- a/src/macosx/native/sun/awt/CDragSourceContextPeer.m
+++ b/src/macosx/native/sun/awt/CDragSourceContextPeer.m
@@ -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
@@ -40,30 +40,39 @@
 JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDragSourceContextPeer_createNativeDragSource
   (JNIEnv *env, jobject jthis, jobject jcomponent, jlong jnativepeer, jobject jtransferable,
    jobject jtrigger, jint jdragposx, jint jdragposy, jint jextmodifiers, jint jclickcount, jlong jtimestamp,
-   jobject jnsdragimage, jint jdragimageoffsetx, jint jdragimageoffsety,
+   jlong nsdragimageptr, jint jdragimageoffsetx, jint jdragimageoffsety,
    jint jsourceactions, jlongArray jformats, jobject jformatmap)
 {
     id controlObj = (id) jlong_to_ptr(jnativepeer);
     __block CDragSource* dragSource = nil;
 
 JNF_COCOA_ENTER(env);
+
+    // Global references are disposed when the DragSource is removed
+    jobject gComponent = JNFNewGlobalRef(env, jcomponent);
+    jobject gDragSourceContextPeer = JNFNewGlobalRef(env, jthis);
+    jobject gTransferable = JNFNewGlobalRef(env, jtransferable);
+    jobject gTriggerEvent = JNFNewGlobalRef(env, jtrigger);
+    jlongArray gFormats = JNFNewGlobalRef(env, jformats);
+    jobject gFormatMap = JNFNewGlobalRef(env, jformatmap);
+
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        dragSource = [[CDragSource alloc] init:jthis
-                                     component:jcomponent
+        dragSource = [[CDragSource alloc] init:gDragSourceContextPeer
+                                     component:gComponent
                                        control:controlObj
-                                  transferable:jtransferable
-                                  triggerEvent:jtrigger
+                                  transferable:gTransferable
+                                  triggerEvent:gTriggerEvent
                                       dragPosX:jdragposx
                                       dragPosY:jdragposy
                                      modifiers:jextmodifiers
                                     clickCount:jclickcount
                                      timeStamp:jtimestamp
-                                     dragImage:jnsdragimage
+                                     dragImage:nsdragimageptr
                               dragImageOffsetX:jdragimageoffsetx
                               dragImageOffsetY:jdragimageoffsety
                                  sourceActions:jsourceactions
-                                       formats:jformats
-                                     formatMap:jformatmap];
+                                       formats:gFormats
+                                     formatMap:gFormatMap];
     }];
 JNF_COCOA_EXIT(env);
 
diff --git a/src/macosx/native/sun/awt/CDropTarget.h b/src/macosx/native/sun/awt/CDropTarget.h
index e8f801d..b6cd156 100644
--- a/src/macosx/native/sun/awt/CDropTarget.h
+++ b/src/macosx/native/sun/awt/CDropTarget.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -31,9 +31,15 @@
 
 @class ControlModel;
 
+@class CDropTarget;
+
+@protocol CDropTargetHolder
+- (void) setDropTarget:(CDropTarget *)target;
+@end
+
 @interface CDropTarget : NSObject {
 @private
-    NSView*        fView;
+    NSView<CDropTargetHolder>* fView;
     jobject            fComponent;
     jobject            fDropTarget;
     jobject            fDropTargetContextPeer;
diff --git a/src/macosx/native/sun/awt/CImage.m b/src/macosx/native/sun/awt/CImage.m
index f92b272..db0956b 100644
--- a/src/macosx/native/sun/awt/CImage.m
+++ b/src/macosx/native/sun/awt/CImage.m
@@ -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
@@ -143,21 +143,23 @@
     NSMutableArray * reps = [NSMutableArray arrayWithCapacity: num];
 
     jint * ws = (*env)->GetIntArrayElements(env, widths, NULL);
-    jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
+    if (ws != NULL) {
+        jint * hs = (*env)->GetIntArrayElements(env, heights, NULL);
+        if (hs != NULL) {
+            jsize i;
+            for (i = 0; i < num; i++) {
+                jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
 
-    jsize i;
-    for (i = 0; i < num; i++) {
-        jintArray buffer = (*env)->GetObjectArrayElement(env, buffers, i);
+                NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
+                if (imageRep) {
+                    [reps addObject: imageRep];
+                }
+            }
 
-        NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, ws[i], hs[i]);
-        if (imageRep) {
-            [reps addObject: imageRep];
+            (*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
         }
+        (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
     }
-
-    (*env)->ReleaseIntArrayElements(env, heights, hs, JNI_ABORT);
-    (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
-
     if ([reps count]) {
         NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)];
         [nsImage addRepresentations: reps];
@@ -320,3 +322,26 @@
 
 JNF_COCOA_EXIT(env);
 }
+
+/*
+ * Class:     sun_lwawt_macosx_CImage
+ * Method:    nativeResizeNSImageRepresentations
+ * Signature: (JDD)V
+ */
+JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CImage_nativeResizeNSImageRepresentations
+(JNIEnv *env, jclass clazz, jlong image, jdouble w, jdouble h)
+{
+    if (!image) return;
+    NSImage *i = (NSImage *)jlong_to_ptr(image);
+    
+JNF_COCOA_ENTER(env);
+    
+    NSImageRep *imageRep = nil;
+    NSArray *imageRepresentations = [i representations];
+    NSEnumerator *imageEnumerator = [imageRepresentations objectEnumerator];
+    while ((imageRep = [imageEnumerator nextObject]) != nil) {
+        [imageRep setSize:NSMakeSize(w, h)];
+    }
+    
+JNF_COCOA_EXIT(env);
+}
diff --git a/src/macosx/native/sun/awt/CRobot.m b/src/macosx/native/sun/awt/CRobot.m
index 3ec4f72..8d4f2a0 100644
--- a/src/macosx/native/sun/awt/CRobot.m
+++ b/src/macosx/native/sun/awt/CRobot.m
@@ -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
@@ -23,6 +23,9 @@
  * questions.
  */
 
+
+#import "jni_util.h"
+
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 #import <ApplicationServices/ApplicationServices.h>
 
@@ -187,9 +190,8 @@
     // volatile, otherwise it warns that it might be clobbered by 'longjmp'
     volatile CGPoint point;
 
-    // Translate the device relative point into a valid global CGPoint.
-    point.x = mouseLastX + globalDeviceBounds.origin.x;
-    point.y = mouseLastY + globalDeviceBounds.origin.y;
+    point.x = mouseLastX;
+    point.y = mouseLastY;
 
     __block CGMouseButton button = kCGMouseButtonLeft;
     __block CGEventType type = kCGEventMouseMoved;
@@ -343,6 +345,7 @@
 
     // get a pointer to the Java int array
     void *jPixelData = (*env)->GetPrimitiveArrayCritical(env, pixels, 0);
+    CHECK_NULL(jPixelData);
 
     // create a graphics context around the Java int array
     CGColorSpaceRef picColorSpace = CGColorSpaceCreateWithName(
diff --git a/src/macosx/native/sun/awt/CTrayIcon.m b/src/macosx/native/sun/awt/CTrayIcon.m
index 5a494fe..79ae024 100644
--- a/src/macosx/native/sun/awt/CTrayIcon.m
+++ b/src/macosx/native/sun/awt/CTrayIcon.m
@@ -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
@@ -135,7 +135,7 @@
 
     clickCount = [event clickCount];
 
-    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/event/NSEvent");
+    static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IIIIIIIIDD)V");
     jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
@@ -152,7 +152,7 @@
     }
 
     static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
-    static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/event/NSEvent;)V");
+    static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
 }
 
diff --git a/src/macosx/native/sun/awt/CWrapper.m b/src/macosx/native/sun/awt/CWrapper.m
index e5847be..247358f 100644
--- a/src/macosx/native/sun/awt/CWrapper.m
+++ b/src/macosx/native/sun/awt/CWrapper.m
@@ -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
@@ -23,38 +23,11 @@
  * questions.
  */
 
-#import "CWrapper.h"
-
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
-
-#import "AWTWindow.h"
-#import "LWCToolkit.h"
-#import "GeomUtilities.h"
 #import "ThreadUtilities.h"
-
 #import "sun_lwawt_macosx_CWrapper_NSWindow.h"
 
 /*
- * Class:     sun_lwawt_macosx_CWrapper$NSObject
- * Method:    release
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSObject_release
-(JNIEnv *env, jclass cls, jlong objectPtr)
-{
-JNF_COCOA_ENTER(env);
-
-    id obj = (id)jlong_to_ptr(objectPtr);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        CFRelease(obj);
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-
-/*
  * Class:     sun_lwawt_macosx_CWrapper$NSWindow
  * Method:    makeKeyAndOrderFront
  * Signature: (J)V
@@ -249,6 +222,7 @@
     dispatch_once(&pred, ^{
         LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSNormalWindowLevel] = NSNormalWindowLevel;
         LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSFloatingWindowLevel] = NSFloatingWindowLevel;
+        LEVELS[sun_lwawt_macosx_CWrapper_NSWindow_NSPopUpMenuWindowLevel] = NSPopUpMenuWindowLevel;
     });
 }
 
@@ -308,8 +282,8 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *parent = (AWTWindow *)jlong_to_ptr(parentPtr);
-    AWTWindow *child = (AWTWindow *)jlong_to_ptr(childPtr);
+    NSWindow *parent = (NSWindow *)jlong_to_ptr(parentPtr);
+    NSWindow *child = (NSWindow *)jlong_to_ptr(childPtr);
     [ThreadUtilities performOnMainThread:@selector(removeChildWindow:)
                                       on:parent
                               withObject:child
@@ -320,26 +294,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSWindow
- * Method:    setFrame
- * Signature: (JIIIIZ)V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSWindow_setFrame
-(JNIEnv *env, jclass cls, jlong windowPtr, jint x, jint y, jint w, jint h, jboolean display)
-{
-JNF_COCOA_ENTER(env);
-
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
-    NSRect frame = NSMakeRect(x, y, w, h);
-    [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
-        [window setFrame:frame display:display];
-    }];
-
-JNF_COCOA_EXIT(env);
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSWindow
  * Method:    setAlphaValue
  * Signature: (JF)V
  */
@@ -349,7 +303,7 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
+    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [window setAlphaValue:(CGFloat)alpha];
     }];
@@ -368,7 +322,7 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
+    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [window setOpaque:(BOOL)opaque];
     }];
@@ -387,7 +341,7 @@
 {
 JNF_COCOA_ENTER(env);
 
-    AWTWindow *window = (AWTWindow *)jlong_to_ptr(windowPtr);
+    NSWindow *window = (NSWindow *)jlong_to_ptr(windowPtr);
     NSColor *color = (NSColor *)jlong_to_ptr(colorPtr);
     [ThreadUtilities performOnMainThreadWaiting:NO block:^(){
         [window setBackgroundColor:color];
@@ -397,6 +351,7 @@
 }
 
 /*
+ * Class:     sun_lwawt_macosx_CWrapper$NSWindow
  * Method:    miniaturize
  * Signature: (J)V
  */
@@ -560,33 +515,6 @@
 
 /*
  * Class:     sun_lwawt_macosx_CWrapper$NSView
- * Method:    frame
- * Signature: (J)Ljava/awt/Rectangle;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_lwawt_macosx_CWrapper_00024NSView_frame
-(JNIEnv *env, jclass cls, jlong viewPtr)
-{
-    jobject jRect = NULL;
-
-JNF_COCOA_ENTER(env);
-
-    __block NSRect rect = NSZeroRect;
-
-    NSView *view = (NSView *)jlong_to_ptr(viewPtr);
-    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-        rect = [view frame];
-    }];
-
-    jRect = NSToJavaRect(env, rect);
-
-JNF_COCOA_EXIT(env);
-
-    return jRect;
-}
-
-/*
- * Class:     sun_lwawt_macosx_CWrapper$NSView
  * Method:    window
  * Signature: (J)J
  */
diff --git a/src/macosx/native/sun/awt/LWCToolkit.m b/src/macosx/native/sun/awt/LWCToolkit.m
index 3300e2d..5e2dd6c 100644
--- a/src/macosx/native/sun/awt/LWCToolkit.m
+++ b/src/macosx/native/sun/awt/LWCToolkit.m
@@ -200,13 +200,17 @@
     gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
 
     jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
+    CHECK_NULL(inputEventClazz);
     jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
+    CHECK_NULL(getButtonDownMasksID);
     jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
     jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
+    CHECK_NULL(tmp);
 
     gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
     if (gButtonDownMasks == NULL) {
         gNumberOfButtons = 0;
+        (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
         JNU_ThrowOutOfMemoryError(env, NULL);
         return;
     }
@@ -240,7 +244,7 @@
     return ((ia & 0xFF) << 24) | ((ir & 0xFF) << 16) | ((ig & 0xFF) << 8) | ((ib & 0xFF) << 0);
 }
 
-void doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
+BOOL doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
     jint len = (*env)->GetArrayLength(env, jColors);
 
     UInt32 colorsArray[len];
@@ -254,8 +258,12 @@
     }];
 
     jint *_colors = (*env)->GetPrimitiveArrayCritical(env, jColors, 0);
+    if (_colors == NULL) {
+        return NO;
+    }
     memcpy(_colors, colors, len * sizeof(UInt32));
     (*env)->ReleasePrimitiveArrayCritical(env, jColors, _colors, 0);
+    return YES;
 }
 
 /**
@@ -267,8 +275,9 @@
 (JNIEnv *env, jobject peer, jintArray jSystemColors, jintArray jAppleColors)
 {
 JNF_COCOA_ENTER(env);
-    doLoadNativeColors(env, jSystemColors, NO);
-    doLoadNativeColors(env, jAppleColors, YES);
+    if (doLoadNativeColors(env, jSystemColors, NO)) {
+        doLoadNativeColors(env, jAppleColors, YES);
+    }
 JNF_COCOA_EXIT(env);
 }
 
diff --git a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
index 44b28f0..40f380b 100644
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
@@ -142,10 +142,9 @@
     splash->screenFormat.byteOrder = 1 ?  BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
     splash->screenFormat.depthBytes = 4;
 
-    dispatch_async(dispatch_get_main_queue(), ^(void) {
-            NSApplication * app = [NSApplicationAWT sharedApplication];
-            [NSApplicationAWT runAWTLoopWithApp: app];
-    });
+    [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
+        [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
+    }];
 }
 
 void
diff --git a/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m b/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
index cb4315b..647042f 100644
--- a/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
+++ b/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
@@ -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
@@ -433,18 +433,18 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_sun_java2d_opengl_CGLGraphicsConfig_getMaxTextureSize
+Java_sun_java2d_opengl_CGLGraphicsConfig_nativeGetMaxTextureSize
     (JNIEnv *env, jclass cglgc)
 {
-    J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getMaxTextureSize");
+    J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_nativeGetMaxTextureSize");
 
     __block int max = 0;
 
-    [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+    [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
         [sharedContext makeCurrentContext];
         j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
+        [NSOpenGLContext clearCurrentContext];
     }];
 
     return (jint)max;
 }
-
diff --git a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
index ae0fedf..7b525a0 100644
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java
@@ -680,7 +680,7 @@
         gotHeader = true;
     }
 
-    public Iterator getImageTypes(int imageIndex)
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
       throws IOException {
         checkIndex(imageIndex);
         try {
@@ -688,7 +688,7 @@
         } catch (IllegalArgumentException e) {
             throw new IIOException(I18N.getString("BMPImageReader6"), e);
         }
-        ArrayList list = new ArrayList(1);
+        ArrayList<ImageTypeSpecifier> list = new ArrayList<>(1);
         list.add(new ImageTypeSpecifier(originalColorModel,
                                         originalSampleModel));
         return list.iterator();
@@ -912,6 +912,7 @@
                 throw new
                     IIOException(I18N.getString("BMPImageReader1"));
             }
+            break;
 
         case VERSION_4_8_BIT:
             switch((int)compression) {
diff --git a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java
index 7e406a0..fef9870 100644
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java
@@ -51,7 +51,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.bmp.BMPImageReader",
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               false,
               null, null, null, null,
diff --git a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java
index 4eeb01c..fd90e2e 100644
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java
@@ -1325,10 +1325,11 @@
                                ImageWriteParam bmpParam) throws IOException {
         String format =
             compressionType == BI_JPEG ? "jpeg" : "png";
-        Iterator iterator = ImageIO.getImageWritersByFormatName(format);
+        Iterator<ImageWriter> iterator =
+               ImageIO.getImageWritersByFormatName(format);
         ImageWriter writer = null;
         if (iterator.hasNext())
-            writer = (ImageWriter)iterator.next();
+            writer = iterator.next();
         if (writer != null) {
             if (embedded_stream == null) {
                 throw new RuntimeException("No stream for writing embedded image!");
diff --git a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java
index 983183d..bcbdb5d 100644
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java
@@ -56,7 +56,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.bmp.BMPImageWriter",
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               false,
               null, null, null, null,
diff --git a/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java b/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java
index 6a937b3..03d6499 100644
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java
@@ -91,10 +91,6 @@
     public int green;
     public int blue;
 
-    // Fields from CommentExtension
-    // List of byte[]
-    public List comments = null; // new ArrayList();
-
     public BMPMetadata() {
         super(true,
               nativeMetadataFormatName,
diff --git a/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java b/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java
index 37c5b3f..d880c50 100644
--- a/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java
+++ b/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java
@@ -42,7 +42,7 @@
 
     public StandardMetadataFormat() {
         super(standardMetadataFormatName, CHILD_POLICY_SOME);
-        List values;
+        List<String> values;
 
         // root -> Chroma
         addElement("Chroma", standardMetadataFormatName,
@@ -52,7 +52,7 @@
         addElement("ColorSpaceType", "Chroma",
                    CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("XYZ");
         values.add("Lab");
         values.add("Luv");
@@ -164,7 +164,7 @@
         // root -> Data -> PlanarConfiguration
         addElement("PlanarConfiguration", "Data", CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("PixelInterleaved");
         values.add("PlaneInterleaved");
         values.add("LineInterleaved");
@@ -178,7 +178,7 @@
         // root -> Data -> SampleFormat
         addElement("SampleFormat", "Data", CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("SignedIntegral");
         values.add("UnsignedIntegral");
         values.add("Real");
@@ -225,7 +225,7 @@
         addElement("ImageOrientation", "Dimension",
                    CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("Normal");
         values.add("Rotate90");
         values.add("Rotate180");
@@ -306,7 +306,7 @@
         // root -> Document -> SubimageInterpretation
         addElement("SubimageInterpretation", "Document",
                    CHILD_POLICY_EMPTY);
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("Standalone");
         values.add("SinglePage");
         values.add("FullResolution");
@@ -418,7 +418,7 @@
                      false,
                      null);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("none");
         values.add("lzw");
         values.add("zip");
@@ -437,7 +437,7 @@
         // root -> Transparency -> Alpha
         addElement("Alpha", "Transparency", CHILD_POLICY_EMPTY);
 
-        values = new ArrayList();
+        values = new ArrayList<>();
         values.add("none");
         values.add("premultiplied");
         values.add("nonpremultiplied");
diff --git a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java
index 45db3e6..d865a58 100644
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java
@@ -84,17 +84,17 @@
 
     // Fields from ApplicationExtension
     // List of byte[]
-    public List applicationIDs = null; // new ArrayList();
+    public List<byte[]> applicationIDs = null;
 
     // List of byte[]
-    public List authenticationCodes = null; // new ArrayList();
+    public List<byte[]> authenticationCodes = null;
 
     // List of byte[]
-    public List applicationData = null; // new ArrayList();
+    public List<byte[]> applicationData = null;
 
     // Fields from CommentExtension
     // List of byte[]
-    public List comments = null; // new ArrayList();
+    public List<byte[]> comments = null;
 
     protected GIFImageMetadata(boolean standardMetadataFormatSupported,
                                String nativeMetadataFormatName,
@@ -225,13 +225,13 @@
             for (int i = 0; i < numAppExtensions; i++) {
                 IIOMetadataNode appExtNode =
                     new IIOMetadataNode("ApplicationExtension");
-                byte[] applicationID = (byte[])applicationIDs.get(i);
+                byte[] applicationID = applicationIDs.get(i);
                 appExtNode.setAttribute("applicationID",
                                         toISO8859(applicationID));
-                byte[] authenticationCode = (byte[])authenticationCodes.get(i);
+                byte[] authenticationCode = authenticationCodes.get(i);
                 appExtNode.setAttribute("authenticationCode",
                                         toISO8859(authenticationCode));
-                byte[] appData = (byte[])applicationData.get(i);
+                byte[] appData = applicationData.get(i);
                 appExtNode.setUserObject(appData.clone());
                 node.appendChild(appExtNode);
             }
@@ -246,7 +246,7 @@
             for (int i = 0; i < numComments; i++) {
                 IIOMetadataNode commentNode =
                     new IIOMetadataNode("CommentExtension");
-                byte[] comment = (byte[])comments.get(i);
+                byte[] comment = comments.get(i);
                 commentNode.setAttribute("value", toISO8859(comment));
                 node.appendChild(commentNode);
             }
@@ -374,7 +374,7 @@
         if (comments == null) {
             return null;
         }
-        Iterator commentIter = comments.iterator();
+        Iterator<byte[]> commentIter = comments.iterator();
         if (!commentIter.hasNext()) {
             return null;
         }
@@ -383,7 +383,7 @@
         IIOMetadataNode node = null; // scratch node
 
         while (commentIter.hasNext()) {
-            byte[] comment = (byte[])commentIter.next();
+            byte[] comment = commentIter.next();
             String s = null;
             try {
                 s = new String(comment, "ISO-8859-1");
diff --git a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
index 0a278e0..650fd31 100644
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java
@@ -72,7 +72,7 @@
     // A List of Longs indicating the stream positions of the
     // start of the metadata for each image.  Entries are added
     // as needed.
-    List imageStartPosition = new ArrayList();
+    List<Long> imageStartPosition = new ArrayList<>();
 
     // Length of metadata for image at 'currIndex', valid only if
     // imageMetadata != null.
@@ -227,7 +227,8 @@
         return new ImageTypeSpecifier(colorModel, sampleModel);
     }
 
-    public Iterator getImageTypes(int imageIndex) throws IIOException {
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
+            throws IIOException {
         checkIndex(imageIndex);
 
         int index = locateImage(imageIndex);
@@ -236,7 +237,7 @@
         }
         readMetadata();
 
-        List l = new ArrayList(1);
+        List<ImageTypeSpecifier> l = new ArrayList<>(1);
 
         byte[] colorTable;
         if (imageMetadata.localColorTable != null) {
@@ -605,7 +606,7 @@
             int index = Math.min(imageIndex, imageStartPosition.size() - 1);
 
             // Seek to that position
-            Long l = (Long)imageStartPosition.get(index);
+            Long l = imageStartPosition.get(index);
             stream.seek(l.longValue());
 
             // Skip images until at desired index or last image found
@@ -731,7 +732,7 @@
                     } else if (label == 0xfe) { // Comment extension
                         byte[] comment = concatenateBlocks();
                         if (imageMetadata.comments == null) {
-                            imageMetadata.comments = new ArrayList();
+                            imageMetadata.comments = new ArrayList<>();
                         }
                         imageMetadata.comments.add(comment);
                     } else if (label == 0xff) { // Application extension
@@ -762,10 +763,10 @@
 
                         // Init lists if necessary
                         if (imageMetadata.applicationIDs == null) {
-                            imageMetadata.applicationIDs = new ArrayList();
+                            imageMetadata.applicationIDs = new ArrayList<>();
                             imageMetadata.authenticationCodes =
-                                new ArrayList();
-                            imageMetadata.applicationData = new ArrayList();
+                                new ArrayList<>();
+                            imageMetadata.applicationData = new ArrayList<>();
                         }
                         imageMetadata.applicationIDs.add(applicationID);
                         imageMetadata.authenticationCodes.add(authCode);
@@ -868,7 +869,7 @@
         }
 
         // Initialize the destination image
-        Iterator imageTypes = getImageTypes(imageIndex);
+        Iterator<ImageTypeSpecifier> imageTypes = getImageTypes(imageIndex);
         this.theImage = getDestination(param,
                                        imageTypes,
                                        imageMetadata.imageWidth,
@@ -1031,7 +1032,7 @@
         streamMetadata = null;
         currIndex = -1;
         imageMetadata = null;
-        imageStartPosition = new ArrayList();
+        imageStartPosition = new ArrayList<>();
         numImages = -1;
 
         // No need to reinitialize 'block'
diff --git a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java
index c611a79..e0342dc 100644
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               readerClassName,
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               true,
               GIFStreamMetadata.nativeMetadataFormatName,
diff --git a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java
index 63874ae..0c4fc02 100644
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java
@@ -1204,9 +1204,9 @@
     private void writeApplicationExtension(GIFWritableImageMetadata im)
       throws IOException {
         if (im.applicationIDs != null) {
-            Iterator iterIDs = im.applicationIDs.iterator();
-            Iterator iterCodes = im.authenticationCodes.iterator();
-            Iterator iterData = im.applicationData.iterator();
+            Iterator<byte[]> iterIDs = im.applicationIDs.iterator();
+            Iterator<byte[]> iterCodes = im.authenticationCodes.iterator();
+            Iterator<byte[]> iterData = im.applicationData.iterator();
 
             while (iterIDs.hasNext()) {
                 try {
@@ -1214,10 +1214,10 @@
                     stream.write(0xff);
 
                     stream.write(11);
-                    stream.write((byte[])iterIDs.next(), 0, 8);
-                    stream.write((byte[])iterCodes.next(), 0, 3);
+                    stream.write(iterIDs.next(), 0, 8);
+                    stream.write(iterCodes.next(), 0, 3);
 
-                    writeBlocks((byte[])iterData.next());
+                    writeBlocks(iterData.next());
 
                     stream.write(0x00);
                 } catch (IOException e) {
@@ -1231,11 +1231,11 @@
       throws IOException {
         if (im.comments != null) {
             try {
-                Iterator iter = im.comments.iterator();
+                Iterator<byte[]> iter = im.comments.iterator();
                 while (iter.hasNext()) {
                     stream.write(0x21);
                     stream.write(0xfe);
-                    writeBlocks((byte[])iter.next());
+                    writeBlocks(iter.next());
                     stream.write(0x00);
                 }
             } catch (IOException e) {
diff --git a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java
index 4f27ed9..0f1b8ae 100644
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               writerClassName,
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               true,
               GIFWritableStreamMetadata.NATIVE_FORMAT_NAME,
diff --git a/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java b/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java
index 3a87554..4162115 100644
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java
@@ -258,14 +258,14 @@
                 }
 
                 if (applicationIDs == null) {
-                    applicationIDs = new ArrayList();
-                    authenticationCodes = new ArrayList();
-                    applicationData = new ArrayList();
+                    applicationIDs = new ArrayList<>();
+                    authenticationCodes = new ArrayList<>();
+                    applicationData = new ArrayList<>();
                 }
 
                 applicationIDs.add(fromISO8859(applicationIDString));
                 authenticationCodes.add(fromISO8859(authenticationCodeString));
-                applicationData.add(applicationExtensionData);
+                applicationData.add((byte[]) applicationExtensionData);
             } else if (name.equals("CommentExtensions")) {
                 Node commentExtension = node.getFirstChild();
                 if (commentExtension != null) {
@@ -276,7 +276,7 @@
                         }
 
                         if (comments == null) {
-                            comments = new ArrayList();
+                            comments = new ArrayList<>();
                         }
 
                         String comment =
@@ -367,7 +367,7 @@
                         String value = getAttribute(childNode, "value");
                         byte[] comment = fromISO8859(value);
                         if (comments == null) {
-                            comments = new ArrayList();
+                            comments = new ArrayList<>();
                         }
                         comments.add(comment);
                     }
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java b/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java
index 20d1807..99f9563 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java
@@ -43,7 +43,7 @@
  * A DHT (Define Huffman Table) marker segment.
  */
 class DHTMarkerSegment extends MarkerSegment {
-    List tables = new ArrayList();
+    List<Htable> tables = new ArrayList<>();
 
     DHTMarkerSegment(boolean needFour) {
         super(JPEG.DHT);
@@ -93,11 +93,11 @@
 
     protected Object clone() {
         DHTMarkerSegment newGuy = (DHTMarkerSegment) super.clone();
-        newGuy.tables = new ArrayList(tables.size());
-        Iterator iter = tables.iterator();
+        newGuy.tables = new ArrayList<>(tables.size());
+        Iterator<Htable> iter = tables.iterator();
         while (iter.hasNext()) {
-            Htable table = (Htable) iter.next();
-            newGuy.tables.add(table.clone());
+            Htable table = iter.next();
+            newGuy.tables.add((Htable) table.clone());
         }
         return newGuy;
     }
@@ -105,7 +105,7 @@
     IIOMetadataNode getNativeNode() {
         IIOMetadataNode node = new IIOMetadataNode("dht");
         for (int i= 0; i<tables.size(); i++) {
-            Htable table = (Htable) tables.get(i);
+            Htable table = tables.get(i);
             node.appendChild(table.getNativeNode());
         }
         return node;
@@ -124,7 +124,7 @@
         System.out.println("Num tables: "
                            + Integer.toString(tables.size()));
         for (int i= 0; i<tables.size(); i++) {
-            Htable table = (Htable) tables.get(i);
+            Htable table = tables.get(i);
             table.print();
         }
         System.out.println();
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java b/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java
index fb78bc3..5852d7a 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java
@@ -44,7 +44,7 @@
  * A DQT (Define Quantization Table) marker segment.
  */
 class DQTMarkerSegment extends MarkerSegment {
-    List tables = new ArrayList();  // Could be 1 to 4
+    List<Qtable> tables = new ArrayList<>();  // Could be 1 to 4
 
     DQTMarkerSegment(float quality, boolean needTwo) {
         super(JPEG.DQT);
@@ -86,11 +86,11 @@
 
     protected Object clone() {
         DQTMarkerSegment newGuy = (DQTMarkerSegment) super.clone();
-        newGuy.tables = new ArrayList(tables.size());
-        Iterator iter = tables.iterator();
+        newGuy.tables = new ArrayList<>(tables.size());
+        Iterator<Qtable> iter = tables.iterator();
         while (iter.hasNext()) {
-            Qtable table = (Qtable) iter.next();
-            newGuy.tables.add(table.clone());
+            Qtable table = iter.next();
+            newGuy.tables.add((Qtable) table.clone());
         }
         return newGuy;
     }
@@ -98,7 +98,7 @@
     IIOMetadataNode getNativeNode() {
         IIOMetadataNode node = new IIOMetadataNode("dqt");
         for (int i= 0; i<tables.size(); i++) {
-            Qtable table = (Qtable) tables.get(i);
+            Qtable table = tables.get(i);
             node.appendChild(table.getNativeNode());
         }
         return node;
@@ -117,7 +117,7 @@
         System.out.println("Num tables: "
                            + Integer.toString(tables.size()));
         for (int i= 0; i<tables.size(); i++) {
-            Qtable table = (Qtable) tables.get(i);
+            Qtable table = tables.get(i);
             table.print();
         }
         System.out.println();
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java
index 393548e..fb59d7b 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java
@@ -76,7 +76,7 @@
     int thumbWidth;
     int thumbHeight;
     JFIFThumbRGB thumb = null;  // If present
-    ArrayList extSegments = new ArrayList();
+    ArrayList<JFIFExtensionMarkerSegment> extSegments = new ArrayList<>();
     ICCMarkerSegment iccSegment = null; // optional ICC
     private static final int THUMB_JPEG = 0x10;
     private static final int THUMB_PALETTE = 0x11;
@@ -157,11 +157,11 @@
     protected Object clone() {
         JFIFMarkerSegment newGuy = (JFIFMarkerSegment) super.clone();
         if (!extSegments.isEmpty()) { // Clone the list with a deep copy
-            newGuy.extSegments = new ArrayList();
-            for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
-                JFIFExtensionMarkerSegment jfxx =
-                    (JFIFExtensionMarkerSegment) iter.next();
-                newGuy.extSegments.add(jfxx.clone());
+            newGuy.extSegments = new ArrayList<>();
+            for (Iterator<JFIFExtensionMarkerSegment> iter =
+                    extSegments.iterator(); iter.hasNext();) {
+                JFIFExtensionMarkerSegment jfxx = iter.next();
+                newGuy.extSegments.add((JFIFExtensionMarkerSegment) jfxx.clone());
             }
         }
         if (iccSegment != null) {
@@ -230,9 +230,9 @@
         if (!extSegments.isEmpty()) {
             IIOMetadataNode JFXXnode = new IIOMetadataNode("JFXX");
             node.appendChild(JFXXnode);
-            for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
-                JFIFExtensionMarkerSegment seg =
-                    (JFIFExtensionMarkerSegment) iter.next();
+            for (Iterator<JFIFExtensionMarkerSegment> iter =
+                    extSegments.iterator(); iter.hasNext();) {
+                JFIFExtensionMarkerSegment seg = iter.next();
                 JFXXnode.appendChild(seg.getNativeNode());
             }
         }
@@ -312,8 +312,7 @@
             }
             index--;
         }
-        JFIFExtensionMarkerSegment jfxx =
-            (JFIFExtensionMarkerSegment) extSegments.get(index);
+        JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
         return jfxx.thumb.getWidth();
     }
 
@@ -324,8 +323,7 @@
             }
             index--;
         }
-        JFIFExtensionMarkerSegment jfxx =
-            (JFIFExtensionMarkerSegment) extSegments.get(index);
+        JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
         return jfxx.thumb.getHeight();
     }
 
@@ -340,8 +338,7 @@
             if (thumb != null) {
                 index--;
             }
-            JFIFExtensionMarkerSegment jfxx =
-                (JFIFExtensionMarkerSegment) extSegments.get(index);
+            JFIFExtensionMarkerSegment jfxx = extSegments.get(index);
             ret = jfxx.thumb.getThumbnail(iis, reader);
         }
         reader.thumbnailComplete();
@@ -436,13 +433,13 @@
      * default encoding is used for the extra thumbnails.
      */
     void writeWithThumbs(ImageOutputStream ios,
-                         List thumbnails,
+                         List<? extends BufferedImage> thumbnails,
                          JPEGImageWriter writer) throws IOException {
         if (thumbnails != null) {
             JFIFExtensionMarkerSegment jfxx = null;
             if (thumbnails.size() == 1) {
                 if (!extSegments.isEmpty()) {
-                    jfxx = (JFIFExtensionMarkerSegment) extSegments.get(0);
+                    jfxx = extSegments.get(0);
                 }
                 writeThumb(ios,
                            (BufferedImage) thumbnails.get(0),
@@ -456,7 +453,7 @@
                 for (int i = 0; i < thumbnails.size(); i++) {
                     jfxx = null;
                     if (i < extSegments.size()) {
-                        jfxx = (JFIFExtensionMarkerSegment) extSegments.get(i);
+                        jfxx = extSegments.get(i);
                     }
                     writeThumb(ios,
                                (BufferedImage) thumbnails.get(i),
@@ -605,7 +602,7 @@
      * marker segments as necessary.
      */
     static void writeDefaultJFIF(ImageOutputStream ios,
-                                 List thumbnails,
+                                 List<? extends BufferedImage> thumbnails,
                                  ICC_Profile iccProfile,
                                  JPEGImageWriter writer)
         throws IOException {
@@ -637,9 +634,9 @@
         System.out.print("Thumbnail Height: ");
         System.out.println(thumbHeight);
         if (!extSegments.isEmpty()) {
-            for (Iterator iter = extSegments.iterator(); iter.hasNext();) {
-                JFIFExtensionMarkerSegment extSegment =
-                    (JFIFExtensionMarkerSegment) iter.next();
+            for (Iterator<JFIFExtensionMarkerSegment> iter =
+                    extSegments.iterator(); iter.hasNext();) {
+                JFIFExtensionMarkerSegment extSegment = iter.next();
                 extSegment.print();
             }
         }
@@ -1373,7 +1370,7 @@
      * combining chunks as necessary.
      */
     class ICCMarkerSegment extends MarkerSegment {
-        ArrayList chunks = null;
+        ArrayList<byte[]> chunks = null;
         byte [] profile = null; // The complete profile when it's fully read
                          // May remain null when writing
         private static final int ID_SIZE = 12;
@@ -1428,7 +1425,7 @@
                 // two chunk numbering bytes
                 length -= 2;
                 buffer.readData(profileData);
-                chunks = new ArrayList();
+                chunks = new ArrayList<>();
                 chunks.add(profileData);
                 chunksRead = 1;
                 inICC = true;
@@ -1518,7 +1515,7 @@
                 for (int i = 1; i <= numChunks; i++) {
                     boolean foundIt = false;
                     for (int chunk = 0; chunk < chunks.size(); chunk++) {
-                        byte [] chunkData = (byte []) chunks.get(chunk);
+                        byte [] chunkData = chunks.get(chunk);
                         if (chunkData[0] == i) { // Right one
                             System.arraycopy(chunkData, 2,
                                              profile, index,
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java
index 92c3e59..4c858a4 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java
@@ -82,7 +82,7 @@
                      "2",
                      "0", "255",
                      true, true);
-        List resUnits = new ArrayList();
+        List<String> resUnits = new ArrayList<>();
         resUnits.add("0");
         resUnits.add("1");
         resUnits.add("2");
@@ -125,7 +125,7 @@
         addElement("JFIFthumbPalette", "app0JFXX", CHILD_POLICY_EMPTY);
         addElement("JFIFthumbRGB", "app0JFXX", CHILD_POLICY_EMPTY);
 
-        List codes = new ArrayList();
+        List<String> codes = new ArrayList<>();
         codes.add("16"); // Hex 10
         codes.add("17"); // Hex 11
         codes.add("19"); // Hex 13
@@ -192,7 +192,7 @@
                      "0", "65535",
                      true, true);
 
-        List transforms = new ArrayList();
+        List<String> transforms = new ArrayList<>();
         transforms.add("0");
         transforms.add("1");
         transforms.add("2");
@@ -205,7 +205,7 @@
 
         addElement("componentSpec", "sof", CHILD_POLICY_EMPTY);
 
-        List procs = new ArrayList();
+        List<String> procs = new ArrayList<>();
         procs.add("0");
         procs.add("1");
         procs.add("2");
@@ -234,7 +234,7 @@
                      null,
                      "0", "65535",
                      true, true);
-        List comps = new ArrayList();
+        List<String> comps = new ArrayList<>();
         comps.add("1");
         comps.add("2");
         comps.add("3");
@@ -267,7 +267,7 @@
                      null,
                      "1", "255",
                      true, true);
-        List tabids = new ArrayList();
+        List<String> tabids = new ArrayList<>();
         tabids.add("0");
         tabids.add("1");
         tabids.add("2");
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
index c3db8e1..961255c 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java
@@ -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
@@ -78,7 +78,7 @@
      * List of stream positions for images, reinitialized every time
      * a new input source is set.
      */
-    private List imagePositions = null;
+    private List<Long> imagePositions = null;
 
     /**
      * The number of images in the stream, or 0.
@@ -223,9 +223,9 @@
     private DisposerRecord disposerRecord;
 
     /** Sets up static C structures. */
-    private static native void initReaderIDs(Class iisClass,
-                                             Class qTableClass,
-                                             Class huffClass);
+    private static native void initReaderIDs(Class<?> iisClass,
+                                             Class<?> qTableClass,
+                                             Class<?> huffClass);
 
     public JPEGImageReader(ImageReaderSpi originator) {
         super(originator);
@@ -375,7 +375,7 @@
             currentImage = 0;
         }
         if (seekForwardOnly) {
-            Long pos = (Long) imagePositions.get(imagePositions.size()-1);
+            Long pos = imagePositions.get(imagePositions.size()-1);
             iis.flushBefore(pos.longValue());
         }
         tablesOnlyChecked = true;
@@ -392,6 +392,7 @@
         }
     }
 
+    @SuppressWarnings("fallthrough")
     private int getNumImagesOnThread(boolean allowSearch)
       throws IOException {
         if (numImages != 0) {
@@ -481,12 +482,12 @@
             checkTablesOnly();
         }
         if (imageIndex < imagePositions.size()) {
-            iis.seek(((Long)(imagePositions.get(imageIndex))).longValue());
+            iis.seek(imagePositions.get(imageIndex).longValue());
         } else {
             // read to start of image, saving positions
             // First seek to the last position we already have, and skip the
             // entire image
-            Long pos = (Long) imagePositions.get(imagePositions.size()-1);
+            Long pos = imagePositions.get(imagePositions.size()-1);
             iis.seek(pos.longValue());
             skipImage();
             // Now add all intervening positions, skipping images
@@ -766,7 +767,7 @@
         }
     }
 
-    public Iterator getImageTypes(int imageIndex)
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
         throws IOException {
         setThreadLock();
         try {
@@ -776,7 +777,7 @@
         }
     }
 
-    private Iterator getImageTypesOnThread(int imageIndex)
+    private Iterator<ImageTypeSpecifier> getImageTypesOnThread(int imageIndex)
         throws IOException {
         if (currentImage != imageIndex) {
             cbLock.check();
@@ -1063,7 +1064,7 @@
 
         if (!wantRaster){
             // Can we read this image?
-            Iterator imageTypes = getImageTypes(imageIndex);
+            Iterator<ImageTypeSpecifier> imageTypes = getImageTypes(imageIndex);
             if (imageTypes.hasNext() == false) {
                 throw new IIOException("Unsupported Image Type");
             }
@@ -1187,8 +1188,8 @@
         // and set knownPassCount
         if (imageIndex == imageMetadataIndex) { // We have metadata
             knownPassCount = 0;
-            for (Iterator iter = imageMetadata.markerSequence.iterator();
-                 iter.hasNext();) {
+            for (Iterator<MarkerSegment> iter =
+                    imageMetadata.markerSequence.iterator(); iter.hasNext();) {
                 if (iter.next() instanceof SOSMarkerSegment) {
                     knownPassCount++;
                 }
@@ -1565,7 +1566,7 @@
 
         // reset local Java structures
         numImages = 0;
-        imagePositions = new ArrayList();
+        imagePositions = new ArrayList<>();
         currentImage = -1;
         image = null;
         raster = null;
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java
index 8d2569e..450dd89 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java
@@ -46,7 +46,7 @@
               JPEG.suffixes,
               JPEG.MIMETypes,
               "com.sun.imageio.plugins.jpeg.JPEGImageReader",
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               true,
               JPEG.nativeStreamMetadataFormatName,
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
index 7f190f6..1913ef4 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java
@@ -107,7 +107,7 @@
     /**
      * If there are thumbnails to be written, this is the list.
      */
-    private List thumbnails = null;
+    private List<? extends BufferedImage> thumbnails = null;
 
     /**
      * If metadata should include an icc profile, store it here.
@@ -1394,14 +1394,14 @@
      */
     private int [] collectScans(JPEGMetadata metadata,
                                 SOFMarkerSegment sof) {
-        List segments = new ArrayList();
+        List<SOSMarkerSegment> segments = new ArrayList<>();
         int SCAN_SIZE = 9;
         int MAX_COMPS_PER_SCAN = 4;
-        for (Iterator iter = metadata.markerSequence.iterator();
+        for (Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
              iter.hasNext();) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof SOSMarkerSegment) {
-                segments.add(seg);
+                segments.add((SOSMarkerSegment) seg);
             }
         }
         int [] retval = null;
@@ -1411,7 +1411,7 @@
             retval = new int [numScans*SCAN_SIZE];
             int index = 0;
             for (int i = 0; i < numScans; i++) {
-                SOSMarkerSegment sos = (SOSMarkerSegment) segments.get(i);
+                SOSMarkerSegment sos = segments.get(i);
                 retval[index++] = sos.componentSpecs.length; // num comps
                 for (int j = 0; j < MAX_COMPS_PER_SCAN; j++) {
                     if (j < sos.componentSpecs.length) {
@@ -1441,10 +1441,10 @@
      */
     private JPEGQTable [] collectQTablesFromMetadata
         (JPEGMetadata metadata) {
-        ArrayList tables = new ArrayList();
-        Iterator iter = metadata.markerSequence.iterator();
+        ArrayList<DQTMarkerSegment.Qtable> tables = new ArrayList<>();
+        Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DQTMarkerSegment) {
                 DQTMarkerSegment dqt =
                     (DQTMarkerSegment) seg;
@@ -1456,7 +1456,7 @@
             retval = new JPEGQTable[tables.size()];
             for (int i = 0; i < retval.length; i++) {
                 retval[i] =
-                    new JPEGQTable(((DQTMarkerSegment.Qtable)tables.get(i)).data);
+                    new JPEGQTable(tables.get(i).data);
             }
         }
         return retval;
@@ -1471,16 +1471,14 @@
      */
     private JPEGHuffmanTable[] collectHTablesFromMetadata
         (JPEGMetadata metadata, boolean wantDC) throws IIOException {
-        ArrayList tables = new ArrayList();
-        Iterator iter = metadata.markerSequence.iterator();
+        ArrayList<DHTMarkerSegment.Htable> tables = new ArrayList<>();
+        Iterator<MarkerSegment> iter = metadata.markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DHTMarkerSegment) {
-                DHTMarkerSegment dht =
-                    (DHTMarkerSegment) seg;
+                DHTMarkerSegment dht = (DHTMarkerSegment) seg;
                 for (int i = 0; i < dht.tables.size(); i++) {
-                    DHTMarkerSegment.Htable htable =
-                        (DHTMarkerSegment.Htable) dht.tables.get(i);
+                    DHTMarkerSegment.Htable htable = dht.tables.get(i);
                     if (htable.tableClass == (wantDC ? 0 : 1)) {
                         tables.add(htable);
                     }
@@ -1553,6 +1551,7 @@
                         retval = JPEG.JCS_YCC;
                     }
                 }
+                break;
             case ColorSpace.TYPE_CMYK:
                 retval = JPEG.JCS_CMYK;
                 break;
@@ -1592,6 +1591,7 @@
                         retval = JPEG.JCS_YCC;
                     }
                 }
+                break;
             case ColorSpace.TYPE_CMYK:
                 retval = JPEG.JCS_CMYK;
                 break;
@@ -1638,6 +1638,7 @@
                         retval = JPEG.JCS_YCC;
                     }
                 }
+                break;
             case ColorSpace.TYPE_CMYK:
                 retval = JPEG.JCS_YCCK;
                 break;
@@ -1662,8 +1663,8 @@
     ////////////// Native methods and callbacks
 
     /** Sets up static native structures. */
-    private static native void initWriterIDs(Class qTableClass,
-                                             Class huffClass);
+    private static native void initWriterIDs(Class<?> qTableClass,
+                                             Class<?> huffClass);
 
     /** Sets up per-writer native structure and returns a pointer to it. */
     private native long initJPEGImageWriter();
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java
index 9973992..94de5da 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java
@@ -50,7 +50,7 @@
               JPEG.suffixes,
               JPEG.MIMETypes,
               "com.sun.imageio.plugins.jpeg.JPEGImageWriter",
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               true,
               JPEG.nativeStreamMetadataFormatName,
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java
index cff4f89..51f1234 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java
@@ -52,6 +52,7 @@
 import java.awt.color.ICC_Profile;
 import java.awt.color.ICC_ColorSpace;
 import java.awt.color.ColorSpace;
+import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 import java.awt.Point;
 
@@ -69,7 +70,7 @@
      * <code>markerSequence</code> is modified.  This is used by reset
      * to restore the original state.
      */
-    private List resetSequence = null;
+    private List<MarkerSegment> resetSequence = null;
 
     /**
      * Set to <code>true</code> when reading a thumbnail stored as
@@ -100,7 +101,7 @@
      * list is package visible so that the writer can access it.
      * @see #MarkerSegment
      */
-    List markerSequence = new ArrayList();
+    List<MarkerSegment> markerSequence = new ArrayList<>();
 
     /**
      * Indicates whether this object represents stream or image
@@ -645,9 +646,9 @@
      * with the given tag, or null if none is found.
      */
     MarkerSegment findMarkerSegment(int tag) {
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
+            MarkerSegment seg = iter.next();
             if (seg.tag == tag) {
                 return seg;
             }
@@ -659,19 +660,20 @@
      * Returns the first or last MarkerSegment object in the list
      * of the given class, or null if none is found.
      */
-    MarkerSegment findMarkerSegment(Class cls, boolean first) {
+    MarkerSegment findMarkerSegment(Class<? extends MarkerSegment> cls, boolean first) {
         if (first) {
-            Iterator iter = markerSequence.iterator();
+            Iterator<MarkerSegment> iter = markerSequence.iterator();
             while (iter.hasNext()) {
-                MarkerSegment seg = (MarkerSegment)iter.next();
+                MarkerSegment seg = iter.next();
                 if (cls.isInstance(seg)) {
                     return seg;
                 }
             }
         } else {
-            ListIterator iter = markerSequence.listIterator(markerSequence.size());
+            ListIterator<MarkerSegment> iter =
+                markerSequence.listIterator(markerSequence.size());
             while (iter.hasPrevious()) {
-                MarkerSegment seg = (MarkerSegment)iter.previous();
+                MarkerSegment seg = iter.previous();
                 if (cls.isInstance(seg)) {
                     return seg;
                 }
@@ -684,19 +686,21 @@
      * Returns the index of the first or last MarkerSegment in the list
      * of the given class, or -1 if none is found.
      */
-    private int findMarkerSegmentPosition(Class cls, boolean first) {
+    private int findMarkerSegmentPosition(Class<? extends MarkerSegment> cls,
+                                          boolean first) {
         if (first) {
-            ListIterator iter = markerSequence.listIterator();
+            ListIterator<MarkerSegment> iter = markerSequence.listIterator();
             for (int i = 0; iter.hasNext(); i++) {
-                MarkerSegment seg = (MarkerSegment)iter.next();
+                MarkerSegment seg = iter.next();
                 if (cls.isInstance(seg)) {
                     return i;
                 }
             }
         } else {
-            ListIterator iter = markerSequence.listIterator(markerSequence.size());
+            ListIterator<MarkerSegment> iter =
+                    markerSequence.listIterator(markerSequence.size());
             for (int i = markerSequence.size()-1; iter.hasPrevious(); i--) {
-                MarkerSegment seg = (MarkerSegment)iter.previous();
+                MarkerSegment seg = iter.previous();
                 if (cls.isInstance(seg)) {
                     return i;
                 }
@@ -706,9 +710,10 @@
     }
 
     private int findLastUnknownMarkerSegmentPosition() {
-        ListIterator iter = markerSequence.listIterator(markerSequence.size());
+        ListIterator<MarkerSegment> iter =
+            markerSequence.listIterator(markerSequence.size());
         for (int i = markerSequence.size()-1; iter.hasPrevious(); i--) {
-            MarkerSegment seg = (MarkerSegment)iter.previous();
+            MarkerSegment seg = iter.previous();
             if (seg.unknown == true) {
                 return i;
             }
@@ -733,15 +738,15 @@
     /**
      * Returns a deep copy of the current marker sequence.
      */
-    private List cloneSequence() {
+    private List<MarkerSegment> cloneSequence() {
         if (markerSequence == null) {
             return null;
         }
-        List retval = new ArrayList(markerSequence.size());
-        Iterator iter = markerSequence.iterator();
+        List<MarkerSegment> retval = new ArrayList<>(markerSequence.size());
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
-            retval.add(seg.clone());
+            MarkerSegment seg = iter.next();
+            retval.add((MarkerSegment) seg.clone());
         }
 
         return retval;
@@ -774,7 +779,7 @@
     IIOMetadataNode getNativeTree() {
         IIOMetadataNode root;
         IIOMetadataNode top;
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         if (isStream) {
             root = new IIOMetadataNode(JPEG.nativeStreamMetadataFormatName);
             top = root;
@@ -797,7 +802,7 @@
             top = sequence;
         }
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             top.appendChild(seg.getNativeNode());
         }
         return root;
@@ -961,9 +966,9 @@
 
         // NumProgressiveScans - count sos segments
         int sosCount = 0;
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment ms = (MarkerSegment) iter.next();
+            MarkerSegment ms = iter.next();
             if (ms.tag == JPEG.SOS) {
                 sosCount++;
             }
@@ -1028,9 +1033,9 @@
         // Add a text entry for each COM Marker Segment
         if (findMarkerSegment(JPEG.COM) != null) {
             text = new IIOMetadataNode("Text");
-            Iterator iter = markerSequence.iterator();
+            Iterator<MarkerSegment> iter = markerSequence.iterator();
             while (iter.hasNext()) {
-                MarkerSegment seg = (MarkerSegment) iter.next();
+                MarkerSegment seg = iter.next();
                 if (seg.tag == JPEG.COM) {
                     COMMarkerSegment com = (COMMarkerSegment) seg;
                     IIOMetadataNode entry = new IIOMetadataNode("TextEntry");
@@ -1068,7 +1073,7 @@
         if (root == null) {
             throw new IllegalArgumentException("null root!");
         }
-        List copy = null;
+        List<MarkerSegment> copy = null;
         if (resetSequence == null) {
             resetSequence = cloneSequence();  // Deep copy
             copy = resetSequence;  // Avoid cloning twice
@@ -1181,12 +1186,12 @@
      */
     private void mergeDQTNode(Node node) throws IIOInvalidTreeException {
         // First collect any existing DQT nodes into a local list
-        ArrayList oldDQTs = new ArrayList();
-        Iterator iter = markerSequence.iterator();
+        ArrayList<DQTMarkerSegment> oldDQTs = new ArrayList<>();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DQTMarkerSegment) {
-                oldDQTs.add(seg);
+                oldDQTs.add((DQTMarkerSegment) seg);
             }
         }
         if (!oldDQTs.isEmpty()) {
@@ -1201,10 +1206,9 @@
                 DQTMarkerSegment dqt = null;
                 int tableIndex = -1;
                 for (int j = 0; j < oldDQTs.size(); j++) {
-                    DQTMarkerSegment testDQT = (DQTMarkerSegment) oldDQTs.get(j);
+                    DQTMarkerSegment testDQT = oldDQTs.get(j);
                     for (int k = 0; k < testDQT.tables.size(); k++) {
-                        DQTMarkerSegment.Qtable testTable =
-                            (DQTMarkerSegment.Qtable) testDQT.tables.get(k);
+                        DQTMarkerSegment.Qtable testTable = testDQT.tables.get(k);
                         if (childID == testTable.tableID) {
                             dqt = testDQT;
                             tableIndex = k;
@@ -1216,7 +1220,7 @@
                 if (dqt != null) {
                     dqt.tables.set(tableIndex, dqt.getQtableFromNode(child));
                 } else {
-                    dqt = (DQTMarkerSegment) oldDQTs.get(oldDQTs.size()-1);
+                    dqt = oldDQTs.get(oldDQTs.size()-1);
                     dqt.tables.add(dqt.getQtableFromNode(child));
                 }
             }
@@ -1257,12 +1261,12 @@
      */
     private void mergeDHTNode(Node node) throws IIOInvalidTreeException {
         // First collect any existing DQT nodes into a local list
-        ArrayList oldDHTs = new ArrayList();
-        Iterator iter = markerSequence.iterator();
+        ArrayList<DHTMarkerSegment> oldDHTs = new ArrayList<>();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while (iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment) iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof DHTMarkerSegment) {
-                oldDHTs.add(seg);
+                oldDHTs.add((DHTMarkerSegment) seg);
             }
         }
         if (!oldDHTs.isEmpty()) {
@@ -1283,10 +1287,9 @@
                 DHTMarkerSegment dht = null;
                 int tableIndex = -1;
                 for (int j = 0; j < oldDHTs.size(); j++) {
-                    DHTMarkerSegment testDHT = (DHTMarkerSegment) oldDHTs.get(j);
+                    DHTMarkerSegment testDHT = oldDHTs.get(j);
                     for (int k = 0; k < testDHT.tables.size(); k++) {
-                        DHTMarkerSegment.Htable testTable =
-                            (DHTMarkerSegment.Htable) testDHT.tables.get(k);
+                        DHTMarkerSegment.Htable testTable = testDHT.tables.get(k);
                         if ((childID == testTable.tableID) &&
                             (childClass == testTable.tableClass)) {
                             dht = testDHT;
@@ -1299,7 +1302,7 @@
                 if (dht != null) {
                     dht.tables.set(tableIndex, dht.getHtableFromNode(child));
                 } else {
-                    dht = (DHTMarkerSegment) oldDHTs.get(oldDHTs.size()-1);
+                    dht = oldDHTs.get(oldDHTs.size()-1);
                     dht.tables.add(dht.getHtableFromNode(child));
                 }
             }
@@ -1735,8 +1738,9 @@
                 }
                 if (idsDiffer) {
                     // update the ids in each SOS marker segment
-                    for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
-                        MarkerSegment seg = (MarkerSegment) iter.next();
+                    for (Iterator<MarkerSegment> iter = markerSequence.iterator();
+                            iter.hasNext();) {
+                        MarkerSegment seg = iter.next();
                         if (seg instanceof SOSMarkerSegment) {
                             SOSMarkerSegment target = (SOSMarkerSegment) seg;
                             for (int i = 0; i < target.componentSpecs.length; i++) {
@@ -1788,11 +1792,12 @@
         }
 
         if (updateQtables) {
-            List tableSegments = new ArrayList();
-            for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
-                MarkerSegment seg = (MarkerSegment) iter.next();
+            List<DQTMarkerSegment> tableSegments = new ArrayList<>();
+            for (Iterator<MarkerSegment> iter = markerSequence.iterator();
+                    iter.hasNext();) {
+                MarkerSegment seg = iter.next();
                 if (seg instanceof DQTMarkerSegment) {
-                    tableSegments.add(seg);
+                    tableSegments.add((DQTMarkerSegment) seg);
                 }
             }
             // If there are no tables, don't add them, as the metadata encodes an
@@ -1806,12 +1811,12 @@
 
                 // Find the table with selector 1.
                 boolean found = false;
-                for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
-                    DQTMarkerSegment testdqt = (DQTMarkerSegment) iter.next();
-                    for (Iterator tabiter = testdqt.tables.iterator();
-                         tabiter.hasNext();) {
-                        DQTMarkerSegment.Qtable tab =
-                            (DQTMarkerSegment.Qtable) tabiter.next();
+                for (Iterator<DQTMarkerSegment> iter = tableSegments.iterator();
+                        iter.hasNext();) {
+                    DQTMarkerSegment testdqt = iter.next();
+                    for (Iterator<DQTMarkerSegment.Qtable> tabiter =
+                            testdqt.tables.iterator(); tabiter.hasNext();) {
+                        DQTMarkerSegment.Qtable tab = tabiter.next();
                         if (tab.tableID == 1) {
                             found = true;
                         }
@@ -1820,12 +1825,12 @@
                 if (!found) {
                     //    find the table with selector 0.  There should be one.
                     DQTMarkerSegment.Qtable table0 = null;
-                    for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
-                        DQTMarkerSegment testdqt = (DQTMarkerSegment) iter.next();
-                        for (Iterator tabiter = testdqt.tables.iterator();
-                             tabiter.hasNext();) {
-                            DQTMarkerSegment.Qtable tab =
-                                (DQTMarkerSegment.Qtable) tabiter.next();
+                    for (Iterator<DQTMarkerSegment> iter =
+                            tableSegments.iterator(); iter.hasNext();) {
+                        DQTMarkerSegment testdqt = iter.next();
+                        for (Iterator<DQTMarkerSegment.Qtable> tabiter =
+                                testdqt.tables.iterator(); tabiter.hasNext();) {
+                            DQTMarkerSegment.Qtable tab = tabiter.next();
                             if (tab.tableID == 0) {
                                 table0 = tab;
                             }
@@ -1835,19 +1840,19 @@
                     // Assuming that the table with id 0 is a luminance table,
                     // compute a new chrominance table of the same quality and
                     // add it to the last DQT segment
-                    DQTMarkerSegment dqt =
-                        (DQTMarkerSegment) tableSegments.get(tableSegments.size()-1);
+                    DQTMarkerSegment dqt = tableSegments.get(tableSegments.size()-1);
                     dqt.tables.add(dqt.getChromaForLuma(table0));
                 }
             }
         }
 
         if (updateHtables) {
-            List tableSegments = new ArrayList();
-            for (Iterator iter = markerSequence.iterator(); iter.hasNext();) {
-                MarkerSegment seg = (MarkerSegment) iter.next();
+            List<DHTMarkerSegment> tableSegments = new ArrayList<>();
+            for (Iterator<MarkerSegment> iter = markerSequence.iterator();
+                    iter.hasNext();) {
+                MarkerSegment seg = iter.next();
                 if (seg instanceof DHTMarkerSegment) {
-                    tableSegments.add(seg);
+                    tableSegments.add((DHTMarkerSegment) seg);
                 }
             }
             // If there are no tables, don't add them, as the metadata encodes an
@@ -1860,12 +1865,12 @@
 
                 // find a table with selector 1. AC/DC is irrelevant
                 boolean found = false;
-                for (Iterator iter = tableSegments.iterator(); iter.hasNext();) {
-                    DHTMarkerSegment testdht = (DHTMarkerSegment) iter.next();
-                    for (Iterator tabiter = testdht.tables.iterator();
-                         tabiter.hasNext();) {
-                        DHTMarkerSegment.Htable tab =
-                            (DHTMarkerSegment.Htable) tabiter.next();
+                for (Iterator<DHTMarkerSegment> iter = tableSegments.iterator();
+                        iter.hasNext();) {
+                    DHTMarkerSegment testdht = iter.next();
+                    for (Iterator<DHTMarkerSegment.Htable> tabiter =
+                            testdht.tables.iterator(); tabiter.hasNext();) {
+                        DHTMarkerSegment.Htable tab = tabiter.next();
                         if (tab.tableID == 1) {
                             found = true;
                         }
@@ -1875,7 +1880,7 @@
                     // Create new standard dc and ac chrominance tables and add them
                     // to the last DHT segment
                     DHTMarkerSegment lastDHT =
-                        (DHTMarkerSegment) tableSegments.get(tableSegments.size()-1);
+                        tableSegments.get(tableSegments.size()-1);
                     lastDHT.addHtable(JPEGHuffmanTable.StdDCLuminance, true, 1);
                     lastDHT.addHtable(JPEGHuffmanTable.StdACLuminance, true, 1);
                 }
@@ -2181,7 +2186,7 @@
         if (resetSequence == null) {
             resetSequence = markerSequence;
         }
-        markerSequence = new ArrayList();
+        markerSequence = new ArrayList<>();
 
         // Build a whole new marker sequence from the tree
 
@@ -2310,10 +2315,10 @@
      * segments, including 0 if there are no SOS marker segments.
      */
     private int countScanBands() {
-        List ids = new ArrayList();
-        Iterator iter = markerSequence.iterator();
+        List<Integer> ids = new ArrayList<>();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof SOSMarkerSegment) {
                 SOSMarkerSegment sos = (SOSMarkerSegment) seg;
                 SOSMarkerSegment.ScanComponentSpec [] specs = sos.componentSpecs;
@@ -2334,7 +2339,7 @@
     void writeToStream(ImageOutputStream ios,
                        boolean ignoreJFIF,
                        boolean forceJFIF,
-                       List thumbnails,
+                       List<? extends BufferedImage> thumbnails,
                        ICC_Profile iccProfile,
                        boolean ignoreAdobe,
                        int newAdobeTransform,
@@ -2360,9 +2365,9 @@
             }
         }
         // Iterate over each MarkerSegment
-        Iterator iter = markerSequence.iterator();
+        Iterator<MarkerSegment> iter = markerSequence.iterator();
         while(iter.hasNext()) {
-            MarkerSegment seg = (MarkerSegment)iter.next();
+            MarkerSegment seg = iter.next();
             if (seg instanceof JFIFMarkerSegment) {
                 if (ignoreJFIF == false) {
                     JFIFMarkerSegment jfif = (JFIFMarkerSegment) seg;
@@ -2409,7 +2414,7 @@
 
     public void print() {
         for (int i = 0; i < markerSequence.size(); i++) {
-            MarkerSegment seg = (MarkerSegment) markerSequence.get(i);
+            MarkerSegment seg = markerSequence.get(i);
             seg.print();
         }
     }
diff --git a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java
index a7c1169..63dce67 100644
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java
@@ -56,7 +56,7 @@
                      DATATYPE_INTEGER,
                      false,
                      "0");
-        List tabids = new ArrayList();
+        List<String> tabids = new ArrayList<>();
         tabids.add("0");
         tabids.add("1");
         tabids.add("2");
@@ -74,7 +74,7 @@
 
         addElement("dht", parentName, 1, 4);
         addElement("dhtable", "dht", CHILD_POLICY_EMPTY);
-        List classes = new ArrayList();
+        List<String> classes = new ArrayList<>();
         classes.add("0");
         classes.add("1");
         addAttribute("dhtable",
diff --git a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java
index 1385595..f2d2d6b 100644
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               readerClassName,
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               false,
               null, null,
diff --git a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
index 350d2b6..0004904 100644
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java
@@ -656,16 +656,16 @@
     }
 
     private void write_tEXt() throws IOException {
-        Iterator keywordIter = metadata.tEXt_keyword.iterator();
-        Iterator textIter = metadata.tEXt_text.iterator();
+        Iterator<String> keywordIter = metadata.tEXt_keyword.iterator();
+        Iterator<String> textIter = metadata.tEXt_text.iterator();
 
         while (keywordIter.hasNext()) {
             ChunkStream cs = new ChunkStream(PNGImageReader.tEXt_TYPE, stream);
-            String keyword = (String)keywordIter.next();
+            String keyword = keywordIter.next();
             cs.writeBytes(keyword);
             cs.writeByte(0);
 
-            String text = (String)textIter.next();
+            String text = textIter.next();
             cs.writeBytes(text);
             cs.finish();
         }
@@ -717,33 +717,33 @@
     }
 
     private void write_zTXt() throws IOException {
-        Iterator keywordIter = metadata.zTXt_keyword.iterator();
-        Iterator methodIter = metadata.zTXt_compressionMethod.iterator();
-        Iterator textIter = metadata.zTXt_text.iterator();
+        Iterator<String> keywordIter = metadata.zTXt_keyword.iterator();
+        Iterator<Integer> methodIter = metadata.zTXt_compressionMethod.iterator();
+        Iterator<String> textIter = metadata.zTXt_text.iterator();
 
         while (keywordIter.hasNext()) {
             ChunkStream cs = new ChunkStream(PNGImageReader.zTXt_TYPE, stream);
-            String keyword = (String)keywordIter.next();
+            String keyword = keywordIter.next();
             cs.writeBytes(keyword);
             cs.writeByte(0);
 
-            int compressionMethod = ((Integer)methodIter.next()).intValue();
+            int compressionMethod = (methodIter.next()).intValue();
             cs.writeByte(compressionMethod);
 
-            String text = (String)textIter.next();
+            String text = textIter.next();
             cs.write(deflate(text.getBytes("ISO-8859-1")));
             cs.finish();
         }
     }
 
     private void writeUnknownChunks() throws IOException {
-        Iterator typeIter = metadata.unknownChunkType.iterator();
-        Iterator dataIter = metadata.unknownChunkData.iterator();
+        Iterator<String> typeIter = metadata.unknownChunkType.iterator();
+        Iterator<byte[]> dataIter = metadata.unknownChunkData.iterator();
 
         while (typeIter.hasNext() && dataIter.hasNext()) {
-            String type = (String)typeIter.next();
+            String type = typeIter.next();
             ChunkStream cs = new ChunkStream(chunkType(type), stream);
-            byte[] data = (byte[])dataIter.next();
+            byte[] data = dataIter.next();
             cs.write(data);
             cs.finish();
         }
diff --git a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java
index 18d7614..44080a0 100644
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java
@@ -62,7 +62,7 @@
                 suffixes,
                 MIMETypes,
                 writerClassName,
-                new Class[] { ImageOutputStream.class },
+                new Class<?>[] { ImageOutputStream.class },
                 readerSpiNames,
                 false,
                 null, null,
diff --git a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java
index 22377d7..1bab314 100644
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java
@@ -152,14 +152,14 @@
         gotHeader = true;
     }
 
-    public Iterator getImageTypes(int imageIndex)
+    public Iterator<ImageTypeSpecifier> getImageTypes(int imageIndex)
         throws IOException {
         checkIndex(imageIndex);
         readHeader();
 
         BufferedImage bi =
             new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_BINARY);
-        ArrayList list = new ArrayList(1);
+        ArrayList<ImageTypeSpecifier> list = new ArrayList<>(1);
         list.add(new ImageTypeSpecifier(bi));
         return list.iterator();
     }
diff --git a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java
index 45c5b37..62a66d5 100644
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java
@@ -55,7 +55,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.wbmp.WBMPImageReader",
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               true,
               null, null, null, null,
diff --git a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java
index 5b18f0e..b18f7d4 100644
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java
@@ -55,7 +55,7 @@
               entensions,
               mimeType,
               "com.sun.imageio.plugins.wbmp.WBMPImageWriter",
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               true,
               null, null, null, null,
diff --git a/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java b/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java
index 5b23588..81070ff 100644
--- a/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java
+++ b/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java
@@ -37,7 +37,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class inputClass = File.class;
+    private static final Class<?> inputClass = File.class;
 
     public FileImageInputStreamSpi() {
         super(vendorName, version, inputClass);
diff --git a/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java b/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java
index 61a3a6e..1ca0800 100644
--- a/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java
+++ b/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java
@@ -37,7 +37,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class outputClass = File.class;
+    private static final Class<?> outputClass = File.class;
 
     public FileImageOutputStreamSpi() {
         super(vendorName, version, outputClass);
diff --git a/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java b/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java
index 5b33133..2591f77 100644
--- a/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java
+++ b/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java
@@ -40,7 +40,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class inputClass = InputStream.class;
+    private static final Class<?> inputClass = InputStream.class;
 
     public InputStreamImageInputStreamSpi() {
         super(vendorName, version, inputClass);
diff --git a/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java b/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java
index f0e5c85..391e00f 100644
--- a/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java
+++ b/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java
@@ -40,7 +40,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class outputClass = OutputStream.class;
+    private static final Class<?> outputClass = OutputStream.class;
 
     public OutputStreamImageOutputStreamSpi() {
         super(vendorName, version, outputClass);
diff --git a/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java b/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java
index 5ccd59d..b5c5112 100644
--- a/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java
+++ b/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java
@@ -38,7 +38,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class inputClass = RandomAccessFile.class;
+    private static final Class<?> inputClass = RandomAccessFile.class;
 
     public RAFImageInputStreamSpi() {
         super(vendorName, version, inputClass);
diff --git a/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java b/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java
index 9b19f52..373f875 100644
--- a/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java
+++ b/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java
@@ -38,7 +38,7 @@
 
     private static final String version = "1.0";
 
-    private static final Class outputClass = RandomAccessFile.class;
+    private static final Class<?> outputClass = RandomAccessFile.class;
 
     public RAFImageOutputStreamSpi() {
         super(vendorName, version, outputClass);
diff --git a/src/share/classes/com/sun/imageio/stream/StreamCloser.java b/src/share/classes/com/sun/imageio/stream/StreamCloser.java
index e4b887d..356c0c0 100644
--- a/src/share/classes/com/sun/imageio/stream/StreamCloser.java
+++ b/src/share/classes/com/sun/imageio/stream/StreamCloser.java
@@ -82,7 +82,7 @@
                 };
 
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             /* The thread must be a member of a thread group
                              * which will not get GCed before VM exit.
diff --git a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java
index 6bd2154..f52e4bd 100644
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java
@@ -41,7 +41,6 @@
 import javax.swing.table.*;
 import javax.accessibility.*;
 
-import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 import sun.swing.plaf.synth.*;
@@ -1329,9 +1328,71 @@
     /**
      * Data model for filter combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return GTKFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel
+            implements ComboBoxModel, PropertyChangeListener {
+        protected FileFilter[] filters;
+
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if (filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if (currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if (found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if (filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public Object getElementAt(int index) {
+            if (index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if (filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 }
diff --git a/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java b/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
index 9d063f7..ae7baa5 100644
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java
@@ -38,7 +38,6 @@
 import java.io.IOException;
 import java.util.*;
 import sun.awt.shell.ShellFolder;
-import sun.swing.AbstractFilterComboBoxModel;
 import sun.swing.SwingUtilities2;
 
 /**
@@ -778,9 +777,70 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return MotifFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop.equals(JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY)) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop.equals(JFileChooser.FILE_FILTER_CHANGED_PROPERTY)) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if (!found) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
diff --git a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
index 7052aeb..48b5010 100644
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java
@@ -1193,9 +1193,70 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return WindowsFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
diff --git a/src/share/classes/com/sun/tracing/ProviderFactory.java b/src/share/classes/com/sun/tracing/ProviderFactory.java
index 1a4f064..dabc1dd 100644
--- a/src/share/classes/com/sun/tracing/ProviderFactory.java
+++ b/src/share/classes/com/sun/tracing/ProviderFactory.java
@@ -5,9 +5,9 @@
 import java.io.PrintStream;
 import java.lang.reflect.Field;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import sun.security.action.GetPropertyAction;
 
 import sun.tracing.NullProviderFactory;
 import sun.tracing.PrintStreamProviderFactory;
@@ -56,7 +56,7 @@
 
         // Try to instantiate a DTraceProviderFactory
         String prop = AccessController.doPrivileged(
-            new GetPropertyAction("com.sun.tracing.dtrace"));
+            (PrivilegedAction<String>) () -> System.getProperty("com.sun.tracing.dtrace"));
 
         if ( (prop == null || !prop.equals("disable")) &&
              DTraceProviderFactory.isSupported() ) {
@@ -65,7 +65,7 @@
 
         // Try to instantiate an output stream factory
         prop = AccessController.doPrivileged(
-            new GetPropertyAction("sun.tracing.stream"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.tracing.stream"));
         if (prop != null) {
             for (String spec : prop.split(",")) {
                 PrintStream ps = getPrintStreamFromSpec(spec);
diff --git a/src/share/classes/java/awt/Component.java b/src/share/classes/java/awt/Component.java
index 87c8879..a7573c0 100644
--- a/src/share/classes/java/awt/Component.java
+++ b/src/share/classes/java/awt/Component.java
@@ -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
@@ -26,10 +26,10 @@
 
 import java.io.PrintStream;
 import java.io.PrintWriter;
+import java.util.Objects;
 import java.util.Vector;
 import java.util.Locale;
 import java.util.EventListener;
-import java.util.Iterator;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -50,8 +50,6 @@
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.beans.Transient;
-import java.awt.event.InputMethodListener;
-import java.awt.event.InputMethodEvent;
 import java.awt.im.InputContext;
 import java.awt.im.InputMethodRequests;
 import java.awt.dnd.DropTarget;
@@ -976,6 +974,17 @@
             public void revalidateSynchronously(Component comp) {
                 comp.revalidateSynchronously();
             }
+
+            @Override
+            public void createBufferStrategy(Component comp, int numBuffers,
+                    BufferCapabilities caps) throws AWTException {
+                comp.createBufferStrategy(numBuffers, caps);
+            }
+
+            @Override
+            public BufferStrategy getBufferStrategy(Component comp) {
+                return comp.getBufferStrategy();
+            }
         });
     }
 
@@ -8120,18 +8129,12 @@
      * @since     JDK1.0
      */
     protected String paramString() {
-        String thisName = getName();
-        String str = (thisName != null? thisName : "") + "," + x + "," + y + "," + width + "x" + height;
-        if (!isValid()) {
-            str += ",invalid";
-        }
-        if (!visible) {
-            str += ",hidden";
-        }
-        if (!enabled) {
-            str += ",disabled";
-        }
-        return str;
+        final String thisName = Objects.toString(getName(), "");
+        final String invalid = isValid() ? "" : ",invalid";
+        final String hidden = visible ? "" : ",hidden";
+        final String disabled = enabled ? "" : ",disabled";
+        return thisName + ',' + x + ',' + y + ',' + width + 'x' + height
+                + invalid + hidden + disabled;
     }
 
     /**
@@ -8140,7 +8143,7 @@
      * @since     JDK1.0
      */
     public String toString() {
-        return getClass().getName() + "[" + paramString() + "]";
+        return getClass().getName() + '[' + paramString() + ']';
     }
 
     /**
diff --git a/src/share/classes/java/awt/DefaultKeyboardFocusManager.java b/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
index 94ac5f8..7e65cf5 100644
--- a/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
+++ b/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
@@ -287,7 +287,7 @@
         synchronized (this) {
             KeyEvent ke = enqueuedKeyEvents.isEmpty() ? null : enqueuedKeyEvents.getFirst();
             if (ke != null && time >= ke.getWhen()) {
-                TypeAheadMarker marker = typeAheadMarkers.getFirst();
+                TypeAheadMarker marker = typeAheadMarkers.isEmpty() ? null : typeAheadMarkers.getFirst();
                 if (marker != null) {
                     Window toplevel = marker.untilFocused.getContainingWindow();
                     // Check that the component awaiting focus belongs to
diff --git a/src/share/classes/java/awt/EventQueue.java b/src/share/classes/java/awt/EventQueue.java
index efe0421..0c009a1 100644
--- a/src/share/classes/java/awt/EventQueue.java
+++ b/src/share/classes/java/awt/EventQueue.java
@@ -1093,6 +1093,13 @@
                 dispatchThread = null;
             }
             AWTAutoShutdown.getInstance().notifyThreadFree(edt);
+            /*
+             * Event was posted after EDT events pumping had stopped, so start
+             * another EDT to handle this event
+             */
+            if (peekEvent() != null) {
+                initDispatchThread();
+            }
         } finally {
             pushPopLock.unlock();
         }
diff --git a/src/share/classes/java/awt/Label.java b/src/share/classes/java/awt/Label.java
index 96bce37..7e33534 100644
--- a/src/share/classes/java/awt/Label.java
+++ b/src/share/classes/java/awt/Label.java
@@ -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
@@ -272,13 +272,13 @@
      * @return     the parameter string of this label
      */
     protected String paramString() {
-        String str = ",align=";
+        String align = "";
         switch (alignment) {
-          case LEFT:   str += "left"; break;
-          case CENTER: str += "center"; break;
-          case RIGHT:  str += "right"; break;
+            case LEFT:   align = "left"; break;
+            case CENTER: align = "center"; break;
+            case RIGHT:  align = "right"; break;
         }
-        return super.paramString() + str + ",text=" + text;
+        return super.paramString() + ",align=" + align + ",text=" + text;
     }
 
     /**
diff --git a/src/share/classes/java/awt/MediaTracker.java b/src/share/classes/java/awt/MediaTracker.java
index 49797b7..4dd0fb5 100644
--- a/src/share/classes/java/awt/MediaTracker.java
+++ b/src/share/classes/java/awt/MediaTracker.java
@@ -28,6 +28,7 @@
 import java.awt.Component;
 import java.awt.Image;
 import java.awt.image.ImageObserver;
+import sun.awt.image.MultiResolutionToolkitImage;
 
 /**
  * The <code>MediaTracker</code> class is a utility class to track
@@ -222,10 +223,17 @@
      * @param     h    the height at which the image is rendered
      */
     public synchronized void addImage(Image image, int id, int w, int h) {
+        addImageImpl(image, id, w, h);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            addImageImpl(rvImage, id, 2 * w, 2 * h);
+        }
+    }
+
+    private void addImageImpl(Image image, int id, int w, int h) {
         head = MediaEntry.insert(head,
                                  new ImageMediaEntry(this, image, id, w, h));
     }
-
     /**
      * Flag indicating that media is currently being loaded.
      * @see         java.awt.MediaTracker#statusAll
@@ -719,6 +727,15 @@
      * @since   JDK1.1
      */
     public synchronized void removeImage(Image image) {
+        removeImageImpl(image);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            removeImageImpl(rvImage);
+        }
+        notifyAll();    // Notify in case remaining images are "done".
+    }
+
+    private void removeImageImpl(Image image) {
         MediaEntry cur = head;
         MediaEntry prev = null;
         while (cur != null) {
@@ -735,7 +752,6 @@
             }
             cur = next;
         }
-        notifyAll();    // Notify in case remaining images are "done".
     }
 
     /**
@@ -750,6 +766,15 @@
      * @since      JDK1.1
      */
     public synchronized void removeImage(Image image, int id) {
+        removeImageImpl(image, id);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            removeImageImpl(rvImage, id);
+        }
+        notifyAll();    // Notify in case remaining images are "done".
+    }
+
+    private void removeImageImpl(Image image, int id) {
         MediaEntry cur = head;
         MediaEntry prev = null;
         while (cur != null) {
@@ -766,7 +791,6 @@
             }
             cur = next;
         }
-        notifyAll();    // Notify in case remaining images are "done".
     }
 
     /**
@@ -783,6 +807,16 @@
      */
     public synchronized void removeImage(Image image, int id,
                                          int width, int height) {
+        removeImageImpl(image, id, width, height);
+        Image rvImage = getResolutionVariant(image);
+        if (rvImage != null) {
+            removeImageImpl(rvImage, id, 2 * width, 2 * height);
+
+        }
+        notifyAll();    // Notify in case remaining images are "done".
+    }
+
+    private void removeImageImpl(Image image, int id, int width, int height) {
         MediaEntry cur = head;
         MediaEntry prev = null;
         while (cur != null) {
@@ -801,12 +835,18 @@
             }
             cur = next;
         }
-        notifyAll();    // Notify in case remaining images are "done".
     }
 
     synchronized void setDone() {
         notifyAll();
     }
+
+    private static Image getResolutionVariant(Image image) {
+        if (image instanceof MultiResolutionToolkitImage) {
+            return ((MultiResolutionToolkitImage) image).getResolutionVariant();
+        }
+        return null;
+    }
 }
 
 abstract class MediaEntry {
diff --git a/src/share/classes/java/awt/Robot.java b/src/share/classes/java/awt/Robot.java
index a777088..3953489 100644
--- a/src/share/classes/java/awt/Robot.java
+++ b/src/share/classes/java/awt/Robot.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2009, 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
@@ -72,9 +72,6 @@
     private int autoDelay = 0;
     private static int LEGAL_BUTTON_MASK = 0;
 
-    // location of robot's GC, used in mouseMove(), getPixelColor() and captureScreenImage()
-    private Point gdLoc;
-
     private DirectColorModel screenCapCM = null;
 
     /**
@@ -132,7 +129,6 @@
 
     private void init(GraphicsDevice screen) throws AWTException {
         checkRobotAllowed();
-        gdLoc = screen.getDefaultConfiguration().getBounds().getLocation();
         Toolkit toolkit = Toolkit.getDefaultToolkit();
         if (toolkit instanceof ComponentFactory) {
             peer = ((ComponentFactory)toolkit).createRobot(this, screen);
@@ -200,7 +196,7 @@
      * @param y         Y position
      */
     public synchronized void mouseMove(int x, int y) {
-        peer.mouseMove(gdLoc.x + x, gdLoc.y + y);
+        peer.mouseMove(x, y);
         afterEvent();
     }
 
@@ -395,7 +391,7 @@
      * @return  Color of the pixel
      */
     public synchronized Color getPixelColor(int x, int y) {
-        Color color = new Color(peer.getRGBPixel(gdLoc.x + x, gdLoc.y + y));
+        Color color = new Color(peer.getRGBPixel(x, y));
         return color;
     }
 
@@ -412,10 +408,7 @@
     public synchronized BufferedImage createScreenCapture(Rectangle screenRect) {
         checkScreenCaptureAllowed();
 
-        // according to the spec, screenRect is relative to robot's GD
-        Rectangle translatedRect = new Rectangle(screenRect);
-        translatedRect.translate(gdLoc.x, gdLoc.y);
-        checkValidRect(translatedRect);
+        checkValidRect(screenRect);
 
         BufferedImage image;
         DataBufferInt buffer;
@@ -441,14 +434,14 @@
         int pixels[];
         int[] bandmasks = new int[3];
 
-        pixels = peer.getRGBPixels(translatedRect);
+        pixels = peer.getRGBPixels(screenRect);
         buffer = new DataBufferInt(pixels, pixels.length);
 
         bandmasks[0] = screenCapCM.getRedMask();
         bandmasks[1] = screenCapCM.getGreenMask();
         bandmasks[2] = screenCapCM.getBlueMask();
 
-        raster = Raster.createPackedRaster(buffer, translatedRect.width, translatedRect.height, translatedRect.width, bandmasks, null);
+        raster = Raster.createPackedRaster(buffer, screenRect.width, screenRect.height, screenRect.width, bandmasks, null);
         SunWritableRaster.makeTrackable(buffer);
 
         image = new BufferedImage(screenCapCM, raster, false, null);
diff --git a/src/share/classes/java/awt/SystemColor.java b/src/share/classes/java/awt/SystemColor.java
index ed5a26b..65b01b2 100644
--- a/src/share/classes/java/awt/SystemColor.java
+++ b/src/share/classes/java/awt/SystemColor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -24,6 +24,8 @@
  */
 package java.awt;
 
+import sun.awt.AWTAccessor;
+
 import java.io.ObjectStreamException;
 
 import java.lang.annotation.Native;
@@ -459,7 +461,8 @@
     };
 
     static {
-      updateSystemColors();
+        AWTAccessor.setSystemColorAccessor(SystemColor::updateSystemColors);
+        updateSystemColors();
     }
 
     /**
diff --git a/src/share/classes/java/awt/Toolkit.java b/src/share/classes/java/awt/Toolkit.java
index a796e01..f13005d 100644
--- a/src/share/classes/java/awt/Toolkit.java
+++ b/src/share/classes/java/awt/Toolkit.java
@@ -26,10 +26,6 @@
 package java.awt;
 
 import java.beans.PropertyChangeEvent;
-import java.util.MissingResourceException;
-import java.util.Properties;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
 import java.awt.event.*;
 import java.awt.peer.*;
 import java.awt.im.InputMethodHighlight;
@@ -855,50 +851,39 @@
      */
     public static synchronized Toolkit getDefaultToolkit() {
         if (toolkit == null) {
-            try {
-                // We disable the JIT during toolkit initialization.  This
-                // tends to touch lots of classes that aren't needed again
-                // later and therefore JITing is counter-productiive.
-                java.lang.Compiler.disable();
-
-                java.security.AccessController.doPrivileged(
-                        new java.security.PrivilegedAction<Void>() {
-                    public Void run() {
-                        String nm = null;
-                        Class<?> cls = null;
-                        try {
-                            nm = System.getProperty("awt.toolkit");
+            java.security.AccessController.doPrivileged(
+                    new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    Class<?> cls = null;
+                    String nm = System.getProperty("awt.toolkit");
+                    try {
+                        cls = Class.forName(nm);
+                    } catch (ClassNotFoundException e) {
+                        ClassLoader cl = ClassLoader.getSystemClassLoader();
+                        if (cl != null) {
                             try {
-                                cls = Class.forName(nm);
-                            } catch (ClassNotFoundException e) {
-                                ClassLoader cl = ClassLoader.getSystemClassLoader();
-                                if (cl != null) {
-                                    try {
-                                        cls = cl.loadClass(nm);
-                                    } catch (ClassNotFoundException ee) {
-                                        throw new AWTError("Toolkit not found: " + nm);
-                                    }
-                                }
+                                cls = cl.loadClass(nm);
+                            } catch (final ClassNotFoundException ignored) {
+                                throw new AWTError("Toolkit not found: " + nm);
                             }
-                            if (cls != null) {
-                                toolkit = (Toolkit)cls.newInstance();
-                                if (GraphicsEnvironment.isHeadless()) {
-                                    toolkit = new HeadlessToolkit(toolkit);
-                                }
-                            }
-                        } catch (InstantiationException e) {
-                            throw new AWTError("Could not instantiate Toolkit: " + nm);
-                        } catch (IllegalAccessException e) {
-                            throw new AWTError("Could not access Toolkit: " + nm);
                         }
-                        return null;
                     }
-                });
-                loadAssistiveTechnologies();
-            } finally {
-                // Make sure to always re-enable the JIT.
-                java.lang.Compiler.enable();
-            }
+                    try {
+                        if (cls != null) {
+                            toolkit = (Toolkit)cls.newInstance();
+                            if (GraphicsEnvironment.isHeadless()) {
+                                toolkit = new HeadlessToolkit(toolkit);
+                            }
+                        }
+                    } catch (final InstantiationException ignored) {
+                        throw new AWTError("Could not instantiate Toolkit: " + nm);
+                    } catch (final IllegalAccessException ignored) {
+                        throw new AWTError("Could not access Toolkit: " + nm);
+                    }
+                    return null;
+                }
+            });
+            loadAssistiveTechnologies();
         }
         return toolkit;
     }
diff --git a/src/share/classes/java/awt/datatransfer/DataFlavor.java b/src/share/classes/java/awt/datatransfer/DataFlavor.java
index 1fb29dd..afa0e49 100644
--- a/src/share/classes/java/awt/datatransfer/DataFlavor.java
+++ b/src/share/classes/java/awt/datatransfer/DataFlavor.java
@@ -570,7 +570,7 @@
         if (DataTransferer.isFlavorCharsetTextType(this) &&
             (isRepresentationClassInputStream() ||
              isRepresentationClassByteBuffer() ||
-             DataTransferer.byteArrayClass.equals(representationClass)))
+             byte[].class.equals(representationClass)))
         {
             params += ";charset=" + DataTransferer.getTextCharset(this);
         }
@@ -743,7 +743,7 @@
     private static Comparator<DataFlavor> textFlavorComparator;
 
     static class TextFlavorComparator
-        extends DataTransferer.DataFlavorComparator {
+            extends DataTransferer.DataFlavorComparator {
 
         /**
          * Compares two <code>DataFlavor</code> objects. Returns a negative
@@ -754,8 +754,8 @@
          * <code>DataFlavor</code>s are ordered according to the rules outlined
          * for <code>selectBestTextFlavor</code>.
          *
-         * @param obj1 the first <code>DataFlavor</code> to be compared
-         * @param obj2 the second <code>DataFlavor</code> to be compared
+         * @param flavor1 the first <code>DataFlavor</code> to be compared
+         * @param flavor2 the second <code>DataFlavor</code> to be compared
          * @return a negative integer, zero, or a positive integer as the first
          *         argument is worse, equal to, or better than the second
          * @throws ClassCastException if either of the arguments is not an
@@ -765,13 +765,10 @@
          *
          * @see #selectBestTextFlavor
          */
-        public int compare(Object obj1, Object obj2) {
-            DataFlavor flavor1 = (DataFlavor)obj1;
-            DataFlavor flavor2 = (DataFlavor)obj2;
-
+        public int compare(DataFlavor flavor1, DataFlavor flavor2) {
             if (flavor1.isFlavorTextType()) {
                 if (flavor2.isFlavorTextType()) {
-                    return super.compare(obj1, obj2);
+                    return super.compare(flavor1, flavor2);
                 } else {
                     return 1;
                 }
@@ -1014,7 +1011,7 @@
                     !(isRepresentationClassReader() ||
                         String.class.equals(representationClass) ||
                         isRepresentationClassCharBuffer() ||
-                        DataTransferer.charArrayClass.equals(representationClass)))
+                        char[].class.equals(representationClass)))
                 {
                     String thisCharset =
                         DataTransferer.canonicalName(getParameter("charset"));
@@ -1099,8 +1096,7 @@
                 !(isRepresentationClassReader() ||
                   String.class.equals(representationClass) ||
                   isRepresentationClassCharBuffer() ||
-                  DataTransferer.charArrayClass.equals
-                  (representationClass)))
+                  char[].class.equals(representationClass)))
             {
                 String charset =
                     DataTransferer.canonicalName(getParameter("charset"));
diff --git a/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java b/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
index 8c94ca5..4fd4c81 100644
--- a/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
+++ b/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java
@@ -544,7 +544,7 @@
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
                 List<DataFlavor> platformFlavors =
-                    transferer.getPlatformMappingsForNative(nat);
+                        transferer.getPlatformMappingsForNative(nat);
                 if (!platformFlavors.isEmpty()) {
                     if (flavors != null) {
                         platformFlavors.removeAll(new HashSet<>(flavors));
diff --git a/src/share/classes/java/awt/dnd/DragGestureEvent.java b/src/share/classes/java/awt/dnd/DragGestureEvent.java
index f496092..3c9eadd 100644
--- a/src/share/classes/java/awt/dnd/DragGestureEvent.java
+++ b/src/share/classes/java/awt/dnd/DragGestureEvent.java
@@ -36,6 +36,7 @@
 
 import java.awt.datatransfer.Transferable;
 
+import java.io.InvalidObjectException;
 import java.util.EventObject;
 
 import java.util.Collections;
@@ -329,22 +330,50 @@
     {
         ObjectInputStream.GetField f = s.readFields();
 
-        dragSource = (DragSource)f.get("dragSource", null);
-        component = (Component)f.get("component", null);
-        origin = (Point)f.get("origin", null);
-        action = f.get("action", 0);
+        DragSource newDragSource = (DragSource)f.get("dragSource", null);
+        if (newDragSource == null) {
+            throw new InvalidObjectException("null DragSource");
+        }
+        dragSource = newDragSource;
+
+        Component newComponent = (Component)f.get("component", null);
+        if (newComponent == null) {
+            throw new InvalidObjectException("null component");
+        }
+        component = newComponent;
+
+        Point newOrigin = (Point)f.get("origin", null);
+        if (newOrigin == null) {
+            throw new InvalidObjectException("null origin");
+        }
+        origin = newOrigin;
+
+        int newAction = f.get("action", 0);
+        if (newAction != DnDConstants.ACTION_COPY &&
+                newAction != DnDConstants.ACTION_MOVE &&
+                newAction != DnDConstants.ACTION_LINK) {
+            throw new InvalidObjectException("bad action");
+        }
+        action = newAction;
+
         // Pre-1.4 support. 'events' was previously non-transient
+        List newEvents;
         try {
-            events = (List)f.get("events", null);
+            newEvents = (List)f.get("events", null);
         } catch (IllegalArgumentException e) {
             // 1.4-compatible byte stream. 'events' was written explicitly
-            events = (List)s.readObject();
+            newEvents = (List)s.readObject();
         }
 
         // Implementation assumes 'events' is never null.
-        if (events == null) {
-            events = Collections.EMPTY_LIST;
+        if (newEvents != null && newEvents.isEmpty()) {
+            // Constructor treats empty events list as invalid value
+            // Throw exception if serialized list is empty
+            throw new InvalidObjectException("empty list of events");
+        } else if (newEvents == null) {
+            newEvents = Collections.emptyList();
         }
+        events = newEvents;
     }
 
     /*
diff --git a/src/share/classes/java/awt/dnd/DragGestureRecognizer.java b/src/share/classes/java/awt/dnd/DragGestureRecognizer.java
index 2d0108a..18f2e2a 100644
--- a/src/share/classes/java/awt/dnd/DragGestureRecognizer.java
+++ b/src/share/classes/java/awt/dnd/DragGestureRecognizer.java
@@ -29,6 +29,8 @@
 import java.awt.Component;
 import java.awt.Point;
 
+import java.io.InvalidObjectException;
+import java.util.Collections;
 import java.util.TooManyListenersException;
 import java.util.ArrayList;
 
@@ -411,10 +413,21 @@
      *
      * @since 1.4
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
-        s.defaultReadObject();
+        ObjectInputStream.GetField f = s.readFields();
+
+        DragSource newDragSource = (DragSource)f.get("dragSource", null);
+        if (newDragSource == null) {
+            throw new InvalidObjectException("null DragSource");
+        }
+        dragSource = newDragSource;
+
+        component = (Component)f.get("component", null);
+        sourceActions = f.get("sourceActions", 0) & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
+        events = (ArrayList<InputEvent>)f.get("events", new ArrayList<>(1));
 
         dragGestureListener = (DragGestureListener)s.readObject();
     }
diff --git a/src/share/classes/java/awt/dnd/DragSourceContext.java b/src/share/classes/java/awt/dnd/DragSourceContext.java
index 5d7715d..cbc4c83 100644
--- a/src/share/classes/java/awt/dnd/DragSourceContext.java
+++ b/src/share/classes/java/awt/dnd/DragSourceContext.java
@@ -37,6 +37,7 @@
 import java.awt.dnd.peer.DragSourceContextPeer;
 
 import java.io.IOException;
+import java.io.InvalidObjectException;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
@@ -562,7 +563,36 @@
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
-        s.defaultReadObject();
+        ObjectInputStream.GetField f = s.readFields();
+
+        DragGestureEvent newTrigger = (DragGestureEvent)f.get("trigger", null);
+        if (newTrigger == null) {
+            throw new InvalidObjectException("Null trigger");
+        }
+        if (newTrigger.getDragSource() == null) {
+            throw new InvalidObjectException("Null DragSource");
+        }
+        if (newTrigger.getComponent() == null) {
+            throw new InvalidObjectException("Null trigger component");
+        }
+
+        int DGRActions = newTrigger.getSourceAsDragGestureRecognizer().getSourceActions()
+                & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
+        if (DGRActions == DnDConstants.ACTION_NONE) {
+            throw new InvalidObjectException("Invalid source actions");
+        }
+        int triggerActions = newTrigger.getDragAction();
+        if (triggerActions != DnDConstants.ACTION_COPY &&
+                triggerActions != DnDConstants.ACTION_MOVE &&
+                triggerActions != DnDConstants.ACTION_LINK) {
+            throw new InvalidObjectException("No drag action");
+        }
+        trigger = newTrigger;
+
+        cursor = (Cursor)f.get("cursor", null);
+        useCustomCursor = f.get("useCustomCursor", false);
+        sourceActions = f.get("sourceActions", 0)
+                & (DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK);
 
         transferable = (Transferable)s.readObject();
         listener = (DragSourceListener)s.readObject();
@@ -630,5 +660,5 @@
      *
      * @serial
      */
-    private final int sourceActions;
+    private int sourceActions;
 }
diff --git a/src/share/classes/java/awt/event/InputEvent.java b/src/share/classes/java/awt/event/InputEvent.java
index 82948b7..ad3d87b 100644
--- a/src/share/classes/java/awt/event/InputEvent.java
+++ b/src/share/classes/java/awt/event/InputEvent.java
@@ -298,6 +298,10 @@
                 public int[] getButtonDownMasks() {
                     return InputEvent.getButtonDownMasks();
                 }
+
+                public boolean canAccessSystemClipboard(InputEvent event) {
+                    return event.canAccessSystemClipboard;
+                }
             });
     }
 
diff --git a/src/share/classes/java/beans/Introspector.java b/src/share/classes/java/beans/Introspector.java
index 61745dd..01b24ad 100644
--- a/src/share/classes/java/beans/Introspector.java
+++ b/src/share/classes/java/beans/Introspector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -729,27 +729,53 @@
             if (igpd != null && ispd != null) {
                 // Complete indexed properties set
                 // Merge any classic property descriptors
-                if (gpd != null) {
-                    PropertyDescriptor tpd = mergePropertyDescriptor(igpd, gpd);
-                    if (tpd instanceof IndexedPropertyDescriptor) {
-                        igpd = (IndexedPropertyDescriptor)tpd;
-                    }
-                }
-                if (spd != null) {
-                    PropertyDescriptor tpd = mergePropertyDescriptor(ispd, spd);
-                    if (tpd instanceof IndexedPropertyDescriptor) {
-                        ispd = (IndexedPropertyDescriptor)tpd;
-                    }
+                if ((gpd == spd) || (gpd == null)) {
+                    pd = spd;
+                } else if (spd == null) {
+                    pd = gpd;
+                } else if (spd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(gpd, (IndexedPropertyDescriptor) spd);
+                } else if (gpd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(spd, (IndexedPropertyDescriptor) gpd);
+                } else {
+                    pd = mergePropertyDescriptor(gpd, spd);
                 }
                 if (igpd == ispd) {
-                    pd = igpd;
+                    ipd = igpd;
                 } else {
-                    pd = mergePropertyDescriptor(igpd, ispd);
+                    ipd = mergePropertyDescriptor(igpd, ispd);
+                }
+                if (pd == null) {
+                    pd = ipd;
+                } else {
+                    Class<?> propType = pd.getPropertyType();
+                    Class<?> ipropType = ipd.getIndexedPropertyType();
+                    if (propType.isArray() && propType.getComponentType() == ipropType) {
+                        pd = pd.getClass0().isAssignableFrom(ipd.getClass0())
+                                ? new IndexedPropertyDescriptor(pd, ipd)
+                                : new IndexedPropertyDescriptor(ipd, pd);
+                    } else if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
+                        pd = pd.getClass0().isAssignableFrom(ipd.getClass0())
+                                ? new PropertyDescriptor(pd, ipd)
+                                : new PropertyDescriptor(ipd, pd);
+                    } else {
+                        pd = ipd;
+                    }
                 }
             } else if (gpd != null && spd != null) {
+                if (igpd != null) {
+                    gpd = mergePropertyWithIndexedProperty(gpd, igpd);
+                }
+                if (ispd != null) {
+                    spd = mergePropertyWithIndexedProperty(spd, ispd);
+                }
                 // Complete simple properties set
                 if (gpd == spd) {
                     pd = gpd;
+                } else if (spd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(gpd, (IndexedPropertyDescriptor) spd);
+                } else if (gpd instanceof IndexedPropertyDescriptor) {
+                    pd = mergePropertyWithIndexedProperty(spd, (IndexedPropertyDescriptor) gpd);
                 } else {
                     pd = mergePropertyDescriptor(gpd, spd);
                 }
@@ -809,6 +835,16 @@
         return current == null ? candidate == null : current.isAssignableFrom(candidate);
     }
 
+    private PropertyDescriptor mergePropertyWithIndexedProperty(PropertyDescriptor pd, IndexedPropertyDescriptor ipd) {
+        Class<?> type = pd.getPropertyType();
+        if (type.isArray() && (type.getComponentType() == ipd.getIndexedPropertyType())) {
+            return pd.getClass0().isAssignableFrom(ipd.getClass0())
+                    ? new IndexedPropertyDescriptor(pd, ipd)
+                    : new IndexedPropertyDescriptor(ipd, pd);
+        }
+        return pd;
+    }
+
     /**
      * Adds the property descriptor to the indexedproperty descriptor only if the
      * types are the same.
@@ -828,6 +864,12 @@
             } else {
                 result = new IndexedPropertyDescriptor(ipd, pd);
             }
+        } else if ((ipd.getReadMethod() == null) && (ipd.getWriteMethod() == null)) {
+            if (pd.getClass0().isAssignableFrom(ipd.getClass0())) {
+                result = new PropertyDescriptor(pd, ipd);
+            } else {
+                result = new PropertyDescriptor(ipd, pd);
+            }
         } else {
             // Cannot merge the pd because of type mismatch
             // Return the most specific pd
@@ -879,7 +921,7 @@
     }
 
     // Handle regular ipd merge
-    private PropertyDescriptor mergePropertyDescriptor(IndexedPropertyDescriptor ipd1,
+    private IndexedPropertyDescriptor mergePropertyDescriptor(IndexedPropertyDescriptor ipd1,
                                                        IndexedPropertyDescriptor ipd2) {
         if (ipd1.getClass0().isAssignableFrom(ipd2.getClass0())) {
             return new IndexedPropertyDescriptor(ipd1, ipd2);
diff --git a/src/share/classes/java/io/SequenceInputStream.java b/src/share/classes/java/io/SequenceInputStream.java
index 1a28584..01da7f6 100644
--- a/src/share/classes/java/io/SequenceInputStream.java
+++ b/src/share/classes/java/io/SequenceInputStream.java
@@ -135,7 +135,7 @@
      * @since   JDK1.1
      */
     public int available() throws IOException {
-        if(in == null) {
+        if (in == null) {
             return 0; // no way to signal EOF from available()
         }
         return in.available();
@@ -160,15 +160,14 @@
      * @exception  IOException  if an I/O error occurs.
      */
     public int read() throws IOException {
-        if (in == null) {
-            return -1;
-        }
-        int c = in.read();
-        if (c == -1) {
+        while (in != null) {
+            int c = in.read();
+            if (c != -1) {
+                return c;
+            }
             nextStream();
-            return read();
         }
-        return c;
+        return -1;
     }
 
     /**
@@ -204,13 +203,14 @@
         } else if (len == 0) {
             return 0;
         }
-
-        int n = in.read(b, off, len);
-        if (n <= 0) {
+        do {
+            int n = in.read(b, off, len);
+            if (n > 0) {
+                return n;
+            }
             nextStream();
-            return read(b, off, len);
-        }
-        return n;
+        } while (in != null);
+        return -1;
     }
 
     /**
diff --git a/src/share/classes/java/lang/invoke/MethodHandleImpl.java b/src/share/classes/java/lang/invoke/MethodHandleImpl.java
index e2dbfc8..cdf6e5a 100644
--- a/src/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/src/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -736,16 +736,17 @@
     @LambdaForm.Hidden
     static Object guardWithCatch(MethodHandle target, Class<? extends Throwable> exType, MethodHandle catcher,
                                  Object... av) throws Throwable {
+        // Use asFixedArity() to avoid unnecessary boxing of last argument for VarargsCollector case.
         try {
-            return target.invokeWithArguments(av);
+            return target.asFixedArity().invokeWithArguments(av);
         } catch (Throwable t) {
             if (!exType.isInstance(t)) throw t;
-            Object[] args = prepend(t, av);
-            return catcher.invokeWithArguments(args);
+            return catcher.asFixedArity().invokeWithArguments(prepend(t, av));
         }
     }
 
     /** Prepend an element {@code elem} to an {@code array}. */
+    @LambdaForm.Hidden
     private static Object[] prepend(Object elem, Object[] array) {
         Object[] newArray = new Object[array.length+1];
         newArray[0] = elem;
diff --git a/src/share/classes/java/math/BigInteger.java b/src/share/classes/java/math/BigInteger.java
index 6fa5d42..9b276d8 100644
--- a/src/share/classes/java/math/BigInteger.java
+++ b/src/share/classes/java/math/BigInteger.java
@@ -126,8 +126,6 @@
      * 1 for positive.  Note that the BigInteger zero <i>must</i> have
      * a signum of 0.  This is necessary to ensures that there is exactly one
      * representation for each BigInteger value.
-     *
-     * @serial
      */
     final int signum;
 
@@ -142,55 +140,43 @@
      */
     final int[] mag;
 
-    // These "redundant fields" are initialized with recognizable nonsense
-    // values, and cached the first time they are needed (or never, if they
-    // aren't needed).
-
-     /**
-     * One plus the bitCount of this BigInteger. Zeros means unitialized.
-     *
-     * @serial
-     * @see #bitCount
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
-     */
-    @Deprecated
-    private int bitCount;
+    // The following fields are stable variables. A stable variable's value
+    // changes at most once from the default zero value to a non-zero stable
+    // value. A stable value is calculated lazily on demand.
 
     /**
-     * One plus the bitLength of this BigInteger. Zeros means unitialized.
+     * One plus the bitCount of this BigInteger. This is a stable variable.
+     *
+     * @see #bitCount
+     */
+    private int bitCountPlusOne;
+
+    /**
+     * One plus the bitLength of this BigInteger. This is a stable variable.
      * (either value is acceptable).
      *
-     * @serial
      * @see #bitLength()
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
      */
-    @Deprecated
-    private int bitLength;
+    private int bitLengthPlusOne;
 
     /**
-     * Two plus the lowest set bit of this BigInteger, as returned by
-     * getLowestSetBit().
+     * Two plus the lowest set bit of this BigInteger. This is a stable variable.
      *
-     * @serial
      * @see #getLowestSetBit
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
      */
-    @Deprecated
-    private int lowestSetBit;
+    private int lowestSetBitPlusTwo;
 
     /**
      * Two plus the index of the lowest-order int in the magnitude of this
-     * BigInteger that contains a nonzero int, or -2 (either value is acceptable).
-     * The least significant int has int-number 0, the next int in order of
+     * BigInteger that contains a nonzero int. This is a stable variable. The
+     * least significant int has int-number 0, the next int in order of
      * increasing significance has int-number 1, and so forth.
-     * @deprecated Deprecated since logical value is offset from stored
-     * value and correction factor is applied in accessor method.
+     *
+     * <p>Note: never used for a BigInteger with a magnitude of zero.
+     *
+     * @see #firstNonzeroIntNum()
      */
-    @Deprecated
-    private int firstNonzeroIntNum;
+    private int firstNonzeroIntNumPlusTwo;
 
     /**
      * This mask is used to obtain the value of an int as if it were unsigned.
@@ -3240,7 +3226,7 @@
      * @return index of the rightmost one bit in this BigInteger.
      */
     public int getLowestSetBit() {
-        @SuppressWarnings("deprecation") int lsb = lowestSetBit - 2;
+        int lsb = lowestSetBitPlusTwo - 2;
         if (lsb == -2) {  // lowestSetBit not initialized yet
             lsb = 0;
             if (signum == 0) {
@@ -3252,7 +3238,7 @@
                     ;
                 lsb += (i << 5) + Integer.numberOfTrailingZeros(b);
             }
-            lowestSetBit = lsb + 2;
+            lowestSetBitPlusTwo = lsb + 2;
         }
         return lsb;
     }
@@ -3271,7 +3257,7 @@
      *         representation of this BigInteger, <i>excluding</i> a sign bit.
      */
     public int bitLength() {
-        @SuppressWarnings("deprecation") int n = bitLength - 1;
+        int n = bitLengthPlusOne - 1;
         if (n == -1) { // bitLength not initialized yet
             int[] m = mag;
             int len = m.length;
@@ -3291,7 +3277,7 @@
                      n = magBitLength;
                  }
             }
-            bitLength = n + 1;
+            bitLengthPlusOne = n + 1;
         }
         return n;
     }
@@ -3305,7 +3291,7 @@
      *         of this BigInteger that differ from its sign bit.
      */
     public int bitCount() {
-        @SuppressWarnings("deprecation") int bc = bitCount - 1;
+        int bc = bitCountPlusOne - 1;
         if (bc == -1) {  // bitCount not initialized yet
             bc = 0;      // offset by one to initialize
             // Count the bits in the magnitude
@@ -3319,7 +3305,7 @@
                 magTrailingZeroCount += Integer.numberOfTrailingZeros(mag[j]);
                 bc += magTrailingZeroCount - 1;
             }
-            bitCount = bc + 1;
+            bitCountPlusOne = bc + 1;
         }
         return bc;
     }
@@ -3622,16 +3608,16 @@
      */
     private static void toString(BigInteger u, StringBuilder sb, int radix,
                                  int digits) {
-        /* If we're smaller than a certain threshold, use the smallToString
-           method, padding with leading zeroes when necessary. */
+        // If we're smaller than a certain threshold, use the smallToString
+        // method, padding with leading zeroes when necessary.
         if (u.mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD) {
             String s = u.smallToString(radix);
 
             // Pad with internal zeros if necessary.
             // Don't pad if we're at the beginning of the string.
             if ((s.length() < digits) && (sb.length() > 0)) {
-                for (int i=s.length(); i < digits; i++) { // May be a faster way to
-                    sb.append('0');                    // do this?
+                for (int i=s.length(); i < digits; i++) {
+                    sb.append('0');
                 }
             }
 
@@ -4185,22 +4171,23 @@
     }
 
     /**
-     * Returns the index of the int that contains the first nonzero int in the
-     * little-endian binary representation of the magnitude (int 0 is the
-     * least significant). If the magnitude is zero, return value is undefined.
-     */
+    * Returns the index of the int that contains the first nonzero int in the
+    * little-endian binary representation of the magnitude (int 0 is the
+    * least significant). If the magnitude is zero, return value is undefined.
+    *
+    * <p>Note: never used for a BigInteger with a magnitude of zero.
+    * @see #getInt.
+    */
     private int firstNonzeroIntNum() {
-        int fn = firstNonzeroIntNum - 2;
+        int fn = firstNonzeroIntNumPlusTwo - 2;
         if (fn == -2) { // firstNonzeroIntNum not initialized yet
-            fn = 0;
-
             // Search for the first nonzero int
             int i;
             int mlen = mag.length;
             for (i = mlen - 1; i >= 0 && mag[i] == 0; i--)
                 ;
             fn = mlen - i - 1;
-            firstNonzeroIntNum = fn + 2; // offset by two to initialize
+            firstNonzeroIntNumPlusTwo = fn + 2; // offset by two to initialize
         }
         return fn;
     }
@@ -4212,16 +4199,17 @@
      * Serializable fields for BigInteger.
      *
      * @serialField signum  int
-     *              signum of this BigInteger.
-     * @serialField magnitude int[]
-     *              magnitude array of this BigInteger.
+     *              signum of this BigInteger
+     * @serialField magnitude byte[]
+     *              magnitude array of this BigInteger
      * @serialField bitCount  int
-     *              number of bits in this BigInteger
+     *              appears in the serialized form for backward compatibility
      * @serialField bitLength int
-     *              the number of bits in the minimal two's-complement
-     *              representation of this BigInteger
+     *              appears in the serialized form for backward compatibility
+     * @serialField firstNonzeroByteNum int
+     *              appears in the serialized form for backward compatibility
      * @serialField lowestSetBit int
-     *              lowest set bit in the twos complement representation
+     *              appears in the serialized form for backward compatibility
      */
     private static final ObjectStreamField[] serialPersistentFields = {
         new ObjectStreamField("signum", Integer.TYPE),
@@ -4238,22 +4226,14 @@
      * for historical reasons, but it is converted to an array of ints
      * and the byte array is discarded.
      * Note:
-     * The current convention is to initialize the cache fields, bitCount,
-     * bitLength and lowestSetBit, to 0 rather than some other marker value.
-     * Therefore, no explicit action to set these fields needs to be taken in
-     * readObject because those fields already have a 0 value be default since
-     * defaultReadObject is not being used.
+     * The current convention is to initialize the cache fields, bitCountPlusOne,
+     * bitLengthPlusOne and lowestSetBitPlusTwo, to 0 rather than some other
+     * marker value. Therefore, no explicit action to set these fields needs to
+     * be taken in readObject because those fields already have a 0 value by
+     * default since defaultReadObject is not being used.
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
-        /*
-         * In order to maintain compatibility with previous serialized forms,
-         * the magnitude of a BigInteger is serialized as an array of bytes.
-         * The magnitude field is used as a temporary store for the byte array
-         * that is deserialized. The cached computation fields should be
-         * transient but are serialized for compatibility reasons.
-         */
-
         // prepare to read the alternate persistent fields
         ObjectInputStream.GetField fields = s.readFields();
 
@@ -4317,12 +4297,14 @@
     }
 
     /**
-     * Save the {@code BigInteger} instance to a stream.
-     * The magnitude of a BigInteger is serialized as a byte array for
-     * historical reasons.
-     *
-     * @serialData two necessary fields are written as well as obsolete
-     *             fields for compatibility with older versions.
+     * Save the {@code BigInteger} instance to a stream.  The magnitude of a
+     * {@code BigInteger} is serialized as a byte array for historical reasons.
+     * To maintain compatibility with older implementations, the integers
+     * -1, -1, -2, and -2 are written as the values of the obsolete fields
+     * {@code bitCount}, {@code bitLength}, {@code lowestSetBit}, and
+     * {@code firstNonzeroByteNum}, respectively.  These values are compatible
+     * with older implementations, but will be ignored by current
+     * implementations.
      */
     private void writeObject(ObjectOutputStream s) throws IOException {
         // set the values of the Serializable fields
@@ -4338,7 +4320,7 @@
 
         // save them
         s.writeFields();
-}
+    }
 
     /**
      * Returns the mag array as an array of bytes.
diff --git a/src/share/classes/java/rmi/activation/ActivationGroup.java b/src/share/classes/java/rmi/activation/ActivationGroup.java
index bfa64ba..aa636a7 100644
--- a/src/share/classes/java/rmi/activation/ActivationGroup.java
+++ b/src/share/classes/java/rmi/activation/ActivationGroup.java
@@ -36,7 +36,7 @@
 import java.rmi.server.RMIClassLoader;
 import java.rmi.server.UnicastRemoteObject;
 import java.security.AccessController;
-import sun.security.action.GetIntegerAction;
+import java.security.PrivilegedAction;
 
 /**
  * An <code>ActivationGroup</code> is responsible for creating new
@@ -446,9 +446,8 @@
     {
         if (currSystem == null) {
             try {
-                int port = AccessController.doPrivileged(
-                    new GetIntegerAction("java.rmi.activation.port",
-                                         ActivationSystem.SYSTEM_PORT));
+                int port = AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+                    Integer.getInteger("java.rmi.activation.port", ActivationSystem.SYSTEM_PORT));
                 currSystem = (ActivationSystem)
                     Naming.lookup("//:" + port +
                                   "/java.rmi.activation.ActivationSystem");
diff --git a/src/share/classes/java/rmi/server/ObjID.java b/src/share/classes/java/rmi/server/ObjID.java
index c3e62ee..221e652 100644
--- a/src/share/classes/java/rmi/server/ObjID.java
+++ b/src/share/classes/java/rmi/server/ObjID.java
@@ -31,9 +31,9 @@
 import java.io.ObjectOutput;
 import java.io.Serializable;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.security.SecureRandom;
 import java.util.concurrent.atomic.AtomicLong;
-import sun.security.action.GetPropertyAction;
 
 /**
  * An <code>ObjID</code> is used to identify a remote object exported
@@ -242,7 +242,7 @@
 
     private static boolean useRandomIDs() {
         String value = AccessController.doPrivileged(
-            new GetPropertyAction("java.rmi.server.randomIDs"));
+            (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.randomIDs"));
         return value == null ? true : Boolean.parseBoolean(value);
     }
 }
diff --git a/src/share/classes/java/util/Arrays.java b/src/share/classes/java/util/Arrays.java
index 2edadd8..fd51aa1 100644
--- a/src/share/classes/java/util/Arrays.java
+++ b/src/share/classes/java/util/Arrays.java
@@ -28,6 +28,7 @@
 import java.lang.reflect.Array;
 import java.util.concurrent.ForkJoinPool;
 import java.util.function.BinaryOperator;
+import java.util.function.Consumer;
 import java.util.function.DoubleBinaryOperator;
 import java.util.function.IntBinaryOperator;
 import java.util.function.IntFunction;
@@ -35,6 +36,7 @@
 import java.util.function.IntToLongFunction;
 import java.util.function.IntUnaryOperator;
 import java.util.function.LongBinaryOperator;
+import java.util.function.UnaryOperator;
 import java.util.stream.DoubleStream;
 import java.util.stream.IntStream;
 import java.util.stream.LongStream;
@@ -3848,12 +3850,13 @@
 
         @Override
         public int indexOf(Object o) {
-            if (o==null) {
-                for (int i=0; i<a.length; i++)
-                    if (a[i]==null)
+            E[] a = this.a;
+            if (o == null) {
+                for (int i = 0; i < a.length; i++)
+                    if (a[i] == null)
                         return i;
             } else {
-                for (int i=0; i<a.length; i++)
+                for (int i = 0; i < a.length; i++)
                     if (o.equals(a[i]))
                         return i;
             }
@@ -3869,6 +3872,28 @@
         public Spliterator<E> spliterator() {
             return Spliterators.spliterator(a, Spliterator.ORDERED);
         }
+
+        @Override
+        public void forEach(Consumer<? super E> action) {
+            Objects.requireNonNull(action);
+            for (E e : a) {
+                action.accept(e);
+            }
+        }
+
+        @Override
+        public void replaceAll(UnaryOperator<E> operator) {
+            Objects.requireNonNull(operator);
+            E[] a = this.a;
+            for (int i = 0; i < a.length; i++) {
+                a[i] = operator.apply(a[i]);
+            }
+        }
+
+        @Override
+        public void sort(Comparator<? super E> c) {
+            Arrays.sort(a, c);
+        }
     }
 
     /**
diff --git a/src/share/classes/java/util/logging/LogManager.java b/src/share/classes/java/util/logging/LogManager.java
index 89bcca8..993c7d5 100644
--- a/src/share/classes/java/util/logging/LogManager.java
+++ b/src/share/classes/java/util/logging/LogManager.java
@@ -570,7 +570,7 @@
         // the context requires default loggers, will be added to the context
         // logger's tree.
         final Logger getGlobalLogger() {
-            @SuppressWarnings("deprecated") // avoids initialization cycles.
+            @SuppressWarnings("deprecation") // avoids initialization cycles.
             final Logger global = Logger.global;
             return global;
         }
@@ -642,7 +642,7 @@
             // method be called for anything else than Logger.global
             // or owner.rootLogger.
             if (!requiresDefaultLoggers() || logger == null
-                    || logger != Logger.global && logger != LogManager.this.rootLogger) {
+                    || logger != getGlobalLogger() && logger != LogManager.this.rootLogger ) {
 
                 // the case where we have a non null logger which is neither
                 // Logger.global nor manager.rootLogger indicates a serious
diff --git a/src/share/classes/javax/imageio/ImageIO.java b/src/share/classes/javax/imageio/ImageIO.java
index 1ad84b4..7beea7b 100644
--- a/src/share/classes/javax/imageio/ImageIO.java
+++ b/src/share/classes/javax/imageio/ImageIO.java
@@ -339,7 +339,7 @@
             throw new IllegalArgumentException("input == null!");
         }
 
-        Iterator iter;
+        Iterator<ImageInputStreamSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageInputStreamSpi.class,
@@ -351,7 +351,7 @@
         boolean usecache = getUseCache() && hasCachePermission();
 
         while (iter.hasNext()) {
-            ImageInputStreamSpi spi = (ImageInputStreamSpi)iter.next();
+            ImageInputStreamSpi spi = iter.next();
             if (spi.getInputClass().isInstance(input)) {
                 try {
                     return spi.createInputStreamInstance(input,
@@ -401,7 +401,7 @@
             throw new IllegalArgumentException("output == null!");
         }
 
-        Iterator iter;
+        Iterator<ImageOutputStreamSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageOutputStreamSpi.class,
@@ -413,7 +413,7 @@
         boolean usecache = getUseCache() && hasCachePermission();
 
         while (iter.hasNext()) {
-            ImageOutputStreamSpi spi = (ImageOutputStreamSpi)iter.next();
+            ImageOutputStreamSpi spi = iter.next();
             if (spi.getOutputClass().isInstance(output)) {
                 try {
                     return spi.createOutputStreamInstance(output,
@@ -512,9 +512,9 @@
 
     static class ImageReaderIterator implements Iterator<ImageReader> {
         // Contains ImageReaderSpis
-        public Iterator iter;
+        private Iterator<ImageReaderSpi> iter;
 
-        public ImageReaderIterator(Iterator iter) {
+        public ImageReaderIterator(Iterator<ImageReaderSpi> iter) {
             this.iter = iter;
         }
 
@@ -525,7 +525,7 @@
         public ImageReader next() {
             ImageReaderSpi spi = null;
             try {
-                spi = (ImageReaderSpi)iter.next();
+                spi = iter.next();
                 return spi.createReaderInstance();
             } catch (IOException e) {
                 // Deregister the spi in this case, but only as
@@ -640,7 +640,7 @@
         if (input == null) {
             throw new IllegalArgumentException("input == null!");
         }
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
@@ -702,7 +702,7 @@
         if (formatName == null) {
             throw new IllegalArgumentException("formatName == null!");
         }
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
@@ -738,7 +738,7 @@
             throw new IllegalArgumentException("fileSuffix == null!");
         }
         // Ensure category is present
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
                                    new ContainsFilter(readerFileSuffixesMethod,
@@ -773,7 +773,7 @@
             throw new IllegalArgumentException("MIMEType == null!");
         }
         // Ensure category is present
-        Iterator iter;
+        Iterator<ImageReaderSpi> iter;
         try {
             iter = theRegistry.getServiceProviders(ImageReaderSpi.class,
                                       new ContainsFilter(readerMIMETypesMethod,
@@ -826,9 +826,9 @@
 
     static class ImageWriterIterator implements Iterator<ImageWriter> {
         // Contains ImageWriterSpis
-        public Iterator iter;
+        private Iterator<ImageWriterSpi> iter;
 
-        public ImageWriterIterator(Iterator iter) {
+        public ImageWriterIterator(Iterator<ImageWriterSpi> iter) {
             this.iter = iter;
         }
 
@@ -839,7 +839,7 @@
         public ImageWriter next() {
             ImageWriterSpi spi = null;
             try {
-                spi = (ImageWriterSpi)iter.next();
+                spi = iter.next();
                 return spi.createWriterInstance();
             } catch (IOException e) {
                 // Deregister the spi in this case, but only as a writerSpi
@@ -885,7 +885,7 @@
         if (formatName == null) {
             throw new IllegalArgumentException("formatName == null!");
         }
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -919,7 +919,7 @@
         if (fileSuffix == null) {
             throw new IllegalArgumentException("fileSuffix == null!");
         }
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -953,7 +953,7 @@
         if (MIMEType == null) {
             throw new IllegalArgumentException("MIMEType == null!");
         }
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -1002,7 +1002,7 @@
 
         ImageReaderSpi readerSpi = reader.getOriginatingProvider();
         if (readerSpi == null) {
-            Iterator readerSpiIter;
+            Iterator<ImageReaderSpi> readerSpiIter;
             // Ensure category is present
             try {
                 readerSpiIter =
@@ -1013,7 +1013,7 @@
             }
 
             while (readerSpiIter.hasNext()) {
-                ImageReaderSpi temp = (ImageReaderSpi) readerSpiIter.next();
+                ImageReaderSpi temp = readerSpiIter.next();
                 if (temp.isOwnReader(reader)) {
                     readerSpi = temp;
                     break;
@@ -1029,7 +1029,7 @@
             return null;
         }
 
-        Class writerSpiClass = null;
+        Class<?> writerSpiClass = null;
         try {
             writerSpiClass = Class.forName(writerNames[0], true,
                                            ClassLoader.getSystemClassLoader());
@@ -1082,7 +1082,7 @@
 
         ImageWriterSpi writerSpi = writer.getOriginatingProvider();
         if (writerSpi == null) {
-            Iterator writerSpiIter;
+            Iterator<ImageWriterSpi> writerSpiIter;
             // Ensure category is present
             try {
                 writerSpiIter =
@@ -1093,7 +1093,7 @@
             }
 
             while (writerSpiIter.hasNext()) {
-                ImageWriterSpi temp = (ImageWriterSpi) writerSpiIter.next();
+                ImageWriterSpi temp = writerSpiIter.next();
                 if (temp.isOwnWriter(writer)) {
                     writerSpi = temp;
                     break;
@@ -1109,7 +1109,7 @@
             return null;
         }
 
-        Class readerSpiClass = null;
+        Class<?> readerSpiClass = null;
         try {
             readerSpiClass = Class.forName(readerNames[0], true,
                                            ClassLoader.getSystemClassLoader());
@@ -1160,7 +1160,7 @@
             throw new IllegalArgumentException("formatName == null!");
         }
 
-        Iterator iter;
+        Iterator<ImageWriterSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageWriterSpi.class,
@@ -1178,9 +1178,9 @@
         implements Iterator<ImageTranscoder>
     {
         // Contains ImageTranscoderSpis
-        public Iterator iter;
+        public Iterator<ImageTranscoderSpi> iter;
 
-        public ImageTranscoderIterator(Iterator iter) {
+        public ImageTranscoderIterator(Iterator<ImageTranscoderSpi> iter) {
             this.iter = iter;
         }
 
@@ -1190,7 +1190,7 @@
 
         public ImageTranscoder next() {
             ImageTranscoderSpi spi = null;
-            spi = (ImageTranscoderSpi)iter.next();
+            spi = iter.next();
             return spi.createTranscoderInstance();
         }
 
@@ -1249,7 +1249,7 @@
         ServiceRegistry.Filter filter =
             new TranscoderFilter(readerSpi, writerSpi);
 
-        Iterator iter;
+        Iterator<ImageTranscoderSpi> iter;
         // Ensure category is present
         try {
             iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
@@ -1435,12 +1435,12 @@
             throw new IllegalArgumentException("stream == null!");
         }
 
-        Iterator iter = getImageReaders(stream);
+        Iterator<ImageReader> iter = getImageReaders(stream);
         if (!iter.hasNext()) {
             return null;
         }
 
-        ImageReader reader = (ImageReader)iter.next();
+        ImageReader reader = iter.next();
         ImageReadParam param = reader.getDefaultReadParam();
         reader.setInput(stream, true, true);
         BufferedImage bi;
diff --git a/src/share/classes/javax/imageio/ImageReader.java b/src/share/classes/javax/imageio/ImageReader.java
index 97dd57d..1ff7c21 100644
--- a/src/share/classes/javax/imageio/ImageReader.java
+++ b/src/share/classes/javax/imageio/ImageReader.java
@@ -291,7 +291,7 @@
         if (input != null) {
             boolean found = false;
             if (originatingProvider != null) {
-                Class[] classes = originatingProvider.getInputTypes();
+                Class<?>[] classes = originatingProvider.getInputTypes();
                 for (int i = 0; i < classes.length; i++) {
                     if (classes[i].isInstance(input)) {
                         found = true;
@@ -793,7 +793,7 @@
     }
 
     private IIOMetadata getMetadata(String formatName,
-                                    Set nodeNames,
+                                    Set<String> nodeNames,
                                     boolean wantStream,
                                     int imageIndex) throws IOException {
         if (formatName == null) {
@@ -1065,10 +1065,10 @@
 
         BufferedImage im = read(imageIndex, param);
 
-        ArrayList thumbnails = null;
+        ArrayList<BufferedImage> thumbnails = null;
         int numThumbnails = getNumThumbnails(imageIndex);
         if (numThumbnails > 0) {
-            thumbnails = new ArrayList();
+            thumbnails = new ArrayList<>();
             for (int j = 0; j < numThumbnails; j++) {
                 thumbnails.add(readThumbnail(imageIndex, j));
             }
@@ -1156,7 +1156,7 @@
         readAll(Iterator<? extends ImageReadParam> params)
         throws IOException
     {
-        List output = new ArrayList();
+        List<IIOImage> output = new ArrayList<>();
 
         int imageIndex = getMinIndex();
 
@@ -1187,10 +1187,10 @@
                 break;
             }
 
-            ArrayList thumbnails = null;
+            ArrayList<BufferedImage> thumbnails = null;
             int numThumbnails = getNumThumbnails(imageIndex);
             if (numThumbnails > 0) {
-                thumbnails = new ArrayList();
+                thumbnails = new ArrayList<>();
                 for (int j = 0; j < numThumbnails; j++) {
                     thumbnails.add(readThumbnail(imageIndex, j));
                 }
@@ -1797,9 +1797,9 @@
 
     // Add an element to a list, creating a new list if the
     // existing list is null, and return the list.
-    static List addToList(List l, Object elt) {
+    static <T> List<T> addToList(List<T> l, T elt) {
         if (l == null) {
-            l = new ArrayList();
+            l = new ArrayList<>();
         }
         l.add(elt);
         return l;
@@ -1808,7 +1808,7 @@
 
     // Remove an element from a list, discarding the list if the
     // resulting list is empty, and return the list or null.
-    static List removeFromList(List l, Object elt) {
+    static <T> List<T> removeFromList(List<T> l, T elt) {
         if (l == null) {
             return l;
         }
@@ -2461,10 +2461,10 @@
              * If that throws MissingResourceException, then try the
              * system class loader.
              */
-            ClassLoader loader = (ClassLoader)
+            ClassLoader loader =
                 java.security.AccessController.doPrivileged(
-                   new java.security.PrivilegedAction() {
-                      public Object run() {
+                   new java.security.PrivilegedAction<ClassLoader>() {
+                      public ClassLoader run() {
                         return Thread.currentThread().getContextClassLoader();
                       }
                 });
diff --git a/src/share/classes/javax/imageio/ImageTypeSpecifier.java b/src/share/classes/javax/imageio/ImageTypeSpecifier.java
index 4c3295b..dbab581 100644
--- a/src/share/classes/javax/imageio/ImageTypeSpecifier.java
+++ b/src/share/classes/javax/imageio/ImageTypeSpecifier.java
@@ -1075,7 +1075,7 @@
                                             new Point(0, 0));
             return new BufferedImage(colorModel, raster,
                                      colorModel.isAlphaPremultiplied(),
-                                     new Hashtable());
+                                     new Hashtable<>());
         } catch (NegativeArraySizeException e) {
             // Exception most likely thrown from a DataBuffer constructor
             throw new IllegalArgumentException
diff --git a/src/share/classes/javax/imageio/ImageWriter.java b/src/share/classes/javax/imageio/ImageWriter.java
index 7876115..43f48e7 100644
--- a/src/share/classes/javax/imageio/ImageWriter.java
+++ b/src/share/classes/javax/imageio/ImageWriter.java
@@ -205,7 +205,7 @@
         if (output != null) {
             ImageWriterSpi provider = getOriginatingProvider();
             if (provider != null) {
-                Class[] classes = provider.getOutputTypes();
+                Class<?>[] classes = provider.getOutputTypes();
                 boolean found = false;
                 for (int i = 0; i < classes.length; i++) {
                     if (classes[i].isInstance(output)) {
@@ -1964,10 +1964,10 @@
              * If that throws MissingResourceException, then try the
              * system class loader.
              */
-            ClassLoader loader = (ClassLoader)
+            ClassLoader loader =
                 java.security.AccessController.doPrivileged(
-                   new java.security.PrivilegedAction() {
-                      public Object run() {
+                   new java.security.PrivilegedAction<ClassLoader>() {
+                      public ClassLoader run() {
                         return Thread.currentThread().getContextClassLoader();
                       }
                 });
diff --git a/src/share/classes/javax/imageio/metadata/IIOMetadata.java b/src/share/classes/javax/imageio/metadata/IIOMetadata.java
index c5f2124..c59cb65 100644
--- a/src/share/classes/javax/imageio/metadata/IIOMetadata.java
+++ b/src/share/classes/javax/imageio/metadata/IIOMetadata.java
@@ -395,15 +395,15 @@
             throw new IllegalArgumentException("Unsupported format name");
         }
         try {
-            Class cls = null;
+            Class<?> cls = null;
             final Object o = this;
 
             // firstly we try to use classloader used for loading
             // the IIOMetadata implemantation for this plugin.
-            ClassLoader loader = (ClassLoader)
+            ClassLoader loader =
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
-                            public Object run() {
+                    new java.security.PrivilegedAction<ClassLoader>() {
+                            public ClassLoader run() {
                                 return o.getClass().getClassLoader();
                             }
                         });
@@ -415,10 +415,10 @@
                 // we failed to load IIOMetadataFormat class by
                 // using IIOMetadata classloader.Next try is to
                 // use thread context classloader.
-                loader = (ClassLoader)
+                loader =
                     java.security.AccessController.doPrivileged(
-                        new java.security.PrivilegedAction() {
-                                public Object run() {
+                        new java.security.PrivilegedAction<ClassLoader>() {
+                                public ClassLoader run() {
                                     return Thread.currentThread().getContextClassLoader();
                                 }
                         });
diff --git a/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java b/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java
index a10de18..0402993 100644
--- a/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java
+++ b/src/share/classes/javax/imageio/metadata/IIOMetadataFormatImpl.java
@@ -90,7 +90,7 @@
     private String rootName;
 
     // Element name (String) -> Element
-    private HashMap elementMap = new HashMap();
+    private HashMap<String, Element> elementMap = new HashMap<>();
 
     class Element {
         String elementName;
@@ -100,17 +100,17 @@
         int maxChildren = 0;
 
         // Child names (Strings)
-        List childList = new ArrayList();
+        List<String> childList = new ArrayList<>();
 
         // Parent names (Strings)
-        List parentList = new ArrayList();
+        List<String> parentList = new ArrayList<>();
 
         // List of attribute names in the order they were added
-        List attrList = new ArrayList();
+        List<String> attrList = new ArrayList<>();
         // Attr name (String) -> Attribute
-        Map attrMap = new HashMap();
+        Map<String, Attribute> attrMap = new HashMap<>();
 
-        ObjectValue objectValue;
+        ObjectValue<?> objectValue;
     }
 
     class Attribute {
@@ -122,7 +122,7 @@
         String defaultValue = null;
 
         // enumeration
-        List enumeratedValues;
+        List<String> enumeratedValues;
 
         // range
         String minValue;
@@ -133,17 +133,18 @@
         int listMaxLength;
     }
 
-    class ObjectValue {
+    class ObjectValue<T> {
         int valueType = VALUE_NONE;
-        Class classType = null;
-        Object defaultValue = null;
+        // ? extends T So that ObjectValue<Object> can take Class<?>
+        Class<? extends T> classType = null;
+        T defaultValue = null;
 
         // Meaningful only if valueType == VALUE_ENUMERATION
-        List enumeratedValues = null;
+        List<? extends T> enumeratedValues = null;
 
         // Meaningful only if valueType == VALUE_RANGE
-        Comparable minValue = null;
-        Comparable maxValue = null;
+        Comparable<? super T> minValue = null;
+        Comparable<? super T> maxValue = null;
 
         // Meaningful only if valueType == VALUE_LIST
         int arrayMinLength = 0;
@@ -272,7 +273,7 @@
         if (mustAppear && (elementName == null)) {
             throw new IllegalArgumentException("element name is null!");
         }
-        Element element = (Element)elementMap.get(elementName);
+        Element element = elementMap.get(elementName);
         if (mustAppear && (element == null)) {
             throw new IllegalArgumentException("No such element: " +
                                                elementName);
@@ -287,7 +288,7 @@
     // Utility method for locating an attribute
     private Attribute getAttribute(String elementName, String attrName) {
         Element element = getElement(elementName);
-        Attribute attr = (Attribute)element.attrMap.get(attrName);
+        Attribute attr = element.attrMap.get(attrName);
         if (attr == null) {
             throw new IllegalArgumentException("No such attribute \"" +
                                                attrName + "\"!");
@@ -408,9 +409,9 @@
     protected void removeElement(String elementName) {
         Element element = getElement(elementName, false);
         if (element != null) {
-            Iterator iter = element.parentList.iterator();
+            Iterator<String> iter = element.parentList.iterator();
             while (iter.hasNext()) {
-                String parentName = (String)iter.next();
+                String parentName = iter.next();
                 Element parent = getElement(parentName, false);
                 if (parent != null) {
                     parent.childList.remove(elementName);
@@ -514,7 +515,7 @@
         if (enumeratedValues.size() == 0) {
             throw new IllegalArgumentException("enumeratedValues is empty!");
         }
-        Iterator iter = enumeratedValues.iterator();
+        Iterator<String> iter = enumeratedValues.iterator();
         while (iter.hasNext()) {
             Object o = iter.next();
             if (o == null) {
@@ -681,7 +682,7 @@
                                        String attrName,
                                        boolean hasDefaultValue,
                                        boolean defaultValue) {
-        List values = new ArrayList();
+        List<String> values = new ArrayList<>();
         values.add("TRUE");
         values.add("FALSE");
 
@@ -740,7 +741,7 @@
                                       T defaultValue)
     {
         Element element = getElement(elementName);
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<T> obj = new ObjectValue<>();
         obj.valueType = VALUE_ARBITRARY;
         obj.classType = classType;
         obj.defaultValue = defaultValue;
@@ -793,7 +794,7 @@
         if (enumeratedValues.size() == 0) {
             throw new IllegalArgumentException("enumeratedValues is empty!");
         }
-        Iterator iter = enumeratedValues.iterator();
+        Iterator<? extends T> iter = enumeratedValues.iterator();
         while (iter.hasNext()) {
             Object o = iter.next();
             if (o == null) {
@@ -804,7 +805,7 @@
             }
         }
 
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<T> obj = new ObjectValue<>();
         obj.valueType = VALUE_ENUMERATION;
         obj.classType = classType;
         obj.defaultValue = defaultValue;
@@ -854,7 +855,7 @@
                        boolean maxInclusive)
     {
         Element element = getElement(elementName);
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<T> obj = new ObjectValue<>();
         obj.valueType = VALUE_RANGE;
         if (minInclusive) {
             obj.valueType |= VALUE_RANGE_MIN_INCLUSIVE_MASK;
@@ -895,7 +896,7 @@
                                   int arrayMinLength,
                                   int arrayMaxLength) {
         Element element = getElement(elementName);
-        ObjectValue obj = new ObjectValue();
+        ObjectValue<Object> obj = new ObjectValue<>();
         obj.valueType = VALUE_LIST;
         obj.classType = classType;
         obj.arrayMinLength = arrayMinLength;
@@ -962,10 +963,10 @@
          * If that throws MissingResourceException, then try the
          * system class loader.
          */
-        ClassLoader loader = (ClassLoader)
+        ClassLoader loader =
             java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
-                   public Object run() {
+                new java.security.PrivilegedAction<ClassLoader>() {
+                   public ClassLoader run() {
                        return Thread.currentThread().getContextClassLoader();
                    }
             });
@@ -1037,17 +1038,17 @@
         if (element.childPolicy == CHILD_POLICY_EMPTY) {
             return null;
         }
-        return (String[])element.childList.toArray(new String[0]);
+        return element.childList.toArray(new String[0]);
     }
 
     // Attributes
 
     public String[] getAttributeNames(String elementName) {
         Element element = getElement(elementName);
-        List names = element.attrList;
+        List<String> names = element.attrList;
 
         String[] result = new String[names.size()];
-        return (String[])names.toArray(result);
+        return names.toArray(result);
     }
 
     public int getAttributeValueType(String elementName, String attrName) {
@@ -1079,10 +1080,9 @@
                 ("Attribute not an enumeration!");
         }
 
-        List values = attr.enumeratedValues;
-        Iterator iter = values.iterator();
+        List<String> values = attr.enumeratedValues;
         String[] result = new String[values.size()];
-        return (String[])values.toArray(result);
+        return values.toArray(result);
     }
 
     public String getAttributeMinValue(String elementName, String attrName) {
@@ -1170,7 +1170,7 @@
         if (attrName == null) {
             throw new IllegalArgumentException("attrName == null!");
         }
-        Attribute attr = (Attribute)element.attrMap.get(attrName);
+        Attribute attr = element.attrMap.get(attrName);
         if (attr == null) {
             throw new IllegalArgumentException("No such attribute!");
         }
@@ -1179,9 +1179,9 @@
         return getResource(key, locale);
     }
 
-    private ObjectValue getObjectValue(String elementName) {
+    private ObjectValue<?> getObjectValue(String elementName) {
         Element element = getElement(elementName);
-        ObjectValue objv = element.objectValue;
+        ObjectValue<?> objv = element.objectValue;
         if (objv == null) {
             throw new IllegalArgumentException("No object within element " +
                                                elementName + "!");
@@ -1191,7 +1191,7 @@
 
     public int getObjectValueType(String elementName) {
         Element element = getElement(elementName);
-        ObjectValue objv = element.objectValue;
+        ObjectValue<?> objv = element.objectValue;
         if (objv == null) {
             return VALUE_NONE;
         }
@@ -1199,27 +1199,27 @@
     }
 
     public Class<?> getObjectClass(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         return objv.classType;
     }
 
     public Object getObjectDefaultValue(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         return objv.defaultValue;
     }
 
     public Object[] getObjectEnumerations(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if (objv.valueType != VALUE_ENUMERATION) {
             throw new IllegalArgumentException("Not an enumeration!");
         }
-        List vlist = objv.enumeratedValues;
+        List<?> vlist = objv.enumeratedValues;
         Object[] values = new Object[vlist.size()];
         return vlist.toArray(values);
     }
 
     public Comparable<?> getObjectMinValue(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if ((objv.valueType & VALUE_RANGE) != VALUE_RANGE) {
             throw new IllegalArgumentException("Not a range!");
         }
@@ -1227,7 +1227,7 @@
     }
 
     public Comparable<?> getObjectMaxValue(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if ((objv.valueType & VALUE_RANGE) != VALUE_RANGE) {
             throw new IllegalArgumentException("Not a range!");
         }
@@ -1235,7 +1235,7 @@
     }
 
     public int getObjectArrayMinLength(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if (objv.valueType != VALUE_LIST) {
             throw new IllegalArgumentException("Not a list!");
         }
@@ -1243,7 +1243,7 @@
     }
 
     public int getObjectArrayMaxLength(String elementName) {
-        ObjectValue objv = getObjectValue(elementName);
+        ObjectValue<?> objv = getObjectValue(elementName);
         if (objv.valueType != VALUE_LIST) {
             throw new IllegalArgumentException("Not a list!");
         }
diff --git a/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java b/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
index 1f3fd25..b939a2c 100644
--- a/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
+++ b/src/share/classes/javax/imageio/metadata/IIOMetadataNode.java
@@ -50,9 +50,9 @@
 
 class IIONamedNodeMap implements NamedNodeMap {
 
-    List nodes;
+    List<? extends Node> nodes;
 
-    public IIONamedNodeMap(List nodes) {
+    public IIONamedNodeMap(List<? extends Node> nodes) {
         this.nodes = nodes;
     }
 
@@ -61,9 +61,9 @@
     }
 
     public Node getNamedItem(String name) {
-        Iterator iter = nodes.iterator();
+        Iterator<? extends Node> iter = nodes.iterator();
         while (iter.hasNext()) {
-            Node node = (Node)iter.next();
+            Node node = iter.next();
             if (name.equals(node.getNodeName())) {
                 return node;
             }
@@ -73,7 +73,7 @@
     }
 
     public Node item(int index) {
-        Node node = (Node)nodes.get(index);
+        Node node = nodes.get(index);
         return node;
     }
 
@@ -111,9 +111,9 @@
 
 class IIONodeList implements NodeList {
 
-    List nodes;
+    List<? extends Node> nodes;
 
-    public IIONodeList(List nodes) {
+    public IIONodeList(List<? extends Node> nodes) {
         this.nodes = nodes;
     }
 
@@ -125,7 +125,7 @@
         if (index < 0 || index > nodes.size()) {
             return null;
         }
-        return (Node)nodes.get(index);
+        return nodes.get(index);
     }
 }
 
@@ -285,7 +285,7 @@
      * A <code>List</code> of <code>IIOAttr</code> nodes representing
      * attributes.
      */
-    private List attributes = new ArrayList();
+    private List<IIOAttr> attributes = new ArrayList<>();
 
     /**
      * Constructs an empty <code>IIOMetadataNode</code>.
@@ -789,7 +789,7 @@
     private void removeAttribute(String name, boolean checkPresent) {
         int numAttributes = attributes.size();
         for (int i = 0; i < numAttributes; i++) {
-            IIOAttr attr = (IIOAttr)attributes.get(i);
+            IIOAttr attr = attributes.get(i);
             if (name.equals(attr.getName())) {
                 attr.setOwnerElement(null);
                 attributes.remove(i);
@@ -873,12 +873,12 @@
     }
 
     public NodeList getElementsByTagName(String name) {
-        List l = new ArrayList();
+        List<Node> l = new ArrayList<>();
         getElementsByTagName(name, l);
         return new IIONodeList(l);
     }
 
-    private void getElementsByTagName(String name, List l) {
+    private void getElementsByTagName(String name, List<Node> l) {
         if (nodeName.equals(name)) {
             l.add(this);
         }
diff --git a/src/share/classes/javax/imageio/spi/DigraphNode.java b/src/share/classes/javax/imageio/spi/DigraphNode.java
index b133c29..7fb4c62 100644
--- a/src/share/classes/javax/imageio/spi/DigraphNode.java
+++ b/src/share/classes/javax/imageio/spi/DigraphNode.java
@@ -39,17 +39,17 @@
  * the current node) may be queried.
  *
  */
-class DigraphNode implements Cloneable, Serializable {
+class DigraphNode<E> implements Cloneable, Serializable {
     private static final long serialVersionUID = 5308261378582246841L;
 
     /** The data associated with this node. */
-    protected Object data;
+    protected E data;
 
     /**
      * A <code>Set</code> of neighboring nodes pointed to by this
      * node.
      */
-    protected Set outNodes = new HashSet();
+    protected Set<DigraphNode<E>> outNodes = new HashSet<>();
 
     /** The in-degree of the node. */
     protected int inDegree = 0;
@@ -58,14 +58,14 @@
      * A <code>Set</code> of neighboring nodes that point to this
      * node.
      */
-    private Set inNodes = new HashSet();
+    private Set<DigraphNode<E>> inNodes = new HashSet<>();
 
-    public DigraphNode(Object data) {
+    public DigraphNode(E data) {
         this.data = data;
     }
 
     /** Returns the <code>Object</code> referenced by this node. */
-    public Object getData() {
+    public E getData() {
         return data;
     }
 
@@ -73,7 +73,7 @@
      * Returns an <code>Iterator</code> containing the nodes pointed
      * to by this node.
      */
-    public Iterator getOutNodes() {
+    public Iterator<DigraphNode<E>> getOutNodes() {
         return outNodes.iterator();
     }
 
@@ -86,7 +86,7 @@
      * @return <code>true</code> if the node was not previously the
      * target of an edge.
      */
-    public boolean addEdge(DigraphNode node) {
+    public boolean addEdge(DigraphNode<E> node) {
         if (outNodes.contains(node)) {
             return false;
         }
@@ -105,7 +105,7 @@
      *
      * @return <code>true</code> if the node is the target of an edge.
      */
-    public boolean hasEdge(DigraphNode node) {
+    public boolean hasEdge(DigraphNode<E> node) {
         return outNodes.contains(node);
     }
 
@@ -116,7 +116,7 @@
      * @return <code>true</code> if the node was previously the target
      * of an edge.
      */
-    public boolean removeEdge(DigraphNode node) {
+    public boolean removeEdge(DigraphNode<E> node) {
         if (!outNodes.contains(node)) {
             return false;
         }
@@ -132,15 +132,17 @@
      * appropriately.
      */
     public void dispose() {
-        Object[] inNodesArray = inNodes.toArray();
+        @SuppressWarnings("unchecked")
+        DigraphNode<E>[] inNodesArray = (DigraphNode<E>[])inNodes.toArray();
         for(int i=0; i<inNodesArray.length; i++) {
-            DigraphNode node = (DigraphNode) inNodesArray[i];
+            DigraphNode<E> node = inNodesArray[i];
             node.removeEdge(this);
         }
 
-        Object[] outNodesArray = outNodes.toArray();
+        @SuppressWarnings("unchecked")
+        DigraphNode<E>[] outNodesArray = (DigraphNode<E>[])outNodes.toArray();
         for(int i=0; i<outNodesArray.length; i++) {
-            DigraphNode node = (DigraphNode) outNodesArray[i];
+            DigraphNode<E> node = outNodesArray[i];
             removeEdge(node);
         }
     }
diff --git a/src/share/classes/javax/imageio/spi/IIORegistry.java b/src/share/classes/javax/imageio/spi/IIORegistry.java
index 8fa2878..ca83967 100644
--- a/src/share/classes/javax/imageio/spi/IIORegistry.java
+++ b/src/share/classes/javax/imageio/spi/IIORegistry.java
@@ -115,7 +115,7 @@
      * A <code>Vector</code> containing the valid IIO registry
      * categories (superinterfaces) to be used in the constructor.
      */
-    private static final Vector initialCategories = new Vector(5);
+    private static final Vector<Class<?>> initialCategories = new Vector<>(5);
 
     static {
         initialCategories.add(ImageReaderSpi.class);
@@ -198,9 +198,10 @@
 
         ClassLoader loader = Thread.currentThread().getContextClassLoader();
 
-        Iterator categories = getCategories();
+        Iterator<Class<?>> categories = getCategories();
         while (categories.hasNext()) {
-            Class<IIOServiceProvider> c = (Class)categories.next();
+            @SuppressWarnings("unchecked")
+            Class<IIOServiceProvider> c = (Class<IIOServiceProvider>)categories.next();
             Iterator<IIOServiceProvider> riter =
                     ServiceLoader.load(c, loader).iterator();
             while (riter.hasNext()) {
@@ -234,12 +235,13 @@
           file read capability is restricted (like the
           applet context case).
          */
-        PrivilegedAction doRegistration =
-            new PrivilegedAction() {
+        PrivilegedAction<Object> doRegistration =
+            new PrivilegedAction<Object>() {
                 public Object run() {
-                    Iterator categories = getCategories();
+                    Iterator<Class<?>> categories = getCategories();
                     while (categories.hasNext()) {
-                        Class<IIOServiceProvider> c = (Class)categories.next();
+                        @SuppressWarnings("unchecked")
+                        Class<IIOServiceProvider> c = (Class<IIOServiceProvider>)categories.next();
                         for (IIOServiceProvider p : ServiceLoader.loadInstalled(c)) {
                             registerServiceProvider(p);
                         }
diff --git a/src/share/classes/javax/imageio/spi/ImageReaderSpi.java b/src/share/classes/javax/imageio/spi/ImageReaderSpi.java
index 9ce6de3..01a2bc8 100644
--- a/src/share/classes/javax/imageio/spi/ImageReaderSpi.java
+++ b/src/share/classes/javax/imageio/spi/ImageReaderSpi.java
@@ -81,14 +81,14 @@
      * the equivalent array <code>{ ImageInputStream.class }</code>.
      */
     @Deprecated
-    public static final Class[] STANDARD_INPUT_TYPE =
+    public static final Class<?>[] STANDARD_INPUT_TYPE =
         { ImageInputStream.class };
 
     /**
      * An array of <code>Class</code> objects to be returned from
      * <code>getInputTypes</code>, initially <code>null</code>.
      */
-    protected Class[] inputTypes = null;
+    protected Class<?>[] inputTypes = null;
 
     /**
      * An array of strings to be returned from
@@ -101,7 +101,7 @@
      * The <code>Class</code> of the reader, initially
      * <code>null</code>.
      */
-    private Class readerClass = null;
+    private Class<?> readerClass = null;
 
     /**
      * Constructs a blank <code>ImageReaderSpi</code>.  It is up to
@@ -197,7 +197,7 @@
                           String[] suffixes,
                           String[] MIMETypes,
                           String readerClassName,
-                          Class[] inputTypes,
+                          Class<?>[] inputTypes,
                           String[] writerSpiNames,
                           boolean supportsStandardStreamMetadataFormat,
                           String nativeStreamMetadataFormatName,
@@ -252,9 +252,9 @@
      * returned.
      *
      * @return a non-<code>null</code> array of
-     * <code>Class</code>objects of length at least 1.
+     * <code>Class</code> objects of length at least 1.
      */
-    public Class[] getInputTypes() {
+    public Class<?>[] getInputTypes() {
         return inputTypes.clone();
     }
 
diff --git a/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java b/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java
index 4a5dd14..2918d99 100644
--- a/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java
+++ b/src/share/classes/javax/imageio/spi/ImageReaderWriterSpi.java
@@ -587,7 +587,7 @@
             throw new IllegalArgumentException("Unsupported format name");
         }
         try {
-            Class cls = Class.forName(formatClassName, true,
+            Class<?> cls = Class.forName(formatClassName, true,
                                       ClassLoader.getSystemClassLoader());
             Method meth = cls.getMethod("getInstance");
             return (IIOMetadataFormat) meth.invoke(null);
diff --git a/src/share/classes/javax/imageio/spi/ImageWriterSpi.java b/src/share/classes/javax/imageio/spi/ImageWriterSpi.java
index 19d1714..6e78e39 100644
--- a/src/share/classes/javax/imageio/spi/ImageWriterSpi.java
+++ b/src/share/classes/javax/imageio/spi/ImageWriterSpi.java
@@ -83,14 +83,14 @@
      * the equivalent array <code>{ ImageOutputStream.class }</code>.
      */
     @Deprecated
-    public static final Class[] STANDARD_OUTPUT_TYPE =
+    public static final Class<?>[] STANDARD_OUTPUT_TYPE =
         { ImageOutputStream.class };
 
     /**
      * An array of <code>Class</code> objects to be returned from
      * <code>getOutputTypes</code>, initially <code>null</code>.
      */
-    protected Class[] outputTypes = null;
+    protected Class<?>[] outputTypes = null;
 
     /**
      * An array of strings to be returned from
@@ -103,7 +103,7 @@
      * The <code>Class</code> of the writer, initially
      * <code>null</code>.
      */
-    private Class writerClass = null;
+    private Class<?> writerClass = null;
 
     /**
      * Constructs a blank <code>ImageWriterSpi</code>.  It is up to
@@ -198,7 +198,7 @@
                           String[] suffixes,
                           String[] MIMETypes,
                           String writerClassName,
-                          Class[] outputTypes,
+                          Class<?>[] outputTypes,
                           String[] readerSpiNames,
                           boolean supportsStandardStreamMetadataFormat,
                           String nativeStreamMetadataFormatName,
@@ -265,9 +265,9 @@
      * returned.
      *
      * @return a non-<code>null</code> array of
-     * <code>Class</code>objects of length at least 1.
+     * <code>Class</code> objects of length at least 1.
      */
-    public Class[] getOutputTypes() {
+    public Class<?>[] getOutputTypes() {
         return outputTypes.clone();
     }
 
diff --git a/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java b/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java
index 99dbf59..f4d17c2 100644
--- a/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java
+++ b/src/share/classes/javax/imageio/spi/PartiallyOrderedSet.java
@@ -51,17 +51,17 @@
  * supplied by a trusted vendor over those supplied by another.
  *
  */
-class PartiallyOrderedSet extends AbstractSet {
+class PartiallyOrderedSet<E> extends AbstractSet<E> {
 
     // The topological sort (roughly) follows the algorithm described in
     // Horowitz and Sahni, _Fundamentals of Data Structures_ (1976),
     // p. 315.
 
     // Maps Objects to DigraphNodes that contain them
-    private Map poNodes = new HashMap();
+    private Map<E, DigraphNode<E>> poNodes = new HashMap<>();
 
     // The set of Objects
-    private Set nodes = poNodes.keySet();
+    private Set<E> nodes = poNodes.keySet();
 
     /**
      * Constructs a <code>PartiallyOrderedSet</code>.
@@ -81,20 +81,20 @@
      * collection, with an ordering that respects the orderings set
      * by the <code>setOrdering</code> method.
      */
-    public Iterator iterator() {
-        return new PartialOrderIterator(poNodes.values().iterator());
+    public Iterator<E> iterator() {
+        return new PartialOrderIterator<>(poNodes.values().iterator());
     }
 
     /**
      * Adds an <code>Object</code> to this
      * <code>PartiallyOrderedSet</code>.
      */
-    public boolean add(Object o) {
+    public boolean add(E o) {
         if (nodes.contains(o)) {
             return false;
         }
 
-        DigraphNode node = new DigraphNode(o);
+        DigraphNode<E> node = new DigraphNode<>(o);
         poNodes.put(o, node);
         return true;
     }
@@ -104,7 +104,7 @@
      * <code>PartiallyOrderedSet</code>.
      */
     public boolean remove(Object o) {
-        DigraphNode node = (DigraphNode)poNodes.get(o);
+        DigraphNode<E> node = poNodes.get(o);
         if (node == null) {
             return false;
         }
@@ -127,11 +127,9 @@
      * @return <code>true</code> if no prior ordering existed
      * between the nodes, <code>false</code>otherwise.
      */
-    public boolean setOrdering(Object first, Object second) {
-        DigraphNode firstPONode =
-            (DigraphNode)poNodes.get(first);
-        DigraphNode secondPONode =
-            (DigraphNode)poNodes.get(second);
+    public boolean setOrdering(E first, E second) {
+        DigraphNode<E> firstPONode = poNodes.get(first);
+        DigraphNode<E> secondPONode = poNodes.get(second);
 
         secondPONode.removeEdge(firstPONode);
         return firstPONode.addEdge(secondPONode);
@@ -142,11 +140,9 @@
      *
      * @return true if a prior prefence existed between the nodes.
      */
-    public boolean unsetOrdering(Object first, Object second) {
-        DigraphNode firstPONode =
-            (DigraphNode)poNodes.get(first);
-        DigraphNode secondPONode =
-            (DigraphNode)poNodes.get(second);
+    public boolean unsetOrdering(E first, E second) {
+        DigraphNode<E> firstPONode = poNodes.get(first);
+        DigraphNode<E> secondPONode = poNodes.get(second);
 
         return firstPONode.removeEdge(secondPONode) ||
             secondPONode.removeEdge(firstPONode);
@@ -156,25 +152,23 @@
      * Returns <code>true</code> if an ordering exists between two
      * nodes.
      */
-    public boolean hasOrdering(Object preferred, Object other) {
-        DigraphNode preferredPONode =
-            (DigraphNode)poNodes.get(preferred);
-        DigraphNode otherPONode =
-            (DigraphNode)poNodes.get(other);
+    public boolean hasOrdering(E preferred, E other) {
+        DigraphNode<E> preferredPONode = poNodes.get(preferred);
+        DigraphNode<E> otherPONode = poNodes.get(other);
 
         return preferredPONode.hasEdge(otherPONode);
     }
 }
 
-class PartialOrderIterator implements Iterator {
+class PartialOrderIterator<E> implements Iterator<E> {
 
-    LinkedList zeroList = new LinkedList();
-    Map inDegrees = new HashMap(); // DigraphNode -> Integer
+    LinkedList<DigraphNode<E>> zeroList = new LinkedList<>();
+    Map<DigraphNode<E>, Integer> inDegrees = new HashMap<>();
 
-    public PartialOrderIterator(Iterator iter) {
+    public PartialOrderIterator(Iterator<DigraphNode<E>> iter) {
         // Initialize scratch in-degree values, zero list
         while (iter.hasNext()) {
-            DigraphNode node = (DigraphNode)iter.next();
+            DigraphNode<E> node = iter.next();
             int inDegree = node.getInDegree();
             inDegrees.put(node, new Integer(inDegree));
 
@@ -189,14 +183,14 @@
         return !zeroList.isEmpty();
     }
 
-    public Object next() {
-        DigraphNode first = (DigraphNode)zeroList.removeFirst();
+    public E next() {
+        DigraphNode<E> first = zeroList.removeFirst();
 
         // For each out node of the output node, decrement its in-degree
-        Iterator outNodes = first.getOutNodes();
+        Iterator<DigraphNode<E>> outNodes = first.getOutNodes();
         while (outNodes.hasNext()) {
-            DigraphNode node = (DigraphNode)outNodes.next();
-            int inDegree = ((Integer)inDegrees.get(node)).intValue() - 1;
+            DigraphNode<E> node = outNodes.next();
+            int inDegree = inDegrees.get(node).intValue() - 1;
             inDegrees.put(node, new Integer(inDegree));
 
             // If the in-degree has fallen to 0, place the node on the list
diff --git a/src/share/classes/javax/imageio/spi/ServiceRegistry.java b/src/share/classes/javax/imageio/spi/ServiceRegistry.java
index 2eff30e..947fb0a 100644
--- a/src/share/classes/javax/imageio/spi/ServiceRegistry.java
+++ b/src/share/classes/javax/imageio/spi/ServiceRegistry.java
@@ -99,7 +99,7 @@
 public class ServiceRegistry {
 
     // Class -> Registry
-    private Map categoryMap = new HashMap();
+    private Map<Class<?>, SubRegistry> categoryMap = new HashMap<>();
 
     /**
      * Constructs a <code>ServiceRegistry</code> instance with a
@@ -117,7 +117,7 @@
             throw new IllegalArgumentException("categories == null!");
         }
         while (categories.hasNext()) {
-            Class category = (Class)categories.next();
+            Class<?> category = categories.next();
             SubRegistry reg = new SubRegistry(this, category);
             categoryMap.put(category, reg);
         }
@@ -208,7 +208,7 @@
      * <code>Class</code>objects.
      */
     public Iterator<Class<?>> getCategories() {
-        Set keySet = categoryMap.keySet();
+        Set<Class<?>> keySet = categoryMap.keySet();
         return keySet.iterator();
     }
 
@@ -216,13 +216,13 @@
      * Returns an Iterator containing the subregistries to which the
      * provider belongs.
      */
-    private Iterator getSubRegistries(Object provider) {
-        List l = new ArrayList();
-        Iterator iter = categoryMap.keySet().iterator();
+    private Iterator<SubRegistry> getSubRegistries(Object provider) {
+        List<SubRegistry> l = new ArrayList<>();
+        Iterator<Class<?>> iter = categoryMap.keySet().iterator();
         while (iter.hasNext()) {
-            Class c = (Class)iter.next();
+            Class<?> c = iter.next();
             if (c.isAssignableFrom(provider.getClass())) {
-                l.add((SubRegistry)categoryMap.get(c));
+                l.add(categoryMap.get(c));
             }
         }
         return l.iterator();
@@ -259,7 +259,7 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -292,9 +292,9 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        Iterator regs = getSubRegistries(provider);
+        Iterator<SubRegistry> regs = getSubRegistries(provider);
         while (regs.hasNext()) {
-            SubRegistry reg = (SubRegistry)regs.next();
+            SubRegistry reg = regs.next();
             reg.registerServiceProvider(provider);
         }
     }
@@ -362,7 +362,7 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -385,9 +385,9 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        Iterator regs = getSubRegistries(provider);
+        Iterator<SubRegistry> regs = getSubRegistries(provider);
         while (regs.hasNext()) {
-            SubRegistry reg = (SubRegistry)regs.next();
+            SubRegistry reg = regs.next();
             reg.deregisterServiceProvider(provider);
         }
     }
@@ -408,9 +408,9 @@
         if (provider == null) {
             throw new IllegalArgumentException("provider == null!");
         }
-        Iterator regs = getSubRegistries(provider);
+        Iterator<SubRegistry> regs = getSubRegistries(provider);
         while (regs.hasNext()) {
-            SubRegistry reg = (SubRegistry)regs.next();
+            SubRegistry reg = regs.next();
             if (reg.contains(provider)) {
                 return true;
             }
@@ -442,11 +442,13 @@
      */
     public <T> Iterator<T> getServiceProviders(Class<T> category,
                                                boolean useOrdering) {
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
-        return reg.getServiceProviders(useOrdering);
+        @SuppressWarnings("unchecked")
+        Iterator<T> it = (Iterator<T>)reg.getServiceProviders(useOrdering);
+        return it;
     }
 
     /**
@@ -499,12 +501,12 @@
     public <T> Iterator<T> getServiceProviders(Class<T> category,
                                                Filter filter,
                                                boolean useOrdering) {
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
-        Iterator iter = getServiceProviders(category, useOrdering);
-        return new FilterIterator(iter, filter);
+        Iterator<T> iter = getServiceProviders(category, useOrdering);
+        return new FilterIterator<>(iter, filter);
     }
 
     /**
@@ -529,11 +531,11 @@
         if (providerClass == null) {
             throw new IllegalArgumentException("providerClass == null!");
         }
-        Iterator iter = categoryMap.keySet().iterator();
+        Iterator<Class<?>> iter = categoryMap.keySet().iterator();
         while (iter.hasNext()) {
-            Class c = (Class)iter.next();
+            Class<?> c = iter.next();
             if (c.isAssignableFrom(providerClass)) {
-                SubRegistry reg = (SubRegistry)categoryMap.get(c);
+                SubRegistry reg = categoryMap.get(c);
                 T provider = reg.getServiceProviderByClass(providerClass);
                 if (provider != null) {
                     return provider;
@@ -580,7 +582,7 @@
         if (firstProvider == secondProvider) {
             throw new IllegalArgumentException("providers are the same!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -626,7 +628,7 @@
         if (firstProvider == secondProvider) {
             throw new IllegalArgumentException("providers are the same!");
         }
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -647,7 +649,7 @@
      * corresponding to <code>category</code>.
      */
     public void deregisterAll(Class<?> category) {
-        SubRegistry reg = (SubRegistry)categoryMap.get(category);
+        SubRegistry reg = categoryMap.get(category);
         if (reg == null) {
             throw new IllegalArgumentException("category unknown!");
         }
@@ -659,9 +661,9 @@
      * categories.
      */
     public void deregisterAll() {
-        Iterator iter = categoryMap.values().iterator();
+        Iterator<SubRegistry> iter = categoryMap.values().iterator();
         while (iter.hasNext()) {
-            SubRegistry reg = (SubRegistry)iter.next();
+            SubRegistry reg = iter.next();
             reg.clear();
         }
     }
@@ -690,15 +692,17 @@
 
     ServiceRegistry registry;
 
-    Class category;
+    Class<?> category;
 
     // Provider Objects organized by partial oridering
-    PartiallyOrderedSet poset = new PartiallyOrderedSet();
+    PartiallyOrderedSet<Object> poset = new PartiallyOrderedSet<>();
 
     // Class -> Provider Object of that class
-    Map<Class<?>,Object> map = new HashMap();
+    // No way to express heterogeneous map, we want
+    // Map<Class<T>, T>, where T is ?
+    Map<Class<?>, Object> map = new HashMap<>();
 
-    public SubRegistry(ServiceRegistry registry, Class category) {
+    public SubRegistry(ServiceRegistry registry, Class<?> category) {
         this.registry = registry;
         this.category = category;
     }
@@ -756,7 +760,7 @@
         return poset.unsetOrdering(firstProvider, secondProvider);
     }
 
-    public Iterator getServiceProviders(boolean useOrdering) {
+    public Iterator<Object> getServiceProviders(boolean useOrdering) {
         if (useOrdering) {
             return poset.iterator();
         } else {
@@ -764,12 +768,13 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     public <T> T getServiceProviderByClass(Class<T> providerClass) {
         return (T)map.get(providerClass);
     }
 
     public void clear() {
-        Iterator iter = map.values().iterator();
+        Iterator<Object> iter = map.values().iterator();
         while (iter.hasNext()) {
             Object provider = iter.next();
             iter.remove();
@@ -794,12 +799,12 @@
  */
 class FilterIterator<T> implements Iterator<T> {
 
-    private Iterator<T> iter;
+    private Iterator<? extends T> iter;
     private ServiceRegistry.Filter filter;
 
     private T next = null;
 
-    public FilterIterator(Iterator<T> iter,
+    public FilterIterator(Iterator<? extends T> iter,
                           ServiceRegistry.Filter filter) {
         this.iter = iter;
         this.filter = filter;
diff --git a/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java b/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
index 0a0be29..46d7748 100644
--- a/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
+++ b/src/share/classes/javax/imageio/stream/ImageInputStreamImpl.java
@@ -43,9 +43,9 @@
  */
 public abstract class ImageInputStreamImpl implements ImageInputStream {
 
-    private Stack markByteStack = new Stack();
+    private Stack<Long> markByteStack = new Stack<>();
 
-    private Stack markBitStack = new Stack();
+    private Stack<Integer> markBitStack = new Stack<>();
 
     private boolean isClosed = false;
 
@@ -798,14 +798,14 @@
             return;
         }
 
-        long pos = ((Long)markByteStack.pop()).longValue();
+        long pos = markByteStack.pop().longValue();
         if (pos < flushedPos) {
             throw new IIOException
                 ("Previous marked position has been discarded!");
         }
         seek(pos);
 
-        int offset = ((Integer)markBitStack.pop()).intValue();
+        int offset = markBitStack.pop().intValue();
         setBitOffset(offset);
     }
 
diff --git a/src/share/classes/javax/imageio/stream/MemoryCache.java b/src/share/classes/javax/imageio/stream/MemoryCache.java
index b7102d7..48c5e50 100644
--- a/src/share/classes/javax/imageio/stream/MemoryCache.java
+++ b/src/share/classes/javax/imageio/stream/MemoryCache.java
@@ -58,7 +58,7 @@
 
     private static final int BUFFER_LENGTH = 8192;
 
-    private ArrayList cache = new ArrayList();
+    private ArrayList<byte[]> cache = new ArrayList<>();
 
     private long cacheStart = 0L;
 
@@ -74,7 +74,7 @@
             // contiguous data...
             throw new IOException("Cache addressing limit exceeded!");
         }
-        return (byte[])cache.get((int)blockOffset);
+        return cache.get((int)blockOffset);
     }
 
     /**
diff --git a/src/share/classes/javax/smartcardio/TerminalFactory.java b/src/share/classes/javax/smartcardio/TerminalFactory.java
index f5dd7ae..b04d556 100644
--- a/src/share/classes/javax/smartcardio/TerminalFactory.java
+++ b/src/share/classes/javax/smartcardio/TerminalFactory.java
@@ -32,8 +32,6 @@
 import sun.security.jca.*;
 import sun.security.jca.GetInstance.*;
 
-import sun.security.action.GetPropertyAction;
-
 /**
  * A factory for CardTerminal objects.
  *
@@ -99,8 +97,8 @@
 
     static {
         // lookup up the user specified type, default to PC/SC
-        String type = AccessController.doPrivileged
-                            (new GetPropertyAction(PROP_NAME, "PC/SC")).trim();
+        String type = AccessController.doPrivileged(
+             (PrivilegedAction<String>) () -> System.getProperty(PROP_NAME, "PC/SC")).trim();
         TerminalFactory factory = null;
         try {
             factory = TerminalFactory.getInstance(type, null);
diff --git a/src/share/classes/javax/swing/BufferStrategyPaintManager.java b/src/share/classes/javax/swing/BufferStrategyPaintManager.java
index 97653d0..14eac74 100644
--- a/src/share/classes/javax/swing/BufferStrategyPaintManager.java
+++ b/src/share/classes/javax/swing/BufferStrategyPaintManager.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -32,6 +32,9 @@
 import java.util.*;
 
 import com.sun.java.swing.SwingUtilities3;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import sun.awt.AWTAccessor;
 
 import sun.awt.SubRegionShowable;
 import sun.java2d.SunGraphics2D;
@@ -69,12 +72,6 @@
     // if we get a blit strategy.
     //
 
-    //
-    // Methods used to create BufferStrategy for Applets.
-    //
-    private static Method COMPONENT_CREATE_BUFFER_STRATEGY_METHOD;
-    private static Method COMPONENT_GET_BUFFER_STRATEGY_METHOD;
-
     private static final PlatformLogger LOGGER = PlatformLogger.getLogger(
                            "javax.swing.BufferStrategyPaintManager");
 
@@ -143,44 +140,6 @@
      */
     private boolean disposeBufferOnEnd;
 
-    private static Method getGetBufferStrategyMethod() {
-        if (COMPONENT_GET_BUFFER_STRATEGY_METHOD == null) {
-            getMethods();
-        }
-        return COMPONENT_GET_BUFFER_STRATEGY_METHOD;
-    }
-
-    private static Method getCreateBufferStrategyMethod() {
-        if (COMPONENT_CREATE_BUFFER_STRATEGY_METHOD == null) {
-            getMethods();
-        }
-        return COMPONENT_CREATE_BUFFER_STRATEGY_METHOD;
-    }
-
-    private static void getMethods() {
-        java.security.AccessController.doPrivileged(
-                            new java.security.PrivilegedAction<Object>() {
-            public Object run() {
-                try {
-                    COMPONENT_CREATE_BUFFER_STRATEGY_METHOD = Component.class.
-                              getDeclaredMethod("createBufferStrategy",
-                                                new Class[] { int.class,
-                                                BufferCapabilities.class });
-                    COMPONENT_CREATE_BUFFER_STRATEGY_METHOD.
-                                            setAccessible(true);
-                    COMPONENT_GET_BUFFER_STRATEGY_METHOD = Component.class.
-                              getDeclaredMethod("getBufferStrategy");
-                    COMPONENT_GET_BUFFER_STRATEGY_METHOD.setAccessible(true);
-                } catch (SecurityException e) {
-                    assert false;
-                } catch (NoSuchMethodException nsme) {
-                    assert false;
-                }
-                return null;
-            }
-        });
-    }
-
     BufferStrategyPaintManager() {
         bufferInfos = new ArrayList<BufferInfo>(1);
     }
@@ -766,16 +725,7 @@
                     componentBS = ((Window)root).getBufferStrategy();
                 }
                 else {
-                    try {
-                        componentBS = (BufferStrategy)
-                                 getGetBufferStrategyMethod().invoke(root);
-                    } catch (InvocationTargetException ite) {
-                        assert false;
-                    } catch (IllegalArgumentException iae) {
-                        assert false;
-                    } catch (IllegalAccessException iae2) {
-                        assert false;
-                    }
+                    componentBS = AWTAccessor.getComponentAccessor().getBufferStrategy(root);
                 }
                 if (componentBS != ourBS) {
                     // Component has a different BS, dispose ours.
@@ -839,19 +789,16 @@
             BufferStrategy bs = null;
             if (SunToolkit.isInstanceOf(root, "java.applet.Applet")) {
                 try {
-                    getCreateBufferStrategyMethod().invoke(root, 2, caps);
-                    bs = (BufferStrategy)getGetBufferStrategyMethod().
-                                            invoke(root);
-                } catch (InvocationTargetException ite) {
+                    AWTAccessor.ComponentAccessor componentAccessor
+                            = AWTAccessor.getComponentAccessor();
+                    componentAccessor.createBufferStrategy(root, 2, caps);
+                    bs = componentAccessor.getBufferStrategy(root);
+                } catch (AWTException e) {
                     // Type is not supported
                     if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
                         LOGGER.finer("createBufferStratety failed",
-                                     ite);
+                                     e);
                     }
-                } catch (IllegalArgumentException iae) {
-                    assert false;
-                } catch (IllegalAccessException iae2) {
-                    assert false;
                 }
             }
             else {
diff --git a/src/share/classes/javax/swing/DefaultDesktopManager.java b/src/share/classes/javax/swing/DefaultDesktopManager.java
index ed62d77..3860e9d 100644
--- a/src/share/classes/javax/swing/DefaultDesktopManager.java
+++ b/src/share/classes/javax/swing/DefaultDesktopManager.java
@@ -677,6 +677,11 @@
 
           f.setBounds(currentBounds);
 
+          if (!floaterCollision) {
+              Rectangle r = currentBounds;
+              currentManager.notifyRepaintPerformed(parent, r.x, r.y, r.width, r.height);
+          }
+
           if(floaterCollision) {
               // since we couldn't blit we just redraw as fast as possible
               // the isDragging mucking is to avoid activating emergency
@@ -706,6 +711,8 @@
           // Fix the damage
           for (int i = 0; i < dirtyRects.length; i++) {
               parent.paintImmediately(dirtyRects[i]);
+              Rectangle r = dirtyRects[i];
+              currentManager.notifyRepaintPerformed(parent, r.x, r.y, r.width, r.height);
           }
 
           // new areas of blit were exposed
@@ -716,9 +723,10 @@
                   dirtyRects[i].x += newX - previousBounds.x;
                   dirtyRects[i].y += newY - previousBounds.y;
                   ((JInternalFrame)f).isDragging = false;
-
                   parent.paintImmediately(dirtyRects[i]);
                   ((JInternalFrame)f).isDragging = true;
+                  Rectangle r = dirtyRects[i];
+                  currentManager.notifyRepaintPerformed(parent, r.x, r.y, r.width, r.height);
               }
 
           }
diff --git a/src/share/classes/javax/swing/JSpinner.java b/src/share/classes/javax/swing/JSpinner.java
index f999fd3..4831d36 100644
--- a/src/share/classes/javax/swing/JSpinner.java
+++ b/src/share/classes/javax/swing/JSpinner.java
@@ -1221,6 +1221,7 @@
             JFormattedTextField ftf = getTextField();
             ftf.setEditable(true);
             ftf.setFormatterFactory(factory);
+            // Change the text orientation for the NumberEditor
             ftf.setHorizontalAlignment(JTextField.RIGHT);
 
             /* TBD - initializing the column width of the text field
@@ -1264,6 +1265,16 @@
         public SpinnerNumberModel getModel() {
             return (SpinnerNumberModel)(getSpinner().getModel());
         }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public void setComponentOrientation(ComponentOrientation o) {
+            super.setComponentOrientation(o);
+            getTextField().setHorizontalAlignment(
+                    o.isLeftToRight() ? JTextField.RIGHT : JTextField.LEFT);
+        }
     }
 
 
diff --git a/src/share/classes/javax/swing/JTable.java b/src/share/classes/javax/swing/JTable.java
index f16888c..5db8833 100644
--- a/src/share/classes/javax/swing/JTable.java
+++ b/src/share/classes/javax/swing/JTable.java
@@ -5308,12 +5308,12 @@
         return retValue;
     }
 
-    private void setLazyValue(Hashtable h, Class c, String s) {
-        h.put(c, new SwingLazyValue(s));
+    private void setLazyValue(Hashtable h, Class c, LazyClass lazyClass) {
+        h.put(c, new TableLazyValue(lazyClass));
     }
 
-    private void setLazyRenderer(Class c, String s) {
-        setLazyValue(defaultRenderersByColumnClass, c, s);
+    private void setLazyRenderer(Class c, LazyClass lazyClass) {
+        setLazyValue(defaultRenderersByColumnClass, c, lazyClass);
     }
 
     /**
@@ -5326,24 +5326,24 @@
         defaultRenderersByColumnClass = new UIDefaults(8, 0.75f);
 
         // Objects
-        setLazyRenderer(Object.class, "javax.swing.table.DefaultTableCellRenderer$UIResource");
+        setLazyRenderer(Object.class, LazyClass.UIResource);
 
         // Numbers
-        setLazyRenderer(Number.class, "javax.swing.JTable$NumberRenderer");
+        setLazyRenderer(Number.class, LazyClass.NumberRenderer);
 
         // Doubles and Floats
-        setLazyRenderer(Float.class, "javax.swing.JTable$DoubleRenderer");
-        setLazyRenderer(Double.class, "javax.swing.JTable$DoubleRenderer");
+        setLazyRenderer(Float.class, LazyClass.DoubleRenderer);
+        setLazyRenderer(Double.class, LazyClass.DoubleRenderer);
 
         // Dates
-        setLazyRenderer(Date.class, "javax.swing.JTable$DateRenderer");
+        setLazyRenderer(Date.class, LazyClass.DateRenderer);
 
         // Icons and ImageIcons
-        setLazyRenderer(Icon.class, "javax.swing.JTable$IconRenderer");
-        setLazyRenderer(ImageIcon.class, "javax.swing.JTable$IconRenderer");
+        setLazyRenderer(Icon.class, LazyClass.IconRenderer);
+        setLazyRenderer(ImageIcon.class, LazyClass.IconRenderer);
 
         // Booleans
-        setLazyRenderer(Boolean.class, "javax.swing.JTable$BooleanRenderer");
+        setLazyRenderer(Boolean.class, LazyClass.BooleanRenderer);
     }
 
     /**
@@ -5421,8 +5421,8 @@
         }
     }
 
-    private void setLazyEditor(Class c, String s) {
-        setLazyValue(defaultEditorsByColumnClass, c, s);
+    private void setLazyEditor(Class c, LazyClass lazyClass) {
+        setLazyValue(defaultEditorsByColumnClass, c, lazyClass);
     }
 
     /**
@@ -5433,13 +5433,13 @@
         defaultEditorsByColumnClass = new UIDefaults(3, 0.75f);
 
         // Objects
-        setLazyEditor(Object.class, "javax.swing.JTable$GenericEditor");
+        setLazyEditor(Object.class, LazyClass.GenericEditor);
 
         // Numbers
-        setLazyEditor(Number.class, "javax.swing.JTable$NumberEditor");
+        setLazyEditor(Number.class, LazyClass.NumberEditor);
 
         // Booleans
-        setLazyEditor(Boolean.class, "javax.swing.JTable$BooleanEditor");
+        setLazyEditor(Boolean.class, LazyClass.BooleanEditor);
     }
 
     /**
@@ -6545,6 +6545,53 @@
         }
     }
 
+    private enum LazyClass {
+
+        UIResource,
+        NumberRenderer,
+        DoubleRenderer,
+        DateRenderer,
+        IconRenderer,
+        BooleanRenderer,
+        GenericEditor,
+        NumberEditor,
+        BooleanEditor,
+    }
+
+    private static class TableLazyValue implements UIDefaults.LazyValue {
+
+        private LazyClass type;
+
+        public TableLazyValue(LazyClass type) {
+            this.type = type;
+        }
+
+        @Override
+        public Object createValue(UIDefaults table) {
+            switch (type) {
+                case UIResource:
+                    return new DefaultTableCellRenderer.UIResource();
+                case NumberRenderer:
+                    return new NumberRenderer();
+                case DoubleRenderer:
+                    return new DoubleRenderer();
+                case DateRenderer:
+                    return new DateRenderer();
+                case IconRenderer:
+                    return new IconRenderer();
+                case BooleanRenderer:
+                    return new BooleanRenderer();
+                case GenericEditor:
+                    return new GenericEditor();
+                case NumberEditor:
+                    return new NumberEditor();
+                case BooleanEditor:
+                    return new BooleanEditor();
+                default:
+                    return null;
+            }
+        }
+    }
 
 /////////////////
 // Accessibility support
diff --git a/src/share/classes/javax/swing/JViewport.java b/src/share/classes/javax/swing/JViewport.java
index 856513a..5b01969 100644
--- a/src/share/classes/javax/swing/JViewport.java
+++ b/src/share/classes/javax/swing/JViewport.java
@@ -25,8 +25,6 @@
 
 package javax.swing;
 
-import sun.swing.JLightweightFrame;
-
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.peer.ComponentPeer;
@@ -37,10 +35,8 @@
 import javax.swing.border.*;
 import javax.accessibility.*;
 
-
 import java.io.Serializable;
 
-
 /**
  * The "viewport" or "porthole" through which you see the underlying
  * information. When you scroll, what moves is the viewport. It is like
@@ -364,18 +360,6 @@
         super.remove(child);
     }
 
-    @Override
-    public void addNotify() {
-        super.addNotify();
-        // JLightweightFrame does not support BLIT_SCROLL_MODE, so it should be replaced
-        Window rootWindow = SwingUtilities.getWindowAncestor(this);
-        if (rootWindow instanceof JLightweightFrame
-                && getScrollMode() == BLIT_SCROLL_MODE) {
-            setScrollMode(BACKINGSTORE_SCROLL_MODE);
-        }
-    }
-
-
     /**
      * Scrolls the view so that <code>Rectangle</code>
      * within the view becomes visible.
@@ -1109,13 +1093,15 @@
                         Graphics g = JComponent.safelyGetGraphics(this);
                         flushViewDirtyRegion(g, dirty);
                         view.setLocation(newX, newY);
-                        g.setClip(0,0,getWidth(), Math.min(getHeight(),
-                                                           jview.getHeight()));
+                        Rectangle r = new Rectangle(
+                            0, 0, getWidth(), Math.min(getHeight(), jview.getHeight()));
+                        g.setClip(r);
                         // Repaint the complete component if the blit succeeded
                         // and needsRepaintAfterBlit returns true.
                         repaintAll = (windowBlitPaint(g) &&
                                       needsRepaintAfterBlit());
                         g.dispose();
+                        rm.notifyRepaintPerformed(this, r.x, r.y, r.width, r.height);
                         rm.markCompletelyClean((JComponent)getParent());
                         rm.markCompletelyClean(this);
                         rm.markCompletelyClean(jview);
diff --git a/src/share/classes/javax/swing/MenuSelectionManager.java b/src/share/classes/javax/swing/MenuSelectionManager.java
index 8bde555..67e35dc 100644
--- a/src/share/classes/javax/swing/MenuSelectionManager.java
+++ b/src/share/classes/javax/swing/MenuSelectionManager.java
@@ -30,6 +30,7 @@
 import javax.swing.event.*;
 
 import sun.awt.AppContext;
+import sun.swing.SwingUtilities2;
 
 /**
  * A MenuSelectionManager owns the selection in menu hierarchy.
@@ -60,6 +61,12 @@
             if (msm == null) {
                 msm = new MenuSelectionManager();
                 context.put(MENU_SELECTION_MANAGER_KEY, msm);
+
+                // installing additional listener if found in the AppContext
+                Object o = context.get(SwingUtilities2.MENU_SELECTION_MANAGER_LISTENER_KEY);
+                if (o != null && o instanceof ChangeListener) {
+                    msm.addChangeListener((ChangeListener) o);
+                }
             }
 
             return msm;
diff --git a/src/share/classes/javax/swing/RepaintManager.java b/src/share/classes/javax/swing/RepaintManager.java
index 5f103d9..c65c826 100644
--- a/src/share/classes/javax/swing/RepaintManager.java
+++ b/src/share/classes/javax/swing/RepaintManager.java
@@ -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
@@ -45,6 +45,8 @@
 import sun.security.action.GetPropertyAction;
 
 import com.sun.java.swing.SwingUtilities3;
+import sun.swing.SwingAccessor;
+import sun.swing.SwingUtilities2.RepaintListener;
 
 /**
  * This class manages repaint requests, allowing the number
@@ -184,6 +186,17 @@
 
 
     static {
+        SwingAccessor.setRepaintManagerAccessor(new SwingAccessor.RepaintManagerAccessor() {
+            @Override
+            public void addRepaintListener(RepaintManager rm, RepaintListener l) {
+                rm.addRepaintListener(l);
+            }
+            @Override
+            public void removeRepaintListener(RepaintManager rm, RepaintListener l) {
+                rm.removeRepaintListener(l);
+            }
+        });
+
         volatileImageBufferEnabled = "true".equals(AccessController.
                 doPrivileged(new GetPropertyAction(
                 "swing.volatileImageBufferEnabled", "true")));
@@ -1267,6 +1280,33 @@
         getPaintManager().copyArea(c, g, x, y, w, h, deltaX, deltaY, clip);
     }
 
+    private java.util.List<RepaintListener> repaintListeners = new ArrayList<>(1);
+
+    private void addRepaintListener(RepaintListener l) {
+        repaintListeners.add(l);
+    }
+
+    private void removeRepaintListener(RepaintListener l) {
+        repaintListeners.remove(l);
+    }
+
+    /**
+     * Notify the attached repaint listeners that an area of the {@code c} component
+     * has been immediately repainted, that is without scheduling a repaint runnable,
+     * due to performing a "blit" (via calling the {@code copyArea} method).
+     *
+     * @param c the component
+     * @param x the x coordinate of the area
+     * @param y the y coordinate of the area
+     * @param w the width of the area
+     * @param h the height of the area
+     */
+    void notifyRepaintPerformed(JComponent c, int x, int y, int w, int h) {
+        for (RepaintListener l : repaintListeners) {
+            l.repaintPerformed(c, x, y, w, h);
+        }
+    }
+
     /**
      * Invoked prior to any paint/copyArea method calls.  This will
      * be followed by an invocation of <code>endPaint</code>.
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java b/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
index b43e5d2..1c9e8cb 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java
@@ -109,8 +109,7 @@
 
 
     static {
-        newline = java.security.AccessController.doPrivileged(
-                                new GetPropertyAction("line.separator"));
+        newline = System.lineSeparator();
         if (newline == null) {
             newline = "\n";
         }
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java b/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
index 95077d1..eb057e6 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java
@@ -997,21 +997,32 @@
                              "model".equals(propertyName)) {
                         ui.updateEnabledState();
                     }
-                else if ("font".equals(propertyName)) {
-                    JComponent editor = spinner.getEditor();
-                    if (editor!=null && editor instanceof JSpinner.DefaultEditor) {
-                        JTextField tf =
-                            ((JSpinner.DefaultEditor)editor).getTextField();
-                        if (tf != null) {
-                            if (tf.getFont() instanceof UIResource) {
-                                tf.setFont(spinner.getFont());
+                    else if ("font".equals(propertyName)) {
+                        JComponent editor = spinner.getEditor();
+                        if (editor!=null && editor instanceof JSpinner.DefaultEditor) {
+                            JTextField tf =
+                                ((JSpinner.DefaultEditor)editor).getTextField();
+                            if (tf != null) {
+                                if (tf.getFont() instanceof UIResource) {
+                                    tf.setFont(spinner.getFont());
+                                }
                             }
                         }
                     }
-                }
-                else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
-                    updateToolTipTextForChildren(spinner);
-                }
+                    else if (JComponent.TOOL_TIP_TEXT_KEY.equals(propertyName)) {
+                        updateToolTipTextForChildren(spinner);
+                    } else if ("componentOrientation".equals(propertyName)) {
+                        ComponentOrientation o
+                                = (ComponentOrientation) e.getNewValue();
+                        if (o != (ComponentOrientation) e.getOldValue()) {
+                            JComponent editor = spinner.getEditor();
+                            if (editor != null) {
+                                editor.applyComponentOrientation(o);
+                            }
+                            spinner.revalidate();
+                            spinner.repaint();
+                        }
+                    }
                 }
             } else if (e.getSource() instanceof JComponent) {
                 JComponent c = (JComponent)e.getSource();
diff --git a/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java b/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
index f0d043b..677d1f8 100644
--- a/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
+++ b/src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
@@ -1067,9 +1067,69 @@
     /**
      * Data model for a type-face selection combo-box.
      */
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return MetalFileChooserUI.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<Object> implements ComboBoxModel<Object>, PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public Object getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
diff --git a/src/share/classes/javax/swing/text/AbstractDocument.java b/src/share/classes/javax/swing/text/AbstractDocument.java
index 6332cb3..a7a109f 100644
--- a/src/share/classes/javax/swing/text/AbstractDocument.java
+++ b/src/share/classes/javax/swing/text/AbstractDocument.java
@@ -698,7 +698,6 @@
             return;
         }
         DocumentFilter filter = getDocumentFilter();
-        InsertStringResult insertStringResult = null;
 
         writeLock();
 
@@ -706,23 +705,21 @@
             if (filter != null) {
                 filter.insertString(getFilterBypass(), offs, str, a);
             } else {
-                insertStringResult = handleInsertString(offs, str, a);
+                handleInsertString(offs, str, a);
             }
         } finally {
             writeUnlock();
         }
-
-        processInsertStringResult(insertStringResult);
     }
 
     /**
      * Performs the actual work of inserting the text; it is assumed the
      * caller has obtained a write lock before invoking this.
      */
-    private InsertStringResult handleInsertString(int offs, String str, AttributeSet a)
+    private void handleInsertString(int offs, String str, AttributeSet a)
             throws BadLocationException {
         if ((str == null) || (str.length() == 0)) {
-            return null;
+            return;
         }
         UndoableEdit u = data.insertString(offs, str);
         DefaultDocumentEvent e =
@@ -749,29 +746,11 @@
         insertUpdate(e, a);
         // Mark the edit as done.
         e.end();
-
-        InsertStringResult result = new InsertStringResult();
-
-        result.documentEvent = e;
-
+        fireInsertUpdate(e);
         // only fire undo if Content implementation supports it
         // undo for the composed text is not supported for now
         if (u != null && (a == null || !a.isDefined(StyleConstants.ComposedTextAttribute))) {
-            result.undoableEditEvent = new UndoableEditEvent(this, e);
-        }
-
-        return result;
-    }
-
-    private void processInsertStringResult(InsertStringResult insertStringResult) {
-        if (insertStringResult == null) {
-            return;
-        }
-
-        fireInsertUpdate(insertStringResult.documentEvent);
-
-        if (insertStringResult.undoableEditEvent != null) {
-            fireUndoableEditUpdate(insertStringResult.undoableEditEvent);
+            fireUndoableEditUpdate(new UndoableEditEvent(this, e));
         }
     }
 
@@ -3129,23 +3108,13 @@
         public void insertString(int offset, String string,
                                  AttributeSet attr) throws
                                         BadLocationException {
-            InsertStringResult insertStringResult = handleInsertString(offset, string, attr);
-
-            processInsertStringResult(insertStringResult);
+            handleInsertString(offset, string, attr);
         }
 
         public void replace(int offset, int length, String text,
                             AttributeSet attrs) throws BadLocationException {
             handleRemove(offset, length);
-
-            InsertStringResult insertStringResult = handleInsertString(offset, text, attrs);
-
-            processInsertStringResult(insertStringResult);
+            handleInsertString(offset, text, attrs);
         }
     }
-
-    private static class InsertStringResult {
-        DefaultDocumentEvent documentEvent;
-        UndoableEditEvent undoableEditEvent;
-    }
 }
diff --git a/src/share/classes/javax/swing/text/AbstractWriter.java b/src/share/classes/javax/swing/text/AbstractWriter.java
index ebf38d2..f2f7f74 100644
--- a/src/share/classes/javax/swing/text/AbstractWriter.java
+++ b/src/share/classes/javax/swing/text/AbstractWriter.java
@@ -141,10 +141,7 @@
             setLineSeparator((String)docNewline);
         }
         else {
-            String newline = null;
-            try {
-                newline = System.getProperty("line.separator");
-            } catch (SecurityException se) {}
+            String newline = System.lineSeparator();
             if (newline == null) {
                 // Should not get here, but if we do it means we could not
                 // find a newline string, use \n in this case.
diff --git a/src/share/classes/javax/swing/text/DefaultEditorKit.java b/src/share/classes/javax/swing/text/DefaultEditorKit.java
index 55d75fb..e5db094 100644
--- a/src/share/classes/javax/swing/text/DefaultEditorKit.java
+++ b/src/share/classes/javax/swing/text/DefaultEditorKit.java
@@ -317,9 +317,7 @@
         int offs = pos;
         Object endOfLineProperty = doc.getProperty(EndOfLineStringProperty);
         if (endOfLineProperty == null) {
-            try {
-                endOfLineProperty = System.getProperty("line.separator");
-            } catch (SecurityException se) { }
+            endOfLineProperty = System.lineSeparator();
         }
         String endOfLine;
         if (endOfLineProperty instanceof String) {
diff --git a/src/share/classes/javax/swing/text/html/parser/Parser.java b/src/share/classes/javax/swing/text/html/parser/Parser.java
index 3843437..7912446 100644
--- a/src/share/classes/javax/swing/text/html/parser/Parser.java
+++ b/src/share/classes/javax/swing/text/html/parser/Parser.java
@@ -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
@@ -2089,6 +2089,13 @@
                         // null end tag.
                         endTag(false);
                         continue;
+                    } else if (textpos == 0) {
+                        if (!legalElementContext(dtd.pcdata)) {
+                            error("unexpected.pcdata");
+                        }
+                        if (last.breaksFlow()) {
+                            space = false;
+                        }
                     }
                     break;
 
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/ByteVector.java b/src/share/classes/jdk/internal/org/objectweb/asm/ByteVector.java
index 89eb6d4..98de323 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/ByteVector.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/ByteVector.java
@@ -259,41 +259,68 @@
             if (c >= '\001' && c <= '\177') {
                 data[len++] = (byte) c;
             } else {
-                int byteLength = i;
-                for (int j = i; j < charLength; ++j) {
-                    c = s.charAt(j);
-                    if (c >= '\001' && c <= '\177') {
-                        byteLength++;
-                    } else if (c > '\u07FF') {
-                        byteLength += 3;
-                    } else {
-                        byteLength += 2;
-                    }
-                }
-                if (byteLength > 65535) {
-                    throw new IllegalArgumentException();
-                }
-                data[length] = (byte) (byteLength >>> 8);
-                data[length + 1] = (byte) byteLength;
-                if (length + 2 + byteLength > data.length) {
-                    length = len;
-                    enlarge(2 + byteLength);
-                    data = this.data;
-                }
-                for (int j = i; j < charLength; ++j) {
-                    c = s.charAt(j);
-                    if (c >= '\001' && c <= '\177') {
-                        data[len++] = (byte) c;
-                    } else if (c > '\u07FF') {
-                        data[len++] = (byte) (0xE0 | c >> 12 & 0xF);
-                        data[len++] = (byte) (0x80 | c >> 6 & 0x3F);
-                        data[len++] = (byte) (0x80 | c & 0x3F);
-                    } else {
-                        data[len++] = (byte) (0xC0 | c >> 6 & 0x1F);
-                        data[len++] = (byte) (0x80 | c & 0x3F);
-                    }
-                }
-                break;
+                length = len;
+                return encodeUTF8(s, i, 65535);
+            }
+        }
+        length = len;
+        return this;
+    }
+
+    /**
+     * Puts an UTF8 string into this byte vector. The byte vector is
+     * automatically enlarged if necessary. The string length is encoded in two
+     * bytes before the encoded characters, if there is space for that (i.e. if
+     * this.length - i - 2 >= 0).
+     *
+     * @param s
+     *            the String to encode.
+     * @param i
+     *            the index of the first character to encode. The previous
+     *            characters are supposed to have already been encoded, using
+     *            only one byte per character.
+     * @param maxByteLength
+     *            the maximum byte length of the encoded string, including the
+     *            already encoded characters.
+     * @return this byte vector.
+     */
+    ByteVector encodeUTF8(final String s, int i, int maxByteLength) {
+        int charLength = s.length();
+        int byteLength = i;
+        char c;
+        for (int j = i; j < charLength; ++j) {
+            c = s.charAt(j);
+            if (c >= '\001' && c <= '\177') {
+                byteLength++;
+            } else if (c > '\u07FF') {
+                byteLength += 3;
+            } else {
+                byteLength += 2;
+            }
+        }
+        if (byteLength > maxByteLength) {
+            throw new IllegalArgumentException();
+        }
+        int start = length - i - 2;
+        if (start >= 0) {
+          data[start] = (byte) (byteLength >>> 8);
+          data[start + 1] = (byte) byteLength;
+        }
+        if (length + byteLength - i > data.length) {
+            enlarge(byteLength - i);
+        }
+        int len = length;
+        for (int j = i; j < charLength; ++j) {
+            c = s.charAt(j);
+            if (c >= '\001' && c <= '\177') {
+                data[len++] = (byte) c;
+            } else if (c > '\u07FF') {
+                data[len++] = (byte) (0xE0 | c >> 12 & 0xF);
+                data[len++] = (byte) (0x80 | c >> 6 & 0x3F);
+                data[len++] = (byte) (0x80 | c & 0x3F);
+            } else {
+                data[len++] = (byte) (0xC0 | c >> 6 & 0x1F);
+                data[len++] = (byte) (0x80 | c & 0x3F);
             }
         }
         length = len;
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java b/src/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java
index ab9dcd0..66e8e7e 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/ClassWriter.java
@@ -716,7 +716,8 @@
             sourceFile = newUTF8(file);
         }
         if (debug != null) {
-            sourceDebug = new ByteVector().putUTF8(debug);
+            sourceDebug = new ByteVector().encodeUTF8(debug, 0,
+                    Integer.MAX_VALUE);
         }
     }
 
@@ -857,7 +858,7 @@
         }
         if (sourceDebug != null) {
             ++attributeCount;
-            size += sourceDebug.length + 4;
+            size += sourceDebug.length + 6;
             newUTF8("SourceDebugExtension");
         }
         if (enclosingMethodOwner != 0) {
@@ -946,9 +947,9 @@
             out.putShort(newUTF8("SourceFile")).putInt(2).putShort(sourceFile);
         }
         if (sourceDebug != null) {
-            int len = sourceDebug.length - 2;
+            int len = sourceDebug.length;
             out.putShort(newUTF8("SourceDebugExtension")).putInt(len);
-            out.putByteArray(sourceDebug.data, 2, len);
+            out.putByteArray(sourceDebug.data, 0, len);
         }
         if (enclosingMethodOwner != 0) {
             out.putShort(newUTF8("EnclosingMethod")).putInt(4);
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java b/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java
index 78953ce..e32a13a 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/Frame.java
@@ -99,8 +99,8 @@
      * stack types. VALUE depends on KIND. For LOCAL types, it is an index in
      * the input local variable types. For STACK types, it is a position
      * relatively to the top of input frame stack. For BASE types, it is either
-     * one of the constants defined in FrameVisitor, or for OBJECT and
-     * UNINITIALIZED types, a tag and an index in the type table.
+     * one of the constants defined below, or for OBJECT and UNINITIALIZED
+     * types, a tag and an index in the type table.
      *
      * Output frames can contain types of any kind and with a positive or
      * negative dimension (and even unassigned types, represented by 0 - which
@@ -537,7 +537,7 @@
     /**
      * The types that are initialized in the basic block. A constructor
      * invocation on an UNINITIALIZED or UNINITIALIZED_THIS type must replace
-     * <i>every occurrence</i> of this type in the local variables and in the
+     * <i>every occurence</i> of this type in the local variables and in the
      * operand stack. This cannot be done during the first phase of the
      * algorithm since, during this phase, the local variables and the operand
      * stack are not completely computed. It is therefore necessary to store the
@@ -1446,6 +1446,7 @@
                 // if t is the NULL type, merge(u,t)=u, so there is no change
                 return false;
             } else if ((t & (DIM | BASE_KIND)) == (u & (DIM | BASE_KIND))) {
+                // if t and u have the same dimension and same base kind
                 if ((u & BASE_KIND) == OBJECT) {
                     // if t is also a reference type, and if u and t have the
                     // same dimension merge(u,t) = dim(t) | common parent of the
@@ -1458,9 +1459,13 @@
                     v = OBJECT | cw.addType("java/lang/Object");
                 }
             } else if ((t & BASE_KIND) == OBJECT || (t & DIM) != 0) {
-                // if t is any other reference or array type,
-                // merge(u,t)=java/lang/Object
-                v = OBJECT | cw.addType("java/lang/Object");
+                // if t is any other reference or array type, the merged type
+                // is Object, or min(dim(u), dim(t)) | java/lang/Object is u
+                // and t have different array dimensions
+                int tdim = t & DIM;
+                int udim = u & DIM;
+                v = (udim != tdim ? Math.min(tdim, udim) : 0) | OBJECT
+                        | cw.addType("java/lang/Object");
             } else {
                 // if t is any other type, merge(u,t)=TOP
                 v = TOP;
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/commons/AnalyzerAdapter.java b/src/share/classes/jdk/internal/org/objectweb/asm/commons/AnalyzerAdapter.java
index e914d45..b761bab 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/commons/AnalyzerAdapter.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/commons/AnalyzerAdapter.java
@@ -240,6 +240,7 @@
                 locals.add(types[i].getInternalName());
             }
         }
+        maxLocals = locals.size();
     }
 
     @Override
@@ -519,12 +520,12 @@
     // ------------------------------------------------------------------------
 
     private Object get(final int local) {
-        maxLocals = Math.max(maxLocals, local);
+        maxLocals = Math.max(maxLocals, local + 1);
         return local < locals.size() ? locals.get(local) : Opcodes.TOP;
     }
 
     private void set(final int local, final Object type) {
-        maxLocals = Math.max(maxLocals, local);
+        maxLocals = Math.max(maxLocals, local + 1);
         while (local >= locals.size()) {
             locals.add(Opcodes.TOP);
         }
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
index 2ba917c..7acfff5 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/InsnList.java
@@ -556,6 +556,8 @@
 
         AbstractInsnNode prev;
 
+        AbstractInsnNode remove;
+
         InsnListIterator(int index) {
             if (index == size()) {
                 next = null;
@@ -577,12 +579,22 @@
             AbstractInsnNode result = next;
             prev = result;
             next = result.next;
+            remove = result;
             return result;
         }
 
         public void remove() {
-            InsnList.this.remove(prev);
-            prev = prev.prev;
+            if (remove != null) {
+                if (remove == next) {
+                    next = next.next;
+                } else {
+                    prev = prev.prev;
+                }
+                InsnList.this.remove(remove);
+                remove = null;
+            } else {
+                throw new IllegalStateException();
+            }
         }
 
         public boolean hasPrevious() {
@@ -593,6 +605,7 @@
             AbstractInsnNode result = prev;
             next = result;
             prev = result.prev;
+            remove = result;
             return result;
         }
 
@@ -619,6 +632,7 @@
         public void add(Object o) {
             InsnList.this.insertBefore(next, (AbstractInsnNode) o);
             prev = (AbstractInsnNode) o;
+            remove = null;
         }
 
         public void set(Object o) {
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
index cd64b52..8f98753 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Analyzer.java
@@ -404,7 +404,7 @@
      *         instruction of the method. The size of the returned array is
      *         equal to the number of instructions (and labels) of the method. A
      *         given frame is <tt>null</tt> if the corresponding instruction
-     *         cannot be reached, or if an error occurred during the analysis of
+     *         cannot be reached, or if an error occured during the analysis of
      *         the method.
      */
     public Frame<V>[] getFrames() {
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/AnalyzerException.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/AnalyzerException.java
index 0cd1bc4..92b570b 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/AnalyzerException.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/AnalyzerException.java
@@ -66,7 +66,7 @@
  * @author Bing Ran
  * @author Eric Bruneton
  */
-@SuppressWarnings("serial") // JDK-implementation class
+@SuppressWarnings("serial") // implementation class
 public class AnalyzerException extends Exception {
 
     public final AbstractInsnNode node;
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java
index 122ee93..649d5a4 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/tree/analysis/Interpreter.java
@@ -111,7 +111,7 @@
      *            the bytecode instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V newOperation(AbstractInsnNode insn)
             throws AnalyzerException;
@@ -130,7 +130,7 @@
      * @return the result of the interpretation of the given instruction. The
      *         returned value must be <tt>equal</tt> to the given value.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V copyOperation(AbstractInsnNode insn, V value)
             throws AnalyzerException;
@@ -151,7 +151,7 @@
      *            the argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V unaryOperation(AbstractInsnNode insn, V value)
             throws AnalyzerException;
@@ -175,7 +175,7 @@
      *            the second argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V binaryOperation(AbstractInsnNode insn, V value1, V value2)
             throws AnalyzerException;
@@ -196,7 +196,7 @@
      *            the third argument of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V ternaryOperation(AbstractInsnNode insn, V value1,
             V value2, V value3) throws AnalyzerException;
@@ -214,7 +214,7 @@
      *            the arguments of the instruction to be interpreted.
      * @return the result of the interpretation of the given instruction.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract V naryOperation(AbstractInsnNode insn,
             List<? extends V> values) throws AnalyzerException;
@@ -232,7 +232,7 @@
      * @param expected
      *            the expected return type of the analyzed method.
      * @throws AnalyzerException
-     *             if an error occurred during the interpretation.
+     *             if an error occured during the interpretation.
      */
     public abstract void returnOperation(AbstractInsnNode insn, V value,
             V expected) throws AnalyzerException;
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckAnnotationAdapter.java b/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckAnnotationAdapter.java
index 3650e37..4b68882 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckAnnotationAdapter.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/CheckAnnotationAdapter.java
@@ -99,7 +99,7 @@
         }
         if (value instanceof Type) {
             int sort = ((Type) value).getSort();
-            if (sort != Type.OBJECT && sort != Type.ARRAY) {
+            if (sort == Type.METHOD) {
                 throw new IllegalArgumentException("Invalid annotation value");
             }
         }
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java b/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java
index 5e20f52..5c2c8bf 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/util/Textifier.java
@@ -166,6 +166,11 @@
      */
     protected Map<Label, String> labelNames;
 
+    /**
+     * Class access flags
+     */
+    private int access;
+
     private int valueNumber = 0;
 
     /**
@@ -245,6 +250,7 @@
     public void visit(final int version, final int access, final String name,
             final String signature, final String superName,
             final String[] interfaces) {
+        this.access = access;
         int major = version & 0xFFFF;
         int minor = version >>> 16;
         buf.setLength(0);
@@ -447,6 +453,11 @@
         if ((access & Opcodes.ACC_BRIDGE) != 0) {
             buf.append("bridge ");
         }
+        if ((this.access & Opcodes.ACC_INTERFACE) != 0
+                && (access & Opcodes.ACC_ABSTRACT) == 0
+                && (access & Opcodes.ACC_STATIC) == 0) {
+            buf.append("default ");
+        }
 
         buf.append(name);
         appendDescriptor(METHOD_DESCRIPTOR, desc);
@@ -856,7 +867,6 @@
         appendDescriptor(INTERNAL_NAME, owner);
         buf.append('.').append(name).append(' ');
         appendDescriptor(METHOD_DESCRIPTOR, desc);
-        buf.append(' ').append(itf ? "itf" : "");
         buf.append('\n');
         text.add(buf.toString());
     }
@@ -869,26 +879,35 @@
         buf.append(name);
         appendDescriptor(METHOD_DESCRIPTOR, desc);
         buf.append(" [");
+        buf.append('\n');
+        buf.append(tab3);
         appendHandle(bsm);
+        buf.append('\n');
         buf.append(tab3).append("// arguments:");
         if (bsmArgs.length == 0) {
             buf.append(" none");
         } else {
-            buf.append('\n').append(tab3);
+            buf.append('\n');
             for (int i = 0; i < bsmArgs.length; i++) {
+                buf.append(tab3);
                 Object cst = bsmArgs[i];
                 if (cst instanceof String) {
                     Printer.appendString(buf, (String) cst);
                 } else if (cst instanceof Type) {
-                    buf.append(((Type) cst).getDescriptor()).append(".class");
+                    Type type = (Type) cst;
+                    if(type.getSort() == Type.METHOD){
+                        appendDescriptor(METHOD_DESCRIPTOR, type.getDescriptor());
+                    } else {
+                        buf.append(type.getDescriptor()).append(".class");
+                    }
                 } else if (cst instanceof Handle) {
                     appendHandle((Handle) cst);
                 } else {
                     buf.append(cst);
                 }
-                buf.append(", ");
+                buf.append(", \n");
             }
-            buf.setLength(buf.length() - 2);
+            buf.setLength(buf.length() - 3);
         }
         buf.append('\n');
         buf.append(tab2).append("]\n");
@@ -1234,10 +1253,10 @@
      *            a handle, non null.
      */
     protected void appendHandle(final Handle h) {
-        buf.append('\n').append(tab3);
         int tag = h.getTag();
         buf.append("// handle kind 0x").append(Integer.toHexString(tag))
                 .append(" : ");
+        boolean isMethodHandle = false;
         switch (tag) {
         case Opcodes.H_GETFIELD:
             buf.append("GETFIELD");
@@ -1253,18 +1272,23 @@
             break;
         case Opcodes.H_INVOKEINTERFACE:
             buf.append("INVOKEINTERFACE");
+            isMethodHandle = true;
             break;
         case Opcodes.H_INVOKESPECIAL:
             buf.append("INVOKESPECIAL");
+            isMethodHandle = true;
             break;
         case Opcodes.H_INVOKESTATIC:
             buf.append("INVOKESTATIC");
+            isMethodHandle = true;
             break;
         case Opcodes.H_INVOKEVIRTUAL:
             buf.append("INVOKEVIRTUAL");
+            isMethodHandle = true;
             break;
         case Opcodes.H_NEWINVOKESPECIAL:
             buf.append("NEWINVOKESPECIAL");
+            isMethodHandle = true;
             break;
         }
         buf.append('\n');
@@ -1272,9 +1296,13 @@
         appendDescriptor(INTERNAL_NAME, h.getOwner());
         buf.append('.');
         buf.append(h.getName());
-        buf.append('(');
+        if(!isMethodHandle){
+            buf.append('(');
+        }
         appendDescriptor(HANDLE_DESCRIPTOR, h.getDesc());
-        buf.append(')').append('\n');
+        if(!isMethodHandle){
+            buf.append(')');
+        }
     }
 
     /**
diff --git a/src/share/classes/jdk/internal/org/objectweb/asm/version.txt b/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
index efe71fa..c6f8ad6 100644
--- a/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
+++ b/src/share/classes/jdk/internal/org/objectweb/asm/version.txt
@@ -1,12 +1,12 @@
 Path: .
-Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/ASM_5_0_BETA
-URL: svn://svn.forge.objectweb.org/svnroot/asm/trunk/asm
-Repository Root: svn://svn.forge.objectweb.org/svnroot/asm
+Working Copy Root Path: /hudson/jobs/objectweb-pull/workspace/asm-svn-2014-03-12
+URL: file:///svnroot/asm/trunk/asm
+Repository Root: file:///svnroot/asm
 Repository UUID: 271bd773-ee82-43a6-9b2b-1890ed8ce7f9
-Revision: 1700
+Revision: 1721
 Node Kind: directory
 Schedule: normal
 Last Changed Author: ebruneton
-Last Changed Rev: 1700
-Last Changed Date: 2013-10-29 20:22:52 +0100 (Tue, 29 Oct 2013)
+Last Changed Rev: 1721
+Last Changed Date: 2014-03-02 17:25:35 +0100 (Sun, 02 Mar 2014)
 
diff --git a/src/share/classes/sun/awt/AWTAccessor.java b/src/share/classes/sun/awt/AWTAccessor.java
index a00a234..8a67f37 100644
--- a/src/share/classes/sun/awt/AWTAccessor.java
+++ b/src/share/classes/sun/awt/AWTAccessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -34,6 +34,7 @@
 import java.awt.event.InvocationEvent;
 import java.awt.event.KeyEvent;
 import java.awt.geom.Point2D;
+import java.awt.image.BufferStrategy;
 import java.awt.peer.ComponentPeer;
 
 import java.lang.reflect.InvocationTargetException;
@@ -243,6 +244,16 @@
          */
         void revalidateSynchronously(Component comp);
 
+        /**
+         * Creates a new strategy for multi-buffering on this component.
+         */
+        void createBufferStrategy(Component comp, int numBuffers,
+                BufferCapabilities caps) throws AWTException;
+
+        /**
+         * returns the buffer strategy used by this component.
+         */
+        BufferStrategy getBufferStrategy(Component comp);
     }
 
     /*
@@ -375,6 +386,11 @@
          * Accessor for InputEvent.getButtonDownMasks()
          */
         int[] getButtonDownMasks();
+
+        /*
+         * Accessor for InputEvent.canAccessSystemClipboard field
+         */
+        boolean canAccessSystemClipboard(InputEvent event);
     }
 
     /*
@@ -729,6 +745,13 @@
     }
 
     /*
+     * An accessor object for the SystemColor class
+     */
+    public interface SystemColorAccessor {
+        void updateSystemColors();
+    }
+
+    /*
      * Accessor instances are initialized in the static initializers of
      * corresponding AWT classes by using setters defined below.
      */
@@ -757,6 +780,7 @@
     private static SequencedEventAccessor sequencedEventAccessor;
     private static ToolkitAccessor toolkitAccessor;
     private static InvocationEventAccessor invocationEventAccessor;
+    private static SystemColorAccessor systemColorAccessor;
 
     /*
      * Set an accessor object for the java.awt.Component class.
@@ -1182,4 +1206,22 @@
     public static InvocationEventAccessor getInvocationEventAccessor() {
         return invocationEventAccessor;
     }
+
+    /*
+     * Get the accessor object for the java.awt.SystemColor class.
+     */
+    public static SystemColorAccessor getSystemColorAccessor() {
+        if (systemColorAccessor == null) {
+            unsafe.ensureClassInitialized(SystemColor.class);
+        }
+
+        return systemColorAccessor;
+    }
+
+     /*
+     * Set the accessor object for the java.awt.SystemColor class.
+     */
+     public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
+         AWTAccessor.systemColorAccessor = systemColorAccessor;
+     }
 }
diff --git a/src/share/classes/sun/awt/FontConfiguration.java b/src/share/classes/sun/awt/FontConfiguration.java
index 4cdc3d8..f95b368 100644
--- a/src/share/classes/sun/awt/FontConfiguration.java
+++ b/src/share/classes/sun/awt/FontConfiguration.java
@@ -867,7 +867,7 @@
         return descriptors;
     }
 
-    private FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+    protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
         String fontName = fontNames[fontIndex];
         String styleName = styleNames[styleIndex];
 
diff --git a/src/share/classes/sun/awt/HToolkit.java b/src/share/classes/sun/awt/HToolkit.java
index ea18275..fdce8cc 100644
--- a/src/share/classes/sun/awt/HToolkit.java
+++ b/src/share/classes/sun/awt/HToolkit.java
@@ -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
@@ -25,6 +25,8 @@
 
 package sun.awt;
 
+import sun.awt.datatransfer.DataTransferer;
+
 import java.awt.*;
 import java.awt.dnd.*;
 import java.awt.dnd.peer.DragSourceContextPeer;
@@ -184,6 +186,11 @@
         return false;
     }
 
+    @Override
+    public DataTransferer getDataTransferer() {
+        return null;
+    }
+
     public GlobalCursorManager getGlobalCursorManager()
         throws HeadlessException {
         throw new HeadlessException();
diff --git a/src/share/classes/sun/awt/SunHints.java b/src/share/classes/sun/awt/SunHints.java
index 3e0dff5..15c7e54 100644
--- a/src/share/classes/sun/awt/SunHints.java
+++ b/src/share/classes/sun/awt/SunHints.java
@@ -172,7 +172,7 @@
         }
     }
 
-    private static final int NUM_KEYS = 9;
+    private static final int NUM_KEYS = 10;
     private static final int VALS_PER_KEY = 8;
 
     /**
@@ -253,6 +253,13 @@
     @Native public static final int INTVAL_STROKE_PURE = 2;
 
     /**
+     * Image scaling hint key and values
+     */
+    @Native public static final int INTKEY_RESOLUTION_VARIANT = 9;
+    @Native public static final int INTVAL_RESOLUTION_VARIANT_DEFAULT = 0;
+    @Native public static final int INTVAL_RESOLUTION_VARIANT_OFF = 1;
+    @Native public static final int INTVAL_RESOLUTION_VARIANT_ON = 2;
+    /**
      * LCD text contrast control hint key.
      * Value is "100" to make discontiguous with the others which
      * are all enumerative and are of a different class.
@@ -450,6 +457,24 @@
                            SunHints.INTVAL_STROKE_PURE,
                            "Pure stroke conversion for accurate paths");
 
+    /**
+     * Image resolution variant hint key and value objects
+     */
+    public static final Key KEY_RESOLUTION_VARIANT =
+        new SunHints.Key(SunHints.INTKEY_RESOLUTION_VARIANT,
+                         "Global image resolution variant key");
+    public static final Object VALUE_RESOLUTION_VARIANT_DEFAULT =
+        new SunHints.Value(KEY_RESOLUTION_VARIANT,
+                           SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT,
+                           "Choose image resolutions based on a default heuristic");
+    public static final Object VALUE_RESOLUTION_VARIANT_OFF =
+        new SunHints.Value(KEY_RESOLUTION_VARIANT,
+                           SunHints.INTVAL_RESOLUTION_VARIANT_OFF,
+                           "Use only the standard resolution of an image");
+    public static final Object VALUE_RESOLUTION_VARIANT_ON =
+        new SunHints.Value(KEY_RESOLUTION_VARIANT,
+                           SunHints.INTVAL_RESOLUTION_VARIANT_ON,
+                           "Always use resolution-specific variants of images");
 
     public static class LCDContrastKey extends Key {
 
diff --git a/src/share/classes/sun/awt/SunToolkit.java b/src/share/classes/sun/awt/SunToolkit.java
index 96b793b..a5f09e1 100644
--- a/src/share/classes/sun/awt/SunToolkit.java
+++ b/src/share/classes/sun/awt/SunToolkit.java
@@ -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
@@ -36,6 +36,9 @@
 import java.awt.TrayIcon;
 import java.awt.SystemTray;
 import java.awt.event.InputEvent;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
@@ -43,6 +46,7 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 
+import sun.awt.datatransfer.DataTransferer;
 import sun.util.logging.PlatformLogger;
 import sun.misc.SoftCache;
 import sun.font.FontDesignMetrics;
@@ -199,6 +203,8 @@
 
     public abstract boolean isTraySupported();
 
+    public abstract DataTransferer getDataTransferer();
+
     @SuppressWarnings("deprecation")
     public abstract FontPeer getFontPeer(String name, int style);
 
@@ -714,33 +720,7 @@
     static final SoftCache imgCache = new SoftCache();
 
     static Image getImageFromHash(Toolkit tk, URL url) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            try {
-                java.security.Permission perm =
-                    url.openConnection().getPermission();
-                if (perm != null) {
-                    try {
-                        sm.checkPermission(perm);
-                    } catch (SecurityException se) {
-                        // fallback to checkRead/checkConnect for pre 1.2
-                        // security managers
-                        if ((perm instanceof java.io.FilePermission) &&
-                            perm.getActions().indexOf("read") != -1) {
-                            sm.checkRead(perm.getName());
-                        } else if ((perm instanceof
-                            java.net.SocketPermission) &&
-                            perm.getActions().indexOf("connect") != -1) {
-                            sm.checkConnect(url.getHost(), url.getPort());
-                        } else {
-                            throw se;
-                        }
-                    }
-                }
-            } catch (java.io.IOException ioe) {
-                    sm.checkConnect(url.getHost(), url.getPort());
-            }
-        }
+        checkPermissions(url);
         synchronized (imgCache) {
             Image img = (Image)imgCache.get(url);
             if (img == null) {
@@ -756,10 +736,7 @@
 
     static Image getImageFromHash(Toolkit tk,
                                                String filename) {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            security.checkRead(filename);
-        }
+        checkPermissions(filename);
         synchronized (imgCache) {
             Image img = (Image)imgCache.get(filename);
             if (img == null) {
@@ -781,15 +758,156 @@
         return getImageFromHash(this, url);
     }
 
-    public Image createImage(String filename) {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            security.checkRead(filename);
+    protected Image getImageWithResolutionVariant(String fileName,
+            String resolutionVariantName) {
+        synchronized (imgCache) {
+            Image image = getImageFromHash(this, fileName);
+            if (image instanceof MultiResolutionImage) {
+                return image;
+            }
+            Image resolutionVariant = getImageFromHash(this, resolutionVariantName);
+            image = createImageWithResolutionVariant(image, resolutionVariant);
+            imgCache.put(fileName, image);
+            return image;
         }
+    }
+
+    protected Image getImageWithResolutionVariant(URL url,
+            URL resolutionVariantURL) {
+        synchronized (imgCache) {
+            Image image = getImageFromHash(this, url);
+            if (image instanceof MultiResolutionImage) {
+                return image;
+            }
+            Image resolutionVariant = getImageFromHash(this, resolutionVariantURL);
+            image = createImageWithResolutionVariant(image, resolutionVariant);
+            imgCache.put(url, image);
+            return image;
+        }
+    }
+
+
+    public Image createImage(String filename) {
+        checkPermissions(filename);
         return createImage(new FileImageSource(filename));
     }
 
     public Image createImage(URL url) {
+        checkPermissions(url);
+        return createImage(new URLImageSource(url));
+    }
+
+    public Image createImage(byte[] data, int offset, int length) {
+        return createImage(new ByteArrayImageSource(data, offset, length));
+    }
+
+    public Image createImage(ImageProducer producer) {
+        return new ToolkitImage(producer);
+    }
+
+    public static Image createImageWithResolutionVariant(Image image,
+            Image resolutionVariant) {
+        return new MultiResolutionToolkitImage(image, resolutionVariant);
+    }
+
+    public int checkImage(Image img, int w, int h, ImageObserver o) {
+        if (!(img instanceof ToolkitImage)) {
+            return ImageObserver.ALLBITS;
+        }
+
+        ToolkitImage tkimg = (ToolkitImage)img;
+        int repbits;
+        if (w == 0 || h == 0) {
+            repbits = ImageObserver.ALLBITS;
+        } else {
+            repbits = tkimg.getImageRep().check(o);
+        }
+        return (tkimg.check(o) | repbits) & checkResolutionVariant(img, w, h, o);
+    }
+
+    public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
+        if (w == 0 || h == 0) {
+            return true;
+        }
+
+        // Must be a ToolkitImage
+        if (!(img instanceof ToolkitImage)) {
+            return true;
+        }
+
+        ToolkitImage tkimg = (ToolkitImage)img;
+        if (tkimg.hasError()) {
+            if (o != null) {
+                o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT,
+                              -1, -1, -1, -1);
+            }
+            return false;
+        }
+        ImageRepresentation ir = tkimg.getImageRep();
+        return ir.prepare(o) & prepareResolutionVariant(img, w, h, o);
+    }
+
+    private int checkResolutionVariant(Image img, int w, int h, ImageObserver o) {
+        ToolkitImage rvImage = getResolutionVariant(img);
+        // Ignore the resolution variant in case of error
+        return (rvImage == null || rvImage.hasError()) ? 0xFFFF :
+                checkImage(rvImage, 2 * w, 2 * h, MultiResolutionToolkitImage.
+                                getResolutionVariantObserver(
+                                        img, o, w, h, 2 * w, 2 * h));
+    }
+
+    private boolean prepareResolutionVariant(Image img, int w, int h,
+            ImageObserver o) {
+
+        ToolkitImage rvImage = getResolutionVariant(img);
+        // Ignore the resolution variant in case of error
+        return rvImage == null || rvImage.hasError() || prepareImage(
+                rvImage, 2 * w, 2 * h,
+                MultiResolutionToolkitImage.getResolutionVariantObserver(
+                        img, o, w, h, 2 * w, 2 * h));
+    }
+
+    private static ToolkitImage getResolutionVariant(Image image) {
+        if (image instanceof MultiResolutionToolkitImage) {
+            Image resolutionVariant = ((MultiResolutionToolkitImage) image).
+                    getResolutionVariant();
+            if (resolutionVariant instanceof ToolkitImage) {
+                return (ToolkitImage) resolutionVariant;
+            }
+        }
+        return null;
+    }
+
+    protected static boolean imageCached(Object key) {
+        return imgCache.containsKey(key);
+    }
+
+    protected static boolean imageExists(String filename) {
+        checkPermissions(filename);
+        return filename != null && new File(filename).exists();
+    }
+
+    @SuppressWarnings("try")
+    protected static boolean imageExists(URL url) {
+        checkPermissions(url);
+        if (url != null) {
+            try (InputStream is = url.openStream()) {
+                return true;
+            }catch(IOException e){
+                return false;
+            }
+        }
+        return false;
+    }
+
+    private static void checkPermissions(String filename) {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            security.checkRead(filename);
+        }
+    }
+
+    private static void checkPermissions(URL url) {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             try {
@@ -817,52 +935,6 @@
                     sm.checkConnect(url.getHost(), url.getPort());
             }
         }
-        return createImage(new URLImageSource(url));
-    }
-
-    public Image createImage(byte[] data, int offset, int length) {
-        return createImage(new ByteArrayImageSource(data, offset, length));
-    }
-
-    public Image createImage(ImageProducer producer) {
-        return new ToolkitImage(producer);
-    }
-
-    public int checkImage(Image img, int w, int h, ImageObserver o) {
-        if (!(img instanceof ToolkitImage)) {
-            return ImageObserver.ALLBITS;
-        }
-
-        ToolkitImage tkimg = (ToolkitImage)img;
-        int repbits;
-        if (w == 0 || h == 0) {
-            repbits = ImageObserver.ALLBITS;
-        } else {
-            repbits = tkimg.getImageRep().check(o);
-        }
-        return tkimg.check(o) | repbits;
-    }
-
-    public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
-        if (w == 0 || h == 0) {
-            return true;
-        }
-
-        // Must be a ToolkitImage
-        if (!(img instanceof ToolkitImage)) {
-            return true;
-        }
-
-        ToolkitImage tkimg = (ToolkitImage)img;
-        if (tkimg.hasError()) {
-            if (o != null) {
-                o.imageUpdate(img, ImageObserver.ERROR|ImageObserver.ABORT,
-                              -1, -1, -1, -1);
-            }
-            return false;
-        }
-        ImageRepresentation ir = tkimg.getImageRep();
-        return ir.prepare(o);
     }
 
     /**
@@ -1120,19 +1192,6 @@
         return getStartupLocale();
     }
 
-    private static String dataTransfererClassName = null;
-
-    protected static void setDataTransfererClassName(String className) {
-        dataTransfererClassName = className;
-    }
-
-    public static String getDataTransfererClassName() {
-        if (dataTransfererClassName == null) {
-            Toolkit.getDefaultToolkit(); // transferer set during toolkit init
-        }
-        return dataTransfererClassName;
-    }
-
     // Support for window closing event notifications
     private transient WindowClosingListener windowClosingListener = null;
     /**
diff --git a/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java b/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java
index 110d7bd..c0bb3c6 100644
--- a/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java
+++ b/src/share/classes/sun/awt/datatransfer/ClipboardTransferable.java
@@ -32,7 +32,6 @@
 import java.io.IOException;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 
@@ -55,7 +54,7 @@
  * @since 1.4 (appeared in modified form as FullyRenderedTransferable in 1.3.1)
  */
 public class ClipboardTransferable implements Transferable {
-    private final HashMap flavorsToData = new HashMap();
+    private final Map<DataFlavor, Object> flavorsToData = new HashMap<>();
     private DataFlavor[] flavors = new DataFlavor[0];
 
     private final class DataFactory {
@@ -84,20 +83,13 @@
                 // Since the SystemFlavorMap will specify many DataFlavors
                 // which map to the same format, we should cache data as we
                 // read it.
-                HashMap cached_data = new HashMap(formats.length, 1.0f);
-
-                Map flavorsForFormats = DataTransferer.getInstance().
-                    getFlavorsForFormats(formats, SunClipboard.flavorMap);
-                for (Iterator iter = flavorsForFormats.keySet().iterator();
-                     iter.hasNext(); )
-                {
-                    DataFlavor flavor = (DataFlavor)iter.next();
-                    Long lFormat = (Long)flavorsForFormats.get(flavor);
-
-                    fetchOneFlavor(clipboard, flavor, lFormat, cached_data);
-                }
-
+                Map<Long, Object> cached_data = new HashMap<>(formats.length, 1.0f);
+                DataTransferer.getInstance()
+                        .getFlavorsForFormats(formats, SunClipboard.flavorMap)
+                        .entrySet()
+                        .forEach(entry -> fetchOneFlavor(clipboard, entry.getKey(), entry.getValue(), cached_data));
                 flavors = DataTransferer.setToSortedDataFlavorArray(flavorsToData.keySet());
+
             }
         } finally {
             clipboard.closeClipboard();
@@ -105,13 +97,12 @@
     }
 
     private boolean fetchOneFlavor(SunClipboard clipboard, DataFlavor flavor,
-                                   Long lFormat, HashMap cached_data)
+                                   long format, Map<Long, Object> cached_data)
     {
         if (!flavorsToData.containsKey(flavor)) {
-            long format = lFormat.longValue();
             Object data = null;
 
-            if (!cached_data.containsKey(lFormat)) {
+            if (!cached_data.containsKey(format)) {
                 try {
                     data = clipboard.getClipboardData(format);
                 } catch (IOException e) {
@@ -122,9 +113,9 @@
 
                 // Cache this data, even if it's null, so we don't have to go
                 // to native code again for this format.
-                cached_data.put(lFormat, data);
+                cached_data.put(format, data);
             } else {
-                data = cached_data.get(lFormat);
+                data = cached_data.get(format);
             }
 
             // Casting IOException to byte array causes ClassCastException.
@@ -134,8 +125,7 @@
                 flavorsToData.put(flavor, data);
                 return false;
             } else if (data != null) {
-                flavorsToData.put(flavor, new DataFactory(format,
-                                                          (byte[])data));
+                flavorsToData.put(flavor, new DataFactory(format, (byte[])data));
                 return true;
             }
         }
@@ -143,14 +133,17 @@
         return false;
     }
 
+    @Override
     public DataFlavor[] getTransferDataFlavors() {
         return flavors.clone();
     }
 
+    @Override
     public boolean isDataFlavorSupported(DataFlavor flavor) {
         return flavorsToData.containsKey(flavor);
     }
 
+    @Override
     public Object getTransferData(DataFlavor flavor)
         throws UnsupportedFlavorException, IOException
     {
diff --git a/src/share/classes/sun/awt/datatransfer/DataTransferer.java b/src/share/classes/sun/awt/datatransfer/DataTransferer.java
index 3d79770..b4b658a 100644
--- a/src/share/classes/sun/awt/datatransfer/DataTransferer.java
+++ b/src/share/classes/sun/awt/datatransfer/DataTransferer.java
@@ -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
@@ -25,10 +25,10 @@
 
 package sun.awt.datatransfer;
 
-import java.awt.AWTError;
 import java.awt.EventQueue;
-import java.awt.Image;
 import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Toolkit;
 
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.FlavorMap;
@@ -70,6 +70,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;
@@ -112,6 +113,7 @@
 import sun.awt.image.ToolkitImage;
 
 import java.io.FilePermission;
+import java.util.stream.Stream;
 
 
 /**
@@ -136,27 +138,6 @@
  * @since 1.3.1
  */
 public abstract class DataTransferer {
-
-    /**
-     * Cached value of Class.forName("[C");
-     */
-    public static final Class charArrayClass;
-
-    /**
-     * Cached value of Class.forName("[B");
-     */
-    public static final Class byteArrayClass;
-
-    /**
-     * The <code>DataFlavor</code> representing plain text with Unicode
-     * encoding, where:
-     * <pre>
-     *     representationClass = java.lang.String
-     *     mimeType            = "text/plain; charset=Unicode"
-     * </pre>
-     */
-    public static final DataFlavor plainTextStringFlavor;
-
     /**
      * The <code>DataFlavor</code> representing a Java text encoding String
      * encoded in UTF-8, where
@@ -174,9 +155,9 @@
         private static final SortedSet<String> standardEncodings = load();
 
         private static SortedSet<String> load() {
-            final Comparator comparator =
+            final Comparator<String> comparator =
                     new CharsetComparator(IndexedComparator.SELECT_WORST);
-            final SortedSet<String> tempSet = new TreeSet<String>(comparator);
+            final SortedSet<String> tempSet = new TreeSet<>(comparator);
             tempSet.add("US-ASCII");
             tempSet.add("ISO-8859-1");
             tempSet.add("UTF-8");
@@ -194,7 +175,7 @@
      * listed in the DataFlavor.selectBestTextFlavor method comment. Additional
      * entries may be added during the life of the JRE for text/<other> types.
      */
-    private static final Map textMIMESubtypeCharsetSupport;
+    private static final Map<String, Boolean> textMIMESubtypeCharsetSupport;
 
     /**
      * Cache of the platform default encoding as specified in the
@@ -206,67 +187,43 @@
      * A collection of all natives listed in flavormap.properties with
      * a primary MIME type of "text".
      */
-    private static final Set textNatives =
-        Collections.synchronizedSet(new HashSet());
+    private static final Set<Long> textNatives =
+            Collections.synchronizedSet(new HashSet<>());
 
     /**
      * The native encodings/charsets for the Set of textNatives.
      */
-    private static final Map nativeCharsets =
-        Collections.synchronizedMap(new HashMap());
+    private static final Map<Long, String> nativeCharsets =
+            Collections.synchronizedMap(new HashMap<>());
 
     /**
      * The end-of-line markers for the Set of textNatives.
      */
-    private static final Map nativeEOLNs =
-        Collections.synchronizedMap(new HashMap());
+    private static final Map<Long, String> nativeEOLNs =
+            Collections.synchronizedMap(new HashMap<>());
 
     /**
      * The number of terminating NUL bytes for the Set of textNatives.
      */
-    private static final Map nativeTerminators =
-        Collections.synchronizedMap(new HashMap());
+    private static final Map<Long, Integer> nativeTerminators =
+            Collections.synchronizedMap(new HashMap<>());
 
     /**
      * The key used to store pending data conversion requests for an AppContext.
      */
     private static final String DATA_CONVERTER_KEY = "DATA_CONVERTER_KEY";
 
-    /**
-     * The singleton DataTransferer instance. It is created during MToolkit
-     * or WToolkit initialization.
-     */
-    private static DataTransferer transferer;
-
     private static final PlatformLogger dtLog = PlatformLogger.getLogger("sun.awt.datatransfer.DataTransfer");
 
     static {
-        Class tCharArrayClass = null, tByteArrayClass = null;
-        try {
-            tCharArrayClass = Class.forName("[C");
-            tByteArrayClass = Class.forName("[B");
-        } catch (ClassNotFoundException cannotHappen) {
-        }
-        charArrayClass = tCharArrayClass;
-        byteArrayClass = tByteArrayClass;
-
-        DataFlavor tPlainTextStringFlavor = null;
-        try {
-            tPlainTextStringFlavor = new DataFlavor
-                ("text/plain;charset=Unicode;class=java.lang.String");
-        } catch (ClassNotFoundException cannotHappen) {
-        }
-        plainTextStringFlavor = tPlainTextStringFlavor;
-
         DataFlavor tJavaTextEncodingFlavor = null;
         try {
-            tJavaTextEncodingFlavor = new DataFlavor
-                ("application/x-java-text-encoding;class=\"[B\"");
+            tJavaTextEncodingFlavor = new DataFlavor("application/x-java-text-encoding;class=\"[B\"");
         } catch (ClassNotFoundException cannotHappen) {
         }
         javaTextEncodingFlavor = tJavaTextEncodingFlavor;
 
-        Map tempMap = new HashMap(17);
+        Map<String, Boolean> tempMap = new HashMap<>(17);
         tempMap.put("sgml", Boolean.TRUE);
         tempMap.put("xml", Boolean.TRUE);
         tempMap.put("html", Boolean.TRUE);
@@ -290,63 +247,8 @@
      * that in a headless environment, there may be no DataTransferer instance;
      * instead, null will be returned.
      */
-    public static DataTransferer getInstance() {
-        synchronized (DataTransferer.class) {
-            if (transferer == null) {
-                final String name = SunToolkit.getDataTransfererClassName();
-                if (name != null) {
-                    PrivilegedAction<DataTransferer> action = new PrivilegedAction<DataTransferer>()
-                    {
-                      public DataTransferer run() {
-                          Class cls = null;
-                          Method method = null;
-                          DataTransferer ret = null;
-
-                          try {
-                              cls = Class.forName(name);
-                          } catch (ClassNotFoundException e) {
-                              ClassLoader cl = ClassLoader.
-                                  getSystemClassLoader();
-                              if (cl != null) {
-                                  try {
-                                      cls = cl.loadClass(name);
-                                  } catch (ClassNotFoundException ee) {
-                                      ee.printStackTrace();
-                                      throw new AWTError("DataTransferer not found: " + name);
-                                  }
-                              }
-                          }
-                          if (cls != null) {
-                              try {
-                                  method = cls.getDeclaredMethod("getInstanceImpl");
-                                  method.setAccessible(true);
-                              } catch (NoSuchMethodException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Cannot instantiate DataTransferer: " + name);
-                              } catch (SecurityException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Access is denied for DataTransferer: " + name);
-                              }
-                          }
-                          if (method != null) {
-                              try {
-                                  ret = (DataTransferer) method.invoke(null);
-                              } catch (InvocationTargetException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Cannot instantiate DataTransferer: " + name);
-                              } catch (IllegalAccessException e) {
-                                  e.printStackTrace();
-                                  throw new AWTError("Cannot access DataTransferer: " + name);
-                              }
-                          }
-                          return ret;
-                      }
-                    };
-                    transferer = AccessController.doPrivileged(action);
-                }
-            }
-        }
-        return transferer;
+    public static synchronized DataTransferer getInstance() {
+        return ((SunToolkit) Toolkit.getDefaultToolkit()).getDataTransferer();
     }
 
     /**
@@ -409,29 +311,27 @@
             return false;
         }
 
-        Object support = textMIMESubtypeCharsetSupport.get(subType);
+        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
 
         if (support != null) {
-            return (support == Boolean.TRUE);
+            return support;
         }
 
         boolean ret_val = (flavor.getParameter("charset") != null);
-        textMIMESubtypeCharsetSupport.put
-            (subType, (ret_val) ? Boolean.TRUE : Boolean.FALSE);
+        textMIMESubtypeCharsetSupport.put(subType, ret_val);
         return ret_val;
     }
     public static boolean doesSubtypeSupportCharset(String subType,
                                                     String charset)
     {
-        Object support = textMIMESubtypeCharsetSupport.get(subType);
+        Boolean support = textMIMESubtypeCharsetSupport.get(subType);
 
         if (support != null) {
-            return (support == Boolean.TRUE);
+            return support;
         }
 
         boolean ret_val = (charset != null);
-        textMIMESubtypeCharsetSupport.put
-            (subType, (ret_val) ? Boolean.TRUE : Boolean.FALSE);
+        textMIMESubtypeCharsetSupport.put(subType, ret_val);
         return ret_val;
     }
 
@@ -459,14 +359,14 @@
         if (flavor.isRepresentationClassReader() ||
             String.class.equals(rep_class) ||
             flavor.isRepresentationClassCharBuffer() ||
-            DataTransferer.charArrayClass.equals(rep_class))
+            char[].class.equals(rep_class))
         {
             return true;
         }
 
         if (!(flavor.isRepresentationClassInputStream() ||
               flavor.isRepresentationClassByteBuffer() ||
-              DataTransferer.byteArrayClass.equals(rep_class))) {
+              byte[].class.equals(rep_class))) {
             return false;
         }
 
@@ -490,15 +390,14 @@
 
         return (flavor.isRepresentationClassInputStream() ||
                 flavor.isRepresentationClassByteBuffer() ||
-                DataTransferer.byteArrayClass.
-                    equals(flavor.getRepresentationClass()));
+                byte[].class.equals(flavor.getRepresentationClass()));
     }
 
     /**
      * Determines whether this JRE can both encode and decode text in the
      * specified encoding.
      */
-    public static boolean isEncodingSupported(String encoding) {
+    private static boolean isEncodingSupported(String encoding) {
         if (encoding == null) {
             return false;
         }
@@ -536,37 +435,35 @@
         }
 
         return new FlavorTable() {
-                public Map getNativesForFlavors(DataFlavor[] flavors) {
-                    return map.getNativesForFlavors(flavors);
+            @Override
+            public Map<DataFlavor, String> getNativesForFlavors(DataFlavor[] flavors) {
+                return map.getNativesForFlavors(flavors);
+            }
+            @Override
+            public Map<String, DataFlavor> getFlavorsForNatives(String[] natives) {
+                return map.getFlavorsForNatives(natives);
+            }
+            @Override
+            public List<String> getNativesForFlavor(DataFlavor flav) {
+                Map<DataFlavor, String> natives = getNativesForFlavors(new DataFlavor[]{flav});
+                String nat = natives.get(flav);
+                if (nat != null) {
+                    return Collections.singletonList(nat);
+                } else {
+                    return Collections.emptyList();
                 }
-                public Map getFlavorsForNatives(String[] natives) {
-                    return map.getFlavorsForNatives(natives);
+            }
+            @Override
+            public List<DataFlavor> getFlavorsForNative(String nat) {
+                Map<String, DataFlavor> flavors = getFlavorsForNatives(new String[]{nat});
+                DataFlavor flavor = flavors.get(nat);
+                if (flavor != null) {
+                    return Collections.singletonList(flavor);
+                } else {
+                    return Collections.emptyList();
                 }
-                public List getNativesForFlavor(DataFlavor flav) {
-                    Map natives =
-                        getNativesForFlavors(new DataFlavor[] { flav } );
-                    String nat = (String)natives.get(flav);
-                    if (nat != null) {
-                        List list = new ArrayList(1);
-                        list.add(nat);
-                        return list;
-                    } else {
-                        return Collections.EMPTY_LIST;
-                    }
-                }
-                public List getFlavorsForNative(String nat) {
-                    Map flavors =
-                        getFlavorsForNatives(new String[] { nat } );
-                    DataFlavor flavor = (DataFlavor)flavors.get(nat);
-                    if (flavor != null) {
-                        List list = new ArrayList(1);
-                        list.add(flavor);
-                        return list;
-                    } else {
-                        return Collections.EMPTY_LIST;
-                    }
-                }
-            };
+            }
+        };
     }
 
     /**
@@ -588,13 +485,13 @@
 
         textNatives.add(format);
         nativeCharsets.put(format, (charset != null && charset.length() != 0)
-            ? charset : getDefaultTextCharset());
+                ? charset : getDefaultTextCharset());
         if (eoln != null && eoln.length() != 0 && !eoln.equals("\n")) {
             nativeEOLNs.put(format, eoln);
         }
         if (terminators != null && terminators.length() != 0) {
             Integer iTerminators = Integer.valueOf(terminators);
-            if (iTerminators.intValue() > 0) {
+            if (iTerminators > 0) {
                 nativeTerminators.put(format, iTerminators);
             }
         }
@@ -609,7 +506,7 @@
     }
 
     protected String getCharsetForTextFormat(Long lFormat) {
-        return (String)nativeCharsets.get(lFormat);
+        return nativeCharsets.get(lFormat);
     }
 
     /**
@@ -649,32 +546,18 @@
      * The map keys are sorted according to the native formats preference
      * order.
      */
-    public SortedMap<Long,DataFlavor> getFormatsForTransferable(
-                               Transferable contents, FlavorTable map)
+    public SortedMap<Long,DataFlavor> getFormatsForTransferable(Transferable contents,
+                                                                FlavorTable map)
     {
         DataFlavor[] flavors = contents.getTransferDataFlavors();
         if (flavors == null) {
-            return new TreeMap();
+            return Collections.emptySortedMap();
         }
         return getFormatsForFlavors(flavors, map);
     }
 
     /**
      * Returns a Map whose keys are all of the possible formats into which data
-     * in the specified DataFlavor can be translated. The value of each key
-     * is the DataFlavor in which a Transferable's data should be requested
-     * when converting to the format.
-     * <p>
-     * The map keys are sorted according to the native formats preference
-     * order.
-     */
-    public SortedMap getFormatsForFlavor(DataFlavor flavor, FlavorTable map) {
-        return getFormatsForFlavors(new DataFlavor[] { flavor },
-                                    map);
-    }
-
-    /**
-     * Returns a Map whose keys are all of the possible formats into which data
      * in the specified DataFlavors can be translated. The value of each key
      * is the DataFlavor in which the Transferable's data should be requested
      * when converting to the format.
@@ -687,18 +570,16 @@
      *            DataFlavors and data formats
      * @throws NullPointerException if flavors or map is <code>null</code>
      */
-    public SortedMap <Long, DataFlavor> getFormatsForFlavors(
-        DataFlavor[] flavors, FlavorTable map)
+    public SortedMap<Long, DataFlavor> getFormatsForFlavors(DataFlavor[] flavors,
+                                                            FlavorTable map)
     {
-        Map <Long,DataFlavor> formatMap =
-            new HashMap <> (flavors.length);
-        Map <Long,DataFlavor> textPlainMap =
-            new HashMap <> (flavors.length);
+        Map<Long,DataFlavor> formatMap = new HashMap<>(flavors.length);
+        Map<Long,DataFlavor> textPlainMap = new HashMap<>(flavors.length);
         // Maps formats to indices that will be used to sort the formats
         // according to the preference order.
         // Larger index value corresponds to the more preferable format.
-        Map indexMap = new HashMap(flavors.length);
-        Map textPlainIndexMap = new HashMap(flavors.length);
+        Map<Long, Integer> indexMap = new HashMap<>(flavors.length);
+        Map<Long, Integer> textPlainIndexMap = new HashMap<>(flavors.length);
 
         int currentIndex = 0;
 
@@ -718,14 +599,13 @@
                 flavor.isRepresentationClassInputStream() ||
                 flavor.isRepresentationClassRemote())
             {
-                List natives = map.getNativesForFlavor(flavor);
+                List<String> natives = map.getNativesForFlavor(flavor);
 
                 currentIndex += natives.size();
 
-                for (Iterator iter = natives.iterator(); iter.hasNext(); ) {
-                    Long lFormat =
-                        getFormatForNativeAsLong((String)iter.next());
-                    Integer index = Integer.valueOf(currentIndex--);
+                for (String aNative : natives) {
+                    Long lFormat = getFormatForNativeAsLong(aNative);
+                    Integer index = currentIndex--;
 
                     formatMap.put(lFormat, flavor);
                     indexMap.put(lFormat, index);
@@ -735,9 +615,8 @@
                     // for a single text/* flavor, we would prefer that
                     // text/plain native data come from a text/plain flavor.
                     if (("text".equals(flavor.getPrimaryType()) &&
-                         "plain".equals(flavor.getSubType())) ||
-                        flavor.equals(DataFlavor.stringFlavor))
-                    {
+                            "plain".equals(flavor.getSubType())) ||
+                            flavor.equals(DataFlavor.stringFlavor)) {
                         textPlainMap.put(lFormat, flavor);
                         textPlainIndexMap.put(lFormat, index);
                     }
@@ -751,9 +630,9 @@
         indexMap.putAll(textPlainIndexMap);
 
         // Sort the map keys according to the formats preference order.
-        Comparator comparator =
-            new IndexOrderComparator(indexMap, IndexedComparator.SELECT_WORST);
-        SortedMap sortedMap = new TreeMap(comparator);
+        Comparator<Long> comparator =
+                new IndexOrderComparator(indexMap, IndexedComparator.SELECT_WORST);
+        SortedMap<Long, DataFlavor> sortedMap = new TreeMap<>(comparator);
         sortedMap.putAll(formatMap);
 
         return sortedMap;
@@ -767,24 +646,6 @@
                                                    FlavorTable map) {
         return keysToLongArray(getFormatsForTransferable(contents, map));
     }
-    public long[] getFormatsForFlavorAsArray(DataFlavor flavor,
-                                             FlavorTable map) {
-        return keysToLongArray(getFormatsForFlavor(flavor, map));
-    }
-    public long[] getFormatsForFlavorsAsArray(DataFlavor[] flavors,
-                                              FlavorTable map) {
-        return keysToLongArray(getFormatsForFlavors(flavors, map));
-    }
-
-    /**
-     * Returns a Map whose keys are all of the possible DataFlavors into which
-     * data in the specified format can be translated. The value of each key
-     * is the format in which the Clipboard or dropped data should be requested
-     * when converting to the DataFlavor.
-     */
-    public Map getFlavorsForFormat(long format, FlavorTable map) {
-        return getFlavorsForFormats(new long[] { format }, map);
-    }
 
     /**
      * Returns a Map whose keys are all of the possible DataFlavors into which
@@ -792,10 +653,10 @@
      * is the format in which the Clipboard or dropped data should be requested
      * when converting to the DataFlavor.
      */
-    public Map getFlavorsForFormats(long[] formats, FlavorTable map) {
-        Map flavorMap = new HashMap(formats.length);
-        Set mappingSet = new HashSet(formats.length);
-        Set flavorSet = new HashSet(formats.length);
+    public Map<DataFlavor, Long> getFlavorsForFormats(long[] formats, FlavorTable map) {
+        Map<DataFlavor, Long> flavorMap = new HashMap<>(formats.length);
+        Set<AbstractMap.SimpleEntry<Long, DataFlavor>> mappingSet = new HashSet<>(formats.length);
+        Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
 
         // First step: build flavorSet, mappingSet and initial flavorMap
         // flavorSet  - the set of all the DataFlavors into which
@@ -804,27 +665,22 @@
         //              into any DataFlavor;
         // flavorMap  - after this step, this map maps each of the DataFlavors
         //              from flavorSet to any of the specified formats.
-        for (int i = 0; i < formats.length; i++) {
-            long format = formats[i];
+        for (long format : formats) {
             String nat = getNativeForFormat(format);
-            List flavors = map.getFlavorsForNative(nat);
-
-            for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
-                DataFlavor flavor = (DataFlavor)iter.next();
-
+            List<DataFlavor> flavors = map.getFlavorsForNative(nat);
+            for (DataFlavor flavor : flavors) {
                 // Don't explicitly test for String, since it is just a special
                 // case of Serializable
                 if (flavor.isFlavorTextType() ||
-                    flavor.isFlavorJavaFileListType() ||
-                    DataFlavor.imageFlavor.equals(flavor) ||
-                    flavor.isRepresentationClassSerializable() ||
-                    flavor.isRepresentationClassInputStream() ||
-                    flavor.isRepresentationClassRemote())
-                {
-                    Long lFormat = Long.valueOf(format);
-                    Object mapping =
-                        DataTransferer.createMapping(lFormat, flavor);
-                    flavorMap.put(flavor, lFormat);
+                        flavor.isFlavorJavaFileListType() ||
+                        DataFlavor.imageFlavor.equals(flavor) ||
+                        flavor.isRepresentationClassSerializable() ||
+                        flavor.isRepresentationClassInputStream() ||
+                        flavor.isRepresentationClassRemote()) {
+
+                    AbstractMap.SimpleEntry<Long, DataFlavor> mapping =
+                            new AbstractMap.SimpleEntry<>(format, flavor);
+                    flavorMap.put(flavor, format);
                     mappingSet.add(mapping);
                     flavorSet.add(flavor);
                 }
@@ -844,19 +700,11 @@
         // a mappingSet of all format-to-flavor mappings for the specified formats
         // and check if the format-to-flavor mapping exists for the
         // (flavor,format) pair being added.
-        for (Iterator flavorIter = flavorSet.iterator();
-             flavorIter.hasNext(); ) {
-            DataFlavor flavor = (DataFlavor)flavorIter.next();
-
-            List natives = map.getNativesForFlavor(flavor);
-
-            for (Iterator nativeIter = natives.iterator();
-                 nativeIter.hasNext(); ) {
-                Long lFormat =
-                    getFormatForNativeAsLong((String)nativeIter.next());
-                Object mapping = DataTransferer.createMapping(lFormat, flavor);
-
-                if (mappingSet.contains(mapping)) {
+        for (DataFlavor flavor : flavorSet) {
+            List<String> natives = map.getNativesForFlavor(flavor);
+            for (String aNative : natives) {
+                Long lFormat = getFormatForNativeAsLong(aNative);
+                if (mappingSet.contains(new AbstractMap.SimpleEntry<>(lFormat, flavor))) {
                     flavorMap.put(flavor, lFormat);
                     break;
                 }
@@ -879,24 +727,19 @@
      * @throws NullPointerException if formats or map is <code>null</code>
      */
     public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
-        Set flavorSet = new HashSet(formats.length);
+        Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
 
-        for (int i = 0; i < formats.length; i++) {
-            String nat = getNativeForFormat(formats[i]);
-            List flavors = map.getFlavorsForNative(nat);
-
-            for (Iterator iter = flavors.iterator(); iter.hasNext(); ) {
-                DataFlavor flavor = (DataFlavor)iter.next();
-
+        for (long format : formats) {
+            List<DataFlavor> flavors = map.getFlavorsForNative(getNativeForFormat(format));
+            for (DataFlavor flavor : flavors) {
                 // Don't explicitly test for String, since it is just a special
                 // case of Serializable
                 if (flavor.isFlavorTextType() ||
-                    flavor.isFlavorJavaFileListType() ||
-                    DataFlavor.imageFlavor.equals(flavor) ||
-                    flavor.isRepresentationClassSerializable() ||
-                    flavor.isRepresentationClassInputStream() ||
-                    flavor.isRepresentationClassRemote())
-                {
+                        flavor.isFlavorJavaFileListType() ||
+                        DataFlavor.imageFlavor.equals(flavor) ||
+                        flavor.isRepresentationClassSerializable() ||
+                        flavor.isRepresentationClassInputStream() ||
+                        flavor.isRepresentationClassRemote()) {
                     flavorSet.add(flavor);
                 }
             }
@@ -907,25 +750,6 @@
 
     /**
      * Returns an array of all DataFlavors for which
-     * 1) a mapping from the specified format exists in the specified map and
-     * 2) the data translation for this mapping can be performed by the data
-     * transfer subsystem.
-     * The array will be sorted according to a
-     * <code>DataFlavorComparator</code> created with the specified
-     * map as an argument.
-     *
-     * @param format the data format
-     * @param map the FlavorTable which contains mappings between
-     *            DataFlavors and data formats
-     * @throws NullPointerException if map is <code>null</code>
-     */
-    public DataFlavor[] getFlavorsForFormatAsArray(long format,
-                                                   FlavorTable map) {
-        return getFlavorsForFormatsAsArray(new long[] { format }, map);
-    }
-
-    /**
-     * Returns an array of all DataFlavors for which
      * 1) a mapping from at least one of the specified formats exists in the
      * specified map and
      * 2) the data translation for this mapping can be performed by the data
@@ -947,22 +771,6 @@
     }
 
     /**
-     * Returns an object that represents a mapping between the specified
-     * key and value. <tt>null</tt> values and the <tt>null</tt> keys are
-     * permitted. The internal representation of the mapping object is
-     * irrelevant. The only requrement is that the two mapping objects are equal
-     * if and only if their keys are equal and their values are equal.
-     * More formally, the two mapping objects are equal if and only if
-     * <tt>(value1 == null ? value2 == null : value1.equals(value2))
-     * && (key1 == null ? key2 == null : key1.equals(key2))</tt>.
-     */
-    private static Object createMapping(Object key, Object value) {
-        // NOTE: Should be updated to use AbstractMap.SimpleEntry as
-        // soon as it is made public.
-        return Arrays.asList(new Object[] { key, value });
-    }
-
-    /**
      * Looks-up or registers the String native with the native data transfer
      * system and returns a long format corresponding to that native.
      */
@@ -1013,17 +821,16 @@
     private byte[] translateTransferableString(String str,
                                                long format) throws IOException
     {
-        Long lFormat = Long.valueOf(format);
+        Long lFormat = format;
         String charset = getBestCharsetForTextFormat(lFormat, null);
         // Search and replace EOLN. Note that if EOLN is "\n", then we
         // never added an entry to nativeEOLNs anyway, so we'll skip this
         // code altogether.
         // windows: "abc\nde"->"abc\r\nde"
-        String eoln = (String)nativeEOLNs.get(lFormat);
+        String eoln = nativeEOLNs.get(lFormat);
         if (eoln != null) {
             int length = str.length();
-            StringBuffer buffer =
-                new StringBuffer(length * 2); // 2 is a heuristic
+            StringBuilder buffer = new StringBuilder(length * 2); // 2 is a heuristic
             for (int i = 0; i < length; i++) {
                 // Fix for 4914613 - skip native EOLN
                 if (str.startsWith(eoln, i)) {
@@ -1048,9 +855,9 @@
         // the we never added an entry to nativeTerminators anyway, so
         // we'll skip code altogether.
         // "abcde" -> "abcde\0"
-        Integer terminators = (Integer)nativeTerminators.get(lFormat);
+        Integer terminators = nativeTerminators.get(lFormat);
         if (terminators != null) {
-            int numTerminators = terminators.intValue();
+            int numTerminators = terminators;
             byte[] terminatedBytes =
                 new byte[bytes.length + numTerminators];
             System.arraycopy(bytes, 0, terminatedBytes, 0, bytes.length);
@@ -1073,7 +880,7 @@
             throws IOException
     {
 
-        Long lFormat = Long.valueOf(format);
+        Long lFormat = format;
         String charset = getBestCharsetForTextFormat(lFormat, localeTransferable);
 
         // Locate terminating NUL bytes. Note that if terminators is 0,
@@ -1086,11 +893,11 @@
         // multibyte coding like UTF-8, but helps understand the procedure.
         // "abcde\0" -> "abcde"
 
-        String eoln = (String)nativeEOLNs.get(lFormat);
-        Integer terminators = (Integer)nativeTerminators.get(lFormat);
+        String eoln = nativeEOLNs.get(lFormat);
+        Integer terminators = nativeTerminators.get(lFormat);
         int count;
         if (terminators != null) {
-            int numTerminators = terminators.intValue();
+            int numTerminators = terminators;
 search:
             for (count = 0; count < (bytes.length - numTerminators + 1); count += numTerminators) {
                 for (int i = count; i < count + numTerminators; i++) {
@@ -1123,7 +930,6 @@
 
             char[] buf = converted.toCharArray();
             char[] eoln_arr = eoln.toCharArray();
-            converted = null;
             int j = 0;
             boolean match;
 
@@ -1214,7 +1020,7 @@
                     ("cannot transfer non-text data as Reader");
             }
 
-            StringBuffer buf = new StringBuffer();
+            StringBuilder buf = new StringBuilder();
             try (Reader r = (Reader)obj) {
                 int c;
                 while ((c = r.read()) != -1) {
@@ -1243,7 +1049,7 @@
                 format);
 
         // Source data is a char array. Convert to a String and recur.
-        } else if (charArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (char[].class.equals(flavor.getRepresentationClass())) {
             if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
                 throw new IOException
                     ("cannot transfer non-text data as char array");
@@ -1274,7 +1080,7 @@
         // Source data is a byte array. For arbitrary flavors, simply return
         // the array. For text flavors, decode back to a String and recur to
         // reencode according to the requested format.
-        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (byte[].class.equals(flavor.getRepresentationClass())) {
             byte[] bytes = (byte[])obj;
 
             if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
@@ -1342,7 +1148,7 @@
             final List list = (List)obj;
             final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
             final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
-            final ArrayList<String> uriList = new ArrayList<String>(fileList.size());
+            final ArrayList<String> uriList = new ArrayList<>(fileList.size());
             for (String fileObject : fileList) {
                 final URI uri = new File(fileObject).toURI();
                 // Some implementations are fussy about the number of slashes (file:///path/to/file is best)
@@ -1356,8 +1162,8 @@
             byte[] eoln = "\r\n".getBytes(targetCharset);
 
             try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
-                for (int i = 0; i < uriList.size(); i++) {
-                    byte[] bytes = uriList.get(i).getBytes(targetCharset);
+                for (String uri : uriList) {
+                    byte[] bytes = uri.getBytes(targetCharset);
                     bos.write(bytes, 0, bytes.length);
                     bos.write(eoln, 0, eoln.length);
                 }
@@ -1433,42 +1239,35 @@
             return str;
         }
 
-
-        String ret_val = "";
         final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
 
         try {
-            ret_val = (String) AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() {
+            return AccessController.doPrivileged((PrivilegedExceptionAction<String>) () -> {
 
-                        StringBuffer allowedFiles = new StringBuffer(str.length());
-                        String [] uriArray = str.split("(\\s)+");
+                StringBuilder allowedFiles = new StringBuilder(str.length());
+                String [] uriArray = str.split("(\\s)+");
 
-                        for (String fileName : uriArray)
+                for (String fileName : uriArray)
+                {
+                    File file = new File(fileName);
+                    if (file.exists() &&
+                        !(isFileInWebstartedCache(file) ||
+                        isForbiddenToRead(file, userProtectionDomain)))
+                    {
+                        if (0 != allowedFiles.length())
                         {
-                            File file = new File(fileName);
-                            if (file.exists() &&
-                                !(isFileInWebstartedCache(file) ||
-                                isForbiddenToRead(file, userProtectionDomain)))
-                            {
-
-                                if (0 != allowedFiles.length())
-                                {
-                                    allowedFiles.append("\\r\\n");
-                                }
-
-                                allowedFiles.append(fileName);
-                            }
+                            allowedFiles.append("\\r\\n");
                         }
 
-                        return allowedFiles.toString();
+                        allowedFiles.append(fileName);
                     }
-                });
+                }
+
+                return allowedFiles.toString();
+            });
         } catch (PrivilegedActionException pae) {
             throw new IOException(pae.getMessage(), pae);
         }
-
-        return ret_val;
     }
 
     private static ProtectionDomain getUserProtectionDomain(Transferable contents) {
@@ -1492,30 +1291,26 @@
     }
 
     private ArrayList<String> castToFiles(final List files,
-                                          final ProtectionDomain userProtectionDomain) throws IOException
-    {
-        final ArrayList<String> fileList = new ArrayList<String>();
+                                          final ProtectionDomain userProtectionDomain) throws IOException {
         try {
-            AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                public Object run() throws IOException {
-                    for (Object fileObject : files)
+            return AccessController.doPrivileged((PrivilegedExceptionAction<ArrayList<String>>) () -> {
+                ArrayList<String> fileList = new ArrayList<>();
+                for (Object fileObject : files)
+                {
+                    File file = castToFile(fileObject);
+                    if (file != null &&
+                        (null == System.getSecurityManager() ||
+                        !(isFileInWebstartedCache(file) ||
+                        isForbiddenToRead(file, userProtectionDomain))))
                     {
-                        File file = castToFile(fileObject);
-                        if (file != null &&
-                            (null == System.getSecurityManager() ||
-                            !(isFileInWebstartedCache(file) ||
-                            isForbiddenToRead(file, userProtectionDomain))))
-                        {
-                            fileList.add(file.getCanonicalPath());
-                        }
+                        fileList.add(file.getCanonicalPath());
                     }
-                    return null;
                 }
+                return fileList;
             });
         } catch (PrivilegedActionException pae) {
             throw new IOException(pae.getMessage());
         }
-        return fileList;
     }
 
     // It is important do not use user's successors
@@ -1539,8 +1334,7 @@
         "deployment.javapi.cachedir"
     };
 
-    private final static ArrayList <File> deploymentCacheDirectoryList =
-            new ArrayList<File>();
+    private final static ArrayList <File> deploymentCacheDirectoryList = new ArrayList<>();
 
     private static boolean isFileInWebstartedCache(File f) {
 
@@ -1598,6 +1392,30 @@
             // Turn the list of Files into a List and return
             theObject = Arrays.asList(files);
 
+            // Source data is a URI list. Convert to DataFlavor.javaFileListFlavor
+            // where possible.
+        } else if (isURIListFormat(format)
+                    && DataFlavor.javaFileListFlavor.equals(flavor)) {
+
+            try (ByteArrayInputStream str = new ByteArrayInputStream(bytes))  {
+
+                URI uris[] = dragQueryURIs(str, format, localeTransferable);
+                if (uris == null) {
+                    return null;
+                }
+                List<File> files = new ArrayList<>();
+                for (URI uri : uris) {
+                    try {
+                        files.add(new File(uri));
+                    } catch (IllegalArgumentException illegalArg) {
+                        // When converting from URIs to less generic files,
+                        // common practice (Wine, SWT) seems to be to
+                        // silently drop the URIs that aren't local files.
+                    }
+                }
+                theObject = files;
+            }
+
             // Target data is a String. Strip terminating NUL bytes. Decode bytes
             // into characters. Search-and-replace EOLN.
         } else if (String.class.equals(flavor.getRepresentationClass()) &&
@@ -1627,7 +1445,7 @@
 
             // Target data is a char array. Recur to obtain String and convert to
             // char array.
-        } else if (charArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (char[].class.equals(flavor.getRepresentationClass())) {
             if (!(isFlavorCharsetTextType(flavor) && isTextFormat(format))) {
                 throw new IOException
                           ("cannot transfer non-text data as char array");
@@ -1655,7 +1473,7 @@
             // the raw bytes. For text flavors, convert to a String to strip
             // terminators and search-and-replace EOLN, then reencode according to
             // the requested flavor.
-        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (byte[].class.equals(flavor.getRepresentationClass())) {
             if (isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
                 theObject = translateBytesToString(
                     bytes, format, localeTransferable
@@ -1728,7 +1546,7 @@
             if (uris == null) {
                 return null;
             }
-            ArrayList files = new ArrayList();
+            List<File> files = new ArrayList<>();
             for (URI uri : uris) {
                 try {
                     files.add(new File(uri));
@@ -1783,7 +1601,7 @@
 
             theObject = constructFlavoredObject(reader, flavor, Reader.class);
             // Target data is a byte array
-        } else if (byteArrayClass.equals(flavor.getRepresentationClass())) {
+        } else if (byte[].class.equals(flavor.getRepresentationClass())) {
             if(isFlavorCharsetTextType(flavor) && isTextFormat(format)) {
                 theObject = translateBytesToString(inputStreamToByteArray(str), format, localeTransferable)
                         .getBytes(DataTransferer.getTextCharset(flavor));
@@ -1853,47 +1671,34 @@
                                            Class clazz)
         throws IOException
     {
-        final Class dfrc = flavor.getRepresentationClass();
+        final Class<?> dfrc = flavor.getRepresentationClass();
 
         if (clazz.equals(dfrc)) {
             return arg; // simple case
         } else {
-            Constructor[] constructors = null;
+            Constructor[] constructors;
 
             try {
-                constructors = (Constructor[])
-                    AccessController.doPrivileged(new PrivilegedAction() {
-                            public Object run() {
-                                return dfrc.getConstructors();
-                            }
-                        });
+                constructors = AccessController.doPrivileged(
+                        (PrivilegedAction<Constructor[]>) dfrc::getConstructors);
             } catch (SecurityException se) {
                 throw new IOException(se.getMessage());
             }
 
-            Constructor constructor = null;
-
-            for (int j = 0; j < constructors.length; j++) {
-                if (!Modifier.isPublic(constructors[j].getModifiers())) {
-                    continue;
-                }
-
-                Class[] ptypes = constructors[j].getParameterTypes();
-
-                if (ptypes != null && ptypes.length == 1 &&
-                    clazz.equals(ptypes[0])) {
-                    constructor = constructors[j];
-                    break;
-                }
-            }
-
-            if (constructor == null) {
-                throw new IOException("can't find <init>(L"+ clazz +
-                                      ";)V for class: " + dfrc.getName());
-            }
+            Constructor constructor = Stream.of(constructors)
+                    .filter(c -> Modifier.isPublic(c.getModifiers()))
+                    .filter(c -> {
+                        Class[] ptypes = c.getParameterTypes();
+                        return ptypes != null
+                                && ptypes.length == 1
+                                && clazz.equals(ptypes[0]);
+                    })
+                    .findFirst()
+                    .orElseThrow(() ->
+                            new IOException("can't find <init>(L"+ clazz + ";)V for class: " + dfrc.getName()));
 
             try {
-                return constructor.newInstance(new Object[] { arg } );
+                return constructor.newInstance(arg);
             } catch (Exception e) {
                 throw new IOException(e.getMessage());
             }
@@ -1905,26 +1710,26 @@
      * can strip NUL terminators and perform EOLN search-and-replace.
      */
     public class ReencodingInputStream extends InputStream {
-        protected BufferedReader wrapped;
-        protected final char[] in = new char[2];
-        protected byte[] out;
+        BufferedReader wrapped;
+        final char[] in = new char[2];
+        byte[] out;
 
-        protected CharsetEncoder encoder;
-        protected CharBuffer inBuf;
-        protected ByteBuffer outBuf;
+        CharsetEncoder encoder;
+        CharBuffer inBuf;
+        ByteBuffer outBuf;
 
-        protected char[] eoln;
-        protected int numTerminators;
+        char[] eoln;
+        int numTerminators;
 
-        protected boolean eos;
-        protected int index, limit;
+        boolean eos;
+        int index, limit;
 
         public ReencodingInputStream(InputStream bytestream, long format,
                                      String targetEncoding,
                                      Transferable localeTransferable)
             throws IOException
         {
-            Long lFormat = Long.valueOf(format);
+            Long lFormat = format;
 
             String sourceEncoding = null;
             if (isLocaleDependentTextFormat(format) &&
@@ -1962,24 +1767,22 @@
                 out = new byte[(int)(encoder.maxBytesPerChar() * 2 + 0.5)];
                 inBuf = CharBuffer.wrap(in);
                 outBuf = ByteBuffer.wrap(out);
-            } catch (IllegalCharsetNameException e) {
-                throw new IOException(e.toString());
-            } catch (UnsupportedCharsetException e) {
-                throw new IOException(e.toString());
-            } catch (UnsupportedOperationException e) {
+            } catch (IllegalCharsetNameException
+                    | UnsupportedCharsetException
+                    | UnsupportedOperationException e) {
                 throw new IOException(e.toString());
             }
 
-            String sEoln = (String)nativeEOLNs.get(lFormat);
+            String sEoln = nativeEOLNs.get(lFormat);
             if (sEoln != null) {
                 eoln = sEoln.toCharArray();
             }
 
             // A hope and a prayer that this works generically. This will
             // definitely work on Win32.
-            Integer terminators = (Integer)nativeTerminators.get(lFormat);
+            Integer terminators = nativeTerminators.get(lFormat);
             if (terminators != null) {
-                numTerminators = terminators.intValue();
+                numTerminators = terminators;
             }
         }
 
@@ -2126,19 +1929,14 @@
         while (readerIterator.hasNext()) {
             ImageReader imageReader = (ImageReader)readerIterator.next();
             try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
-                ImageInputStream imageInputStream =
-                    ImageIO.createImageInputStream(bais);
-
-                try {
+                try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) {
                     ImageReadParam param = imageReader.getDefaultReadParam();
                     imageReader.setInput(imageInputStream, true, true);
-                    BufferedImage bufferedImage =
-                        imageReader.read(imageReader.getMinIndex(), param);
+                    BufferedImage bufferedImage = imageReader.read(imageReader.getMinIndex(), param);
                     if (bufferedImage != null) {
                         return bufferedImage;
                     }
                 } finally {
-                    imageInputStream.close();
                     imageReader.dispose();
                 }
             } catch (IOException e) {
@@ -2227,7 +2025,7 @@
         }
     }
 
-    protected byte[] imageToStandardBytesImpl(RenderedImage renderedImage,
+    byte[] imageToStandardBytesImpl(RenderedImage renderedImage,
                                               String mimeType)
         throws IOException {
 
@@ -2248,14 +2046,10 @@
             }
 
             try {
-                ImageOutputStream imageOutputStream =
-                    ImageIO.createImageOutputStream(baos);
-                try {
+                try (ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(baos)) {
                     imageWriter.setOutput(imageOutputStream);
                     imageWriter.write(renderedImage);
                     imageOutputStream.flush();
-                } finally {
-                    imageOutputStream.close();
                 }
             } catch (IOException e) {
                 imageWriter.dispose();
@@ -2341,7 +2135,7 @@
          * that may contain client code.
          */
         if (isToolkitThread) try {
-            final Stack stack = new Stack();
+            final Stack<byte[]> stack = new Stack<>();
             final Runnable dataConverter = new Runnable() {
                 // Guard against multiple executions.
                 private boolean done = false;
@@ -2351,7 +2145,7 @@
                     }
                     byte[] data = null;
                     try {
-                        DataFlavor flavor = (DataFlavor)formatMap.get(Long.valueOf(format));
+                        DataFlavor flavor = (DataFlavor)formatMap.get(format);
                         if (flavor != null) {
                             data = translateTransferable(contents, flavor, format);
                         }
@@ -2388,12 +2182,11 @@
                 appContext.remove(DATA_CONVERTER_KEY);
             }
 
-            ret = (byte[])stack.pop();
+            ret = stack.pop();
         } finally {
             getToolkitThreadBlockedHandler().unlock();
         } else {
-            DataFlavor flavor = (DataFlavor)
-                formatMap.get(Long.valueOf(format));
+            DataFlavor flavor = (DataFlavor)formatMap.get(format);
             if (flavor != null) {
                 ret = translateTransferable(contents, flavor, format);
             }
@@ -2428,12 +2221,12 @@
      * The map keys are sorted according to the native formats preference
      * order.
      */
-    public static long[] keysToLongArray(SortedMap map) {
-        Set keySet = map.keySet();
+    public static long[] keysToLongArray(SortedMap<Long, ?> map) {
+        Set<Long> keySet = map.keySet();
         long[] retval = new long[keySet.size()];
         int i = 0;
-        for (Iterator iter = keySet.iterator(); iter.hasNext(); i++) {
-            retval[i] = ((Long)iter.next()).longValue();
+        for (Iterator<Long> iter = keySet.iterator(); iter.hasNext(); i++) {
+            retval[i] = iter.next();
         }
         return retval;
     }
@@ -2445,7 +2238,7 @@
     public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) {
         DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
         flavorsSet.toArray(flavors);
-        final Comparator comparator =
+        final Comparator<DataFlavor> comparator =
                 new DataFlavorComparator(IndexedComparator.SELECT_WORST);
         Arrays.sort(flavors, comparator);
         return flavors;
@@ -2474,8 +2267,8 @@
      * If there are no platform-specific mappings for this native, the method
      * returns an empty <code>List</code>.
      */
-    public List getPlatformMappingsForNative(String nat) {
-        return new ArrayList();
+    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
+        return new ArrayList<>();
     }
 
     /**
@@ -2483,15 +2276,15 @@
      * If there are no platform-specific mappings for this flavor, the method
      * returns an empty <code>List</code>.
      */
-    public List getPlatformMappingsForFlavor(DataFlavor df) {
-        return new ArrayList();
+    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        return new ArrayList<>();
     }
 
     /**
      * A Comparator which includes a helper function for comparing two Objects
      * which are likely to be keys in the specified Map.
      */
-    public abstract static class IndexedComparator implements Comparator {
+    public abstract static class IndexedComparator<T> implements Comparator<T> {
 
         /**
          * The best Object (e.g., DataFlavor) will be the last in sequence.
@@ -2503,11 +2296,7 @@
          */
         public static final boolean SELECT_WORST = false;
 
-        protected final boolean order;
-
-        public IndexedComparator() {
-            this(SELECT_BEST);
-        }
+        final boolean order;
 
         public IndexedComparator(boolean order) {
             this.order = order;
@@ -2526,48 +2315,11 @@
          *             first object is mapped to a less, equal to, or greater
          *             index than the second.
          */
-        protected static int compareIndices(Map indexMap,
-                                            Object obj1, Object obj2,
-                                            Integer fallbackIndex) {
-            Integer index1 = (Integer)indexMap.get(obj1);
-            Integer index2 = (Integer)indexMap.get(obj2);
-
-            if (index1 == null) {
-                index1 = fallbackIndex;
-            }
-            if (index2 == null) {
-                index2 = fallbackIndex;
-            }
-
-            return index1.compareTo(index2);
-        }
-
-        /**
-         * Helper method to compare two objects by their Long indices in the
-         * given map. If the map doesn't contain an entry for either of the
-         * objects, the fallback index will be used for the object instead.
-         *
-         * @param indexMap the map which maps objects into Long indexes.
-         * @param obj1 the first object to be compared.
-         * @param obj2 the second object to be compared.
-         * @param fallbackIndex the Long to be used as a fallback index.
-         * @return a negative integer, zero, or a positive integer as the
-         *             first object is mapped to a less, equal to, or greater
-         *             index than the second.
-         */
-        protected static int compareLongs(Map indexMap,
-                                          Object obj1, Object obj2,
-                                          Long fallbackIndex) {
-            Long index1 = (Long)indexMap.get(obj1);
-            Long index2 = (Long)indexMap.get(obj2);
-
-            if (index1 == null) {
-                index1 = fallbackIndex;
-            }
-            if (index2 == null) {
-                index2 = fallbackIndex;
-            }
-
+        static <T> int compareIndices(Map<T, Integer> indexMap,
+                                      T obj1, T obj2,
+                                      Integer fallbackIndex) {
+            Integer index1 = indexMap.getOrDefault(obj1, fallbackIndex);
+            Integer index2 = indexMap.getOrDefault(obj2, fallbackIndex);
             return index1.compareTo(index2);
         }
     }
@@ -2579,45 +2331,37 @@
      * in alphabetical order, charsets are not automatically converted to their
      * canonical forms.
      */
-    public static class CharsetComparator extends IndexedComparator {
-        private static final Map charsets;
-        private static String defaultEncoding;
+    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 = Integer.valueOf(2);
-        private static final Integer OTHER_CHARSET_INDEX = Integer.valueOf(1);
-        private static final Integer WORST_CHARSET_INDEX = Integer.valueOf(0);
-        private static final Integer UNSUPPORTED_CHARSET_INDEX =
-            Integer.valueOf(Integer.MIN_VALUE);
+        private static final Integer DEFAULT_CHARSET_INDEX = 2;
+        private static final Integer OTHER_CHARSET_INDEX = 1;
+        private static final Integer WORST_CHARSET_INDEX = 0;
+        private static final Integer UNSUPPORTED_CHARSET_INDEX = Integer.MIN_VALUE;
 
         private static final String UNSUPPORTED_CHARSET = "UNSUPPORTED";
 
         static {
-            HashMap charsetsMap = new HashMap(8, 1.0f);
+            Map<String, Integer> charsetsMap = new HashMap<>(8, 1.0f);
 
             // we prefer Unicode charsets
-            charsetsMap.put(canonicalName("UTF-16LE"), Integer.valueOf(4));
-            charsetsMap.put(canonicalName("UTF-16BE"), Integer.valueOf(5));
-            charsetsMap.put(canonicalName("UTF-8"), Integer.valueOf(6));
-            charsetsMap.put(canonicalName("UTF-16"), Integer.valueOf(7));
+            charsetsMap.put(canonicalName("UTF-16LE"), 4);
+            charsetsMap.put(canonicalName("UTF-16BE"), 5);
+            charsetsMap.put(canonicalName("UTF-8"), 6);
+            charsetsMap.put(canonicalName("UTF-16"), 7);
 
             // US-ASCII is the worst charset supported
             charsetsMap.put(canonicalName("US-ASCII"), WORST_CHARSET_INDEX);
 
-            String defEncoding = DataTransferer.canonicalName
-                (DataTransferer.getDefaultTextCharset());
+            defaultEncoding = DataTransferer.canonicalName(DataTransferer.getDefaultTextCharset());
+            charsetsMap.putIfAbsent(defaultEncoding, DEFAULT_CHARSET_INDEX);
 
-            if (charsetsMap.get(defaultEncoding) == null) {
-                charsetsMap.put(defaultEncoding, DEFAULT_CHARSET_INDEX);
-            }
             charsetsMap.put(UNSUPPORTED_CHARSET, UNSUPPORTED_CHARSET_INDEX);
 
             charsets = Collections.unmodifiableMap(charsetsMap);
         }
 
-        public CharsetComparator() {
-            this(SELECT_BEST);
-        }
-
         public CharsetComparator(boolean order) {
             super(order);
         }
@@ -2637,18 +2381,12 @@
          * @throws NullPointerException if either of the arguments is
          *         <code>null</code>.
          */
-        public int compare(Object obj1, Object obj2) {
-            String charset1 = null;
-            String charset2 = null;
+        public int compare(String obj1, String obj2) {
             if (order == SELECT_BEST) {
-                charset1 = (String)obj1;
-                charset2 = (String)obj2;
+                return compareCharsets(obj1, obj2);
             } else {
-                charset1 = (String)obj2;
-                charset2 = (String)obj1;
+                return compareCharsets(obj2, obj1);
             }
-
-            return compareCharsets(charset1, charset2);
         }
 
         /**
@@ -2674,7 +2412,7 @@
          *             first argument is worse, equal to, or better than the
          *             second.
          */
-        protected int compareCharsets(String charset1, String charset2) {
+        int compareCharsets(String charset1, String charset2) {
             charset1 = getEncoding(charset1);
             charset2 = getEncoding(charset2);
 
@@ -2704,7 +2442,7 @@
          * @param charset the charset.
          * @return an encoding for this charset.
          */
-        protected static String getEncoding(String charset) {
+        static String getEncoding(String charset) {
             if (charset == null) {
                 return null;
             } else if (!DataTransferer.isEncodingSupported(charset)) {
@@ -2732,131 +2470,108 @@
      * most descriptive one. For flavors which are otherwise equal, the
      * flavors' string representation are compared in the alphabetical order.
      */
-    public static class DataFlavorComparator extends IndexedComparator {
+    public static class DataFlavorComparator extends IndexedComparator<DataFlavor> {
 
         private final CharsetComparator charsetComparator;
 
-        private static final Map exactTypes;
-        private static final Map primaryTypes;
-        private static final Map nonTextRepresentations;
-        private static final Map textTypes;
-        private static final Map decodedTextRepresentations;
-        private static final Map encodedTextRepresentations;
+        private static final Map<String, Integer> exactTypes;
+        private static final Map<String, Integer> primaryTypes;
+        private static final Map<Class<?>, Integer> nonTextRepresentations;
+        private static final Map<String, Integer> textTypes;
+        private static final Map<Class<?>, Integer> decodedTextRepresentations;
+        private static final Map<Class<?>, Integer> encodedTextRepresentations;
 
-        private static final Integer UNKNOWN_OBJECT_LOSES =
-            Integer.valueOf(Integer.MIN_VALUE);
-        private static final Integer UNKNOWN_OBJECT_WINS =
-            Integer.valueOf(Integer.MAX_VALUE);
-
-        private static final Long UNKNOWN_OBJECT_LOSES_L =
-            Long.valueOf(Long.MIN_VALUE);
-        private static final Long UNKNOWN_OBJECT_WINS_L =
-            Long.valueOf(Long.MAX_VALUE);
+        private static final Integer UNKNOWN_OBJECT_LOSES = Integer.MIN_VALUE;
+        private static final Integer UNKNOWN_OBJECT_WINS = Integer.MAX_VALUE;
 
         static {
             {
-                HashMap exactTypesMap = new HashMap(4, 1.0f);
+                Map<String, Integer> exactTypesMap = new HashMap<>(4, 1.0f);
 
                 // application/x-java-* MIME types
-                exactTypesMap.put("application/x-java-file-list",
-                                  Integer.valueOf(0));
-                exactTypesMap.put("application/x-java-serialized-object",
-                                  Integer.valueOf(1));
-                exactTypesMap.put("application/x-java-jvm-local-objectref",
-                                  Integer.valueOf(2));
-                exactTypesMap.put("application/x-java-remote-object",
-                                  Integer.valueOf(3));
+                exactTypesMap.put("application/x-java-file-list", 0);
+                exactTypesMap.put("application/x-java-serialized-object", 1);
+                exactTypesMap.put("application/x-java-jvm-local-objectref", 2);
+                exactTypesMap.put("application/x-java-remote-object", 3);
 
                 exactTypes = Collections.unmodifiableMap(exactTypesMap);
             }
 
             {
-                HashMap primaryTypesMap = new HashMap(1, 1.0f);
+                Map<String, Integer> primaryTypesMap = new HashMap<>(1, 1.0f);
 
-                primaryTypesMap.put("application", Integer.valueOf(0));
+                primaryTypesMap.put("application", 0);
 
                 primaryTypes = Collections.unmodifiableMap(primaryTypesMap);
             }
 
             {
-                HashMap nonTextRepresentationsMap = new HashMap(3, 1.0f);
+                Map<Class<?>, Integer> nonTextRepresentationsMap = new HashMap<>(3, 1.0f);
 
-                nonTextRepresentationsMap.put(java.io.InputStream.class,
-                                              Integer.valueOf(0));
-                nonTextRepresentationsMap.put(java.io.Serializable.class,
-                                              Integer.valueOf(1));
+                nonTextRepresentationsMap.put(java.io.InputStream.class, 0);
+                nonTextRepresentationsMap.put(java.io.Serializable.class, 1);
 
                 Class<?> remoteClass = RMI.remoteClass();
                 if (remoteClass != null) {
-                    nonTextRepresentationsMap.put(remoteClass,
-                                                  Integer.valueOf(2));
+                    nonTextRepresentationsMap.put(remoteClass, 2);
                 }
 
-                nonTextRepresentations =
-                    Collections.unmodifiableMap(nonTextRepresentationsMap);
+                nonTextRepresentations = Collections.unmodifiableMap(nonTextRepresentationsMap);
             }
 
             {
-                HashMap textTypesMap = new HashMap(16, 1.0f);
+                Map<String, Integer> textTypesMap = new HashMap<>(16, 1.0f);
 
                 // plain text
-                textTypesMap.put("text/plain", Integer.valueOf(0));
+                textTypesMap.put("text/plain", 0);
 
                 // stringFlavor
-                textTypesMap.put("application/x-java-serialized-object",
-                                Integer.valueOf(1));
+                textTypesMap.put("application/x-java-serialized-object", 1);
 
                 // misc
-                textTypesMap.put("text/calendar", Integer.valueOf(2));
-                textTypesMap.put("text/css", Integer.valueOf(3));
-                textTypesMap.put("text/directory", Integer.valueOf(4));
-                textTypesMap.put("text/parityfec", Integer.valueOf(5));
-                textTypesMap.put("text/rfc822-headers", Integer.valueOf(6));
-                textTypesMap.put("text/t140", Integer.valueOf(7));
-                textTypesMap.put("text/tab-separated-values", Integer.valueOf(8));
-                textTypesMap.put("text/uri-list", Integer.valueOf(9));
+                textTypesMap.put("text/calendar", 2);
+                textTypesMap.put("text/css", 3);
+                textTypesMap.put("text/directory", 4);
+                textTypesMap.put("text/parityfec", 5);
+                textTypesMap.put("text/rfc822-headers", 6);
+                textTypesMap.put("text/t140", 7);
+                textTypesMap.put("text/tab-separated-values", 8);
+                textTypesMap.put("text/uri-list", 9);
 
                 // enriched
-                textTypesMap.put("text/richtext", Integer.valueOf(10));
-                textTypesMap.put("text/enriched", Integer.valueOf(11));
-                textTypesMap.put("text/rtf", Integer.valueOf(12));
+                textTypesMap.put("text/richtext", 10);
+                textTypesMap.put("text/enriched", 11);
+                textTypesMap.put("text/rtf", 12);
 
                 // markup
-                textTypesMap.put("text/html", Integer.valueOf(13));
-                textTypesMap.put("text/xml", Integer.valueOf(14));
-                textTypesMap.put("text/sgml", Integer.valueOf(15));
+                textTypesMap.put("text/html", 13);
+                textTypesMap.put("text/xml", 14);
+                textTypesMap.put("text/sgml", 15);
 
                 textTypes = Collections.unmodifiableMap(textTypesMap);
             }
 
             {
-                HashMap decodedTextRepresentationsMap = new HashMap(4, 1.0f);
+                Map<Class<?>, Integer> decodedTextRepresentationsMap = new HashMap<>(4, 1.0f);
 
-                decodedTextRepresentationsMap.put
-                    (DataTransferer.charArrayClass, Integer.valueOf(0));
-                decodedTextRepresentationsMap.put
-                    (java.nio.CharBuffer.class, Integer.valueOf(1));
-                decodedTextRepresentationsMap.put
-                    (java.lang.String.class, Integer.valueOf(2));
-                decodedTextRepresentationsMap.put
-                    (java.io.Reader.class, Integer.valueOf(3));
+                decodedTextRepresentationsMap.put(char[].class, 0);
+                decodedTextRepresentationsMap.put(CharBuffer.class, 1);
+                decodedTextRepresentationsMap.put(String.class, 2);
+                decodedTextRepresentationsMap.put(Reader.class, 3);
 
                 decodedTextRepresentations =
-                    Collections.unmodifiableMap(decodedTextRepresentationsMap);
+                        Collections.unmodifiableMap(decodedTextRepresentationsMap);
             }
 
             {
-                HashMap encodedTextRepresentationsMap = new HashMap(3, 1.0f);
+                Map<Class<?>, Integer> encodedTextRepresentationsMap = new HashMap<>(3, 1.0f);
 
-                encodedTextRepresentationsMap.put
-                    (DataTransferer.byteArrayClass, Integer.valueOf(0));
-                encodedTextRepresentationsMap.put
-                    (java.nio.ByteBuffer.class, Integer.valueOf(1));
-                encodedTextRepresentationsMap.put
-                    (java.io.InputStream.class, Integer.valueOf(2));
+                encodedTextRepresentationsMap.put(byte[].class, 0);
+                encodedTextRepresentationsMap.put(ByteBuffer.class, 1);
+                encodedTextRepresentationsMap.put(InputStream.class, 2);
 
                 encodedTextRepresentations =
-                    Collections.unmodifiableMap(encodedTextRepresentationsMap);
+                        Collections.unmodifiableMap(encodedTextRepresentationsMap);
             }
         }
 
@@ -2870,16 +2585,9 @@
             charsetComparator = new CharsetComparator(order);
         }
 
-        public int compare(Object obj1, Object obj2) {
-            DataFlavor flavor1 = null;
-            DataFlavor flavor2 = null;
-            if (order == SELECT_BEST) {
-                flavor1 = (DataFlavor)obj1;
-                flavor2 = (DataFlavor)obj2;
-            } else {
-                flavor1 = (DataFlavor)obj2;
-                flavor2 = (DataFlavor)obj1;
-            }
+        public int compare(DataFlavor obj1, DataFlavor obj2) {
+            DataFlavor flavor1 = order == SELECT_BEST ? obj1 : obj2;
+            DataFlavor flavor2 = order == SELECT_BEST ? obj2 : obj1;
 
             if (flavor1.equals(flavor2)) {
                 return 0;
@@ -2982,22 +2690,16 @@
      * reverse index-based order: an object A is greater than an object B if and
      * only if A is less than B with the direct index-based order.
      */
-    public static class IndexOrderComparator extends IndexedComparator {
-        private final Map indexMap;
-        private static final Integer FALLBACK_INDEX =
-            Integer.valueOf(Integer.MIN_VALUE);
+    public static class IndexOrderComparator extends IndexedComparator<Long> {
+        private final Map<Long, Integer> indexMap;
+        private static final Integer FALLBACK_INDEX = Integer.MIN_VALUE;
 
-        public IndexOrderComparator(Map indexMap) {
-            super(SELECT_BEST);
-            this.indexMap = indexMap;
-        }
-
-        public IndexOrderComparator(Map indexMap, boolean order) {
+        public IndexOrderComparator(Map<Long, Integer> indexMap, boolean order) {
             super(order);
             this.indexMap = indexMap;
         }
 
-        public int compare(Object obj1, Object obj2) {
+        public int compare(Long obj1, Long obj2) {
             if (order == SELECT_WORST) {
                 return -compareIndices(indexMap, obj1, obj2, FALLBACK_INDEX);
             } else {
@@ -3047,7 +2749,7 @@
          * Returns {@code true} if the given class is java.rmi.Remote.
          */
         static boolean isRemote(Class<?> c) {
-            return (remoteClass == null) ? null : remoteClass.isAssignableFrom(c);
+            return (remoteClass == null) ? false : remoteClass.isAssignableFrom(c);
         }
 
         /**
@@ -3064,9 +2766,7 @@
         static Object newMarshalledObject(Object obj) throws IOException {
             try {
                 return marshallCtor.newInstance(obj);
-            } catch (InstantiationException x) {
-                throw new AssertionError(x);
-            } catch (IllegalAccessException x) {
+            } catch (InstantiationException | IllegalAccessException x) {
                 throw new AssertionError(x);
             } catch (InvocationTargetException  x) {
                 Throwable cause = x.getCause();
diff --git a/src/share/classes/sun/awt/datatransfer/SunClipboard.java b/src/share/classes/sun/awt/datatransfer/SunClipboard.java
index df2a25a..13d4a4c 100644
--- a/src/share/classes/sun/awt/datatransfer/SunClipboard.java
+++ b/src/share/classes/sun/awt/datatransfer/SunClipboard.java
@@ -217,7 +217,7 @@
             openClipboard(null);
 
             long[] formats = getClipboardFormats();
-            Long lFormat = (Long)DataTransferer.getInstance().
+            Long lFormat = DataTransferer.getInstance().
                     getFlavorsForFormats(formats, flavorMap).get(flavor);
 
             if (lFormat == null) {
diff --git a/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java b/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
index f0882c3..2efea8d 100644
--- a/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
+++ b/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
@@ -627,14 +627,14 @@
         if (dropOperation == DnDConstants.ACTION_NONE)
             throw new IllegalArgumentException("invalid acceptDrop() action");
 
-        if (dropStatus != STATUS_WAIT) {
+        if (dropStatus == STATUS_WAIT || dropStatus == STATUS_ACCEPT) {
+            currentDA = currentA = mapOperation(dropOperation & currentSA);
+
+            dropStatus   = STATUS_ACCEPT;
+            dropComplete = false;
+        } else {
             throw new InvalidDnDOperationException("invalid acceptDrop()");
         }
-
-        currentDA = currentA = mapOperation(dropOperation & currentSA);
-
-        dropStatus   = STATUS_ACCEPT;
-        dropComplete = false;
     }
 
     /**
diff --git a/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java b/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
new file mode 100644
index 0000000..79f7a3b
--- /dev/null
+++ b/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
@@ -0,0 +1,71 @@
+/*
+ * 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.Image;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+
+public class MultiResolutionBufferedImage extends BufferedImage
+        implements MultiResolutionImage {
+
+    Image[] resolutionVariants;
+    int baseIndex;
+
+    public MultiResolutionBufferedImage(int imageType, int baseIndex, Image... images) {
+        super(images[baseIndex].getWidth(null), images[baseIndex].getHeight(null),
+                imageType);
+        this.baseIndex = baseIndex;
+        this.resolutionVariants = images;
+        Graphics g = getGraphics();
+        g.drawImage(images[baseIndex], 0, 0, null);
+        g.dispose();
+        images[baseIndex] = this;
+    }
+
+    @Override
+    public Image getResolutionVariant(int width, int height) {
+        for (Image image : resolutionVariants) {
+            if (width <= image.getWidth(null) && height <= image.getHeight(null)) {
+                return image;
+            }
+        }
+        return this;
+    }
+
+    @Override
+    public List<Image> getResolutionVariants() {
+        return Arrays.asList(resolutionVariants);
+    }
+
+    public MultiResolutionBufferedImage map(Function<Image, Image> mapper) {
+        return new MultiResolutionBufferedImage(getType(), baseIndex,
+                Arrays.stream(resolutionVariants).map(mapper)
+                        .toArray(length -> new Image[length]));
+    }
+}
diff --git a/src/share/classes/sun/awt/image/MultiResolutionImage.java b/src/share/classes/sun/awt/image/MultiResolutionImage.java
new file mode 100644
index 0000000..40be02e
--- /dev/null
+++ b/src/share/classes/sun/awt/image/MultiResolutionImage.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, 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.Image;
+import java.util.List;
+
+/**
+ * This interface is designed to provide a set of images at various resolutions.
+ *
+ * The <code>MultiResolutionImage</code> interface should be implemented by any
+ * class whose instances are intended to provide image resolution variants
+ * according to the given image width and height.
+ *
+ * For example,
+ * <pre>
+ * {@code
+ *  public class ScaledImage extends BufferedImage
+ *         implements MultiResolutionImage {
+ *
+ *    @Override
+ *    public Image getResolutionVariant(int width, int height) {
+ *      return ((width <= getWidth() && height <= getHeight()))
+ *             ? this : highResolutionImage;
+ *    }
+ *
+ *    @Override
+ *    public List<Image> getResolutionVariants() {
+ *        return Arrays.asList(this, highResolutionImage);
+ *    }
+ *  }
+ * }</pre>
+ *
+ * It is recommended to cache image variants for performance reasons.
+ *
+ * <b>WARNING</b>: This class is an implementation detail. This API may change
+ * between update release, and it may even be removed or be moved in some other
+ * package(s)/class(es).
+ */
+public interface MultiResolutionImage {
+
+    /**
+     * Provides an image with necessary resolution which best fits to the given
+     * image width and height.
+     *
+     * @param width the desired image resolution width.
+     * @param height the desired image resolution height.
+     * @return image resolution variant.
+     *
+     * @since JDK1.8
+     */
+    public Image getResolutionVariant(int width, int height);
+
+    /**
+     * Gets list of all resolution variants including the base image
+     *
+     * @return list of resolution variants.
+     * @since JDK1.8
+     */
+    public List<Image> getResolutionVariants();
+}
diff --git a/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java b/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java
new file mode 100644
index 0000000..a49c8a7
--- /dev/null
+++ b/src/share/classes/sun/awt/image/MultiResolutionToolkitImage.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2013, 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.Image;
+import java.awt.image.ImageObserver;
+import java.util.Arrays;
+import java.util.List;
+import sun.misc.SoftCache;
+
+public class MultiResolutionToolkitImage extends ToolkitImage implements MultiResolutionImage {
+
+    Image resolutionVariant;
+
+    public MultiResolutionToolkitImage(Image lowResolutionImage, Image resolutionVariant) {
+        super(lowResolutionImage.getSource());
+        this.resolutionVariant = resolutionVariant;
+    }
+
+    @Override
+    public Image getResolutionVariant(int width, int height) {
+        return ((width <= getWidth() && height <= getHeight()))
+                ? this : resolutionVariant;
+    }
+
+    public Image getResolutionVariant() {
+        return resolutionVariant;
+    }
+
+    @Override
+    public List<Image> getResolutionVariants() {
+        return Arrays.<Image>asList(this, resolutionVariant);
+    }
+
+    private static final int BITS_INFO = ImageObserver.SOMEBITS
+            | ImageObserver.FRAMEBITS | ImageObserver.ALLBITS;
+
+    private static class ObserverCache {
+
+        static final SoftCache INSTANCE = new SoftCache();
+    }
+
+    public static ImageObserver getResolutionVariantObserver(
+            final Image image, final ImageObserver observer,
+            final int imgWidth, final int imgHeight,
+            final int rvWidth, final int rvHeight) {
+
+        if (observer == null) {
+            return null;
+        }
+
+        synchronized (ObserverCache.INSTANCE) {
+            ImageObserver o = (ImageObserver) ObserverCache.INSTANCE.get(image);
+
+            if (o == null) {
+
+                o = (Image resolutionVariant, int flags,
+                        int x, int y, int width, int height) -> {
+
+                            if ((flags & (ImageObserver.WIDTH | BITS_INFO)) != 0) {
+                                width = (width + 1) / 2;
+                            }
+
+                            if ((flags & (ImageObserver.HEIGHT | BITS_INFO)) != 0) {
+                                height = (height + 1) / 2;
+                            }
+
+                            if ((flags & BITS_INFO) != 0) {
+                                x /= 2;
+                                y /= 2;
+                            }
+
+                            return observer.imageUpdate(
+                                    image, flags, x, y, width, height);
+                        };
+
+                ObserverCache.INSTANCE.put(image, o);
+            }
+            return o;
+        }
+    }
+}
diff --git a/src/share/classes/sun/font/AttributeValues.java b/src/share/classes/sun/font/AttributeValues.java
index d1e808a..bcef301 100644
--- a/src/share/classes/sun/font/AttributeValues.java
+++ b/src/share/classes/sun/font/AttributeValues.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -410,7 +410,7 @@
     }
 
     public Hashtable<Object, Object> toSerializableHashtable() {
-        Hashtable ht = new Hashtable();
+        Hashtable<Object, Object> ht = new Hashtable<>();
         int hashkey = defined;
         for (int m = defined, i = 0; m != 0; ++i) {
             EAttribute ea = EAttribute.atts[i];
@@ -798,7 +798,7 @@
                 hl = (InputMethodHighlight)((Annotation)imHighlight).getValue();
             }
 
-            Map imStyles = hl.getStyle();
+            Map<TextAttribute, ?> imStyles = hl.getStyle();
             if (imStyles == null) {
                 Toolkit tk = Toolkit.getDefaultToolkit();
                 imStyles = tk.mapInputMethodHighlight(hl);
@@ -812,6 +812,7 @@
         return this;
     }
 
+    @SuppressWarnings("unchecked")
     public static AffineTransform getBaselineTransform(Map<?, ?> map) {
         if (map != null) {
             AttributeValues av = null;
@@ -828,6 +829,7 @@
         return null;
     }
 
+    @SuppressWarnings("unchecked")
     public static AffineTransform getCharTransform(Map<?, ?> map) {
         if (map != null) {
             AttributeValues av = null;
diff --git a/src/share/classes/sun/font/CompositeFont.java b/src/share/classes/sun/font/CompositeFont.java
index 5432969..f2defd7 100644
--- a/src/share/classes/sun/font/CompositeFont.java
+++ b/src/share/classes/sun/font/CompositeFont.java
@@ -447,8 +447,7 @@
     }
 
     public String toString() {
-        String ls = java.security.AccessController.doPrivileged(
-                new sun.security.action.GetPropertyAction("line.separator"));
+        String ls = System.lineSeparator();
         String componentsStr = "";
         for (int i=0; i<numSlots; i++) {
             componentsStr += "    Slot["+i+"]="+getSlotFont(i)+ls;
diff --git a/src/share/classes/sun/font/CreatedFontTracker.java b/src/share/classes/sun/font/CreatedFontTracker.java
index 199676f..71efa7b 100644
--- a/src/share/classes/sun/font/CreatedFontTracker.java
+++ b/src/share/classes/sun/font/CreatedFontTracker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -113,7 +113,7 @@
             if (t == null) {
                 // Add a shutdown hook to remove the temp file.
                 java.security.AccessController.doPrivileged(
-                   new java.security.PrivilegedAction() {
+                   new java.security.PrivilegedAction<Object>() {
                       public Object run() {
                           /* The thread must be a member of a thread group
                            * which will not get GCed before VM exit.
diff --git a/src/share/classes/sun/font/Decoration.java b/src/share/classes/sun/font/Decoration.java
index cb14b0b..de5274d 100644
--- a/src/share/classes/sun/font/Decoration.java
+++ b/src/share/classes/sun/font/Decoration.java
@@ -46,6 +46,7 @@
 import java.awt.geom.Line2D;
 import java.awt.geom.Rectangle2D;
 import java.awt.geom.GeneralPath;
+import java.text.AttributedCharacterIterator.Attribute;
 
 import static sun.font.AttributeValues.*;
 import static sun.font.EAttribute.*;
@@ -107,7 +108,7 @@
      * Return a Decoration appropriate for the the given Map.
      * @param attributes the Map used to determine the Decoration
      */
-    public static Decoration getDecoration(Map attributes) {
+    public static Decoration getDecoration(Map<? extends Attribute, ?> attributes) {
         if (attributes == null) {
             return PLAIN;
         }
diff --git a/src/share/classes/sun/font/FileFont.java b/src/share/classes/sun/font/FileFont.java
index 8b49a50..6b84a5f 100644
--- a/src/share/classes/sun/font/FileFont.java
+++ b/src/share/classes/sun/font/FileFont.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -159,7 +159,7 @@
         SunFontManager fm = SunFontManager.getInstance();
         fm.deRegisterBadFont(this);
 
-        for (Reference strikeRef : strikeCache.values()) {
+        for (Reference<FontStrike> strikeRef : strikeCache.values()) {
             if (strikeRef != null) {
                 /* NB we know these are all FileFontStrike instances
                  * because the cache is on this FileFont
@@ -261,7 +261,7 @@
 
         public void dispose() {
             java.security.AccessController.doPrivileged(
-                 new java.security.PrivilegedAction() {
+                 new java.security.PrivilegedAction<Object>() {
                       public Object run() {
                           if (fontFile != null) {
                               try {
diff --git a/src/share/classes/sun/font/Font2D.java b/src/share/classes/sun/font/Font2D.java
index 903b380..6fa3ca4 100644
--- a/src/share/classes/sun/font/Font2D.java
+++ b/src/share/classes/sun/font/Font2D.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -91,8 +91,8 @@
      * the map will have fewer entries, and there's no need to try to
      * make the Font2D part of the key.
      */
-    protected ConcurrentHashMap<FontStrikeDesc, Reference>
-        strikeCache = new ConcurrentHashMap<FontStrikeDesc, Reference>();
+    protected ConcurrentHashMap<FontStrikeDesc, Reference<FontStrike>>
+        strikeCache = new ConcurrentHashMap<>();
 
     /* Store the last Strike in a Reference object.
      * Similarly to the strike that was stored on a C++ font object,
@@ -105,7 +105,7 @@
      * This pre-supposes that a FontStrike is a shareable object, which
      * it should.
      */
-    protected Reference lastFontStrike = new SoftReference(null);
+    protected Reference<FontStrike> lastFontStrike = new SoftReference<>(null);
 
     /*
      * POSSIBLE OPTIMISATION:
@@ -195,7 +195,7 @@
      * strike.
      */
     public FontStrike getStrike(Font font) {
-        FontStrike strike = (FontStrike)lastFontStrike.get();
+        FontStrike strike = lastFontStrike.get();
         if (strike != null) {
             return strike;
         } else {
@@ -307,17 +307,17 @@
          * collected, then we create a new strike, put it in the map and
          * set it to be the last strike.
          */
-        FontStrike strike = (FontStrike)lastFontStrike.get();
+        FontStrike strike = lastFontStrike.get();
         if (strike != null && desc.equals(strike.desc)) {
             //strike.lastlookupTime = System.currentTimeMillis();
             return strike;
         } else {
-            Reference strikeRef = strikeCache.get(desc);
+            Reference<FontStrike> strikeRef = strikeCache.get(desc);
             if (strikeRef != null) {
-                strike = (FontStrike)strikeRef.get();
+                strike = strikeRef.get();
                 if (strike != null) {
                     //strike.lastlookupTime = System.currentTimeMillis();
-                    lastFontStrike = new SoftReference(strike);
+                    lastFontStrike = new SoftReference<>(strike);
                     StrikeCache.refStrike(strike);
                     return strike;
                 }
@@ -360,14 +360,14 @@
             }
             strikeCache.put(desc, strikeRef);
             //strike.lastlookupTime = System.currentTimeMillis();
-            lastFontStrike = new SoftReference(strike);
+            lastFontStrike = new SoftReference<>(strike);
             StrikeCache.refStrike(strike);
             return strike;
         }
     }
 
     void removeFromCache(FontStrikeDesc desc) {
-        Reference ref = strikeCache.get(desc);
+        Reference<FontStrike> ref = strikeCache.get(desc);
         if (ref != null) {
             Object o = ref.get();
             if (o == null) {
diff --git a/src/share/classes/sun/font/FontDesignMetrics.java b/src/share/classes/sun/font/FontDesignMetrics.java
index d843c16..750e502 100644
--- a/src/share/classes/sun/font/FontDesignMetrics.java
+++ b/src/share/classes/sun/font/FontDesignMetrics.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, 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
@@ -170,10 +170,10 @@
      * Also we put the references on a queue so that if they do get nulled
      * out we can clear the keys from the table.
      */
-    private static class KeyReference extends SoftReference
+    private static class KeyReference extends SoftReference<Object>
         implements DisposerRecord, Disposer.PollDisposable {
 
-        static ReferenceQueue queue = Disposer.getQueue();
+        static ReferenceQueue<Object> queue = Disposer.getQueue();
 
         Object key;
 
diff --git a/src/share/classes/sun/font/FontFamily.java b/src/share/classes/sun/font/FontFamily.java
index aa23436..6a4cd25 100644
--- a/src/share/classes/sun/font/FontFamily.java
+++ b/src/share/classes/sun/font/FontFamily.java
@@ -25,6 +25,7 @@
 
 package sun.font;
 
+import java.io.File;
 import java.awt.Font;
 import java.util.HashMap;
 import java.util.concurrent.ConcurrentHashMap;
@@ -105,8 +106,39 @@
         return familyRank;
     }
 
+    private boolean isFromSameSource(Font2D font) {
+        if (!(font instanceof FileFont)) {
+            return false;
+        }
+
+        FileFont existingFont = null;
+        if (plain instanceof FileFont) {
+            existingFont = (FileFont)plain;
+        } else if (bold instanceof FileFont) {
+            existingFont = (FileFont)bold;
+        } else if (italic instanceof FileFont) {
+             existingFont = (FileFont)italic;
+        } else if (bolditalic instanceof FileFont) {
+             existingFont = (FileFont)bolditalic;
+        }
+        // A family isn't created until there's a font.
+        // So if we didn't find a file font it means this
+        // isn't a file-based family.
+        if (existingFont == null) {
+            return false;
+        }
+        File existDir = (new File(existingFont.platName)).getParentFile();
+
+        FileFont newFont = (FileFont)font;
+        File newDir = (new File(newFont.platName)).getParentFile();
+        return java.util.Objects.equals(newDir, existDir);
+    }
+
     public void setFont(Font2D font, int style) {
-        if (font.getRank() > familyRank) {
+        /* Allow a lower-rank font only if its a file font
+         * from the exact same source as any previous font.
+         */
+        if ((font.getRank() > familyRank) && !isFromSameSource(font)) {
             if (FontUtilities.isLogging()) {
                 FontUtilities.getLogger()
                                   .warning("Rejecting adding " + font +
diff --git a/src/share/classes/sun/font/FontManagerFactory.java b/src/share/classes/sun/font/FontManagerFactory.java
index 667d948..4faa48e 100644
--- a/src/share/classes/sun/font/FontManagerFactory.java
+++ b/src/share/classes/sun/font/FontManagerFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -71,7 +71,7 @@
             return instance;
         }
 
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
 
             public Object run() {
                 try {
@@ -79,7 +79,7 @@
                             System.getProperty("sun.font.fontmanager",
                                                DEFAULT_CLASS);
                     ClassLoader cl = ClassLoader.getSystemClassLoader();
-                    Class fmClass = Class.forName(fmClassName, true, cl);
+                    Class<?> fmClass = Class.forName(fmClassName, true, cl);
                     instance = (FontManager) fmClass.newInstance();
                 } catch (ClassNotFoundException |
                          InstantiationException |
diff --git a/src/share/classes/sun/font/FontManagerNativeLibrary.java b/src/share/classes/sun/font/FontManagerNativeLibrary.java
index 47cfe92..06b9f48 100644
--- a/src/share/classes/sun/font/FontManagerNativeLibrary.java
+++ b/src/share/classes/sun/font/FontManagerNativeLibrary.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -30,7 +30,7 @@
 public class FontManagerNativeLibrary {
     static {
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
                /* REMIND do we really have to load awt here? */
                System.loadLibrary("awt");
diff --git a/src/share/classes/sun/font/FontResolver.java b/src/share/classes/sun/font/FontResolver.java
index cc06e1d..b5d2fe9 100644
--- a/src/share/classes/sun/font/FontResolver.java
+++ b/src/share/classes/sun/font/FontResolver.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, 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
@@ -33,6 +33,7 @@
 import java.awt.Font;
 import java.awt.GraphicsEnvironment;
 import java.awt.font.TextAttribute;
+import java.text.AttributedCharacterIterator;
 import java.util.ArrayList;
 import java.util.Map;
 import sun.text.CodePointIterator;
@@ -222,7 +223,8 @@
      *        is Font.PLAIN
      * @see #getFontIndex
      */
-    public Font getFont(int index, Map attributes) {
+    public Font getFont(int index,
+                        Map<? extends AttributedCharacterIterator.Attribute, ?> attributes) {
         Font font = defaultFont;
 
         if (index >= 2) {
diff --git a/src/share/classes/sun/font/FontScaler.java b/src/share/classes/sun/font/FontScaler.java
index 89179b3..9f2dc3f 100644
--- a/src/share/classes/sun/font/FontScaler.java
+++ b/src/share/classes/sun/font/FontScaler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -82,23 +82,24 @@
 public abstract class FontScaler implements DisposerRecord {
 
     private static FontScaler nullScaler = null;
-    private static Constructor<FontScaler> scalerConstructor = null;
+    private static Constructor<? extends FontScaler> scalerConstructor = null;
 
     //Find preferred font scaler
     //
     //NB: we can allow property based preferences
     //   (theoretically logic can be font type specific)
     static {
-        Class scalerClass = null;
-        Class arglst[] = new Class[] {Font2D.class, int.class,
+        Class<? extends FontScaler> scalerClass = null;
+        Class<?>[] arglst = new Class<?>[] {Font2D.class, int.class,
         boolean.class, int.class};
 
         try {
-            if (FontUtilities.isOpenJDK) {
-                scalerClass = Class.forName("sun.font.FreetypeFontScaler");
-            } else {
-                scalerClass = Class.forName("sun.font.T2KFontScaler");
-            }
+            @SuppressWarnings("unchecked")
+            Class<? extends FontScaler> tmp = (Class<? extends FontScaler>)
+                (FontUtilities.isOpenJDK ?
+                 Class.forName("sun.font.FreetypeFontScaler") :
+                 Class.forName("sun.font.T2KFontScaler"));
+            scalerClass = tmp;
         } catch (ClassNotFoundException e) {
                 scalerClass = NullFontScaler.class;
         }
diff --git a/src/share/classes/sun/font/FontUtilities.java b/src/share/classes/sun/font/FontUtilities.java
index 04a4f9f..11731fd 100644
--- a/src/share/classes/sun/font/FontUtilities.java
+++ b/src/share/classes/sun/font/FontUtilities.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -71,7 +71,7 @@
     // This static initializer block figures out the OS constants.
     static {
 
-        AccessController.doPrivileged(new PrivilegedAction () {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 String osName = System.getProperty("os.name", "unknownOS");
                 isSolaris = osName.startsWith("SunOS");
@@ -391,7 +391,7 @@
      */
     private static volatile
         SoftReference<ConcurrentHashMap<PhysicalFont, CompositeFont>>
-        compMapRef = new SoftReference(null);
+        compMapRef = new SoftReference<>(null);
 
     public static FontUIResource getCompositeFontUIResource(Font font) {
 
@@ -421,7 +421,7 @@
         ConcurrentHashMap<PhysicalFont, CompositeFont> compMap = compMapRef.get();
         if (compMap == null) { // Its been collected.
             compMap = new ConcurrentHashMap<PhysicalFont, CompositeFont>();
-            compMapRef = new SoftReference(compMap);
+            compMapRef = new SoftReference<>(compMap);
         }
         CompositeFont compFont = compMap.get(physicalFont);
         if (compFont == null) {
diff --git a/src/share/classes/sun/font/FreetypeFontScaler.java b/src/share/classes/sun/font/FreetypeFontScaler.java
index 50b69e5..a7413d0 100644
--- a/src/share/classes/sun/font/FreetypeFontScaler.java
+++ b/src/share/classes/sun/font/FreetypeFontScaler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -50,7 +50,7 @@
         initIDs(FreetypeFontScaler.class);
     }
 
-    private static native void initIDs(Class FFS);
+    private static native void initIDs(Class<?> FFS);
 
     private void invalidateScaler() throws FontScalerException {
         nativeScaler = 0;
@@ -69,7 +69,7 @@
                                         indexInCollection,
                                         supportsCJK,
                                         filesize);
-        this.font = new WeakReference(font);
+        this.font = new WeakReference<>(font);
     }
 
     synchronized StrikeMetrics getFontMetrics(long pScalerContext)
diff --git a/src/share/classes/sun/font/GlyphLayout.java b/src/share/classes/sun/font/GlyphLayout.java
index 749a1c7..0129d22 100644
--- a/src/share/classes/sun/font/GlyphLayout.java
+++ b/src/share/classes/sun/font/GlyphLayout.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,7 +92,7 @@
     private ScriptRun _scriptRuns;     // iterator over script runs
     private FontRunIterator _fontRuns; // iterator over physical fonts in a composite
     private int _ercount;
-    private ArrayList _erecords;
+    private ArrayList<EngineRecord> _erecords;
     private Point2D.Float _pt;
     private FontStrikeDesc _sd;
     private float[] _mat;
@@ -457,7 +457,7 @@
         //        _sd.init(dtx, gtx, font.getStyle(), frc.isAntiAliased(), frc.usesFractionalMetrics());
         _sd = txinfo.sd;
         for (;ix != stop; ix += dir) {
-            EngineRecord er = (EngineRecord)_erecords.get(ix);
+            EngineRecord er = _erecords.get(ix);
             for (;;) {
                 try {
                     er.layout();
@@ -505,7 +505,7 @@
         this._textRecord = new TextRecord();
         this._scriptRuns = new ScriptRun();
         this._fontRuns = new FontRunIterator();
-        this._erecords = new ArrayList(10);
+        this._erecords = new ArrayList<>(10);
         this._pt = new Point2D.Float();
         this._sd = new FontStrikeDesc();
         this._mat = new float[4];
@@ -523,7 +523,7 @@
             er = new EngineRecord();
             _erecords.add(er);
         } else {
-            er = (EngineRecord)_erecords.get(_ercount);
+            er = _erecords.get(_ercount);
         }
         er.init(start, limit, font, script, lang, gmask);
         ++_ercount;
diff --git a/src/share/classes/sun/font/StandardGlyphVector.java b/src/share/classes/sun/font/StandardGlyphVector.java
index 75951ac..77f2715 100644
--- a/src/share/classes/sun/font/StandardGlyphVector.java
+++ b/src/share/classes/sun/font/StandardGlyphVector.java
@@ -153,7 +153,7 @@
     private AffineTransform invdtx; // inverse of dtx or null if dtx is identity
     private AffineTransform frctx; // font render context transform, wish we could just share it
     private Font2D font2D;         // basic strike-independent stuff
-    private SoftReference fsref;   // font strike reference for glyphs with no per-glyph transform
+    private SoftReference<GlyphStrike> fsref;   // font strike reference for glyphs with no per-glyph transform
 
     /////////////////////////////
     // Constructors and Factory methods
@@ -526,9 +526,9 @@
         }
 
         Shape[] lbcache;
-        if (lbcacheRef == null || (lbcache = (Shape[])lbcacheRef.get()) == null) {
+        if (lbcacheRef == null || (lbcache = lbcacheRef.get()) == null) {
             lbcache = new Shape[glyphs.length];
-            lbcacheRef = new SoftReference(lbcache);
+            lbcacheRef = new SoftReference<>(lbcache);
         }
 
         Shape result = lbcache[ix];
@@ -568,7 +568,7 @@
 
         return result;
     }
-    private SoftReference lbcacheRef;
+    private SoftReference<Shape[]> lbcacheRef;
 
     public Shape getGlyphVisualBounds(int ix) {
         if (ix < 0 || ix >= glyphs.length) {
@@ -576,9 +576,9 @@
         }
 
         Shape[] vbcache;
-        if (vbcacheRef == null || (vbcache = (Shape[])vbcacheRef.get()) == null) {
+        if (vbcacheRef == null || (vbcache = vbcacheRef.get()) == null) {
             vbcache = new Shape[glyphs.length];
-            vbcacheRef = new SoftReference(vbcache);
+            vbcacheRef = new SoftReference<>(vbcache);
         }
 
         Shape result = vbcache[ix];
@@ -589,7 +589,7 @@
 
         return result;
     }
-    private SoftReference vbcacheRef;
+    private SoftReference<Shape[]> vbcacheRef;
 
     public Rectangle getGlyphPixelBounds(int index, FontRenderContext renderFRC, float x, float y) {
       return getGlyphsPixelBounds(renderFRC, x, y, index, 1);
@@ -1230,14 +1230,14 @@
 
     private void clearCaches(int ix) {
         if (lbcacheRef != null) {
-            Shape[] lbcache = (Shape[])lbcacheRef.get();
+            Shape[] lbcache = lbcacheRef.get();
             if (lbcache != null) {
                 lbcache[ix] = null;
             }
         }
 
         if (vbcacheRef != null) {
-            Shape[] vbcache = (Shape[])vbcacheRef.get();
+            Shape[] vbcache = vbcacheRef.get();
             if (vbcache != null) {
                 vbcache[ix] = null;
             }
@@ -1357,11 +1357,11 @@
     private GlyphStrike getDefaultStrike() {
         GlyphStrike gs = null;
         if (fsref != null) {
-            gs = (GlyphStrike)fsref.get();
+            gs = fsref.get();
         }
         if (gs == null) {
             gs = GlyphStrike.create(this, dtx, null);
-            fsref = new SoftReference(gs);
+            fsref = new SoftReference<>(gs);
         }
         return gs;
     }
@@ -1379,7 +1379,7 @@
         StandardGlyphVector sgv;  // reference back to glyph vector - yuck
         int[] indices;            // index into unique strikes
         double[] transforms;      // six doubles per unique transform, because AT is a pain to manipulate
-        SoftReference strikesRef; // ref to unique strikes, one per transform
+        SoftReference<GlyphStrike[]> strikesRef; // ref to unique strikes, one per transform
         boolean haveAllStrikes;   // true if the strike array has been filled by getStrikes().
 
         // used when first setting a transform
@@ -1653,12 +1653,12 @@
         private GlyphStrike[] getStrikeArray() {
             GlyphStrike[] strikes = null;
             if (strikesRef != null) {
-                strikes = (GlyphStrike[])strikesRef.get();
+                strikes = strikesRef.get();
             }
             if (strikes == null) {
                 haveAllStrikes = false;
                 strikes = new GlyphStrike[transformCount() + 1];
-                strikesRef = new SoftReference(strikes);
+                strikesRef = new SoftReference<>(strikes);
             }
 
             return strikes;
diff --git a/src/share/classes/sun/font/StrikeCache.java b/src/share/classes/sun/font/StrikeCache.java
index eeda70c..49b31ac 100644
--- a/src/share/classes/sun/font/StrikeCache.java
+++ b/src/share/classes/sun/font/StrikeCache.java
@@ -65,7 +65,7 @@
 
     static final Unsafe unsafe = Unsafe.getUnsafe();
 
-    static ReferenceQueue refQueue = Disposer.getQueue();
+    static ReferenceQueue<Object> refQueue = Disposer.getQueue();
 
     static ArrayList<GlyphDisposedListener> disposeListeners = new ArrayList<GlyphDisposedListener>(1);
 
@@ -159,7 +159,7 @@
         }
 
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
 
                /* Allow a client to override the reference type used to
@@ -378,11 +378,11 @@
         }
     }
 
-    public static Reference getStrikeRef(FontStrike strike) {
+    public static Reference<FontStrike> getStrikeRef(FontStrike strike) {
         return getStrikeRef(strike, cacheRefTypeWeak);
     }
 
-    public static Reference getStrikeRef(FontStrike strike, boolean weak) {
+    public static Reference<FontStrike> getStrikeRef(FontStrike strike, boolean weak) {
         /* Some strikes may have no disposer as there's nothing
          * for them to free, as they allocated no native resource
          * eg, if they did not allocate resources because of a problem,
@@ -392,9 +392,9 @@
          */
         if (strike.disposer == null) {
             if (weak) {
-                return new WeakReference(strike);
+                return new WeakReference<>(strike);
             } else {
-                return new SoftReference(strike);
+                return new SoftReference<>(strike);
             }
         }
 
@@ -410,7 +410,7 @@
     }
 
     static class SoftDisposerRef
-        extends SoftReference implements DisposableStrike {
+        extends SoftReference<FontStrike> implements DisposableStrike {
 
         private FontStrikeDisposer disposer;
 
@@ -418,15 +418,16 @@
             return disposer;
         }
 
+        @SuppressWarnings("unchecked")
         SoftDisposerRef(FontStrike strike) {
             super(strike, StrikeCache.refQueue);
             disposer = strike.disposer;
-            Disposer.addReference(this, disposer);
+            Disposer.addReference((Reference<Object>)(Reference)this, disposer);
         }
     }
 
     static class WeakDisposerRef
-        extends WeakReference implements DisposableStrike {
+        extends WeakReference<FontStrike> implements DisposableStrike {
 
         private FontStrikeDisposer disposer;
 
@@ -434,10 +435,11 @@
             return disposer;
         }
 
+        @SuppressWarnings("unchecked")
         WeakDisposerRef(FontStrike strike) {
             super(strike, StrikeCache.refQueue);
             disposer = strike.disposer;
-            Disposer.addReference(this, disposer);
+            Disposer.addReference((Reference<Object>)(Reference)this, disposer);
         }
     }
 
diff --git a/src/share/classes/sun/font/SunFontManager.java b/src/share/classes/sun/font/SunFontManager.java
index cd366f0..9ac30ef 100644
--- a/src/share/classes/sun/font/SunFontManager.java
+++ b/src/share/classes/sun/font/SunFontManager.java
@@ -197,9 +197,9 @@
     private static HashSet<String> missingFontFiles = null;
     private String defaultFontName;
     private String defaultFontFileName;
-    protected HashSet registeredFontFiles = new HashSet();
+    protected HashSet<String> registeredFontFiles = new HashSet<>();
 
-    private ArrayList badFonts;
+    private ArrayList<String> badFonts;
     /* fontPath is the location of all fonts on the system, excluding the
      * JRE's own font directory but including any path specified using the
      * sun.java2d.fontpath property. Together with that property,  it is
@@ -332,7 +332,7 @@
     static {
 
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
 
            public Object run() {
                FontManagerNativeLibrary.load();
@@ -373,7 +373,7 @@
 
         initJREFontMap();
         java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                     public Object run() {
                         File badFontFile =
                             new File(jreFontDirName + File.separator +
@@ -381,7 +381,7 @@
                         if (badFontFile.exists()) {
                             FileInputStream fis = null;
                             try {
-                                badFonts = new ArrayList();
+                                badFonts = new ArrayList<>();
                                 fis = new FileInputStream(badFontFile);
                                 InputStreamReader isr = new InputStreamReader(fis);
                                 BufferedReader br = new BufferedReader(isr);
@@ -762,7 +762,7 @@
             if (family == null) {
                 family = new FontFamily(familyName, false, rank);
                 family.setFont(f, f.style);
-            } else if (family.getRank() >= rank) {
+            } else {
                 family.setFont(f, f.style);
             }
             fullNameToFont.put(fontName.toLowerCase(Locale.ENGLISH), f);
@@ -853,7 +853,7 @@
                 if (family == null) {
                     family = new FontFamily(familyName, false, rank);
                     family.setFont(newFont, newFont.style);
-                } else if (family.getRank() >= rank) {
+                } else {
                     family.setFont(newFont, newFont.style);
                 }
                 return newFont;
@@ -1227,9 +1227,9 @@
                  * and I don't know how to recover from there being absolutely
                  * no fonts anywhere on the system.
                  */
-                Iterator i = physicalFonts.values().iterator();
+                Iterator<PhysicalFont> i = physicalFonts.values().iterator();
                 if (i.hasNext()) {
-                    defaultPhysicalFont = (PhysicalFont)i.next();
+                    defaultPhysicalFont = i.next();
                 } else {
                     throw new Error("Probable fatal error:No fonts found.");
                 }
@@ -1303,7 +1303,7 @@
         } else {
             filter = new TTorT1Filter();
         }
-        return (String[])AccessController.doPrivileged(new PrivilegedAction() {
+        return (String[])AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 if (pathDirs.length == 1) {
                     File dir = new File(pathDirs[0]);
@@ -1419,6 +1419,7 @@
              * them "MS UI Gothic" has no JA name whereas the other two do.
              * So not every font in these files is unmapped or new.
              */
+            @SuppressWarnings("unchecked")
             HashMap<String,String> ffmapCopy =
                 (HashMap<String,String>)(fontToFileMap.clone());
             for (String key : fontToFamilyNameMap.keySet()) {
@@ -1470,7 +1471,7 @@
                     String name = unmappedFontNames.get(i);
                     String familyName = fontToFamilyNameMap.get(name);
                     if (familyName != null) {
-                        ArrayList family = familyToFontListMap.get(familyName);
+                        ArrayList<String> family = familyToFontListMap.get(familyName);
                         if (family != null) {
                             if (family.size() <= 1) {
                                 familyToFontListMap.remove(familyName);
@@ -1896,7 +1897,7 @@
      * to register those again, but we do want to register other registry
      * installed fonts.
      */
-    protected void registerOtherFontFiles(HashSet registeredFontFiles) {
+    protected void registerOtherFontFiles(HashSet<String> registeredFontFiles) {
         if (getFullNameToFileMap().size() == 0) {
             return;
         }
@@ -2080,6 +2081,7 @@
          * name.
          */
         if (_usingPerAppContextComposites) {
+            @SuppressWarnings("unchecked")
             ConcurrentHashMap<String, Font2D> altNameCache =
                 (ConcurrentHashMap<String, Font2D>)
                 AppContext.getAppContext().get(CompositeFont.class);
@@ -2304,10 +2306,15 @@
                 nameTable = createdByFullName;
             } else {
                 AppContext appContext = AppContext.getAppContext();
-                familyTable =
+                @SuppressWarnings("unchecked")
+                Hashtable<String,FontFamily> tmp1 =
                     (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
-                nameTable =
+                familyTable = tmp1;
+
+                @SuppressWarnings("unchecked")
+                Hashtable<String, Font2D> tmp2 =
                     (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+                nameTable = tmp2;
             }
 
             family = familyTable.get(lowerCaseName);
@@ -2467,7 +2474,7 @@
         } catch (FontFormatException e) {
             if (isCopy) {
                 java.security.AccessController.doPrivileged(
-                     new java.security.PrivilegedAction() {
+                     new java.security.PrivilegedAction<Object>() {
                           public Object run() {
                               if (_tracker != null) {
                                   _tracker.subBytes((int)fFile.length());
@@ -2492,7 +2499,7 @@
                     final Runnable fileCloserRunnable = new Runnable() {
                       public void run() {
                          java.security.AccessController.doPrivileged(
-                         new java.security.PrivilegedAction() {
+                         new java.security.PrivilegedAction<Object>() {
                          public Object run() {
 
                             for (int i=0;i<CHANNELPOOLSIZE;i++) {
@@ -2521,7 +2528,7 @@
                       }
                     };
                     java.security.AccessController.doPrivileged(
-                       new java.security.PrivilegedAction() {
+                       new java.security.PrivilegedAction<Object>() {
                           public Object run() {
                               /* The thread must be a member of a thread group
                                * which will not get GCed before VM exit.
@@ -2627,15 +2634,17 @@
         fullNameToFont.remove(oldFont.fullName.toLowerCase(Locale.ENGLISH));
         FontFamily.remove(oldFont);
         if (localeFullNamesToFont != null) {
-            Map.Entry[] mapEntries = localeFullNamesToFont.entrySet().
-                toArray(new Map.Entry[0]);
+            Map.Entry<?, ?>[] mapEntries = localeFullNamesToFont.entrySet().
+                toArray(new Map.Entry<?, ?>[0]);
             /* Should I be replacing these, or just I just remove
              * the names from the map?
              */
             for (int i=0; i<mapEntries.length;i++) {
                 if (mapEntries[i].getValue() == oldFont) {
                     try {
-                        mapEntries[i].setValue(newFont);
+                        @SuppressWarnings("unchecked")
+                        Map.Entry<String, PhysicalFont> tmp = (Map.Entry<String, PhysicalFont>)mapEntries[i];
+                        tmp.setValue(newFont);
                     } catch (Exception e) {
                         /* some maps don't support this operation.
                          * In this case just give up and remove the entry.
@@ -2864,7 +2873,7 @@
     private static boolean maybeMultiAppContext() {
         Boolean appletSM = (Boolean)
             java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             SecurityManager sm = System.getSecurityManager();
                             return new Boolean
@@ -3055,10 +3064,15 @@
             fontsAreRegistered = true;
         } else {
             AppContext appContext = AppContext.getAppContext();
-            familyTable =
+            @SuppressWarnings("unchecked")
+            Hashtable<String,FontFamily> tmp1 =
                 (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
-            fullNameTable =
+            familyTable = tmp1;
+            @SuppressWarnings("unchecked")
+            Hashtable<String,Font2D> tmp2 =
                 (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+            fullNameTable = tmp2;
+
             if (familyTable == null) {
                 familyTable = new Hashtable<String,FontFamily>();
                 fullNameTable = new Hashtable<String,Font2D>();
@@ -3114,8 +3128,10 @@
             familyTable = createdByFamilyName;
         } else if (fontsAreRegisteredPerAppContext) {
             AppContext appContext = AppContext.getAppContext();
-            familyTable =
+            @SuppressWarnings("unchecked")
+            Hashtable<String,FontFamily> tmp =
                 (Hashtable<String,FontFamily>)appContext.get(regFamilyKey);
+            familyTable = tmp;
         } else {
             return null;
         }
@@ -3142,8 +3158,10 @@
             nameTable = createdByFullName;
         } else if (fontsAreRegisteredPerAppContext) {
             AppContext appContext = AppContext.getAppContext();
-            nameTable =
+            @SuppressWarnings("unchecked")
+            Hashtable<String,Font2D> tmp =
                 (Hashtable<String,Font2D>)appContext.get(regFullNameKey);
+            nameTable = tmp;
         } else {
             return null;
         }
@@ -3305,7 +3323,7 @@
             initialiseDeferredFonts();
 
             java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     if (fontPath == null) {
                         fontPath = getPlatformFontPath(noType1Font);
@@ -3440,7 +3458,7 @@
                 FontUtilities.getLogger().info("loadAllFontFiles() called");
             }
             java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     if (fontPath == null) {
                         fontPath = getPlatformFontPath(noType1Font);
@@ -3682,7 +3700,7 @@
     public Font[] getAllInstalledFonts() {
         if (allFonts == null) {
             loadFonts();
-            TreeMap fontMapNames = new TreeMap();
+            TreeMap<String, Font2D> fontMapNames = new TreeMap<>();
             /* warning: the number of composite fonts could change dynamically
              * if applications are allowed to create them. "allfonts" could
              * then be stale.
@@ -3715,7 +3733,7 @@
             Font[] fonts = new Font[fontNames.length];
             for (int i=0; i < fontNames.length; i++) {
                 fonts[i] = new Font(fontNames[i], Font.PLAIN, 1);
-                Font2D f2d = (Font2D)fontMapNames.get(fontNames[i]);
+                Font2D f2d = fontMapNames.get(fontNames[i]);
                 if (f2d  != null) {
                     FontAccess.getFontAccess().setFont2D(fonts[i], f2d.handle);
                 }
@@ -3798,7 +3816,7 @@
 
     public void register1dot0Fonts() {
         java.security.AccessController.doPrivileged(
-                            new java.security.PrivilegedAction() {
+                            new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 String type1Dir = "/usr/openwin/lib/X11/fonts/Type1";
                 registerFontsInDir(type1Dir, true, Font2D.TYPE1_RANK,
@@ -3840,7 +3858,7 @@
         if (systemLocale == null) {
             systemLocale = (Locale)
                 java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 /* On windows the system locale may be different than the
                  * user locale. This is an unsupported configuration, but
diff --git a/src/share/classes/sun/font/SunLayoutEngine.java b/src/share/classes/sun/font/SunLayoutEngine.java
index eb763cd..0927d24 100644
--- a/src/share/classes/sun/font/SunLayoutEngine.java
+++ b/src/share/classes/sun/font/SunLayoutEngine.java
@@ -129,13 +129,13 @@
 
   // !!! don't need this unless we have more than one sun layout engine...
     public LayoutEngine getEngine(LayoutEngineKey key) {
-        ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get();
+        ConcurrentHashMap<LayoutEngineKey, LayoutEngine> cache = cacheref.get();
         if (cache == null) {
-            cache = new ConcurrentHashMap();
-            cacheref = new SoftReference(cache);
+            cache = new ConcurrentHashMap<>();
+            cacheref = new SoftReference<>(cache);
         }
 
-        LayoutEngine e = (LayoutEngine)cache.get(key);
+        LayoutEngine e = cache.get(key);
         if (e == null) {
             LayoutEngineKey copy = key.copy();
             e = new SunLayoutEngine(copy);
@@ -143,7 +143,8 @@
         }
         return e;
     }
-    private SoftReference cacheref = new SoftReference(null);
+    private SoftReference<ConcurrentHashMap<LayoutEngineKey, LayoutEngine>> cacheref =
+        new SoftReference<>(null);
 
     private SunLayoutEngine(LayoutEngineKey key) {
         this.key = key;
diff --git a/src/share/classes/sun/font/TrueTypeFont.java b/src/share/classes/sun/font/TrueTypeFont.java
index 96430e7..b7e0e88 100644
--- a/src/share/classes/sun/font/TrueTypeFont.java
+++ b/src/share/classes/sun/font/TrueTypeFont.java
@@ -290,7 +290,7 @@
             try {
                 RandomAccessFile raf = (RandomAccessFile)
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             try {
                                 return new RandomAccessFile(platName, "r");
@@ -1546,7 +1546,7 @@
      * during typical start-up and the information here is likely never
      * needed.
      */
-    protected void initAllNames(int requestedID, HashSet names) {
+    protected void initAllNames(int requestedID, HashSet<String> names) {
 
         byte[] name = new byte[256];
         ByteBuffer buffer = getTableBuffer(nameTag);
@@ -1584,23 +1584,23 @@
     }
 
     String[] getAllFamilyNames() {
-        HashSet aSet = new HashSet();
+        HashSet<String> aSet = new HashSet<>();
         try {
             initAllNames(FAMILY_NAME_ID, aSet);
         } catch (Exception e) {
             /* In case of malformed font */
         }
-        return (String[])aSet.toArray(new String[0]);
+        return aSet.toArray(new String[0]);
     }
 
     String[] getAllFullNames() {
-        HashSet aSet = new HashSet();
+        HashSet<String> aSet = new HashSet<>();
         try {
             initAllNames(FULL_NAME_ID, aSet);
         } catch (Exception e) {
             /* In case of malformed font */
         }
-        return (String[])aSet.toArray(new String[0]);
+        return aSet.toArray(new String[0]);
     }
 
     /*  Used by the OpenType engine for mark positioning.
diff --git a/src/share/classes/sun/font/Type1Font.java b/src/share/classes/sun/font/Type1Font.java
index 9e5216b..fca68cb 100644
--- a/src/share/classes/sun/font/Type1Font.java
+++ b/src/share/classes/sun/font/Type1Font.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -86,7 +86,7 @@
 
         public synchronized void dispose() {
             java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                     public Object run() {
 
                         if (fileName != null) {
@@ -98,16 +98,16 @@
         }
     }
 
-    WeakReference bufferRef = new WeakReference(null);
+    WeakReference<Object> bufferRef = new WeakReference<>(null);
 
     private String psName = null;
 
-    static private HashMap styleAbbreviationsMapping;
-    static private HashSet styleNameTokes;
+    static private HashMap<String, String> styleAbbreviationsMapping;
+    static private HashSet<String> styleNameTokes;
 
     static {
-        styleAbbreviationsMapping = new HashMap();
-        styleNameTokes = new HashSet();
+        styleAbbreviationsMapping = new HashMap<>();
+        styleNameTokes = new HashSet<>();
 
         /* These abbreviation rules are taken from Appendix 1 of Adobe Technical Note #5088 */
         /* NB: this list is not complete - we did not include abbreviations which contain
@@ -192,7 +192,7 @@
             try {
                 RandomAccessFile raf = (RandomAccessFile)
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             try {
                                 return new RandomAccessFile(platName, "r");
@@ -205,7 +205,7 @@
                 fileSize = (int)fc.size();
                 mapBuf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fileSize);
                 mapBuf.position(0);
-                bufferRef = new WeakReference(mapBuf);
+                bufferRef = new WeakReference<>(mapBuf);
                 fc.close();
             } catch (NullPointerException e) {
                 throw new FontFormatException(e.toString());
@@ -232,7 +232,7 @@
         try {
             raf = (RandomAccessFile)
                 java.security.AccessController.doPrivileged(
-                    new java.security.PrivilegedAction() {
+                    new java.security.PrivilegedAction<Object>() {
                         public Object run() {
                             try {
                                 return new RandomAccessFile(platName, "r");
@@ -474,7 +474,7 @@
 
     private String expandAbbreviation(String abbr) {
         if (styleAbbreviationsMapping.containsKey(abbr))
-                        return (String) styleAbbreviationsMapping.get(abbr);
+                        return styleAbbreviationsMapping.get(abbr);
         return abbr;
     }
 
diff --git a/src/share/classes/sun/java2d/Disposer.java b/src/share/classes/sun/java2d/Disposer.java
index f58e8a7..61877c3 100644
--- a/src/share/classes/sun/java2d/Disposer.java
+++ b/src/share/classes/sun/java2d/Disposer.java
@@ -47,8 +47,9 @@
  * @see DisposerRecord
  */
 public class Disposer implements Runnable {
-    private static final ReferenceQueue queue = new ReferenceQueue();
-    private static final Hashtable records = new Hashtable();
+    private static final ReferenceQueue<Object> queue = new ReferenceQueue<>();
+    private static final Hashtable<java.lang.ref.Reference<Object>, DisposerRecord> records =
+        new Hashtable<>();
 
     private static Disposer disposerInstance;
     public static final int WEAK = 0;
@@ -77,7 +78,7 @@
         }
         disposerInstance = new Disposer();
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
                 public Object run() {
                     /* The thread must be a member of a thread group
                      * which will not get GCed before VM exit.
@@ -135,11 +136,11 @@
         if (target instanceof DisposerTarget) {
             target = ((DisposerTarget)target).getDisposerReferent();
         }
-        java.lang.ref.Reference ref;
+        java.lang.ref.Reference<Object> ref;
         if (refType == PHANTOM) {
-            ref = new PhantomReference(target, queue);
+            ref = new PhantomReference<>(target, queue);
         } else {
-            ref = new WeakReference(target, queue);
+            ref = new WeakReference<>(target, queue);
         }
         records.put(ref, rec);
     }
@@ -149,7 +150,7 @@
             try {
                 Object obj = queue.remove();
                 ((Reference)obj).clear();
-                DisposerRecord rec = (DisposerRecord)records.remove(obj);
+                DisposerRecord rec = records.remove(obj);
                 rec.dispose();
                 obj = null;
                 rec = null;
@@ -214,7 +215,7 @@
                    && freed < 10000 && deferred < 100) {
                 freed++;
                 ((Reference)obj).clear();
-                DisposerRecord rec = (DisposerRecord)records.remove(obj);
+                DisposerRecord rec = records.remove(obj);
                 if (rec instanceof PollDisposable) {
                     rec.dispose();
                     obj = null;
@@ -247,17 +248,18 @@
      * so will clutter the records hashmap and no one will be cleaning up
      * the reference queue.
      */
-    public static void addReference(Reference ref, DisposerRecord rec) {
+    @SuppressWarnings("unchecked")
+    public static void addReference(Reference<Object> ref, DisposerRecord rec) {
         records.put(ref, rec);
     }
 
     public static void addObjectRecord(Object obj, DisposerRecord rec) {
-        records.put(new WeakReference(obj, queue) , rec);
+        records.put(new WeakReference<>(obj, queue) , rec);
     }
 
     /* This is intended for use in conjunction with addReference(..)
      */
-    public static ReferenceQueue getQueue() {
+    public static ReferenceQueue<Object> getQueue() {
         return queue;
     }
 
diff --git a/src/share/classes/sun/java2d/SunGraphics2D.java b/src/share/classes/sun/java2d/SunGraphics2D.java
index 3921bbc..f66eee6 100644
--- a/src/share/classes/sun/java2d/SunGraphics2D.java
+++ b/src/share/classes/sun/java2d/SunGraphics2D.java
@@ -61,6 +61,7 @@
 import java.awt.Rectangle;
 import java.text.AttributedCharacterIterator;
 import java.awt.Font;
+import java.awt.Point;
 import java.awt.image.ImageObserver;
 import java.awt.Transparency;
 import java.awt.font.GlyphVector;
@@ -93,6 +94,13 @@
 import sun.misc.PerformanceLogger;
 
 import java.lang.annotation.Native;
+import sun.awt.image.MultiResolutionImage;
+
+import static java.awt.geom.AffineTransform.TYPE_FLIP;
+import static java.awt.geom.AffineTransform.TYPE_MASK_SCALE;
+import static java.awt.geom.AffineTransform.TYPE_TRANSLATION;
+import sun.awt.image.MultiResolutionToolkitImage;
+import sun.awt.image.ToolkitImage;
 
 /**
  * This is a the master Graphics2D superclass for all of the Sun
@@ -237,6 +245,7 @@
     protected Region devClip;           // Actual physical drawable in pixels
 
     private final int devScale;         // Actual physical scale factor
+    private int resolutionVariantHint;
 
     // cached state for text rendering
     private boolean validFontInfo;
@@ -274,6 +283,7 @@
         lcdTextContrast = lcdTextContrastDefaultValue;
         interpolationHint = -1;
         strokeHint = SunHints.INTVAL_STROKE_DEFAULT;
+        resolutionVariantHint = SunHints.INTVAL_RESOLUTION_VARIANT_DEFAULT;
 
         interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
 
@@ -1249,6 +1259,10 @@
                 stateChanged = (strokeHint != newHint);
                 strokeHint = newHint;
                 break;
+            case SunHints.INTKEY_RESOLUTION_VARIANT:
+                stateChanged = (resolutionVariantHint != newHint);
+                resolutionVariantHint = newHint;
+                break;
             default:
                 recognized = false;
                 stateChanged = false;
@@ -1322,6 +1336,9 @@
         case SunHints.INTKEY_STROKE_CONTROL:
             return SunHints.Value.get(SunHints.INTKEY_STROKE_CONTROL,
                                       strokeHint);
+        case SunHints.INTKEY_RESOLUTION_VARIANT:
+            return SunHints.Value.get(SunHints.INTKEY_RESOLUTION_VARIANT,
+                                      resolutionVariantHint);
         }
         return null;
     }
@@ -3050,18 +3067,58 @@
     }
 // end of text rendering methods
 
-    private static boolean isHiDPIImage(final Image img) {
-        return SurfaceManager.getImageScale(img) != 1;
+    private boolean isHiDPIImage(final Image img) {
+        return (SurfaceManager.getImageScale(img) != 1) ||
+               (resolutionVariantHint != SunHints.INTVAL_RESOLUTION_VARIANT_OFF
+                    && img instanceof MultiResolutionImage);
     }
 
     private boolean drawHiDPIImage(Image img, int dx1, int dy1, int dx2,
                                    int dy2, int sx1, int sy1, int sx2, int sy2,
                                    Color bgcolor, ImageObserver observer) {
-        final int scale = SurfaceManager.getImageScale(img);
-        sx1 = Region.clipScale(sx1, scale);
-        sx2 = Region.clipScale(sx2, scale);
-        sy1 = Region.clipScale(sy1, scale);
-        sy2 = Region.clipScale(sy2, scale);
+
+        if (SurfaceManager.getImageScale(img) != 1) {  // Volatile Image
+            final int scale = SurfaceManager.getImageScale(img);
+            sx1 = Region.clipScale(sx1, scale);
+            sx2 = Region.clipScale(sx2, scale);
+            sy1 = Region.clipScale(sy1, scale);
+            sy2 = Region.clipScale(sy2, scale);
+        } else if (img instanceof MultiResolutionImage) {
+            // get scaled destination image size
+
+            int width = img.getWidth(observer);
+            int height = img.getHeight(observer);
+
+            Image resolutionVariant = getResolutionVariant(
+                    (MultiResolutionImage) img, width, height,
+                    dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
+
+            if (resolutionVariant != img && resolutionVariant != null) {
+                // recalculate source region for the resolution variant
+
+                ImageObserver rvObserver = MultiResolutionToolkitImage.
+                        getResolutionVariantObserver(img, observer,
+                                width, height, -1, -1);
+
+                int rvWidth = resolutionVariant.getWidth(rvObserver);
+                int rvHeight = resolutionVariant.getHeight(rvObserver);
+
+                if (0 < width && 0 < height && 0 < rvWidth && 0 < rvHeight) {
+
+                    float widthScale = ((float) rvWidth) / width;
+                    float heightScale = ((float) rvHeight) / height;
+
+                    sx1 = Region.clipScale(sx1, widthScale);
+                    sy1 = Region.clipScale(sy1, heightScale);
+                    sx2 = Region.clipScale(sx2, widthScale);
+                    sy2 = Region.clipScale(sy2, heightScale);
+
+                    observer = rvObserver;
+                    img = resolutionVariant;
+                }
+            }
+        }
+
         try {
             return imagepipe.scaleImage(this, img, dx1, dy1, dx2, dy2, sx1, sy1,
                                         sx2, sy2, bgcolor, observer);
@@ -3081,6 +3138,54 @@
         }
     }
 
+    private Image getResolutionVariant(MultiResolutionImage img,
+            int srcWidth, int srcHeight, int dx1, int dy1, int dx2, int dy2,
+            int sx1, int sy1, int sx2, int sy2) {
+
+        if (srcWidth <= 0 || srcHeight <= 0) {
+            return null;
+        }
+
+        int sw = sx2 - sx1;
+        int sh = sy2 - sy1;
+
+        if (sw == 0 || sh == 0) {
+            return null;
+        }
+
+        int type = transform.getType();
+        int dw = dx2 - dx1;
+        int dh = dy2 - dy1;
+        double destRegionWidth;
+        double destRegionHeight;
+
+        if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP)) == 0) {
+            destRegionWidth = dw;
+            destRegionHeight = dh;
+        } else if ((type & ~(TYPE_TRANSLATION | TYPE_FLIP | TYPE_MASK_SCALE)) == 0) {
+            destRegionWidth = dw * transform.getScaleX();
+            destRegionHeight = dh * transform.getScaleY();
+        } else {
+            destRegionWidth = dw * Math.hypot(
+                    transform.getScaleX(), transform.getShearY());
+            destRegionHeight = dh * Math.hypot(
+                    transform.getShearX(), transform.getScaleY());
+        }
+
+        int destImageWidth = (int) Math.abs(srcWidth * destRegionWidth / sw);
+        int destImageHeight = (int) Math.abs(srcHeight * destRegionHeight / sh);
+
+        Image resolutionVariant
+                = img.getResolutionVariant(destImageWidth, destImageHeight);
+
+        if (resolutionVariant instanceof ToolkitImage
+                && ((ToolkitImage) resolutionVariant).hasError()) {
+            return null;
+        }
+
+        return resolutionVariant;
+    }
+
     /**
      * Draws an image scaled to x,y,w,h in nonblocking mode with a
      * callback object.
diff --git a/src/share/classes/sun/management/VMManagementImpl.java b/src/share/classes/sun/management/VMManagementImpl.java
index c5d0505..d9e8d64 100644
--- a/src/share/classes/sun/management/VMManagementImpl.java
+++ b/src/share/classes/sun/management/VMManagementImpl.java
@@ -37,7 +37,6 @@
 import java.util.Collections;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * Implementation of VMManagement interface that accesses the management
@@ -173,10 +172,8 @@
     }
 
     public String   getBootClassPath( ) {
-        PrivilegedAction<String> pa
-            = new GetPropertyAction("sun.boot.class.path");
-        String result =  AccessController.doPrivileged(pa);
-        return result;
+        return AccessController.doPrivileged(
+            (PrivilegedAction<String>) () -> System.getProperty("sun.boot.class.path"));
     }
 
     public long getUptime() {
diff --git a/src/share/classes/sun/misc/CharacterDecoder.java b/src/share/classes/sun/misc/CharacterDecoder.java
index 728e760..76329ec 100644
--- a/src/share/classes/sun/misc/CharacterDecoder.java
+++ b/src/share/classes/sun/misc/CharacterDecoder.java
@@ -183,25 +183,21 @@
      * buffer and returns a byte array containing the data.
      * @exception CEFormatException An error has occurred while decoding
      */
-    public byte decodeBuffer(String inputString)[] throws IOException {
-        byte    inputBuffer[] = new byte[inputString.length()];
-        ByteArrayInputStream inStream;
-        ByteArrayOutputStream outStream;
-
-        inputString.getBytes(0, inputString.length(), inputBuffer, 0);
-        inStream = new ByteArrayInputStream(inputBuffer);
-        outStream = new ByteArrayOutputStream();
+    public byte[] decodeBuffer(String inputString) throws IOException {
+        byte inputBuffer[] = inputString.getBytes();
+        ByteArrayInputStream inStream = new ByteArrayInputStream(inputBuffer);
+        ByteArrayOutputStream outStream = new ByteArrayOutputStream();
         decodeBuffer(inStream, outStream);
-        return (outStream.toByteArray());
+        return outStream.toByteArray();
     }
 
     /**
      * Decode the contents of the inputstream into a buffer.
      */
-    public byte decodeBuffer(InputStream in)[] throws IOException {
+    public byte[] decodeBuffer(InputStream in) throws IOException {
         ByteArrayOutputStream outStream = new ByteArrayOutputStream();
         decodeBuffer(in, outStream);
-        return (outStream.toByteArray());
+        return outStream.toByteArray();
     }
 
     /**
diff --git a/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java b/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
index 5b11fe3..aa28e55 100644
--- a/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
+++ b/src/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
@@ -36,7 +36,7 @@
 import sun.net.dns.ResolverConfiguration;
 import sun.net.spi.nameservice.*;
 import java.security.AccessController;
-import sun.security.action.*;
+import java.security.PrivilegedAction;
 
 /*
  * A name service provider based on JNDI-DNS.
@@ -231,7 +231,7 @@
 
         // default domain
         String domain = AccessController.doPrivileged(
-            new GetPropertyAction("sun.net.spi.nameservice.domain"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.net.spi.nameservice.domain"));
         if (domain != null && domain.length() > 0) {
             domainList = new LinkedList<String>();
             domainList.add(domain);
@@ -239,7 +239,7 @@
 
         // name servers
         String nameservers = AccessController.doPrivileged(
-            new GetPropertyAction("sun.net.spi.nameservice.nameservers"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.net.spi.nameservice.nameservers"));
         if (nameservers != null && nameservers.length() > 0) {
             nameProviderUrl = createProviderURL(nameservers);
             if (nameProviderUrl.length() == 0) {
diff --git a/src/share/classes/sun/rmi/log/ReliableLog.java b/src/share/classes/sun/rmi/log/ReliableLog.java
index c1a224f..3c097c4 100644
--- a/src/share/classes/sun/rmi/log/ReliableLog.java
+++ b/src/share/classes/sun/rmi/log/ReliableLog.java
@@ -30,8 +30,6 @@
 import java.rmi.server.RMIClassLoader;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * This class is a simple implementation of a reliable Log.  The
@@ -141,7 +139,7 @@
     {
         super();
         this.Debug = AccessController.doPrivileged(
-            new GetBooleanAction("sun.rmi.log.debug")).booleanValue();
+            (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.log.debug"));
         dir = new File(dirPath);
         if (!(dir.exists() && dir.isDirectory())) {
             // create directory
@@ -334,7 +332,7 @@
         getLogClassConstructor() {
 
         String logClassName = AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.log.class"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.log.class"));
         if (logClassName != null) {
             try {
                 ClassLoader loader =
diff --git a/src/share/classes/sun/rmi/runtime/Log.java b/src/share/classes/sun/rmi/runtime/Log.java
index 23c9531..507622a 100644
--- a/src/share/classes/sun/rmi/runtime/Log.java
+++ b/src/share/classes/sun/rmi/runtime/Log.java
@@ -26,22 +26,16 @@
 package sun.rmi.runtime;
 
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.PrintStream;
 import java.io.OutputStream;
 import java.rmi.server.LogStream;
-import java.util.logging.ConsoleHandler;
+import java.security.PrivilegedAction;
 import java.util.logging.Handler;
-import java.util.logging.Formatter;
 import java.util.logging.SimpleFormatter;
-import java.util.logging.StreamHandler;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import java.util.logging.LogManager;
 import java.util.logging.LogRecord;
 import java.util.logging.StreamHandler;
-import java.util.Map;
-import java.util.HashMap;
 
 /**
  * Utility which provides an abstract "logger" like RMI internal API
@@ -71,10 +65,8 @@
     /* selects log implementation */
     private static final LogFactory logFactory;
     static {
-        boolean useOld =
-            Boolean.valueOf(java.security.AccessController.
-                doPrivileged(new sun.security.action.GetPropertyAction(
-                    "sun.rmi.log.useOld"))).booleanValue();
+        boolean useOld = java.security.AccessController.doPrivileged(
+            (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.log.useOld"));
 
         /* set factory to select the logging facility to use */
         logFactory = (useOld ? (LogFactory) new LogStreamLogFactory() :
diff --git a/src/share/classes/sun/rmi/runtime/RuntimeUtil.java b/src/share/classes/sun/rmi/runtime/RuntimeUtil.java
index e439925..1eca061 100644
--- a/src/share/classes/sun/rmi/runtime/RuntimeUtil.java
+++ b/src/share/classes/sun/rmi/runtime/RuntimeUtil.java
@@ -33,7 +33,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.logging.Level;
-import sun.security.action.GetIntegerAction;
 
 /**
  * RMI runtime implementation utilities.
@@ -54,8 +53,8 @@
 
     /** number of scheduler threads */
     private static final int schedulerThreads =         // default 1
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.runtime.schedulerThreads", 1));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.runtime.schedulerThreads", 1));
 
     /** permission required to get instance */
     private static final Permission GET_INSTANCE_PERMISSION =
diff --git a/src/share/classes/sun/rmi/server/Activation.java b/src/share/classes/sun/rmi/server/Activation.java
index 1cd509f..dc18b34 100644
--- a/src/share/classes/sun/rmi/server/Activation.java
+++ b/src/share/classes/sun/rmi/server/Activation.java
@@ -107,9 +107,6 @@
 import sun.rmi.runtime.NewThreadAction;
 import sun.rmi.server.UnicastServerRef;
 import sun.rmi.transport.LiveRef;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetPropertyAction;
 import sun.security.provider.PolicyFile;
 import com.sun.rmi.rmid.ExecPermission;
 import com.sun.rmi.rmid.ExecOptionPermission;
@@ -184,7 +181,8 @@
 
     // this should be a *private* method since it is privileged
     private static int getInt(String name, int def) {
-        return AccessController.doPrivileged(new GetIntegerAction(name, def));
+        return AccessController.doPrivileged(
+                (PrivilegedAction<Integer>) () -> Integer.getInteger(name, def));
     }
 
     private transient Activator activator;
@@ -2042,13 +2040,13 @@
             }
 
             debugExec = AccessController.doPrivileged(
-                new GetBooleanAction("sun.rmi.server.activation.debugExec"));
+                (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("sun.rmi.server.activation.debugExec"));
 
             /**
              * Determine class name for activation exec policy (if any).
              */
             String execPolicyClassName = AccessController.doPrivileged(
-                new GetPropertyAction("sun.rmi.activation.execPolicy", null));
+                (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.activation.execPolicy"));
             if (execPolicyClassName == null) {
                 if (!stop) {
                     DefaultExecPolicy.checkConfiguration();
@@ -2387,7 +2385,7 @@
 
     static {
         lineSeparator = AccessController.doPrivileged(
-            new GetPropertyAction("line.separator"));
+           (PrivilegedAction<String>) () -> System.getProperty("line.separator"));
         lineSeparatorLength = lineSeparator.length();
     }
 
diff --git a/src/share/classes/sun/rmi/server/LoaderHandler.java b/src/share/classes/sun/rmi/server/LoaderHandler.java
index 96c692b..cdfadce 100644
--- a/src/share/classes/sun/rmi/server/LoaderHandler.java
+++ b/src/share/classes/sun/rmi/server/LoaderHandler.java
@@ -47,6 +47,7 @@
 import java.security.Policy;
 import java.security.ProtectionDomain;
 import java.rmi.server.LogStream;
+import java.security.PrivilegedAction;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -57,7 +58,6 @@
 import java.util.WeakHashMap;
 import sun.reflect.misc.ReflectUtil;
 import sun.rmi.runtime.Log;
-import sun.security.action.GetPropertyAction;
 
 /**
  * <code>LoaderHandler</code> provides the implementation of the static
@@ -73,7 +73,7 @@
     /** RMI class loader log level */
     static final int logLevel = LogStream.parseLevel(
         java.security.AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.loader.logLevel")));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.loader.logLevel")));
 
     /* loader system log */
     static final Log loaderLog =
@@ -86,7 +86,7 @@
     private static String codebaseProperty = null;
     static {
         String prop = java.security.AccessController.doPrivileged(
-            new GetPropertyAction("java.rmi.server.codebase"));
+            (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.codebase"));
         if (prop != null && prop.trim().length() > 0) {
             codebaseProperty = prop;
         }
diff --git a/src/share/classes/sun/rmi/server/MarshalInputStream.java b/src/share/classes/sun/rmi/server/MarshalInputStream.java
index 64b8fc9..20f8874 100644
--- a/src/share/classes/sun/rmi/server/MarshalInputStream.java
+++ b/src/share/classes/sun/rmi/server/MarshalInputStream.java
@@ -36,6 +36,7 @@
 import java.security.Permission;
 
 import java.rmi.server.RMIClassLoader;
+import java.security.PrivilegedAction;
 
 /**
  * MarshalInputStream is an extension of ObjectInputStream.  When resolving
@@ -65,7 +66,7 @@
      */
     private static final boolean useCodebaseOnlyProperty =
         ! java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction(
+            (PrivilegedAction<String>) () -> System.getProperty(
                 "java.rmi.server.useCodebaseOnly", "true"))
             .equalsIgnoreCase("false");
 
diff --git a/src/share/classes/sun/rmi/server/UnicastRef.java b/src/share/classes/sun/rmi/server/UnicastRef.java
index 9b95724..a581235 100644
--- a/src/share/classes/sun/rmi/server/UnicastRef.java
+++ b/src/share/classes/sun/rmi/server/UnicastRef.java
@@ -39,11 +39,11 @@
 import java.rmi.server.RemoteObject;
 import java.rmi.server.RemoteRef;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import sun.rmi.runtime.Log;
 import sun.rmi.transport.Connection;
 import sun.rmi.transport.LiveRef;
 import sun.rmi.transport.StreamRemoteCall;
-import sun.security.action.GetBooleanAction;
 
 /**
  * NOTE: There is a JDK-internal dependency on the existence of this
@@ -64,8 +64,8 @@
      */
     public static final Log clientCallLog =
         Log.getLog("sun.rmi.client.call", "RMI",
-                   AccessController.doPrivileged(
-                       new GetBooleanAction("sun.rmi.client.logCalls")));
+                   AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+                       Boolean.getBoolean("sun.rmi.client.logCalls")));
     private static final long serialVersionUID = 8258372400816541186L;
 
     protected LiveRef ref;
diff --git a/src/share/classes/sun/rmi/server/UnicastServerRef.java b/src/share/classes/sun/rmi/server/UnicastServerRef.java
index 8342c08..b608f23 100644
--- a/src/share/classes/sun/rmi/server/UnicastServerRef.java
+++ b/src/share/classes/sun/rmi/server/UnicastServerRef.java
@@ -56,7 +56,6 @@
 import sun.rmi.transport.LiveRef;
 import sun.rmi.transport.Target;
 import sun.rmi.transport.tcp.TCPTransport;
-import sun.security.action.GetBooleanAction;
 
 /**
  * UnicastServerRef implements the remote reference layer server-side
@@ -73,7 +72,7 @@
 {
     /** value of server call log property */
     public static final boolean logCalls = AccessController.doPrivileged(
-        new GetBooleanAction("java.rmi.server.logCalls"));
+        (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("java.rmi.server.logCalls"));
 
     /** server call log */
     public static final Log callLog =
@@ -84,8 +83,8 @@
 
     /** flag to enable writing exceptions to System.err */
     private static final boolean wantExceptionLog =
-        AccessController.doPrivileged(
-            new GetBooleanAction("sun.rmi.server.exceptionTrace"));
+        AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+            Boolean.getBoolean("sun.rmi.server.exceptionTrace"));
 
     private boolean forceStubUse = false;
 
@@ -94,9 +93,8 @@
      * exceptions thrown by remote invocations to this VM
      */
     private static final boolean suppressStackTraces =
-        AccessController.doPrivileged(
-            new GetBooleanAction(
-                "sun.rmi.server.suppressStackTraces"));
+        AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+            Boolean.getBoolean("sun.rmi.server.suppressStackTraces"));
 
     /**
      * skeleton to dispatch remote calls through, for 1.1 stub protocol
diff --git a/src/share/classes/sun/rmi/server/Util.java b/src/share/classes/sun/rmi/server/Util.java
index e37bcb9..04cf97f 100644
--- a/src/share/classes/sun/rmi/server/Util.java
+++ b/src/share/classes/sun/rmi/server/Util.java
@@ -57,8 +57,6 @@
 import sun.rmi.runtime.Log;
 import sun.rmi.transport.LiveRef;
 import sun.rmi.transport.tcp.TCPEndpoint;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * A utility class with static methods for creating stubs/proxies and
@@ -70,7 +68,7 @@
     /** "server" package log level */
     static final int logLevel = LogStream.parseLevel(
         AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.server.logLevel")));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.server.logLevel")));
 
     /** server reference log */
     public static final Log serverRefLog =
@@ -79,8 +77,7 @@
     /** cached value of property java.rmi.server.ignoreStubClasses */
     private static final boolean ignoreStubClasses =
         AccessController.doPrivileged(
-            new GetBooleanAction("java.rmi.server.ignoreStubClasses")).
-            booleanValue();
+            (PrivilegedAction<Boolean>) () -> Boolean.getBoolean("java.rmi.server.ignoreStubClasses"));
 
     /** cache of  impl classes that have no corresponding stub class */
     private static final Map<Class<?>, Void> withoutStubs =
diff --git a/src/share/classes/sun/rmi/transport/DGCAckHandler.java b/src/share/classes/sun/rmi/transport/DGCAckHandler.java
index 7f70440..26e9f7b 100644
--- a/src/share/classes/sun/rmi/transport/DGCAckHandler.java
+++ b/src/share/classes/sun/rmi/transport/DGCAckHandler.java
@@ -27,6 +27,7 @@
 
 import java.rmi.server.UID;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -36,7 +37,6 @@
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 import sun.rmi.runtime.RuntimeUtil;
-import sun.security.action.GetLongAction;
 
 /**
  * Holds strong references to a set of remote objects, or live remote
@@ -65,8 +65,8 @@
 
     /** timeout for holding references without receiving an acknowledgment */
     private static final long dgcAckTimeout =           // default 5 minutes
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.ackTimeout", 300000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.ackTimeout", 300000));
 
     /** thread pool for scheduling delayed tasks */
     private static final ScheduledExecutorService scheduler =
diff --git a/src/share/classes/sun/rmi/transport/DGCClient.java b/src/share/classes/sun/rmi/transport/DGCClient.java
index 74586d7..ecf4e46 100644
--- a/src/share/classes/sun/rmi/transport/DGCClient.java
+++ b/src/share/classes/sun/rmi/transport/DGCClient.java
@@ -44,7 +44,6 @@
 import sun.rmi.runtime.NewThreadAction;
 import sun.rmi.server.UnicastRef;
 import sun.rmi.server.Util;
-import sun.security.action.GetLongAction;
 
 /**
  * DGCClient implements the client-side of the RMI distributed garbage
@@ -85,21 +84,18 @@
 
     /** lease duration to request (usually ignored by server) */
     private static final long leaseValue =              // default 10 minutes
-        AccessController.doPrivileged(
-            new GetLongAction("java.rmi.dgc.leaseValue",
-                              600000)).longValue();
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("java.rmi.dgc.leaseValue", 600000));
 
     /** maximum interval between retries of failed clean calls */
     private static final long cleanInterval =           // default 3 minutes
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.cleanInterval",
-                              180000)).longValue();
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.cleanInterval", 180000));
 
     /** maximum interval between complete garbage collections of local heap */
     private static final long gcInterval =              // default 1 hour
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.client.gcInterval",
-                              3600000)).longValue();
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.client.gcInterval", 3600000));
 
     /** minimum retry count for dirty calls that fail */
     private static final int dirtyFailureRetries = 5;
diff --git a/src/share/classes/sun/rmi/transport/DGCImpl.java b/src/share/classes/sun/rmi/transport/DGCImpl.java
index 88ac91b..e22eca6 100644
--- a/src/share/classes/sun/rmi/transport/DGCImpl.java
+++ b/src/share/classes/sun/rmi/transport/DGCImpl.java
@@ -50,8 +50,6 @@
 import sun.rmi.server.UnicastRef;
 import sun.rmi.server.UnicastServerRef;
 import sun.rmi.server.Util;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * This class implements the guts of the server-side distributed GC
@@ -65,17 +63,17 @@
     /* dgc system log */
     static final Log dgcLog = Log.getLog("sun.rmi.dgc", "dgc",
         LogStream.parseLevel(AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.dgc.logLevel"))));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.dgc.logLevel"))));
 
     /** lease duration to grant to clients */
     private static final long leaseValue =              // default 10 minutes
         AccessController.doPrivileged(
-            new GetLongAction("java.rmi.dgc.leaseValue", 600000));
+            (PrivilegedAction<Long>) () -> Long.getLong("java.rmi.dgc.leaseValue", 600000));
 
     /** lease check interval; default is half of lease grant duration */
     private static final long leaseCheckInterval =
         AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.checkInterval", leaseValue / 2));
+            (PrivilegedAction<Long>) () -> Long.getLong("sun.rmi.dgc.checkInterval", leaseValue / 2));
 
     /** thread pool for scheduling delayed tasks */
     private static final ScheduledExecutorService scheduler =
diff --git a/src/share/classes/sun/rmi/transport/ObjectTable.java b/src/share/classes/sun/rmi/transport/ObjectTable.java
index ca0f2b8..cdb1312 100644
--- a/src/share/classes/sun/rmi/transport/ObjectTable.java
+++ b/src/share/classes/sun/rmi/transport/ObjectTable.java
@@ -37,7 +37,6 @@
 import sun.misc.GC;
 import sun.rmi.runtime.Log;
 import sun.rmi.runtime.NewThreadAction;
-import sun.security.action.GetLongAction;
 
 /**
  * Object table shared by all implementors of the Transport interface.
@@ -51,8 +50,8 @@
 
     /** maximum interval between complete garbage collections of local heap */
     private final static long gcInterval =              // default 1 hour
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.dgc.server.gcInterval", 3600000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.dgc.server.gcInterval", 3600000));
 
     /**
      * lock guarding objTable and implTable.
diff --git a/src/share/classes/sun/rmi/transport/Transport.java b/src/share/classes/sun/rmi/transport/Transport.java
index 217c936..e9978e1 100644
--- a/src/share/classes/sun/rmi/transport/Transport.java
+++ b/src/share/classes/sun/rmi/transport/Transport.java
@@ -37,6 +37,7 @@
 import java.rmi.server.RemoteServer;
 import java.rmi.server.ServerNotActiveException;
 import java.security.AccessControlContext;
+import java.security.PrivilegedAction;
 import sun.rmi.runtime.Log;
 import sun.rmi.server.Dispatcher;
 import sun.rmi.server.UnicastServerRef;
@@ -55,7 +56,7 @@
 
     private static String getLogLevel() {
         return java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.rmi.transport.logLevel"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.logLevel"));
     }
 
     /* transport package log */
diff --git a/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java b/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java
index 3d4ac00..a9932be 100644
--- a/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java
+++ b/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java
@@ -26,6 +26,7 @@
 
 import java.io.*;
 import java.net.*;
+import java.security.PrivilegedAction;
 
 import sun.rmi.runtime.Log;
 
@@ -79,7 +80,7 @@
      */
     private String lineSeparator =
         java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("line.separator"));
+            (PrivilegedAction<String>) () -> System.getProperty("line.separator"));
 
     /**
      * Create a stream socket and connect it to the specified port on
diff --git a/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java b/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java
index da819be..8cb7cc4 100644
--- a/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java
+++ b/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java
@@ -32,9 +32,6 @@
 import java.rmi.server.RMISocketFactory;
 import sun.rmi.runtime.Log;
 import sun.rmi.runtime.NewThreadAction;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * RMIMasterSocketFactory attempts to create a socket connection to the
@@ -53,7 +50,7 @@
 
     private static String getLogLevel() {
         return java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.rmi.transport.proxy.logLevel"));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.proxy.logLevel"));
     }
 
     /* proxy package log */
@@ -65,15 +62,14 @@
     private static long connectTimeout = getConnectTimeout();
 
     private static long getConnectTimeout() {
-        return java.security.AccessController.doPrivileged(
-                new GetLongAction("sun.rmi.transport.proxy.connectTimeout",
-                              15000)).longValue(); // default: 15 seconds
+        return java.security.AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.transport.proxy.connectTimeout", 15000)); // default: 15 seconds
     }
 
     /** whether to fallback to HTTP on general connect failures */
     private static final boolean eagerHttpFallback =
-        java.security.AccessController.doPrivileged(new GetBooleanAction(
-            "sun.rmi.transport.proxy.eagerHttpFallback")).booleanValue();
+        java.security.AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
+            Boolean.getBoolean("sun.rmi.transport.proxy.eagerHttpFallback"));
 
     /** table of hosts successfully connected to and the factory used */
     private Hashtable<String, RMISocketFactory> successTable =
@@ -104,14 +100,14 @@
         try {
             String proxyHost;
             proxyHost = java.security.AccessController.doPrivileged(
-                new GetPropertyAction("http.proxyHost"));
+               (PrivilegedAction<String>) () -> System.getProperty("http.proxyHost"));
 
             if (proxyHost == null)
                 proxyHost = java.security.AccessController.doPrivileged(
-                    new GetPropertyAction("proxyHost"));
+                    (PrivilegedAction<String>) () -> System.getProperty("proxyHost"));
 
             boolean disable = java.security.AccessController.doPrivileged(
-                new GetPropertyAction("java.rmi.server.disableHttp", "true"))
+                (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.disableHttp", "true"))
                 .equalsIgnoreCase("true");
 
             if (!disable && proxyHost != null && proxyHost.length() > 0) {
diff --git a/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java b/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java
index 8625508..f47f3fe 100644
--- a/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java
+++ b/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java
@@ -27,6 +27,7 @@
 import java.io.*;
 import java.util.*;
 import java.rmi.server.LogStream;
+import java.security.PrivilegedAction;
 
 import sun.rmi.runtime.Log;
 
@@ -51,7 +52,7 @@
 
     private static String getLogLevel() {
         return java.security.AccessController.doPrivileged(
-            new sun.security.action.GetPropertyAction("sun.rmi.transport.tcp.multiplex.logLevel"));
+           (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.multiplex.logLevel"));
     }
 
     /* multiplex system log */
diff --git a/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java b/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java
index dbce2cc..d073e89 100644
--- a/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java
+++ b/src/share/classes/sun/rmi/transport/tcp/TCPChannel.java
@@ -34,6 +34,7 @@
 import java.rmi.RemoteException;
 import java.security.AccessControlContext;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.ListIterator;
@@ -48,8 +49,6 @@
 import sun.rmi.transport.Connection;
 import sun.rmi.transport.Endpoint;
 import sun.rmi.transport.TransportConstants;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetLongAction;
 
 /**
  * TCPChannel is the socket-based implementation of the RMI Channel
@@ -87,19 +86,18 @@
 
     /** client-side connection idle usage timeout */
     private static final long idleTimeout =             // default 15 seconds
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.transport.connectionTimeout", 15000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.transport.connectionTimeout", 15000));
 
     /** client-side connection handshake read timeout */
     private static final int handshakeTimeout =         // default 1 minute
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.handshakeTimeout",
-                                 60000));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.handshakeTimeout", 60000));
 
     /** client-side connection response read timeout (after handshake) */
     private static final int responseTimeout =          // default infinity
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.responseTimeout", 0));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.responseTimeout", 0));
 
     /** thread pool for scheduling delayed tasks */
     private static final ScheduledExecutorService scheduler =
diff --git a/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java b/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java
index d733821..2370eb1 100644
--- a/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java
+++ b/src/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java
@@ -38,6 +38,7 @@
 import java.rmi.server.RMIServerSocketFactory;
 import java.rmi.server.RMISocketFactory;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -50,9 +51,6 @@
 import sun.rmi.transport.Endpoint;
 import sun.rmi.transport.Target;
 import sun.rmi.transport.Transport;
-import sun.security.action.GetBooleanAction;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * TCPEndpoint represents some communication endpoint for an address
@@ -82,12 +80,14 @@
 
     // this should be a *private* method since it is privileged
     private static int getInt(String name, int def) {
-        return AccessController.doPrivileged(new GetIntegerAction(name, def));
+        return AccessController.doPrivileged(
+                (PrivilegedAction<Integer>) () -> Integer.getInteger(name, def));
     }
 
     // this should be a *private* method since it is privileged
     private static boolean getBoolean(String name) {
-        return AccessController.doPrivileged(new GetBooleanAction(name));
+        return AccessController.doPrivileged(
+                (PrivilegedAction<Boolean>) () -> Boolean.getBoolean(name));
     }
 
     /**
@@ -95,7 +95,7 @@
      */
     private static String getHostnameProperty() {
         return AccessController.doPrivileged(
-            new GetPropertyAction("java.rmi.server.hostname"));
+            (PrivilegedAction<String>) () -> System.getProperty("java.rmi.server.hostname"));
     }
 
     /**
diff --git a/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java b/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java
index 24655c2..d669fe5 100644
--- a/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java
+++ b/src/share/classes/sun/rmi/transport/tcp/TCPTransport.java
@@ -49,6 +49,7 @@
 import java.rmi.server.UID;
 import java.security.AccessControlContext;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
@@ -73,9 +74,6 @@
 import sun.rmi.transport.Transport;
 import sun.rmi.transport.TransportConstants;
 import sun.rmi.transport.proxy.HttpReceiveSocket;
-import sun.security.action.GetIntegerAction;
-import sun.security.action.GetLongAction;
-import sun.security.action.GetPropertyAction;
 
 /**
  * TCPTransport is the socket-based implementation of the RMI Transport
@@ -90,19 +88,18 @@
     /* tcp package log */
     static final Log tcpLog = Log.getLog("sun.rmi.transport.tcp", "tcp",
         LogStream.parseLevel(AccessController.doPrivileged(
-            new GetPropertyAction("sun.rmi.transport.tcp.logLevel"))));
+            (PrivilegedAction<String>) () -> System.getProperty("sun.rmi.transport.tcp.logLevel"))));
 
     /** maximum number of connection handler threads */
     private static final int maxConnectionThreads =     // default no limit
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.maxConnectionThreads",
-                                 Integer.MAX_VALUE));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.maxConnectionThreads",
+                               Integer.MAX_VALUE));
 
     /** keep alive time for idle connection handler threads */
     private static final long threadKeepAliveTime =     // default 1 minute
-        AccessController.doPrivileged(
-            new GetLongAction("sun.rmi.transport.tcp.threadKeepAliveTime",
-                              60000));
+        AccessController.doPrivileged((PrivilegedAction<Long>) () ->
+            Long.getLong("sun.rmi.transport.tcp.threadKeepAliveTime", 60000));
 
     /** thread pool for connection handlers */
     private static final ExecutorService connectionThreadPool =
@@ -143,9 +140,8 @@
      * and 20 hours.
      */
     private static final int connectionReadTimeout =    // default 2 hours
-        AccessController.doPrivileged(
-            new GetIntegerAction("sun.rmi.transport.tcp.readTimeout",
-                                 2 * 3600 * 1000));
+        AccessController.doPrivileged((PrivilegedAction<Integer>) () ->
+            Integer.getInteger("sun.rmi.transport.tcp.readTimeout", 2 * 3600 * 1000));
 
     /**
      * Constructs a TCPTransport.
diff --git a/src/share/classes/sun/security/krb5/Config.java b/src/share/classes/sun/security/krb5/Config.java
index a86cdfd..3b10862 100644
--- a/src/share/classes/sun/security/krb5/Config.java
+++ b/src/share/classes/sun/security/krb5/Config.java
@@ -549,12 +549,11 @@
                             previous = line.substring(1).trim();
                         }
                     } else {
-                        if (previous == null) {
-                            throw new KrbException(
-                                "Config file must starts with a section");
+                        // Lines before the first section are ignored
+                        if (previous != null) {
+                            v.add(previous);
+                            previous = line;
                         }
-                        v.add(previous);
-                        previous = line;
                     }
                 }
                 if (previous != null) {
diff --git a/src/share/classes/sun/security/krb5/KrbApReq.java b/src/share/classes/sun/security/krb5/KrbApReq.java
index b88e42d..96b0cf1 100644
--- a/src/share/classes/sun/security/krb5/KrbApReq.java
+++ b/src/share/classes/sun/security/krb5/KrbApReq.java
@@ -284,7 +284,7 @@
 
         if (dkey == null) {
             throw new KrbException(Krb5.API_INVALID_ARG,
-                "Cannot find key of appropriate type to decrypt AP REP - " +
+                "Cannot find key of appropriate type to decrypt AP-REQ - " +
                                    EType.toString(encPartKeyType));
         }
 
@@ -380,7 +380,7 @@
 
     /**
      * Returns the credentials that are contained in the ticket that
-     * is part of this this AP-REP.
+     * is part of this AP-REQ.
      */
     public Credentials getCreds() {
         return creds;
diff --git a/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java b/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
index c4eaff3..571801f 100644
--- a/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
+++ b/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java
@@ -94,9 +94,6 @@
             X509Certificate firstCert = certList.get(0);
             // check trusted certificate's subject
             selector.setSubject(firstCert.getIssuerX500Principal());
-            // check the validity period
-            selector.setValidityPeriod(firstCert.getNotBefore(),
-                                       firstCert.getNotAfter());
             /*
              * Facilitate certification path construction with authority
              * key identifier and subject key identifier.
diff --git a/src/share/classes/sun/security/tools/policytool/PolicyTool.java b/src/share/classes/sun/security/tools/policytool/PolicyTool.java
index 9de42a0..d5f5fe8 100644
--- a/src/share/classes/sun/security/tools/policytool/PolicyTool.java
+++ b/src/share/classes/sun/security/tools/policytool/PolicyTool.java
@@ -1160,7 +1160,7 @@
         if (policyFile == null) {
             String userHome;
             userHome = java.security.AccessController.doPrivileged(
-                    new sun.security.action.GetPropertyAction("user.home"));
+                (PrivilegedAction<String>) () -> System.getProperty("user.home"));
             policyFile = userHome + File.separatorChar + ".java.policy";
         }
 
diff --git a/src/share/classes/sun/security/util/DerInputStream.java b/src/share/classes/sun/security/util/DerInputStream.java
index e0f77ee..6241448 100644
--- a/src/share/classes/sun/security/util/DerInputStream.java
+++ b/src/share/classes/sun/security/util/DerInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, 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
@@ -167,7 +167,7 @@
         if (buffer.read() != DerValue.tag_Integer) {
             throw new IOException("DER input, Integer tag error");
         }
-        return buffer.getInteger(getLength(buffer));
+        return buffer.getInteger(getDefiniteLength(buffer));
     }
 
     /**
@@ -179,7 +179,7 @@
         if (buffer.read() != DerValue.tag_Integer) {
             throw new IOException("DER input, Integer tag error");
         }
-        return buffer.getBigInteger(getLength(buffer), false);
+        return buffer.getBigInteger(getDefiniteLength(buffer), false);
     }
 
     /**
@@ -193,7 +193,7 @@
         if (buffer.read() != DerValue.tag_Integer) {
             throw new IOException("DER input, Integer tag error");
         }
-        return buffer.getBigInteger(getLength(buffer), true);
+        return buffer.getBigInteger(getDefiniteLength(buffer), true);
     }
 
     /**
@@ -205,7 +205,7 @@
         if (buffer.read() != DerValue.tag_Enumerated) {
             throw new IOException("DER input, Enumerated tag error");
         }
-        return buffer.getInteger(getLength(buffer));
+        return buffer.getInteger(getDefiniteLength(buffer));
     }
 
     /**
@@ -216,7 +216,7 @@
         if (buffer.read() != DerValue.tag_BitString)
             throw new IOException("DER input not an bit string");
 
-        return buffer.getBitString(getLength(buffer));
+        return buffer.getBitString(getDefiniteLength(buffer));
     }
 
     /**
@@ -224,21 +224,32 @@
      * not be byte-aligned.
      */
     public BitArray getUnalignedBitString() throws IOException {
-        if (buffer.read() != DerValue.tag_BitString)
+        if (buffer.read() != DerValue.tag_BitString) {
             throw new IOException("DER input not a bit string");
+        }
 
-        int length = getLength(buffer) - 1;
+        int length = getDefiniteLength(buffer);
+
+        if (length == 0) {
+            return new BitArray(0);
+        }
 
         /*
          * First byte = number of excess bits in the last octet of the
          * representation.
          */
+        length--;
         int validBits = length*8 - buffer.read();
+        if (validBits < 0) {
+            throw new IOException("valid bits of bit string invalid");
+        }
 
         byte[] repn = new byte[length];
 
-        if ((length != 0) && (buffer.read(repn) != length))
+        if ((length != 0) && (buffer.read(repn) != length)) {
             throw new IOException("short read of DER bit string");
+        }
+
         return new BitArray(validBits, repn);
     }
 
@@ -249,7 +260,7 @@
         if (buffer.read() != DerValue.tag_OctetString)
             throw new IOException("DER input not an octet string");
 
-        int length = getLength(buffer);
+        int length = getDefiniteLength(buffer);
         byte[] retval = new byte[length];
         if ((length != 0) && (buffer.read(retval) != length))
             throw new IOException("short read of DER octet string");
@@ -363,7 +374,7 @@
            if (tag != buffer.read())
                 throw new IOException("Indefinite length encoding" +
                         " not supported");
-           len = DerInputStream.getLength(buffer);
+           len = DerInputStream.getDefiniteLength(buffer);
         }
 
         if (len == 0)
@@ -480,7 +491,7 @@
             throw new IOException("DER input not a " +
                                   stringName + " string");
 
-        int length = getLength(buffer);
+        int length = getDefiniteLength(buffer);
         byte[] retval = new byte[length];
         if ((length != 0) && (buffer.read(retval) != length))
             throw new IOException("short read of DER " +
@@ -495,7 +506,7 @@
     public Date getUTCTime() throws IOException {
         if (buffer.read() != DerValue.tag_UtcTime)
             throw new IOException("DER input, UTCtime tag invalid ");
-        return buffer.getUTCTime(getLength(buffer));
+        return buffer.getUTCTime(getDefiniteLength(buffer));
     }
 
     /**
@@ -504,7 +515,7 @@
     public Date getGeneralizedTime() throws IOException {
         if (buffer.read() != DerValue.tag_GeneralizedTime)
             throw new IOException("DER input, GeneralizedTime tag invalid ");
-        return buffer.getGeneralizedTime(getLength(buffer));
+        return buffer.getGeneralizedTime(getDefiniteLength(buffer));
     }
 
     /*
@@ -570,6 +581,24 @@
         return value;
     }
 
+    int getDefiniteLength() throws IOException {
+        return getDefiniteLength(buffer);
+    }
+
+    /*
+     * Get a length from the input stream.
+     *
+     * @return the length
+     * @exception IOException on parsing error or if indefinite length found.
+     */
+    static int getDefiniteLength(InputStream in) throws IOException {
+        int len = getLength(in);
+        if (len < 0) {
+            throw new IOException("Indefinite length encoding not supported");
+        }
+        return len;
+    }
+
     /**
      * Mark the current position in the buffer, so that
      * a later call to <code>reset</code> will return here.
diff --git a/src/share/classes/sun/security/util/DerValue.java b/src/share/classes/sun/security/util/DerValue.java
index abb45cc..0a53973 100644
--- a/src/share/classes/sun/security/util/DerValue.java
+++ b/src/share/classes/sun/security/util/DerValue.java
@@ -265,7 +265,7 @@
             if (tag != inbuf.read())
                 throw new IOException
                         ("Indefinite length encoding not supported");
-            length = DerInputStream.getLength(inbuf);
+            length = DerInputStream.getDefiniteLength(inbuf);
             buffer = inbuf.dup();
             buffer.truncate(length);
             data = new DerInputStream(buffer);
@@ -377,7 +377,7 @@
             if (tag != in.read())
                 throw new IOException
                         ("Indefinite length encoding not supported");
-            length = DerInputStream.getLength(in);
+            length = DerInputStream.getDefiniteLength(in);
         }
 
         if (fullyBuffered && in.available() != length)
diff --git a/src/share/classes/sun/security/util/ObjectIdentifier.java b/src/share/classes/sun/security/util/ObjectIdentifier.java
index 66038a3..cb1f8ea 100644
--- a/src/share/classes/sun/security/util/ObjectIdentifier.java
+++ b/src/share/classes/sun/security/util/ObjectIdentifier.java
@@ -255,7 +255,7 @@
                 + " (tag = " +  type_id + ")"
                 );
 
-        encoding = new byte[in.getLength()];
+        encoding = new byte[in.getDefiniteLength()];
         in.getBytes(encoding);
         check(encoding);
     }
diff --git a/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java b/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java
deleted file mode 100644
index fb7c9d1..0000000
--- a/src/share/classes/sun/swing/AbstractFilterComboBoxModel.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2013, 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.swing;
-
-import javax.swing.AbstractListModel;
-import javax.swing.ComboBoxModel;
-import javax.swing.JFileChooser;
-import javax.swing.filechooser.FileFilter;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-/**
- * Data model for a type-face selection combo-box.
- */
-@SuppressWarnings("serial") // JDK-implementation class
-public abstract class AbstractFilterComboBoxModel
-        extends AbstractListModel<FileFilter>
-        implements ComboBoxModel<FileFilter>, PropertyChangeListener {
-
-    protected FileFilter[] filters;
-
-    protected AbstractFilterComboBoxModel() {
-        this.filters = getFileChooser().getChoosableFileFilters();
-    }
-
-    protected abstract JFileChooser getFileChooser();
-
-    @Override
-    public void propertyChange(PropertyChangeEvent event) {
-        String property = event.getPropertyName();
-        if (property == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
-            this.filters = (FileFilter[]) event.getNewValue();
-            fireContentsChanged(this, -1, -1);
-        } else if (property == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
-            fireContentsChanged(this, -1, -1);
-        }
-    }
-
-    @Override
-    public void setSelectedItem(Object filter) {
-        if (filter != null) {
-            getFileChooser().setFileFilter((FileFilter) filter);
-            fireContentsChanged(this, -1, -1);
-        }
-    }
-
-    @Override
-    public Object getSelectedItem() {
-        // Ensure that the current filter is in the list.
-        // NOTE: we should not have to do this, since JFileChooser adds
-        // the filter to the choosable filters list when the filter
-        // is set. Lets be paranoid just in case someone overrides
-        // setFileFilter in JFileChooser.
-        FileFilter currentFilter = getFileChooser().getFileFilter();
-        if (currentFilter != null) {
-            for (FileFilter filter : this.filters) {
-                if (filter == currentFilter) {
-                    return currentFilter;
-                }
-            }
-            getFileChooser().addChoosableFileFilter(currentFilter);
-        }
-        return currentFilter;
-    }
-
-    @Override
-    public int getSize() {
-        return (this.filters != null)
-                ? filters.length
-                : 0;
-    }
-
-    @Override
-    public FileFilter getElementAt(int index) {
-        if (index >= getSize()) {
-            // This shouldn't happen. Try to recover gracefully.
-            return getFileChooser().getFileFilter();
-        }
-        return (this.filters != null)
-                ? filters[index]
-                : null;
-    }
-}
diff --git a/src/share/classes/sun/swing/JLightweightFrame.java b/src/share/classes/sun/swing/JLightweightFrame.java
index f94cdbc..236d9f6 100644
--- a/src/share/classes/sun/swing/JLightweightFrame.java
+++ b/src/share/classes/sun/swing/JLightweightFrame.java
@@ -36,6 +36,7 @@
 import java.awt.MouseInfo;
 import java.awt.Point;
 import java.awt.Rectangle;
+import java.awt.Window;
 import java.awt.event.ContainerEvent;
 import java.awt.event.ContainerListener;
 import java.awt.image.BufferedImage;
@@ -43,16 +44,19 @@
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.security.AccessController;
+import javax.swing.JComponent;
 
 import javax.swing.JLayeredPane;
 import javax.swing.JPanel;
 import javax.swing.JRootPane;
 import javax.swing.LayoutFocusTraversalPolicy;
+import javax.swing.RepaintManager;
 import javax.swing.RootPaneContainer;
 import javax.swing.SwingUtilities;
 
 import sun.awt.LightweightFrame;
 import sun.security.action.GetPropertyAction;
+import sun.swing.SwingUtilities2.RepaintListener;
 
 /**
  * The frame serves as a lightweight container which paints its content
@@ -90,6 +94,7 @@
     private int[] copyBuffer;
 
     private PropertyChangeListener layoutSizeListener;
+    private RepaintListener repaintListener;
 
     static {
         SwingAccessor.setJLightweightFrameAccessor(new SwingAccessor.JLightweightFrameAccessor() {
@@ -131,6 +136,30 @@
                 }
             }
         };
+
+        repaintListener = (JComponent c, int x, int y, int w, int h) -> {
+            Window jlf = SwingUtilities.getWindowAncestor(c);
+            if (jlf != JLightweightFrame.this) {
+                return;
+            }
+            Point p = SwingUtilities.convertPoint(c, x, y, jlf);
+            Rectangle r = new Rectangle(p.x, p.y, w, h).intersection(
+                    new Rectangle(0, 0, bbImage.getWidth(), bbImage.getHeight()));
+
+            if (!r.isEmpty()) {
+                notifyImageUpdated(r.x, r.y, r.width, r.height);
+            }
+        };
+
+        SwingAccessor.getRepaintManagerAccessor().addRepaintListener(
+            RepaintManager.currentManager(this), repaintListener);
+    }
+
+    @Override
+    public void dispose() {
+        SwingAccessor.getRepaintManagerAccessor().removeRepaintListener(
+            RepaintManager.currentManager(this), repaintListener);
+        super.dispose();
     }
 
     /**
@@ -210,6 +239,13 @@
         }
     }
 
+    private void notifyImageUpdated(int x, int y, int width, int height) {
+        if (copyBufferEnabled) {
+            syncCopyBuffer(false, x, y, width, height);
+        }
+        content.imageUpdated(x, y, width, height);
+    }
+
     @SuppressWarnings("serial") // anonymous class inside
     private void initInterior() {
         contentPane = new JPanel() {
@@ -233,10 +269,7 @@
                     EventQueue.invokeLater(new Runnable() {
                         @Override
                         public void run() {
-                            if (copyBufferEnabled) {
-                                syncCopyBuffer(false, clip.x, clip.y, clip.width, clip.height);
-                            }
-                            content.imageUpdated(clip.x, clip.y, clip.width, clip.height);
+                            notifyImageUpdated(clip.x, clip.y, clip.width, clip.height);
                         }
                     });
                 } finally {
diff --git a/src/share/classes/sun/swing/SwingAccessor.java b/src/share/classes/sun/swing/SwingAccessor.java
index 10d4de6..797802a 100644
--- a/src/share/classes/sun/swing/SwingAccessor.java
+++ b/src/share/classes/sun/swing/SwingAccessor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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,6 +28,7 @@
 import sun.misc.Unsafe;
 
 import java.awt.Point;
+import javax.swing.RepaintManager;
 
 import javax.swing.text.JTextComponent;
 import javax.swing.TransferHandler;
@@ -82,6 +83,14 @@
     }
 
     /**
+     * An accessor for the RepaintManager class.
+     */
+    public interface RepaintManagerAccessor {
+        void addRepaintListener(RepaintManager rm, SwingUtilities2.RepaintListener l);
+        void removeRepaintListener(RepaintManager rm, SwingUtilities2.RepaintListener l);
+    }
+
+    /**
      * The javax.swing.text.JTextComponent class accessor object.
      */
     private static JTextComponentAccessor jtextComponentAccessor;
@@ -120,6 +129,31 @@
      * Retrieve the accessor object for the JLightweightFrame class
      */
     public static JLightweightFrameAccessor getJLightweightFrameAccessor() {
+        if (jLightweightFrameAccessor == null) {
+            unsafe.ensureClassInitialized(JLightweightFrame.class);
+        }
         return jLightweightFrameAccessor;
     }
+
+    /**
+     * The RepaintManager class accessor object.
+     */
+    private static RepaintManagerAccessor repaintManagerAccessor;
+
+    /**
+     * Set an accessor object for the RepaintManager class.
+     */
+    public static void setRepaintManagerAccessor(RepaintManagerAccessor accessor) {
+        repaintManagerAccessor = accessor;
+    }
+
+    /**
+     * Retrieve the accessor object for the RepaintManager class.
+     */
+    public static RepaintManagerAccessor getRepaintManagerAccessor() {
+        if (repaintManagerAccessor == null) {
+            unsafe.ensureClassInitialized(RepaintManager.class);
+        }
+        return repaintManagerAccessor;
+    }
 }
diff --git a/src/share/classes/sun/swing/SwingLazyValue.java b/src/share/classes/sun/swing/SwingLazyValue.java
index e3e2186..508e5b8 100644
--- a/src/share/classes/sun/swing/SwingLazyValue.java
+++ b/src/share/classes/sun/swing/SwingLazyValue.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,9 +26,6 @@
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
-import java.lang.reflect.AccessibleObject;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 import javax.swing.UIDefaults;
 import sun.reflect.misc.ReflectUtil;
 
@@ -69,12 +66,10 @@
             if (methodName != null) {
                 Class<?>[] types = getClassArray(args);
                 Method m = c.getMethod(methodName, types);
-                makeAccessible(m);
                 return m.invoke(c, args);
             } else {
                 Class<?>[] types = getClassArray(args);
                 Constructor<?> constructor = c.getConstructor(types);
-                makeAccessible(constructor);
                 return constructor.newInstance(args);
             }
         } catch (Exception e) {
@@ -87,15 +82,6 @@
         return null;
     }
 
-    private void makeAccessible(final AccessibleObject object) {
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-            public Void run() {
-                object.setAccessible(true);
-                return null;
-            }
-        });
-    }
-
     private Class<?>[] getClassArray(Object[] args) {
         Class<?>[] types = null;
         if (args!=null) {
diff --git a/src/share/classes/sun/swing/SwingUtilities2.java b/src/share/classes/sun/swing/SwingUtilities2.java
index 75a0a4f..2698ee9 100644
--- a/src/share/classes/sun/swing/SwingUtilities2.java
+++ b/src/share/classes/sun/swing/SwingUtilities2.java
@@ -80,6 +80,9 @@
     public static final Object LAF_STATE_KEY =
             new StringBuffer("LookAndFeel State");
 
+    public static final Object MENU_SELECTION_MANAGER_LISTENER_KEY =
+            new StringBuffer("MenuSelectionManager listener key");
+
     // Maintain a cache of CACHE_SIZE fonts and the left side bearing
      // of the characters falling into the range MIN_CHAR_INDEX to
      // MAX_CHAR_INDEX. The values in fontCache are created as needed.
@@ -189,7 +192,6 @@
         new StringUIClientPropertyKey ("maxTextOffset");
 
     // security stuff
-    private static Field inputEvent_CanAccessSystemClipboard_Field = null;
     private static final String UntrustedClipboardAccess =
         "UNTRUSTED_CLIPBOARD_ACCESS_KEY";
 
@@ -1263,41 +1265,6 @@
     }
 
     /**
-     * returns canAccessSystemClipboard field from InputEvent
-     *
-     * @param ie InputEvent to get the field from
-     */
-    private static synchronized boolean inputEvent_canAccessSystemClipboard(InputEvent ie) {
-        if (inputEvent_CanAccessSystemClipboard_Field == null) {
-            inputEvent_CanAccessSystemClipboard_Field =
-                AccessController.doPrivileged(
-                    new java.security.PrivilegedAction<Field>() {
-                        public Field run() {
-                            try {
-                                Field field = InputEvent.class.
-                                    getDeclaredField("canAccessSystemClipboard");
-                                field.setAccessible(true);
-                                return field;
-                            } catch (SecurityException e) {
-                            } catch (NoSuchFieldException e) {
-                            }
-                            return null;
-                        }
-                    });
-        }
-        if (inputEvent_CanAccessSystemClipboard_Field == null) {
-            return false;
-        }
-        boolean ret = false;
-        try {
-            ret = inputEvent_CanAccessSystemClipboard_Field.
-                getBoolean(ie);
-        } catch(IllegalAccessException e) {
-        }
-        return ret;
-    }
-
-    /**
      * Returns true if the given event is corrent gesture for
      * accessing clipboard
      *
@@ -1350,7 +1317,8 @@
              */
             if (e instanceof InputEvent
                 && (! checkGesture || isAccessClipboardGesture((InputEvent)e))) {
-                return inputEvent_canAccessSystemClipboard((InputEvent)e);
+                return AWTAccessor.getInputEventAccessor().
+                        canAccessSystemClipboard((InputEvent) e);
             } else {
                 return false;
             }
@@ -1966,4 +1934,11 @@
         }
         return path;
     }
+
+    /**
+     * Used to listen to "blit" repaints in RepaintManager.
+     */
+    public interface RepaintListener {
+        void repaintPerformed(JComponent c, int x, int y, int w, int h);
+    }
 }
diff --git a/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java b/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
index f0d0ac3..1bf094c 100644
--- a/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
+++ b/src/share/classes/sun/swing/plaf/synth/SynthFileChooserUIImpl.java
@@ -927,9 +927,70 @@
      * Data model for a type-face selection combo-box.
      */
     @SuppressWarnings("serial") // JDK-implementation class
-    protected class FilterComboBoxModel extends AbstractFilterComboBoxModel {
-        protected JFileChooser getFileChooser() {
-            return SynthFileChooserUIImpl.this.getFileChooser();
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter> implements ComboBoxModel<FileFilter>,
+            PropertyChangeListener {
+        protected FileFilter[] filters;
+        protected FilterComboBoxModel() {
+            super();
+            filters = getFileChooser().getChoosableFileFilters();
+        }
+
+        public void propertyChange(PropertyChangeEvent e) {
+            String prop = e.getPropertyName();
+            if(prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) {
+                filters = (FileFilter[]) e.getNewValue();
+                fireContentsChanged(this, -1, -1);
+            } else if (prop == JFileChooser.FILE_FILTER_CHANGED_PROPERTY) {
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public void setSelectedItem(Object filter) {
+            if(filter != null) {
+                getFileChooser().setFileFilter((FileFilter) filter);
+                fireContentsChanged(this, -1, -1);
+            }
+        }
+
+        public Object getSelectedItem() {
+            // Ensure that the current filter is in the list.
+            // NOTE: we shouldnt' have to do this, since JFileChooser adds
+            // the filter to the choosable filters list when the filter
+            // is set. Lets be paranoid just in case someone overrides
+            // setFileFilter in JFileChooser.
+            FileFilter currentFilter = getFileChooser().getFileFilter();
+            boolean found = false;
+            if(currentFilter != null) {
+                for (FileFilter filter : filters) {
+                    if (filter == currentFilter) {
+                        found = true;
+                    }
+                }
+                if(found == false) {
+                    getFileChooser().addChoosableFileFilter(currentFilter);
+                }
+            }
+            return getFileChooser().getFileFilter();
+        }
+
+        public int getSize() {
+            if(filters != null) {
+                return filters.length;
+            } else {
+                return 0;
+            }
+        }
+
+        public FileFilter getElementAt(int index) {
+            if(index > getSize() - 1) {
+                // This shouldn't happen. Try to recover gracefully.
+                return getFileChooser().getFileFilter();
+            }
+            if(filters != null) {
+                return filters[index];
+            } else {
+                return null;
+            }
         }
     }
 
diff --git a/src/share/classes/sun/tools/serialver/serialver.properties b/src/share/classes/sun/tools/serialver/resources/serialver.properties
similarity index 100%
rename from src/share/classes/sun/tools/serialver/serialver.properties
rename to src/share/classes/sun/tools/serialver/resources/serialver.properties
diff --git a/src/share/classes/sun/tools/serialver/serialver_ja.properties b/src/share/classes/sun/tools/serialver/resources/serialver_ja.properties
similarity index 100%
rename from src/share/classes/sun/tools/serialver/serialver_ja.properties
rename to src/share/classes/sun/tools/serialver/resources/serialver_ja.properties
diff --git a/src/share/classes/sun/tools/serialver/serialver_zh_CN.properties b/src/share/classes/sun/tools/serialver/resources/serialver_zh_CN.properties
similarity index 100%
rename from src/share/classes/sun/tools/serialver/serialver_zh_CN.properties
rename to src/share/classes/sun/tools/serialver/resources/serialver_zh_CN.properties
diff --git a/src/share/instrument/FileSystemSupport.h b/src/share/instrument/FileSystemSupport.h
index f618ee7..66e56b4 100644
--- a/src/share/instrument/FileSystemSupport.h
+++ b/src/share/instrument/FileSystemSupport.h
@@ -65,9 +65,3 @@
  * Resolve the child pathname string against the parent.
  */
 char* resolve(const char* parent, const char* child);
-
-/**
- * Convert a pathname to canonical form.
- * -- compiled in from src/<platform>/native/java/io/canonicalize_md.c
- */
-int canonicalize(char *original, char *resolved, int len);
diff --git a/src/share/instrument/InvocationAdapter.c b/src/share/instrument/InvocationAdapter.c
index 878adec..f363953 100644
--- a/src/share/instrument/InvocationAdapter.c
+++ b/src/share/instrument/InvocationAdapter.c
@@ -669,6 +669,13 @@
     jplis_assert((void*)res != (void*)NULL);     \
 }
 
+/**
+ * Convert a pathname to canonical form.
+ * This method is exported from libjava.
+ */
+extern int
+Canonicalize(JNIEnv *unused, char *orig, char *out, int len);
+
 
 /*
  * This function takes the value of the Boot-Class-Path attribute,
@@ -790,7 +797,8 @@
             char* resolved;
 
             if (!haveBasePath) {
-                if (canonicalize((char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {
+                /* Use NULL as the JNIEnv since we know that Canonicalize does not use it. */
+                if (Canonicalize(NULL, (char*)jarfile, canonicalPath, sizeof(canonicalPath)) != 0) {
                     fprintf(stderr, "WARNING: unable to canonicalize %s\n", jarfile);
                     free(path);
                     continue;
diff --git a/src/share/native/com/sun/java/util/jar/pack/bands.cpp b/src/share/native/com/sun/java/util/jar/pack/bands.cpp
index f698c6d..b7799f9 100644
--- a/src/share/native/com/sun/java/util/jar/pack/bands.cpp
+++ b/src/share/native/com/sun/java/util/jar/pack/bands.cpp
@@ -288,7 +288,7 @@
   { e_##name,  #name, /*debug only*/ \
     cspec, ix }
 
-const band_init all_band_inits[] = {
+const band_init all_band_inits[BAND_LIMIT+1] = {
 //BAND_INIT(archive_magic, BYTE1_spec, 0),
 //BAND_INIT(archive_header, UNSIGNED5_spec, 0),
 //BAND_INIT(band_headers, BYTE1_spec, 0),
@@ -448,14 +448,8 @@
   BAND_INIT(file_modtime, DELTA5_spec, 0),
   BAND_INIT(file_options, UNSIGNED5_spec, 0),
 //BAND_INIT(file_bits, BYTE1_spec, 0),
-#ifndef PRODUCT
-  { 0, 0, 0, 0 }
-#else
-  { 0, 0 }
-#endif
+  { 0, NULL, 0, 0 }
 };
-#define NUM_BAND_INITS \
-        (sizeof(all_band_inits)/sizeof(all_band_inits[0]))
 
 band* band::makeBands(unpacker* u) {
   band* tmp_all_bands = U_NEW(band, BAND_LIMIT);
diff --git a/src/share/native/common/jni_util.c b/src/share/native/common/jni_util.c
index 6837dd6..2955e0f 100644
--- a/src/share/native/common/jni_util.c
+++ b/src/share/native/common/jni_util.c
@@ -834,12 +834,12 @@
 /*
  * Export the platform dependent path canonicalization so that
  * VM can find it when loading system classes.
- *
+ * This function is also used by the instrumentation agent.
  */
 extern int canonicalize(char *path, const char *out, int len);
 
 JNIEXPORT int
-Canonicalize(JNIEnv *env, char *orig, char *out, int len)
+Canonicalize(JNIEnv *unused, char *orig, char *out, int len)
 {
     /* canonicalize an already natived path */
     return canonicalize(orig, out, len);
diff --git a/src/share/native/sun/awt/medialib/awt_ImagingLib.c b/src/share/native/sun/awt/medialib/awt_ImagingLib.c
index bd27ed8..db69fd7 100644
--- a/src/share/native/sun/awt/medialib/awt_ImagingLib.c
+++ b/src/share/native/sun/awt/medialib/awt_ImagingLib.c
@@ -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
@@ -1106,6 +1106,7 @@
     if (ddata == NULL) {
         /* Need to store it back into the array */
         if (storeRasterArray(env, srcRasterP, dstRasterP, dst) < 0) {
+            (*env)->ExceptionClear(env); // Could not store the array, try another way
             retStatus = awt_setPixels(env, dstRasterP, mlib_ImageGetData(dst));
         }
     }
@@ -2014,6 +2015,7 @@
 
     jpixels = (*env)->NewIntArray(env, nbytes);
     if (JNU_IsNull(env, jpixels)) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowOutOfMemoryError(env, "Out of Memory");
         return -1;
     }
@@ -2079,6 +2081,7 @@
 
     jpixels = (*env)->NewIntArray(env, nbytes);
     if (JNU_IsNull(env, jpixels)) {
+        (*env)->ExceptionClear(env);
         JNU_ThrowOutOfMemoryError(env, "Out of Memory");
         return -1;
     }
@@ -2775,21 +2778,14 @@
 
     /* Need to grab the lookup tables.  Right now only bytes */
     rgb = (int *) (*env)->GetPrimitiveArrayCritical(env, cmP->jrgb, NULL);
+    CHECK_NULL_RETURN(rgb, -1);
 
     /* Interleaved with shared data */
     dataP = (void *) (*env)->GetPrimitiveArrayCritical(env,
                                                        rasterP->jdata, NULL);
-    if (rgb == NULL || dataP == NULL) {
+    if (dataP == NULL) {
         /* Release the lookup tables */
-        if (rgb) {
-            (*env)->ReleasePrimitiveArrayCritical(env, cmP->jrgb, rgb,
-                                                  JNI_ABORT);
-        }
-        if (dataP) {
-            (*env)->ReleasePrimitiveArrayCritical(env,
-                                                  rasterP->jdata, dataP,
-                                                  JNI_ABORT);
-        }
+        (*env)->ReleasePrimitiveArrayCritical(env, cmP->jrgb, rgb, JNI_ABORT);
         return -1;
     }
 
diff --git a/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c b/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c
index db245be..86f6837 100644
--- a/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c
+++ b/src/share/native/sun/awt/splashscreen/java_awt_SplashScreen.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -24,8 +24,9 @@
  */
 
 #include "splashscreen_impl.h"
-#include <jni.h>
 #include <jlong_md.h>
+#include <jni.h>
+#include <jni_util.h>
 #include <sizecalc.h>
 
 JNIEXPORT jint JNICALL
@@ -212,8 +213,9 @@
     if (!splash) {
         return JNI_FALSE;
     }
-    size = (*env)->GetArrayLength(env, data);
     pBytes = (*env)->GetByteArrayElements(env, data, NULL);
+    CHECK_NULL_RETURN(pBytes, JNI_FALSE);
+    size = (*env)->GetArrayLength(env, data);
     rc = SplashLoadMemory(pBytes, size);
     (*env)->ReleaseByteArrayElements(env, data, pBytes, JNI_ABORT);
     return rc ? JNI_TRUE : JNI_FALSE;
diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h b/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h
index 10574ad..536b935 100644
--- a/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h
@@ -189,7 +189,11 @@
             PUT(rgbquad_t, ptr, value);
             break;
         case 3:                /* not supported, LSB or MSB should always be specified */
-            *(int *) 0 = 0;    /* crash */
+            PUT(byte_t, ptr, 0xff); /* Put a stub value */
+            INCP(byte_t, ptr);
+            PUT(byte_t, ptr, 0xff);
+            INCP(byte_t, ptr);
+            PUT(byte_t, ptr, 0xff);
             break;
         case 2:
             PUT(word_t, ptr, value);
@@ -253,7 +257,7 @@
             value = GET(rgbquad_t, ptr);
             break;
         case 3:                /* not supported, LSB or MSB should always be specified */
-            *(int *) 0 = 0;
+            value = 0xFFFFFFFF; /*return a stub value */
             break;
         case 2:
             value = (rgbquad_t) GET(word_t, ptr);
diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_png.c b/src/share/native/sun/awt/splashscreen/splashscreen_png.c
index 08e381b..ed6f012 100644
--- a/src/share/native/sun/awt/splashscreen/splashscreen_png.c
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_png.c
@@ -25,7 +25,7 @@
 
 #include "splashscreen_impl.h"
 
-#include "../libpng/png.h"
+#include <png.h>
 
 #include <setjmp.h>
 
diff --git a/src/share/native/sun/java2d/opengl/OGLContext.c b/src/share/native/sun/java2d/opengl/OGLContext.c
index 0139491..ed179f6 100644
--- a/src/share/native/sun/java2d/opengl/OGLContext.c
+++ b/src/share/native/sun/java2d/opengl/OGLContext.c
@@ -38,6 +38,8 @@
 #include "GraphicsPrimitiveMgr.h"
 #include "Region.h"
 
+#include "jvm.h"
+
 /**
  * The following methods are implemented in the windowing system (i.e. GLX
  * and WGL) source files.
diff --git a/src/share/native/sun/security/pkcs11/j2secmod.c b/src/share/native/sun/security/pkcs11/j2secmod.c
index 9c648fa..4ed2f15 100644
--- a/src/share/native/sun/security/pkcs11/j2secmod.c
+++ b/src/share/native/sun/security/pkcs11/j2secmod.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -30,20 +30,27 @@
 // #define SECMOD_DEBUG
 
 #include "j2secmod.h"
+#include "jni_util.h"
 
 
 JNIEXPORT jboolean JNICALL Java_sun_security_pkcs11_Secmod_nssVersionCheck
   (JNIEnv *env, jclass thisClass, jlong jHandle, jstring jVersion)
 {
-    const char *requiredVersion = (*env)->GetStringUTFChars(env, jVersion, NULL);
-    int res;
-    FPTR_VersionCheck versionCheck =
-        (FPTR_VersionCheck)findFunction(env, jHandle, "NSS_VersionCheck");
+    int res = 0;
+    FPTR_VersionCheck versionCheck;
+    const char *requiredVersion;
 
+    versionCheck = (FPTR_VersionCheck)findFunction(env, jHandle,
+        "NSS_VersionCheck");
     if (versionCheck == NULL) {
         return JNI_FALSE;
     }
 
+    requiredVersion = (*env)->GetStringUTFChars(env, jVersion, NULL);
+    if (requiredVersion == NULL)  {
+        return JNI_FALSE;
+    }
+
     res = versionCheck(requiredVersion);
     dprintf2("-version >=%s: %d\n", requiredVersion, res);
     (*env)->ReleaseStringUTFChars(env, jVersion, requiredVersion);
@@ -59,55 +66,73 @@
 JNIEXPORT jboolean JNICALL Java_sun_security_pkcs11_Secmod_nssInitialize
   (JNIEnv *env, jclass thisClass, jstring jFunctionName, jlong jHandle, jstring jConfigDir, jboolean jNssOptimizeSpace)
 {
-    const char *functionName =
-        (*env)->GetStringUTFChars(env, jFunctionName, NULL);
-    const char *configDir = (jConfigDir == NULL)
-        ? NULL : (*env)->GetStringUTFChars(env, jConfigDir, NULL);
+    int res = 0;
     FPTR_Initialize initialize =
         (FPTR_Initialize)findFunction(env, jHandle, "NSS_Initialize");
-    int res = 0;
     unsigned int flags = 0x00;
+    const char *configDir = NULL;
+    const char *functionName = NULL;
+
+    /* If we cannot initialize, exit now */
+    if (initialize == NULL) {
+        res = 1;
+        goto cleanup;
+    }
+
+    functionName = (*env)->GetStringUTFChars(env, jFunctionName, NULL);
+    if (functionName == NULL) {
+        res = 1;
+        goto cleanup;
+    }
+
+    if (jConfigDir != NULL) {
+        configDir = (*env)->GetStringUTFChars(env, jConfigDir, NULL);
+        if (!configDir) {
+            res = 1;
+            goto cleanup;
+        }
+    }
 
     if (jNssOptimizeSpace == JNI_TRUE) {
         flags = 0x20; // NSS_INIT_OPTIMIZESPACE flag
     }
 
-    if (initialize != NULL) {
-        /*
-         * If the NSS_Init function is requested then call NSS_Initialize to
-         * open the Cert, Key and Security Module databases, read only.
-         */
-        if (strcmp("NSS_Init", functionName) == 0) {
-            flags = flags | 0x01; // NSS_INIT_READONLY flag
-            res = initialize(configDir, "", "", "secmod.db", flags);
+    /*
+     * If the NSS_Init function is requested then call NSS_Initialize to
+     * open the Cert, Key and Security Module databases, read only.
+     */
+    if (strcmp("NSS_Init", functionName) == 0) {
+        flags = flags | 0x01; // NSS_INIT_READONLY flag
+        res = initialize(configDir, "", "", "secmod.db", flags);
 
-        /*
-         * If the NSS_InitReadWrite function is requested then call
-         * NSS_Initialize to open the Cert, Key and Security Module databases,
-         * read/write.
-         */
-        } else if (strcmp("NSS_InitReadWrite", functionName) == 0) {
-            res = initialize(configDir, "", "", "secmod.db", flags);
+    /*
+     * If the NSS_InitReadWrite function is requested then call
+     * NSS_Initialize to open the Cert, Key and Security Module databases,
+     * read/write.
+     */
+    } else if (strcmp("NSS_InitReadWrite", functionName) == 0) {
+        res = initialize(configDir, "", "", "secmod.db", flags);
 
-        /*
-         * If the NSS_NoDB_Init function is requested then call
-         * NSS_Initialize without creating Cert, Key or Security Module
-         * databases.
-         */
-        } else if (strcmp("NSS_NoDB_Init", functionName) == 0) {
-            flags = flags | 0x02  // NSS_INIT_NOCERTDB flag
-                          | 0x04  // NSS_INIT_NOMODDB flag
-                          | 0x08  // NSS_INIT_FORCEOPEN flag
-                          | 0x10; // NSS_INIT_NOROOTINIT flag
-            res = initialize("", "", "", "", flags);
+    /*
+     * If the NSS_NoDB_Init function is requested then call
+     * NSS_Initialize without creating Cert, Key or Security Module
+     * databases.
+     */
+    } else if (strcmp("NSS_NoDB_Init", functionName) == 0) {
+        flags = flags | 0x02  // NSS_INIT_NOCERTDB flag
+                      | 0x04  // NSS_INIT_NOMODDB flag
+                      | 0x08  // NSS_INIT_FORCEOPEN flag
+                      | 0x10; // NSS_INIT_NOROOTINIT flag
+        res = initialize("", "", "", "", flags);
 
-        } else {
-            res = 2;
-        }
     } else {
-        res = 1;
+        res = 2;
     }
-    (*env)->ReleaseStringUTFChars(env, jFunctionName, functionName);
+
+cleanup:
+    if (functionName != NULL) {
+        (*env)->ReleaseStringUTFChars(env, jFunctionName, functionName);
+    }
     if (configDir != NULL) {
         (*env)->ReleaseStringUTFChars(env, jConfigDir, configDir);
     }
@@ -142,13 +167,30 @@
     }
 
     jListClass = (*env)->FindClass(env, "java/util/ArrayList");
+    if (jListClass == NULL) {
+        return NULL;
+    }
     jListConstructor = (*env)->GetMethodID(env, jListClass, "<init>", "()V");
+    if (jListConstructor == NULL) {
+        return NULL;
+    }
     jAdd = (*env)->GetMethodID(env, jListClass, "add", "(Ljava/lang/Object;)Z");
+    if (jAdd == NULL) {
+        return NULL;
+    }
     jList = (*env)->NewObject(env, jListClass, jListConstructor);
-
+    if (jList == NULL) {
+        return NULL;
+    }
     jModuleClass = (*env)->FindClass(env, "sun/security/pkcs11/Secmod$Module");
+    if (jModuleClass == NULL) {
+        return NULL;
+    }
     jModuleConstructor = (*env)->GetMethodID(env, jModuleClass, "<init>",
         "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)V");
+    if (jModuleConstructor == NULL) {
+        return NULL;
+    }
 
     while (list != NULL) {
         module = list->module;
@@ -160,16 +202,28 @@
         dprintf1("-internal: %d\n", module->internal);
         dprintf1("-fips: %d\n", module->isFIPS);
         jCommonName = (*env)->NewStringUTF(env, module->commonName);
+        if (jCommonName == NULL) {
+            return NULL;
+        }
         if (module->dllName == NULL) {
             jDllName = NULL;
         } else {
             jDllName = (*env)->NewStringUTF(env, module->dllName);
+            if (jDllName == NULL) {
+                return NULL;
+            }
         }
         jFIPS = module->isFIPS;
         for (i = 0; i < module->slotCount; i++ ) {
             jModule = (*env)->NewObject(env, jModuleClass, jModuleConstructor,
                 jLibDir, jDllName, jCommonName, jFIPS, i);
+            if (jModule == NULL) {
+                return NULL;
+            }
             (*env)->CallVoidMethod(env, jList, jAdd, jModule);
+            if ((*env)->ExceptionCheck(env)) {
+                return NULL;
+            }
         }
         list = list->next;
     }
diff --git a/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java b/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
index a53242f..fad3b3b 100644
--- a/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
+++ b/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, 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
@@ -24,7 +24,6 @@
  */
 package sun.awt.X11;
 
-import java.awt.Dialog;
 import java.awt.FileDialog;
 import java.awt.peer.FileDialogPeer;
 import java.io.File;
@@ -36,15 +35,15 @@
  *
  * @author Costantino Cerbo (c.cerbo@gmail.com)
  */
-class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
+final class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
 
-    private FileDialog fd;
+    private final FileDialog fd;
 
     // A pointer to the native GTK FileChooser widget
     private volatile long widget = 0L;
 
-    public GtkFileDialogPeer(FileDialog fd) {
-        super((Dialog) fd);
+    GtkFileDialogPeer(FileDialog fd) {
+        super(fd);
         this.fd = fd;
     }
 
@@ -172,9 +171,7 @@
                 dirname = file.getParent();
             }
         }
-        GtkFileDialogPeer.this.run(fd.getTitle(), fd.getMode(), dirname,
-                                   filename, fd.getFilenameFilter(),
-                                   fd.isMultipleMode(), fd.getX(), fd.getY());
+        run(fd.getTitle(), fd.getMode(), dirname, filename,
+            fd.getFilenameFilter(), fd.isMultipleMode(), fd.getX(), fd.getY());
     }
-
 }
diff --git a/src/solaris/classes/sun/awt/X11/XAWTFormatter.java b/src/solaris/classes/sun/awt/X11/XAWTFormatter.java
index a2145dc..198d7a7 100644
--- a/src/solaris/classes/sun/awt/X11/XAWTFormatter.java
+++ b/src/solaris/classes/sun/awt/X11/XAWTFormatter.java
@@ -43,8 +43,7 @@
 
     // Line separator string.  This is the value of the line.separator
     // property at the moment that the SimpleFormatter was created.
-    private String lineSeparator = java.security.AccessController.doPrivileged(
-               new sun.security.action.GetPropertyAction("line.separator"));
+    private String lineSeparator = System.lineSeparator();
 
     boolean displayFullRecord = false;
     boolean useANSI = false;
diff --git a/src/solaris/classes/sun/awt/X11/XDataTransferer.java b/src/solaris/classes/sun/awt/X11/XDataTransferer.java
index 20ff1d5..f54bc87 100644
--- a/src/solaris/classes/sun/awt/X11/XDataTransferer.java
+++ b/src/solaris/classes/sun/awt/X11/XDataTransferer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -56,6 +56,7 @@
 import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
 
 import java.io.ByteArrayOutputStream;
+import java.util.stream.Stream;
 
 /**
  * Platform-specific support for the data transfer subsystem.
@@ -77,11 +78,9 @@
 
     private static XDataTransferer transferer;
 
-    static XDataTransferer getInstanceImpl() {
-        synchronized (XDataTransferer.class) {
-            if (transferer == null) {
-                transferer = new XDataTransferer();
-            }
+    static synchronized XDataTransferer getInstanceImpl() {
+        if (transferer == null) {
+            transferer = new XDataTransferer();
         }
         return transferer;
     }
@@ -242,6 +241,7 @@
         }
     }
 
+    @Override
     protected String[] dragQueryFile(byte[] bytes) {
         XToolkit.awtLock();
         try {
@@ -252,8 +252,8 @@
         }
     }
 
+    @Override
     protected URI[] dragQueryURIs(InputStream stream,
-                                  byte[] bytes,
                                   long format,
                                   Transferable localeTransferable)
       throws IOException {
@@ -281,7 +281,7 @@
         try {
             reader = new BufferedReader(new InputStreamReader(stream, charset));
             String line;
-            ArrayList<URI> uriList = new ArrayList<URI>();
+            ArrayList<URI> uriList = new ArrayList<>();
             URI uri;
             while ((line = reader.readLine()) != null) {
                 try {
@@ -329,8 +329,9 @@
      * a valid MIME and return a list of flavors to which the data in this MIME
      * type can be translated by the Data Transfer subsystem.
      */
-    public List <DataFlavor> getPlatformMappingsForNative(String nat) {
-        List <DataFlavor> flavors = new ArrayList();
+    @Override
+    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
+        List<DataFlavor> flavors = new ArrayList<>();
 
         if (nat == null) {
             return flavors;
@@ -390,8 +391,9 @@
      * MIME types to which the data in this flavor can be translated by the Data
      * Transfer subsystem.
      */
-    public List getPlatformMappingsForFlavor(DataFlavor df) {
-        List natives = new ArrayList(1);
+    @Override
+    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        List<String> natives = new ArrayList<>(1);
 
         if (df == null) {
             return natives;
@@ -410,25 +412,22 @@
         if (df.getRepresentationClass() != null &&
             (df.isRepresentationClassInputStream() ||
              df.isRepresentationClassByteBuffer() ||
-             byteArrayClass.equals(df.getRepresentationClass()))) {
+             byte[].class.equals(df.getRepresentationClass()))) {
             natives.add(mimeType);
         }
 
         if (DataFlavor.imageFlavor.equals(df)) {
             String[] mimeTypes = ImageIO.getWriterMIMETypes();
             if (mimeTypes != null) {
-                for (int i = 0; i < mimeTypes.length; i++) {
-                    Iterator writers =
-                        ImageIO.getImageWritersByMIMEType(mimeTypes[i]);
-
+                for (String mime : mimeTypes) {
+                    Iterator<ImageWriter> writers = ImageIO.getImageWritersByMIMEType(mime);
                     while (writers.hasNext()) {
-                        ImageWriter imageWriter = (ImageWriter)writers.next();
-                        ImageWriterSpi writerSpi =
-                            imageWriter.getOriginatingProvider();
+                        ImageWriter imageWriter = writers.next();
+                        ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider();
 
                         if (writerSpi != null &&
-                            writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
-                            natives.add(mimeTypes[i]);
+                                writerSpi.canEncodeImage(getDefaultImageTypeSpecifier())) {
+                            natives.add(mime);
                             break;
                         }
                     }
diff --git a/src/solaris/classes/sun/awt/X11/XDesktopPeer.java b/src/solaris/classes/sun/awt/X11/XDesktopPeer.java
index 547d979..abe706a 100644
--- a/src/solaris/classes/sun/awt/X11/XDesktopPeer.java
+++ b/src/solaris/classes/sun/awt/X11/XDesktopPeer.java
@@ -33,6 +33,9 @@
 
 import java.awt.Desktop.Action;
 import java.awt.peer.DesktopPeer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 
 
 /**
@@ -43,6 +46,10 @@
  */
 public class XDesktopPeer implements DesktopPeer {
 
+    // supportedActions may be changed from native within an init() call
+    private static final List<Action> supportedActions
+            = new ArrayList<>(Arrays.asList(Action.OPEN, Action.MAIL, Action.BROWSE));
+
     private static boolean nativeLibraryLoaded = false;
     private static boolean initExecuted = false;
 
@@ -65,11 +72,11 @@
 
     static boolean isDesktopSupported() {
         initWithLock();
-        return nativeLibraryLoaded;
+        return nativeLibraryLoaded && !supportedActions.isEmpty();
     }
 
     public boolean isSupported(Action type) {
-        return type != Action.PRINT && type != Action.EDIT;
+        return supportedActions.contains(type);
     }
 
     public void open(File file) throws IOException {
diff --git a/src/solaris/classes/sun/awt/X11/XRepaintArea.java b/src/solaris/classes/sun/awt/X11/XRepaintArea.java
index 0b54aa8..af99e44 100644
--- a/src/solaris/classes/sun/awt/X11/XRepaintArea.java
+++ b/src/solaris/classes/sun/awt/X11/XRepaintArea.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,8 +28,8 @@
 
 import java.awt.Component;
 import java.awt.Graphics;
+
 import sun.awt.RepaintArea;
-import java.awt.peer.ComponentPeer;
 
 /**
  * The <code>RepaintArea</code> is a geometric construct created for the
@@ -39,24 +39,15 @@
  *
  * @author      Eric Hawkes
  */
-class XRepaintArea extends RepaintArea {
-
-    /**
-     * Constructs a new <code>XRepaintArea</code>
-     * @since   1.3
-     */
-    public XRepaintArea() {
-    }
+final class XRepaintArea extends RepaintArea {
 
     /**
      * Calls <code>Component.update(Graphics)</code> with given Graphics.
      */
     protected void updateComponent(Component comp, Graphics g) {
         if (comp != null) {
-            final XComponentPeer peer = (XComponentPeer) comp.getPeer();
-            if (peer != null) {
-                peer.paintPeer(g);
-            }
+            // We don't call peer.paintPeer() here, because we shouldn't paint
+            // native component when processing UPDATE events.
             super.updateComponent(comp, g);
         }
     }
diff --git a/src/solaris/classes/sun/awt/X11/XRootWindow.java b/src/solaris/classes/sun/awt/X11/XRootWindow.java
index 1a35581..6b8b162 100644
--- a/src/solaris/classes/sun/awt/X11/XRootWindow.java
+++ b/src/solaris/classes/sun/awt/X11/XRootWindow.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -46,7 +46,8 @@
     }
 
     private XRootWindow() {
-        super(new XCreateWindowParams(new Object[] {DELAYED, Boolean.TRUE}));
+        super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
+                                                     EVENT_MASK, XConstants.StructureNotifyMask }));
     }
 
     public void postInit(XCreateWindowParams params){
diff --git a/src/solaris/classes/sun/awt/X11/XToolkit.java b/src/solaris/classes/sun/awt/X11/XToolkit.java
index ba9ef8c..86f704e 100644
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java
@@ -47,6 +47,7 @@
 import javax.swing.LookAndFeel;
 import javax.swing.UIDefaults;
 import sun.awt.*;
+import sun.awt.datatransfer.DataTransferer;
 import sun.font.FontConfigManager;
 import sun.java2d.SunGraphicsEnvironment;
 import sun.misc.PerformanceLogger;
@@ -299,8 +300,6 @@
         return awtAppClassName;
     }
 
-    static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.X11.XDataTransferer";
-
     public XToolkit() {
         super();
         if (PerformanceLogger.loggingEnabled()) {
@@ -322,7 +321,6 @@
 
             init();
             XWM.init();
-            SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
 
             PrivilegedAction<Thread> action = new PrivilegedAction() {
                 public Thread run() {
@@ -823,10 +821,32 @@
                     // managers don't set this hint correctly, so we just get intersection with windowBounds
                     if (windowBounds != null && windowBounds.intersects(screenBounds))
                     {
-                        insets.left = Math.max((int)Native.getLong(native_ptr, 0), insets.left);
-                        insets.right = Math.max((int)Native.getLong(native_ptr, 1), insets.right);
-                        insets.top = Math.max((int)Native.getLong(native_ptr, 2), insets.top);
-                        insets.bottom = Math.max((int)Native.getLong(native_ptr, 3), insets.bottom);
+                        int left = (int)Native.getLong(native_ptr, 0);
+                        int right = (int)Native.getLong(native_ptr, 1);
+                        int top = (int)Native.getLong(native_ptr, 2);
+                        int bottom = (int)Native.getLong(native_ptr, 3);
+
+                        /*
+                         * struts could be relative to root window bounds, so
+                         * make them relative to the screen bounds in this case
+                         */
+                        left = rootBounds.x + left > screenBounds.x ?
+                                rootBounds.x + left - screenBounds.x : 0;
+                        right = rootBounds.x + rootBounds.width - right <
+                                screenBounds.x + screenBounds.width ?
+                                screenBounds.x + screenBounds.width -
+                                (rootBounds.x + rootBounds.width - right) : 0;
+                        top = rootBounds.y + top > screenBounds.y ?
+                                rootBounds.y + top - screenBounds.y : 0;
+                        bottom = rootBounds.y + rootBounds.height - bottom <
+                                screenBounds.y + screenBounds.height ?
+                                screenBounds.y + screenBounds.height -
+                                (rootBounds.y + rootBounds.height - bottom) : 0;
+
+                        insets.left = Math.max(left, insets.left);
+                        insets.right = Math.max(right, insets.right);
+                        insets.top = Math.max(top, insets.top);
+                        insets.bottom = Math.max(bottom, insets.bottom);
                     }
                 }
             }
@@ -1124,6 +1144,11 @@
         return false;
     }
 
+    @Override
+    public DataTransferer getDataTransferer() {
+        return XDataTransferer.getInstanceImpl();
+    }
+
     /**
      * Returns the supported cursor size
      */
@@ -2357,9 +2382,7 @@
 
     private static XEventDispatcher oops_waiter;
     private static boolean oops_updated;
-    private static boolean oops_failed;
-    private XAtom oops;
-    private static final long WORKAROUND_SLEEP = 100;
+    private static boolean oops_move;
 
     /**
      * @inheritDoc
@@ -2370,52 +2393,33 @@
         if (oops_waiter == null) {
             oops_waiter = new XEventDispatcher() {
                     public void dispatchEvent(XEvent e) {
-                        if (e.get_type() == XConstants.SelectionNotify) {
-                            XSelectionEvent pe = e.get_xselection();
-                            if (pe.get_property() == oops.getAtom()) {
-                                oops_updated = true;
-                                awtLockNotifyAll();
-                            } else if (pe.get_selection() == XAtom.get("WM_S0").getAtom() &&
-                                       pe.get_target() == XAtom.get("VERSION").getAtom() &&
-                                       pe.get_property() == 0 &&
-                                       XlibWrapper.XGetSelectionOwner(getDisplay(), XAtom.get("WM_S0").getAtom()) == 0)
-                            {
-                                // WM forgot to acquire selection  or there is no WM
-                                oops_failed = true;
-                                awtLockNotifyAll();
-                            }
-
+                        if (e.get_type() == XConstants.ConfigureNotify) {
+                            // OOPS ConfigureNotify event catched
+                            oops_updated = true;
+                            awtLockNotifyAll();
                         }
                     }
                 };
         }
 
-        if (oops == null) {
-            oops = XAtom.get("OOPS");
-        }
-
         awtLock();
         try {
             addEventDispatcher(win.getWindow(), oops_waiter);
 
             oops_updated = false;
-            oops_failed = false;
-            // Wait for selection notify for oops on win
             long event_number = getEventNumber();
-            XAtom atom = XAtom.get("WM_S0");
-            if (eventLog.isLoggable(PlatformLogger.Level.FINER)) {
-                eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()));
-            }
-            XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
-                                          XAtom.get("VERSION").getAtom(), oops.getAtom(),
-                                          win.getWindow(), XConstants.CurrentTime);
+            // Generate OOPS ConfigureNotify event
+            XlibWrapper.XMoveWindow(getDisplay(), win.getWindow(), oops_move ? 0 : 1, 0);
+            // Change win position each time to avoid system optimization
+            oops_move = !oops_move;
             XSync();
 
-            eventLog.finer("Requested OOPS");
+            eventLog.finer("Generated OOPS ConfigureNotify event");
 
             long start = System.currentTimeMillis();
-            while (!oops_updated && !oops_failed) {
+            while (!oops_updated) {
                 try {
+                    // Wait for OOPS ConfigureNotify event
                     awtLockWait(timeout);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
@@ -2426,20 +2430,8 @@
                     throw new OperationTimedOut(Long.toString(System.currentTimeMillis() - start));
                 }
             }
-            if (oops_failed && getEventNumber() - event_number == 1) {
-                // If selection update failed we can simply wait some time
-                // hoping some events will arrive
-                awtUnlock();
-                eventLog.finest("Emergency sleep");
-                try {
-                    Thread.sleep(WORKAROUND_SLEEP);
-                } catch (InterruptedException ie) {
-                    throw new RuntimeException(ie);
-                } finally {
-                    awtLock();
-                }
-            }
-            return getEventNumber() - event_number > 2;
+            // Don't take into account OOPS ConfigureNotify event
+            return getEventNumber() - event_number > 1;
         } finally {
             removeEventDispatcher(win.getWindow(), oops_waiter);
             eventLog.finer("Exiting syncNativeQueue");
diff --git a/src/solaris/classes/sun/awt/X11/XWindow.java b/src/solaris/classes/sun/awt/X11/XWindow.java
index 8df6e56..d59ac88 100644
--- a/src/solaris/classes/sun/awt/X11/XWindow.java
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java
@@ -456,6 +456,7 @@
             ColorModel cm = getColorModel();
             int pixel = PixelConverter.instance.rgbToPixel(c.getRGB(), cm);
             XlibWrapper.XSetWindowBackground(XToolkit.getDisplay(), getContentWindow(), pixel);
+            XlibWrapper.XClearWindow(XToolkit.getDisplay(), getContentWindow());
         }
         finally {
             XToolkit.awtUnlock();
diff --git a/src/solaris/classes/sun/awt/windows/ThemeReader.java b/src/solaris/classes/sun/awt/windows/ThemeReader.java
index de379c0..7445cc2 100644
--- a/src/solaris/classes/sun/awt/windows/ThemeReader.java
+++ b/src/solaris/classes/sun/awt/windows/ThemeReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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,7 +25,10 @@
 
 package sun.awt.windows;
 
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.Point;
 
 
 /**
@@ -36,7 +39,8 @@
  *
  * @author Leif Samuelsson
  */
-public class ThemeReader {
+public final class ThemeReader {
+
     public static boolean isThemed() {
         return false;
     }
@@ -84,16 +88,18 @@
     public static Dimension getPartSize(String widget, int part, int state) {
         return null;
     }
+
     public static long getThemeTransitionDuration(String widget, int part,
                                        int stateFrom, int stateTo, int propId) {
         return 0;
     }
+
     public static boolean isGetThemeTransitionDurationDefined() {
         return false;
     }
+
     public static Insets getThemeBackgroundContentMargins(String widget,
                     int part, int state, int boundingWidth, int boundingHeight) {
         return null;
     }
-
 }
diff --git a/src/solaris/classes/sun/font/FcFontConfiguration.java b/src/solaris/classes/sun/font/FcFontConfiguration.java
index 23cf936..eb038c4 100644
--- a/src/solaris/classes/sun/font/FcFontConfiguration.java
+++ b/src/solaris/classes/sun/font/FcFontConfiguration.java
@@ -33,6 +33,7 @@
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -173,8 +174,16 @@
     }
 
     @Override
-    public FontDescriptor[] getFontDescriptors(String fontName, int style) {
-        return new FontDescriptor[0];
+    protected FontDescriptor[] buildFontDescriptors(int fontIndex, int styleIndex) {
+        CompositeFontDescriptor[] cfi = get2DCompositeFontInfo();
+        int idx = fontIndex * NUM_STYLES + styleIndex;
+        String[] componentFaceNames = cfi[idx].getComponentFaceNames();
+        FontDescriptor[] ret = new FontDescriptor[componentFaceNames.length];
+        for (int i = 0; i < componentFaceNames.length; i++) {
+            ret[i] = new FontDescriptor(componentFaceNames[i], StandardCharsets.UTF_8.newEncoder(), new int[0]);
+        }
+
+        return ret;
     }
 
     @Override
@@ -250,10 +259,12 @@
                 }
 
                 String[] fileNames = new String[numFonts];
+                String[] faceNames = new String[numFonts];
 
                 int index;
                 for (index = 0; index < fcFonts.length; index++) {
                     fileNames[index] = fcFonts[index].fontFile;
+                    faceNames[index] = fcFonts[index].familyName;
                 }
 
                 if (installedFallbackFontFiles != null) {
@@ -266,7 +277,7 @@
                         = new CompositeFontDescriptor(
                             faceName,
                             1,
-                            null,
+                            faceNames,
                             fileNames,
                             null, null);
             }
diff --git a/src/solaris/classes/sun/print/CUPSPrinter.java b/src/solaris/classes/sun/print/CUPSPrinter.java
index ddfb6e1..b70b398 100644
--- a/src/solaris/classes/sun/print/CUPSPrinter.java
+++ b/src/solaris/classes/sun/print/CUPSPrinter.java
@@ -252,6 +252,7 @@
                             try {
                                 return urlConnection.getOutputStream();
                             } catch (Exception e) {
+                               IPPPrintService.debug_println(debugPrefix+e);
                             }
                             return null;
                         }
@@ -282,6 +283,9 @@
 
                     if (responseMap != null && responseMap.length > 0) {
                         defaultMap = responseMap[0];
+                    } else {
+                       IPPPrintService.debug_println(debugPrefix+
+                           " empty response map for GET_DEFAULT.");
                     }
 
                     if (defaultMap == null) {
@@ -310,7 +314,10 @@
 
                     if (attribClass != null) {
                         printerInfo[0] = attribClass.getStringValue();
-                        attribClass = (AttributeClass)defaultMap.get("device-uri");
+                        attribClass = (AttributeClass)
+                            defaultMap.get("printer-uri-supported");
+                        IPPPrintService.debug_println(debugPrefix+
+                          "printer-uri-supported="+attribClass);
                         if (attribClass != null) {
                             printerInfo[1] = attribClass.getStringValue();
                         } else {
diff --git a/src/solaris/classes/sun/print/IPPPrintService.java b/src/solaris/classes/sun/print/IPPPrintService.java
index 6892881..fbf8802 100644
--- a/src/solaris/classes/sun/print/IPPPrintService.java
+++ b/src/solaris/classes/sun/print/IPPPrintService.java
@@ -1904,9 +1904,8 @@
                                   new HashMap[respList.size()]);
             } else {
                 debug_println(debugPrefix+
-                              "readIPPResponse client error, IPP status code-"
-                                   +Integer.toHexString(response[2])+" & "
-                                   +Integer.toHexString(response[3]));
+                          "readIPPResponse client error, IPP status code: 0x"+
+                          toHex(response[2]) + toHex(response[3]));
                 return null;
             }
 
@@ -1919,6 +1918,10 @@
         }
     }
 
+    private static String toHex(byte v) {
+        String s = Integer.toHexString(v&0xff);
+        return (s.length() == 2) ? s :  "0"+s;
+    }
 
     public String toString() {
         return "IPP Printer : " + getName();
diff --git a/src/solaris/classes/sun/print/UnixPrintJob.java b/src/solaris/classes/sun/print/UnixPrintJob.java
index 6e0a927..5793973 100644
--- a/src/solaris/classes/sun/print/UnixPrintJob.java
+++ b/src/solaris/classes/sun/print/UnixPrintJob.java
@@ -409,7 +409,11 @@
                     ((IPPPrintService)service).isIPPSupportedImages(
                                                 flavor.getMimeType()))) {
                     printableJob(new ImagePrinter(instream));
-                    ((UnixPrintService)service).wakeNotifier();
+                    if (service instanceof IPPPrintService) {
+                        ((IPPPrintService)service).wakeNotifier();
+                    } else {
+                        ((UnixPrintService)service).wakeNotifier();
+                    }
                     return;
                 }
             } catch (ClassCastException cce) {
@@ -430,7 +434,11 @@
                     instream = url.openStream();
                 } else {
                     printableJob(new ImagePrinter(url));
-                    ((UnixPrintService)service).wakeNotifier();
+                    if (service instanceof IPPPrintService) {
+                        ((IPPPrintService)service).wakeNotifier();
+                    } else {
+                        ((UnixPrintService)service).wakeNotifier();
+                    }
                     return;
                 }
             } catch (ClassCastException cce) {
diff --git a/src/solaris/classes/sun/print/UnixPrintServiceLookup.java b/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
index 9a7be7f..7abed34 100644
--- a/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+++ b/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
@@ -273,9 +273,25 @@
         String[] printers = null; // array of printer names
         String[] printerURIs = null; //array of printer URIs
 
-        getDefaultPrintService();
+        try {
+            getDefaultPrintService();
+        } catch (Throwable t) {
+            IPPPrintService.debug_println(debugPrefix+
+              "Exception getting default printer : " + t);
+        }
         if (CUPSPrinter.isCupsRunning()) {
-            printerURIs = CUPSPrinter.getAllPrinters();
+            try {
+                printerURIs = CUPSPrinter.getAllPrinters();
+                IPPPrintService.debug_println("CUPS URIs = " + printerURIs);
+                if (printerURIs != null) {
+                    for (int p = 0; p < printerURIs.length; p++) {
+                       IPPPrintService.debug_println("URI="+printerURIs[p]);
+                    }
+                }
+            } catch (Throwable t) {
+            IPPPrintService.debug_println(debugPrefix+
+              "Exception getting all CUPS printers : " + t);
+            }
             if ((printerURIs != null) && (printerURIs.length > 0)) {
                 printers = new String[printerURIs.length];
                 for (int i=0; i<printerURIs.length; i++) {
@@ -632,8 +648,10 @@
                                       (CUPSPrinter.isCupsRunning()));
         if (CUPSPrinter.isCupsRunning()) {
             String[] printerInfo = CUPSPrinter.getDefaultPrinter();
-            defaultPrinter = printerInfo[0];
-            psuri = printerInfo[1];
+            if (printerInfo != null && printerInfo.length >= 2) {
+                defaultPrinter = printerInfo[0];
+                psuri = printerInfo[1];
+            }
         } else {
             if (isMac() || isSysV()) {
                 defaultPrinter = getDefaultPrinterNameSysV();
diff --git a/src/solaris/native/sun/awt/awt_Font.c b/src/solaris/native/sun/awt/awt_Font.c
index 8a5a380..f1ff8b8 100644
--- a/src/solaris/native/sun/awt/awt_Font.c
+++ b/src/solaris/native/sun/awt/awt_Font.c
@@ -452,6 +452,7 @@
         int32_t i, size;
         char *fontsetname = NULL;
         char *nativename = NULL;
+        Boolean doFree = FALSE;
         jobjectArray componentFonts = NULL;
         jobject peer = NULL;
         jobject fontDescriptor = NULL;
@@ -491,8 +492,10 @@
 
             if (!JNU_IsNull(env, fontDescriptorName)) {
                 nativename = (char *) JNU_GetStringPlatformChars(env, fontDescriptorName, NULL);
+                doFree = TRUE;
             } else {
                 nativename = "";
+                doFree = FALSE;
             }
 
             fdata->flist[i].xlfd = malloc(strlen(nativename)
@@ -500,7 +503,7 @@
             jio_snprintf(fdata->flist[i].xlfd, strlen(nativename) + 10,
                          nativename, size * 10);
 
-            if (nativename != NULL && nativename != "")
+            if (nativename != NULL && doFree)
                 JNU_ReleaseStringPlatformChars(env, fontDescriptorName, (const char *) nativename);
 
             /*
diff --git a/src/solaris/native/sun/awt/awt_LoadLibrary.c b/src/solaris/native/sun/awt/awt_LoadLibrary.c
index 4f69b9b..446915e 100644
--- a/src/solaris/native/sun/awt/awt_LoadLibrary.c
+++ b/src/solaris/native/sun/awt/awt_LoadLibrary.c
@@ -113,7 +113,7 @@
     jvm = vm;
 
     /* Get address of this library and the directory containing it. */
-    dladdr((void *)JNI_OnLoad, &dlinfo);
+    dladdr((void *)AWT_OnLoad, &dlinfo);
     realpath((char *)dlinfo.dli_fname, buf);
     len = strlen(buf);
     p = strrchr(buf, '/');
@@ -227,7 +227,7 @@
 
 
 #define REFLECT_VOID_FUNCTION(name, arglist, paramlist)                 \
-typedef name##_type arglist;                                            \
+typedef void name##_type arglist;                                       \
 void name arglist                                                       \
 {                                                                       \
     static name##_type *name##_ptr = NULL;                              \
diff --git a/src/solaris/native/sun/awt/gtk2_interface.c b/src/solaris/native/sun/awt/gtk2_interface.c
index cb960b1..cfcef70 100644
--- a/src/solaris/native/sun/awt/gtk2_interface.c
+++ b/src/solaris/native/sun/awt/gtk2_interface.c
@@ -32,6 +32,7 @@
 #include "java_awt_Transparency.h"
 #include "jvm_md.h"
 #include "sizecalc.h"
+#include <jni_util.h>
 
 #define GTK2_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
 #define GTK2_LIB JNI_LIB_NAME("gtk-x11-2.0")
@@ -438,10 +439,82 @@
     }
 }
 
+#define ADD_SUPPORTED_ACTION(actionStr) \
+do { \
+    jfieldID fld_action = (*env)->GetStaticFieldID(env, cls_action, actionStr, "Ljava/awt/Desktop$Action;"); \
+    if (!(*env)->ExceptionCheck(env)) { \
+        jobject action = (*env)->GetStaticObjectField(env, cls_action, fld_action); \
+        (*env)->CallBooleanMethod(env, supportedActions, mid_arrayListAdd, action); \
+    } else { \
+        (*env)->ExceptionClear(env); \
+    } \
+} while(0);
+
+
+void update_supported_actions(JNIEnv *env) {
+    GVfs * (*fp_g_vfs_get_default) (void);
+    const gchar * const * (*fp_g_vfs_get_supported_uri_schemes) (GVfs * vfs);
+    const gchar * const * schemes = NULL;
+
+    jclass cls_action = (*env)->FindClass(env, "java/awt/Desktop$Action");
+    CHECK_NULL(cls_action);
+    jclass cls_xDesktopPeer = (*env)->FindClass(env, "sun/awt/X11/XDesktopPeer");
+    CHECK_NULL(cls_xDesktopPeer);
+    jfieldID fld_supportedActions = (*env)->GetStaticFieldID(env, cls_xDesktopPeer, "supportedActions", "Ljava/util/List;");
+    CHECK_NULL(fld_supportedActions);
+    jobject supportedActions = (*env)->GetStaticObjectField(env, cls_xDesktopPeer, fld_supportedActions);
+
+    jclass cls_arrayList = (*env)->FindClass(env, "java/util/ArrayList");
+    CHECK_NULL(cls_arrayList);
+    jmethodID mid_arrayListAdd = (*env)->GetMethodID(env, cls_arrayList, "add", "(Ljava/lang/Object;)Z");
+    CHECK_NULL(mid_arrayListAdd);
+    jmethodID mid_arrayListClear = (*env)->GetMethodID(env, cls_arrayList, "clear", "()V");
+    CHECK_NULL(mid_arrayListClear);
+
+    (*env)->CallVoidMethod(env, supportedActions, mid_arrayListClear);
+
+    ADD_SUPPORTED_ACTION("OPEN");
+
+    /**
+     * gtk_show_uri() documentation says:
+     *
+     * > you need to install gvfs to get support for uri schemes such as http://
+     * > or ftp://, as only local files are handled by GIO itself.
+     *
+     * So OPEN action was safely added here.
+     * However, it looks like Solaris 11 have gvfs support only for 32-bit
+     * applications only by default.
+     */
+
+    fp_g_vfs_get_default = dl_symbol("g_vfs_get_default");
+    fp_g_vfs_get_supported_uri_schemes = dl_symbol("g_vfs_get_supported_uri_schemes");
+    dlerror();
+
+    if (fp_g_vfs_get_default && fp_g_vfs_get_supported_uri_schemes) {
+        GVfs * vfs = fp_g_vfs_get_default();
+        schemes = vfs ? fp_g_vfs_get_supported_uri_schemes(vfs) : NULL;
+        if (schemes) {
+            int i = 0;
+            while (schemes[i]) {
+                if (strcmp(schemes[i], "http") == 0) {
+                    ADD_SUPPORTED_ACTION("BROWSE");
+                    ADD_SUPPORTED_ACTION("MAIL");
+                    break;
+                }
+                i++;
+            }
+        }
+    } else {
+#ifdef INTERNAL_BUILD
+        fprintf(stderr, "Cannot load g_vfs_get_supported_uri_schemes\n");
+#endif /* INTERNAL_BUILD */
+    }
+
+}
 /**
  * Functions for awt_Desktop.c
  */
-gboolean gtk2_show_uri_load() {
+gboolean gtk2_show_uri_load(JNIEnv *env) {
      gboolean success = FALSE;
      dlerror();
      const char *gtk_version = fp_gtk_check_version(2, 14, 0);
@@ -464,9 +537,12 @@
 #ifdef INTERNAL_BUILD
              fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
 #endif /* INTERNAL_BUILD */
-         } else {
-             success = TRUE;
-         }
+        } else {
+#ifdef __solaris__
+            update_supported_actions(env);
+#endif
+            success = TRUE;
+        }
      }
      return success;
 }
@@ -533,7 +609,10 @@
         }
 
         /* GLib */
-        fp_glib_check_version = dl_symbol("glib_check_version");
+        fp_glib_check_version = dlsym(gtk2_libhandle, "glib_check_version");
+        if (!fp_glib_check_version) {
+            dlerror();
+        }
         fp_g_free = dl_symbol("g_free");
         fp_g_object_unref = dl_symbol("g_object_unref");
 
@@ -709,7 +788,7 @@
         /**
          * GLib thread system
          */
-        if (fp_glib_check_version(2, 20, 0) == NULL) {
+        if (GLIB_CHECK_VERSION(2, 20, 0)) {
             fp_g_thread_get_initialized = dl_symbol_gthread("g_thread_get_initialized");
         }
         fp_g_thread_init = dl_symbol_gthread("g_thread_init");
@@ -827,7 +906,7 @@
         // We can use g_thread_get_initialized () but it is available only for
         // GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20.
         gboolean is_g_thread_get_initialized = FALSE;
-        if (fp_glib_check_version(2, 20, 0) == NULL) {
+        if (GLIB_CHECK_VERSION(2, 20, 0)) {
             is_g_thread_get_initialized = fp_g_thread_get_initialized();
         }
 
diff --git a/src/solaris/native/sun/awt/gtk2_interface.h b/src/solaris/native/sun/awt/gtk2_interface.h
index c8fe453..1523f74 100644
--- a/src/solaris/native/sun/awt/gtk2_interface.h
+++ b/src/solaris/native/sun/awt/gtk2_interface.h
@@ -270,6 +270,7 @@
 /* We define all structure pointers to be void* */
 typedef void GError;
 typedef void GMainContext;
+typedef void GVfs;
 
 typedef struct _GSList GSList;
 struct _GSList
@@ -647,10 +648,19 @@
  * Returns :
  * NULL if the GLib library is compatible with the given version, or a string
  * describing the version mismatch.
+ * Please note that the glib_check_version() is available since 2.6,
+ * so you should use GLIB_CHECK_VERSION macro instead.
  */
 gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
                        guint required_micro);
 
+/**
+ * Returns :
+ *  TRUE if the GLib library is compatible with the given version
+ */
+#define GLIB_CHECK_VERSION(major, minor, micro) \
+    (fp_glib_check_version && fp_glib_check_version(major, minor, micro) == NULL)
+
 /*
  * Check whether the gtk2 library is available and meets the minimum
  * version requirement.  If the library is already loaded this method has no
@@ -680,7 +690,7 @@
  * gtk2_load, so it must be invoked only after a successful gtk2_load
  * invocation
  */
-gboolean gtk2_show_uri_load();
+gboolean gtk2_show_uri_load(JNIEnv *env);
 
 /*
  * Unload the gtk2 library.  If the library is already unloaded this method has
@@ -811,7 +821,7 @@
 
 /**
  * This function is available for GLIB > 2.20, so it MUST be
- * called within (fp_glib_check_version(2, 20, 0) == NULL) check.
+ * called within GLIB_CHECK_VERSION(2, 20, 0) check.
  */
 gboolean (*fp_g_thread_get_initialized)(void);
 
diff --git a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
index 66dca0d..6fd354a 100644
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 2010, 2012, 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.
+ */
+
 #include <jni.h>
 #include <stdio.h>
 #include <jni_util.h>
diff --git a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
deleted file mode 100644
index 8bdf815..0000000
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class sun_awt_X11_GtkFileDialogPeer */
-
-#ifndef _Included_sun_awt_X11_GtkFileDialogPeer
-#define _Included_sun_awt_X11_GtkFileDialogPeer
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    initIDs
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
-(JNIEnv *, jclass);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    run
- * Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/io/FilenameFilter;ZII)V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_run
-(JNIEnv *, jobject, jstring, jint, jstring, jstring, jobject, jboolean, jint, jint);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    quit
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
-(JNIEnv *, jobject);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    toFront
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
-(JNIEnv *, jobject);
-
-/*
- * Class:     sun_awt_X11_GtkFileDialogPeer
- * Method:    setBounds
- * Signature: (IIIII)V
- */
-JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_setBounds
-(JNIEnv * env, jobject jpeer, jint x, jint y, jint width, jint height, jint op);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
index fd48e42..eb82d64 100644
--- a/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
+++ b/src/solaris/native/sun/java2d/x11/X11SurfaceData.c
@@ -510,7 +510,7 @@
     xsdo->cData = xsdo->configData->color_data;
 
     XShared_initSurface(env, xsdo, depth, width, height, drawable);
-    xsdo->xrPic = NULL;
+    xsdo->xrPic = None;
 #endif /* !HEADLESS */
 }
 
diff --git a/src/solaris/native/sun/security/pkcs11/j2secmod_md.c b/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
index e07bea7..20cfabe 100644
--- a/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
+++ b/src/solaris/native/sun/security/pkcs11/j2secmod_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -50,6 +50,10 @@
   (JNIEnv *env, jclass thisClass, jstring jLibName)
 {
     const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
+    if (libName == NULL) {
+        return 0L;
+    }
+
     // look up existing handle only, do not load
 #if defined(AIX)
     void *hModule = dlopen(libName, RTLD_LAZY);
@@ -66,6 +70,9 @@
 {
     void *hModule;
     const char *libName = (*env)->GetStringUTFChars(env, jLibName, NULL);
+    if (libName == NULL) {
+       return 0L;
+    }
 
     dprintf1("-lib %s\n", libName);
     hModule = dlopen(libName, RTLD_LAZY);
diff --git a/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c b/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
index 3d805c5..fe05a1d 100644
--- a/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
+++ b/src/solaris/native/sun/security/pkcs11/wrapper/p11_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 
 /* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
@@ -88,6 +88,9 @@
     const char *getFunctionListStr;
 
     const char *libraryNameStr = (*env)->GetStringUTFChars(env, jPkcs11ModulePath, 0);
+    if (libraryNameStr == NULL) {
+        return;
+    }
     TRACE1("DEBUG: connect to PKCS#11 module: %s ... ", libraryNameStr);
 
 
@@ -123,6 +126,9 @@
     // with the old JAR file jGetFunctionList is null, temporarily check for that
     if (jGetFunctionList != NULL) {
         getFunctionListStr = (*env)->GetStringUTFChars(env, jGetFunctionList, 0);
+        if (getFunctionListStr == NULL) {
+            return;
+        }
         C_GetFunctionList = (CK_C_GetFunctionList) dlsym(hModule, getFunctionListStr);
         (*env)->ReleaseStringUTFChars(env, jGetFunctionList, getFunctionListStr);
     }
diff --git a/src/solaris/native/sun/xawt/XToolkit.c b/src/solaris/native/sun/xawt/XToolkit.c
index fc42f42..36d8250 100644
--- a/src/solaris/native/sun/xawt/XToolkit.c
+++ b/src/solaris/native/sun/xawt/XToolkit.c
@@ -699,7 +699,7 @@
     if (pollFds[0].revents) {
         // Events in X pipe
         update_poll_timeout(TIMEOUT_EVENTS);
-        PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %ld \n", curPollTimeout);
+        PRINT2("performPoll(): TIMEOUT_EVENTS curPollTimeout = %d \n", curPollTimeout);
     }
     return;
 
diff --git a/src/solaris/native/sun/xawt/awt_Desktop.c b/src/solaris/native/sun/xawt/awt_Desktop.c
index 55c7690..16c50ea 100644
--- a/src/solaris/native/sun/xawt/awt_Desktop.c
+++ b/src/solaris/native/sun/xawt/awt_Desktop.c
@@ -42,7 +42,7 @@
         return JNI_TRUE;
     }
 
-    if (gtk2_load(env) && gtk2_show_uri_load()) {
+    if (gtk2_load(env) && gtk2_show_uri_load(env)) {
         gtk_has_been_loaded = TRUE;
         return JNI_TRUE;
     } else if (gnome_load()) {
diff --git a/src/windows/classes/sun/awt/windows/ThemeReader.java b/src/windows/classes/sun/awt/windows/ThemeReader.java
index c749e5d..6324899 100644
--- a/src/windows/classes/sun/awt/windows/ThemeReader.java
+++ b/src/windows/classes/sun/awt/windows/ThemeReader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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,11 +25,15 @@
 
 package sun.awt.windows;
 
-import java.awt.*;
-import java.util.*;
-import java.util.concurrent.locks.*;
-import java.beans.*;
-import javax.swing.SwingUtilities;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.Point;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 /* !!!! WARNING !!!!
  * This class has to be in sync with
@@ -45,9 +49,9 @@
  * @author Bino George
  * @author Igor Kushnirskiy
  */
-public class ThemeReader {
-    private static final HashMap<String, Long> widgetToTheme =
-        new HashMap<String, Long>();
+public final class ThemeReader {
+
+    private static final Map<String, Long> widgetToTheme = new HashMap<>();
 
     // lock for the cache
     // reading should be done with readLock
@@ -70,7 +74,7 @@
         }
     }
 
-    public native static boolean isThemed();
+    public static native boolean isThemed();
 
     // this should be called only with writeLock held
     private static Long getThemeImpl(String widget) {
@@ -109,8 +113,9 @@
         return theme;
     }
 
-    public native static void paintBackground(int[] buffer, long theme, int part, int state,
-                             int x, int y, int w, int h, int stride);
+    private static native void paintBackground(int[] buffer, long theme,
+                                               int part, int state, int x,
+                                               int y, int w, int h, int stride);
 
     public static void paintBackground(int[] buffer, String widget,
            int part, int state, int x, int y, int w, int h, int stride) {
@@ -122,8 +127,8 @@
         }
     }
 
-    public native static Insets getThemeMargins(long theme, int part, int state,
- int marginType);
+    private static native Insets getThemeMargins(long theme, int part,
+                                                 int state, int marginType);
 
     public static Insets getThemeMargins(String widget, int part, int state, int marginType) {
         readLock.lock();
@@ -134,7 +139,7 @@
         }
     }
 
-    private native static boolean isThemePartDefined(long theme, int part, int state);
+    private static native boolean isThemePartDefined(long theme, int part, int state);
 
     public static boolean isThemePartDefined(String widget, int part, int state) {
         readLock.lock();
@@ -145,8 +150,8 @@
         }
     }
 
-    public native static Color getColor(long theme, int part, int state,
-                                                               int property);
+    private static native Color getColor(long theme, int part, int state,
+                                         int property);
 
     public static Color getColor(String widget, int part, int state, int property) {
         readLock.lock();
@@ -157,8 +162,8 @@
         }
     }
 
-    public native static int getInt(long theme, int part, int state,
-                                                                int property);
+    private static native int getInt(long theme, int part, int state,
+                                     int property);
 
     public static int getInt(String widget, int part, int state, int property) {
         readLock.lock();
@@ -169,8 +174,8 @@
         }
     }
 
-    public native static int getEnum(long theme, int part, int state,
-                                                                int property);
+    private static native int getEnum(long theme, int part, int state,
+                                      int property);
 
     public static int getEnum(String widget, int part, int state, int property) {
         readLock.lock();
@@ -181,8 +186,8 @@
         }
     }
 
-    public native static boolean getBoolean(long theme, int part, int state,
-                                                                int property);
+    private static native boolean getBoolean(long theme, int part, int state,
+                                             int property);
 
     public static boolean getBoolean(String widget, int part, int state,
                                      int property) {
@@ -194,7 +199,7 @@
         }
     }
 
-    public native static boolean getSysBoolean(long theme, int property);
+    private static native boolean getSysBoolean(long theme, int property);
 
     public static boolean getSysBoolean(String widget, int property) {
         readLock.lock();
@@ -205,8 +210,8 @@
         }
     }
 
-    public native static Point getPoint(long theme, int part, int state,
-                                                                int property);
+    private static native Point getPoint(long theme, int part, int state,
+                                         int property);
 
     public static Point getPoint(String widget, int part, int state, int property) {
         readLock.lock();
@@ -217,8 +222,8 @@
         }
     }
 
-    public native static Dimension getPosition(long theme, int part, int state,
-                                                                 int property);
+    private static native Dimension getPosition(long theme, int part, int state,
+                                                int property);
 
     public static Dimension getPosition(String widget, int part, int state,
                                         int property) {
@@ -230,7 +235,8 @@
         }
     }
 
-    public native static Dimension getPartSize(long theme, int part, int state);
+    private static native Dimension getPartSize(long theme, int part,
+                                                int state);
 
     public static Dimension getPartSize(String widget, int part, int state) {
         readLock.lock();
@@ -241,14 +247,15 @@
         }
     }
 
-    public native static long openTheme(String widget);
+    private static native long openTheme(String widget);
 
-    public native static void closeTheme(long theme);
+    private static native void closeTheme(long theme);
 
-    public native static void setWindowTheme(String subAppName);
+    private static native void setWindowTheme(String subAppName);
 
-    private native static long getThemeTransitionDuration(long theme, int part,
+    private static native long getThemeTransitionDuration(long theme, int part,
                                         int stateFrom, int stateTo, int propId);
+
     public static long getThemeTransitionDuration(String widget, int part,
                                        int stateFrom, int stateTo, int propId) {
         readLock.lock();
@@ -259,10 +266,12 @@
             readLock.unlock();
         }
     }
-    public native static boolean isGetThemeTransitionDurationDefined();
 
-    private native static Insets getThemeBackgroundContentMargins(long theme,
+    public static native boolean isGetThemeTransitionDurationDefined();
+
+    private static native Insets getThemeBackgroundContentMargins(long theme,
                      int part, int state, int boundingWidth, int boundingHeight);
+
     public static Insets getThemeBackgroundContentMargins(String widget,
                     int part, int state, int boundingWidth, int boundingHeight) {
         readLock.lock();
diff --git a/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java b/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
index 5410549..ff06aa5 100644
--- a/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
+++ b/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -33,7 +33,6 @@
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBufferInt;
 import java.awt.image.VolatileImage;
-import java.lang.ref.WeakReference;
 import java.security.AccessController;
 import sun.awt.image.BufImgSurfaceData;
 import sun.java2d.DestSurfaceProvider;
@@ -46,7 +45,6 @@
 import sun.security.action.GetPropertyAction;
 
 import static java.awt.image.VolatileImage.*;
-import static java.awt.Transparency.*;
 import static sun.java2d.pipe.hw.AccelSurface.*;
 import static sun.java2d.pipe.hw.ContextCapabilities.*;
 
@@ -59,7 +57,7 @@
  * Note: this class does not attempt to be thread safe, it is expected to be
  * called from a single thread (EDT).
  */
-public abstract class TranslucentWindowPainter {
+abstract class TranslucentWindowPainter {
 
     protected Window window;
     protected WWindowPeer peer;
@@ -231,6 +229,7 @@
             return (viBB != null ? !viBB.contentsLost() : true);
         }
 
+        @Override
         public void flush() {
             if (backBuffer != null) {
                 backBuffer.flush();
@@ -313,6 +312,7 @@
                     try {
                         BufferedContext.validateContext(as);
                         rq.flushAndInvokeNow(new Runnable() {
+                            @Override
                             public void run() {
                                 long psdops = as.getNativeOps();
                                 arr[0] = updateWindowAccel(psdops, w, h);
diff --git a/src/windows/classes/sun/awt/windows/WBufferStrategy.java b/src/windows/classes/sun/awt/windows/WBufferStrategy.java
index 8dc6792..372b3cc 100644
--- a/src/windows/classes/sun/awt/windows/WBufferStrategy.java
+++ b/src/windows/classes/sun/awt/windows/WBufferStrategy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, 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
@@ -34,8 +34,9 @@
  * the back buffer associated with a Component.  If that
  * Component has a BufferStrategy with >1 buffer, then the
  * Image subclass associated with that buffer will be returned.
+ * Note: the class is used by the JAWT3d.
  */
-public class WBufferStrategy {
+public final class WBufferStrategy {
 
     private static native void initIDs(Class <?> componentClass);
 
diff --git a/src/windows/classes/sun/awt/windows/WButtonPeer.java b/src/windows/classes/sun/awt/windows/WButtonPeer.java
index f006c9a..36469af 100644
--- a/src/windows/classes/sun/awt/windows/WButtonPeer.java
+++ b/src/windows/classes/sun/awt/windows/WButtonPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -37,6 +37,7 @@
 
     // ComponentPeer overrides
 
+    @Override
     public Dimension getMinimumSize() {
         FontMetrics fm = getFontMetrics(((Button)target).getFont());
         String label = ((Button)target).getLabel();
@@ -46,12 +47,14 @@
         return new Dimension(fm.stringWidth(label) + 14,
                              fm.getHeight() + 8);
     }
+    @Override
     public boolean isFocusable() {
         return true;
     }
 
     // ButtonPeer implementation
 
+    @Override
     public native void setLabel(String label);
 
     // Toolkit & peer internals
@@ -60,6 +63,7 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer peer);
 
     // native callbacks
@@ -70,6 +74,7 @@
         // Fixed 5064013: the InvocationEvent time should be equals
         // the time of the ActionEvent
         WToolkit.executeOnEventHandlerThread(target, new Runnable() {
+            @Override
             public void run() {
                 postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
                                           ((Button)target).getActionCommand(),
@@ -79,6 +84,7 @@
     }
 
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
@@ -88,6 +94,7 @@
      */
     private static native void initIDs();
 
+    @Override
     public boolean handleJavaKeyEvent(KeyEvent e) {
          switch (e.getID()) {
             case KeyEvent.KEY_RELEASED:
diff --git a/src/windows/classes/sun/awt/windows/WCanvasPeer.java b/src/windows/classes/sun/awt/windows/WCanvasPeer.java
index 627372b..e1fd0e5 100644
--- a/src/windows/classes/sun/awt/windows/WCanvasPeer.java
+++ b/src/windows/classes/sun/awt/windows/WCanvasPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, 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
@@ -24,12 +24,16 @@
  */
 package sun.awt.windows;
 
-import java.awt.*;
-import java.awt.peer.*;
-import java.lang.ref.WeakReference;
-import sun.awt.SunToolkit;
-import sun.awt.Win32GraphicsDevice;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.peer.CanvasPeer;
+
 import sun.awt.PaintEventDispatcher;
+import sun.awt.SunToolkit;
 
 class WCanvasPeer extends WComponentPeer implements CanvasPeer {
 
@@ -41,8 +45,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     void initialize() {
         eraseBackground = !SunToolkit.getSunAwtNoerasebackground();
         boolean eraseBackgroundOnResize = SunToolkit.getSunAwtErasebackgroundonresize();
@@ -60,6 +66,7 @@
         }
     }
 
+    @Override
     public void paint(Graphics g) {
         Dimension d = ((Component)target).getSize();
         if (g instanceof Graphics2D ||
@@ -75,6 +82,7 @@
         super.paint(g);
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return eraseBackground;
     }
@@ -99,6 +107,7 @@
     private native void setNativeBackgroundErase(boolean doErase,
                                                  boolean doEraseOnResize);
 
+    @Override
     public GraphicsConfiguration getAppropriateGraphicsConfiguration(
             GraphicsConfiguration gc)
     {
diff --git a/src/windows/classes/sun/awt/windows/WCheckboxMenuItemPeer.java b/src/windows/classes/sun/awt/windows/WCheckboxMenuItemPeer.java
index 2527834..e500c22 100644
--- a/src/windows/classes/sun/awt/windows/WCheckboxMenuItemPeer.java
+++ b/src/windows/classes/sun/awt/windows/WCheckboxMenuItemPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, 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
@@ -24,14 +24,16 @@
  */
 package sun.awt.windows;
 
-import java.awt.*;
-import java.awt.peer.*;
+import java.awt.CheckboxMenuItem;
 import java.awt.event.ItemEvent;
+import java.awt.peer.CheckboxMenuItemPeer;
 
-class WCheckboxMenuItemPeer extends WMenuItemPeer implements CheckboxMenuItemPeer {
+final class WCheckboxMenuItemPeer extends WMenuItemPeer
+        implements CheckboxMenuItemPeer {
 
     // CheckboxMenuItemPeer implementation
 
+    @Override
     public native void setState(boolean t);
 
     // Toolkit & peer internals
@@ -46,6 +48,7 @@
     public void handleAction(final boolean state) {
         final CheckboxMenuItem target = (CheckboxMenuItem)this.target;
         WToolkit.executeOnEventHandlerThread(target, new Runnable() {
+            @Override
             public void run() {
                 target.setState(state);
                 postEvent(new ItemEvent(target, ItemEvent.ITEM_STATE_CHANGED,
diff --git a/src/windows/classes/sun/awt/windows/WCheckboxPeer.java b/src/windows/classes/sun/awt/windows/WCheckboxPeer.java
index efab531..1bc49ff 100644
--- a/src/windows/classes/sun/awt/windows/WCheckboxPeer.java
+++ b/src/windows/classes/sun/awt/windows/WCheckboxPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -32,12 +32,16 @@
 
     // CheckboxPeer implementation
 
+    @Override
     public native void setState(boolean state);
+    @Override
     public native void setCheckboxGroup(CheckboxGroup g);
+    @Override
     public native void setLabel(String label);
 
     private static native int getCheckMarkSize();
 
+    @Override
     public Dimension getMinimumSize() {
         String lbl = ((Checkbox)target).getLabel();
         int marksize = getCheckMarkSize();
@@ -54,6 +58,7 @@
                              Math.max(fm.getHeight() + 8,  marksize));
     }
 
+    @Override
     public boolean isFocusable() {
         return true;
     }
@@ -64,8 +69,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     void initialize() {
         Checkbox t = (Checkbox)target;
         setState(t.getState());
@@ -79,6 +86,7 @@
         super.initialize();
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
@@ -88,6 +96,7 @@
     void handleAction(final boolean state) {
         final Checkbox cb = (Checkbox)this.target;
         WToolkit.executeOnEventHandlerThread(cb, new Runnable() {
+            @Override
             public void run() {
                 CheckboxGroup chg = cb.getCheckboxGroup();
                 if ((chg != null) && (cb == chg.getSelectedCheckbox()) && cb.getState()) {
diff --git a/src/windows/classes/sun/awt/windows/WChoicePeer.java b/src/windows/classes/sun/awt/windows/WChoicePeer.java
index 74f9548..adfff70 100644
--- a/src/windows/classes/sun/awt/windows/WChoicePeer.java
+++ b/src/windows/classes/sun/awt/windows/WChoicePeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -36,6 +36,7 @@
 
     // WComponentPeer overrides
 
+    @Override
     public Dimension getMinimumSize() {
         FontMetrics fm = getFontMetrics(((Choice)target).getFont());
         Choice c = (Choice)target;
@@ -45,23 +46,29 @@
         }
         return new Dimension(28 + w, Math.max(fm.getHeight() + 6, 15));
     }
+    @Override
     public boolean isFocusable() {
         return true;
     }
 
     // ChoicePeer implementation
 
+    @Override
     public native void select(int index);
 
+    @Override
     public void add(String item, int index) {
         addItem(item, index);
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
 
+    @Override
     public native void removeAll();
+    @Override
     public native void remove(int index);
 
     /**
@@ -72,6 +79,7 @@
     }
     public native void addItems(String[] items, int index);
 
+    @Override
     public synchronized native void reshape(int x, int y, int width, int height);
 
     private WindowListener windowListener;
@@ -82,8 +90,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     @SuppressWarnings("deprecation")
     void initialize() {
         Choice opt = (Choice)target;
@@ -104,9 +114,11 @@
             WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
             if (wpeer != null) {
                 windowListener = new WindowAdapter() {
+                        @Override
                         public void windowIconified(WindowEvent e) {
                             closeList();
                         }
+                        @Override
                         public void windowClosing(WindowEvent e) {
                             closeList();
                         }
@@ -117,6 +129,7 @@
         super.initialize();
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     protected void disposeImpl() {
         // TODO: we should somehow reset the listener when the choice
@@ -136,6 +149,7 @@
     void handleAction(final int index) {
         final Choice c = (Choice)target;
         WToolkit.executeOnEventHandlerThread(c, new Runnable() {
+            @Override
             public void run() {
                 c.select(index);
                 postEvent(new ItemEvent(c, ItemEvent.ITEM_STATE_CHANGED,
diff --git a/src/windows/classes/sun/awt/windows/WClipboard.java b/src/windows/classes/sun/awt/windows/WClipboard.java
index 63914c1..1938369 100644
--- a/src/windows/classes/sun/awt/windows/WClipboard.java
+++ b/src/windows/classes/sun/awt/windows/WClipboard.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, 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
@@ -28,14 +28,11 @@
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 import java.awt.datatransfer.UnsupportedFlavorException;
-
 import java.io.IOException;
-
-import java.util.Iterator;
 import java.util.Map;
 
-import sun.awt.datatransfer.SunClipboard;
 import sun.awt.datatransfer.DataTransferer;
+import sun.awt.datatransfer.SunClipboard;
 
 
 /**
@@ -50,18 +47,20 @@
  *
  * @since JDK1.1
  */
-public class WClipboard extends SunClipboard {
+final class WClipboard extends SunClipboard {
 
     private boolean isClipboardViewerRegistered;
 
-    public WClipboard() {
+    WClipboard() {
         super("System");
     }
 
+    @Override
     public long getID() {
         return 0;
     }
 
+    @Override
     protected void setContentsNative(Transferable contents) {
 
         // Don't use delayed Clipboard rendering for the Transferable's data.
@@ -107,6 +106,7 @@
      * Currently delayed data rendering is not used for the Windows clipboard,
      * so there is no native context to clear.
      */
+    @Override
     protected void clearNativeContext() {}
 
     /**
@@ -115,11 +115,13 @@
      *
      * @throws IllegalStateException if the clipboard has not been opened
      */
+    @Override
     public native void openClipboard(SunClipboard newOwner) throws IllegalStateException;
     /**
      * Call the Win32 CloseClipboard function if we have clipboard ownership,
      * does nothing if we have not ownership.
      */
+    @Override
     public native void closeClipboard();
     /**
      * Call the Win32 SetClipboardData function.
@@ -131,9 +133,12 @@
         init();
     }
 
+    @Override
     protected native long[] getClipboardFormats();
+    @Override
     protected native byte[] getClipboardData(long format) throws IOException;
 
+    @Override
     protected void registerClipboardViewerChecked() {
         if (!isClipboardViewerRegistered) {
             registerClipboardViewer();
@@ -148,6 +153,7 @@
      * until the toolkit window disposing since MSDN suggests removing
      * the window from the clipboard viewer chain just before it is destroyed.
      */
+    @Override
     protected void unregisterClipboardViewerChecked() {}
 
     /**
@@ -175,6 +181,7 @@
      *
      * @since 1.5
      */
+    @Override
     protected Transferable createLocaleTransferable(long[] formats) throws IOException {
         boolean found = false;
         for (int i = 0; i < formats.length; i++) {
@@ -197,12 +204,15 @@
         final byte[] localeDataFinal = localeData;
 
         return new Transferable() {
+                @Override
                 public DataFlavor[] getTransferDataFlavors() {
                     return new DataFlavor[] { DataTransferer.javaTextEncodingFlavor };
                 }
+                @Override
                 public boolean isDataFlavorSupported(DataFlavor flavor) {
                     return flavor.equals(DataTransferer.javaTextEncodingFlavor);
                 }
+                @Override
                 public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
                     if (isDataFlavorSupported(flavor)) {
                         return localeDataFinal;
@@ -211,5 +221,4 @@
                 }
             };
     }
-
 }
diff --git a/src/windows/classes/sun/awt/windows/WColor.java b/src/windows/classes/sun/awt/windows/WColor.java
index f8453c4..4a040f3 100644
--- a/src/windows/classes/sun/awt/windows/WColor.java
+++ b/src/windows/classes/sun/awt/windows/WColor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 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
@@ -29,7 +29,7 @@
 /*
  * This helper class maps Windows system colors to AWT Color objects.
  */
-class WColor {
+final class WColor {
 
     static final int WINDOW_BKGND = 1;  // COLOR_WINDOW
     static final int WINDOW_TEXT  = 2;  // COLOR_WINDOWTEXT
diff --git a/src/windows/classes/sun/awt/windows/WComponentPeer.java b/src/windows/classes/sun/awt/windows/WComponentPeer.java
index d4c4f70..1008004 100644
--- a/src/windows/classes/sun/awt/windows/WComponentPeer.java
+++ b/src/windows/classes/sun/awt/windows/WComponentPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -93,7 +93,9 @@
     private Color background;
     private Font font;
 
+    @Override
     public native boolean isObscured();
+    @Override
     public boolean canDetermineObscurity() { return true; }
 
     // DropTarget support
@@ -101,19 +103,21 @@
     int nDropTargets;
     long nativeDropTargetContext; // native pointer
 
-    public synchronized native void pShow();
-    public synchronized native void hide();
-    public synchronized native void enable();
-    public synchronized native void disable();
+    private synchronized native void pShow();
+    synchronized native void hide();
+    synchronized native void enable();
+    synchronized native void disable();
 
     public long getHWnd() {
         return hwnd;
     }
 
     /* New 1.1 API */
+    @Override
     public native Point getLocationOnScreen();
 
     /* New 1.1 API */
+    @Override
     public void setVisible(boolean b) {
         if (b) {
             show();
@@ -130,6 +134,7 @@
     }
 
     /* New 1.1 API */
+    @Override
     public void setEnabled(boolean b) {
         if (b) {
             enable();
@@ -143,6 +148,7 @@
     private native void reshapeNoCheck(int x, int y, int width, int height);
 
     /* New 1.1 API */
+    @Override
     public void setBounds(int x, int y, int width, int height, int op) {
         // Should set paintPending before reahape to prevent
         // thread race between paint events
@@ -185,6 +191,7 @@
         final Container cont = (Container)target;
 
         WToolkit.executeOnEventHandlerThread(cont, new Runnable() {
+            @Override
             public void run() {
                 // Discarding old paint events doesn't seem to be necessary.
                 cont.invalidate();
@@ -228,6 +235,7 @@
 
     native synchronized void updateWindow();
 
+    @Override
     public void paint(Graphics g) {
         ((Component)target).paint(g);
     }
@@ -239,6 +247,7 @@
     private native int[] createPrintedPixels(int srcX, int srcY,
                                              int srcW, int srcH,
                                              int alpha);
+    @Override
     public void print(Graphics g) {
 
         Component comp = (Component)target;
@@ -275,6 +284,7 @@
         comp.print(g);
     }
 
+    @Override
     public void coalescePaintEvent(PaintEvent e) {
         Rectangle r = e.getUpdateRect();
         if (!(e instanceof IgnorePaintEvent)) {
@@ -319,6 +329,7 @@
 
     native void nativeHandleEvent(AWTEvent e);
 
+    @Override
     @SuppressWarnings("fallthrough")
     public void handleEvent(AWTEvent e) {
         int id = e.getID();
@@ -367,21 +378,25 @@
 
     native void setFocus(boolean doSetFocus);
 
+    @Override
     public Dimension getMinimumSize() {
         return ((Component)target).getSize();
     }
 
+    @Override
     public Dimension getPreferredSize() {
         return getMinimumSize();
     }
 
     // Do nothing for heavyweight implementation
+    @Override
     public void layout() {}
 
     public Rectangle getBounds() {
         return ((Component)target).getBounds();
     }
 
+    @Override
     public boolean isFocusable() {
         return false;
     }
@@ -390,6 +405,7 @@
      * Return the GraphicsConfiguration associated with this peer, either
      * the locally stored winGraphicsConfig, or that of the target Component.
      */
+    @Override
     public GraphicsConfiguration getGraphicsConfiguration() {
         if (winGraphicsConfig != null) {
             return winGraphicsConfig;
@@ -481,6 +497,7 @@
 
     public void replaceSurfaceDataLater() {
         Runnable r = new Runnable() {
+            @Override
             public void run() {
                 // Shouldn't do anything if object is disposed in meanwhile
                 // No need for sync as disposeAction in Window is performed
@@ -501,6 +518,7 @@
         }
     }
 
+    @Override
     public boolean updateGraphicsData(GraphicsConfiguration gc) {
         winGraphicsConfig = (Win32GraphicsConfig)gc;
         try {
@@ -512,6 +530,7 @@
     }
 
     //This will return null for Components not yet added to a Container
+    @Override
     public ColorModel getColorModel() {
         GraphicsConfiguration gc = getGraphicsConfiguration();
         if (gc != null) {
@@ -549,6 +568,7 @@
     // fallback default font object
     final static Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12);
 
+    @Override
     @SuppressWarnings("deprecation")
     public Graphics getGraphics() {
         if (isDisposed()) {
@@ -601,11 +621,13 @@
         }
         return null;
     }
+    @Override
     public FontMetrics getFontMetrics(Font font) {
         return WFontMetrics.getFontMetrics(font);
     }
 
     private synchronized native void _dispose();
+    @Override
     protected void disposeImpl() {
         SurfaceData oldData = surfaceData;
         surfaceData = null;
@@ -618,17 +640,20 @@
 
     public void disposeLater() {
         postEvent(new InvocationEvent(target, new Runnable() {
+            @Override
             public void run() {
                 dispose();
             }
         }));
     }
 
+    @Override
     public synchronized void setForeground(Color c) {
         foreground = c;
         _setForeground(c.getRGB());
     }
 
+    @Override
     public synchronized void setBackground(Color c) {
         background = c;
         _setBackground(c.getRGB());
@@ -644,19 +669,22 @@
         return background;
     }
 
-    public native void _setForeground(int rgb);
-    public native void _setBackground(int rgb);
+    private native void _setForeground(int rgb);
+    private native void _setBackground(int rgb);
 
+    @Override
     public synchronized void setFont(Font f) {
         font = f;
         _setFont(f);
     }
-    public synchronized native void _setFont(Font f);
+    synchronized native void _setFont(Font f);
+    @Override
     public void updateCursorImmediately() {
         WGlobalCursorManager.getCursorManager().updateCursorImmediately();
     }
 
     // TODO: consider moving it to KeyboardFocusManagerPeerImpl
+    @Override
     @SuppressWarnings("deprecation")
     public boolean requestFocus(Component lightweightChild, boolean temporary,
                                 boolean focusedWindowChangeAllowed, long time,
@@ -720,24 +748,29 @@
         return false;
     }
 
+    @Override
     public Image createImage(ImageProducer producer) {
         return new ToolkitImage(producer);
     }
 
+    @Override
     public Image createImage(int width, int height) {
         Win32GraphicsConfig gc =
             (Win32GraphicsConfig)getGraphicsConfiguration();
         return gc.createAcceleratedImage((Component)target, width, height);
     }
 
+    @Override
     public VolatileImage createVolatileImage(int width, int height) {
         return new SunVolatileImage((Component)target, width, height);
     }
 
+    @Override
     public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
         return Toolkit.getDefaultToolkit().prepareImage(img, w, h, o);
     }
 
+    @Override
     public int checkImage(Image img, int w, int h, ImageObserver o) {
         return Toolkit.getDefaultToolkit().checkImage(img, w, h, o);
     }
@@ -891,6 +924,7 @@
      * register a DropTarget with this native peer
      */
 
+    @Override
     public synchronized void addDropTarget(DropTarget dt) {
         if (nDropTargets == 0) {
             nativeDropTargetContext = addNativeDropTarget();
@@ -902,6 +936,7 @@
      * unregister a DropTarget with this native peer
      */
 
+    @Override
     public synchronized void removeDropTarget(DropTarget dt) {
         nDropTargets--;
         if (nDropTargets == 0) {
@@ -924,6 +959,7 @@
     native void removeNativeDropTarget();
     native boolean nativeHandlesWheelScrolling();
 
+    @Override
     public boolean handlesWheelScrolling() {
         // should this be cached?
         return nativeHandlesWheelScrolling();
@@ -1001,6 +1037,7 @@
     /**
      * @see java.awt.peer.ComponentPeer#reparent
      */
+    @Override
     public void reparent(ContainerPeer newNativeParent) {
         pSetParent(newNativeParent);
     }
@@ -1008,6 +1045,7 @@
     /**
      * @see java.awt.peer.ComponentPeer#isReparentSupported
      */
+    @Override
     public boolean isReparentSupported() {
         return true;
     }
@@ -1081,6 +1119,7 @@
      * Applies the shape to the native component window.
      * @since 1.7
      */
+    @Override
     @SuppressWarnings("deprecation")
     public void applyShape(Region shape) {
         if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
@@ -1101,6 +1140,7 @@
      * Lowers this component at the bottom of the above component. If the above parameter
      * is null then the method places this component at the top of the Z-order.
      */
+    @Override
     public void setZOrder(ComponentPeer above) {
         long aboveHWND = (above != null) ? ((WComponentPeer)above).getHWnd() : 0;
 
diff --git a/src/windows/classes/sun/awt/windows/WCustomCursor.java b/src/windows/classes/sun/awt/windows/WCustomCursor.java
index 640c228..dc5debd 100644
--- a/src/windows/classes/sun/awt/windows/WCustomCursor.java
+++ b/src/windows/classes/sun/awt/windows/WCustomCursor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, 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
@@ -38,13 +38,14 @@
  * @see Component#setCursor
  * @author      ThomasBall
  */
-public class WCustomCursor extends CustomCursor {
+final class WCustomCursor extends CustomCursor {
 
-    public WCustomCursor(Image cursor, Point hotSpot, String name)
+    WCustomCursor(Image cursor, Point hotSpot, String name)
             throws IndexOutOfBoundsException {
         super(cursor, hotSpot, name);
     }
 
+    @Override
     protected void createNativeCursor(Image im, int[] pixels, int w, int h,
                                       int xHotSpot, int yHotSpot) {
         BufferedImage bimage = new BufferedImage(w, h,
diff --git a/src/windows/classes/sun/awt/windows/WDataTransferer.java b/src/windows/classes/sun/awt/windows/WDataTransferer.java
index a5685ad..4b16e21 100644
--- a/src/windows/classes/sun/awt/windows/WDataTransferer.java
+++ b/src/windows/classes/sun/awt/windows/WDataTransferer.java
@@ -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
@@ -51,7 +51,6 @@
 
 import java.io.BufferedInputStream;
 import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.IOException;
@@ -85,7 +84,7 @@
  *
  * @since 1.3.1
  */
-public class WDataTransferer extends DataTransferer {
+final class WDataTransferer extends DataTransferer {
     private static final String[] predefinedClipboardNames = {
             "",
             "TEXT",
@@ -159,17 +158,14 @@
 
     private static WDataTransferer transferer;
 
-    public static WDataTransferer getInstanceImpl() {
+    static synchronized WDataTransferer getInstanceImpl() {
         if (transferer == null) {
-            synchronized (WDataTransferer.class) {
-                if (transferer == null) {
-                    transferer = new WDataTransferer();
-                }
-            }
+            transferer = new WDataTransferer();
         }
         return transferer;
     }
 
+    @Override
     public SortedMap <Long, DataFlavor> getFormatsForFlavors(
             DataFlavor[] flavors, FlavorTable map)
     {
@@ -183,10 +179,12 @@
         return retval;
     }
 
+    @Override
     public String getDefaultUnicodeEncoding() {
         return "utf-16le";
     }
 
+    @Override
     public byte[] translateTransferable(Transferable contents,
                                         DataFlavor flavor,
                                         long format) throws IOException
@@ -224,6 +222,7 @@
     }
 
     // The stream is closed as a closable object
+    @Override
     public Object translateStream(InputStream str,
                                  DataFlavor flavor, long format,
                                  Transferable localeTransferable)
@@ -239,6 +238,7 @@
 
     }
 
+    @Override
     public Object translateBytes(byte[] bytes, DataFlavor flavor, long format,
         Transferable localeTransferable) throws IOException
     {
@@ -286,14 +286,17 @@
 
     }
 
+    @Override
     public boolean isLocaleDependentTextFormat(long format) {
         return format == CF_TEXT || format == CFSTR_INETURL;
     }
 
+    @Override
     public boolean isFileFormat(long format) {
         return format == CF_HDROP || format == CF_FILEGROUPDESCRIPTORA || format == CF_FILEGROUPDESCRIPTORW;
     }
 
+    @Override
     protected Long getFormatForNativeAsLong(String str) {
         Long format = predefinedClipboardNameMap.get(str);
         if (format == null) {
@@ -302,6 +305,7 @@
         return format;
     }
 
+    @Override
     protected String getNativeForFormat(long format) {
         return (format < predefinedClipboardNames.length)
                 ? predefinedClipboardNames[(int)format]
@@ -311,6 +315,7 @@
     private final ToolkitThreadBlockedHandler handler =
             new WToolkitThreadBlockedHandler();
 
+    @Override
     public ToolkitThreadBlockedHandler getToolkitThreadBlockedHandler() {
         return handler;
     }
@@ -327,12 +332,14 @@
      */
     private static native String getClipboardFormatName(long format);
 
+    @Override
     public boolean isImageFormat(long format) {
         return format == CF_DIB || format == CF_ENHMETAFILE ||
                 format == CF_METAFILEPICT || format == CF_PNG ||
                 format == CF_JFIF;
     }
 
+    @Override
     protected byte[] imageToPlatformBytes(Image image, long format)
             throws IOException {
         String mimeType = null;
@@ -406,6 +413,7 @@
 
     private static final byte [] UNICODE_NULL_TERMINATOR =  new byte [] {0,0};
 
+    @Override
     protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList)
             throws IOException
     {
@@ -443,6 +451,7 @@
      * Translates either a byte array or an input stream which contain
      * platform-specific image data in the given format into an Image.
      */
+    @Override
     protected Image platformImageBytesToImage(byte[] bytes, long format)
             throws IOException {
         String mimeType = null;
@@ -482,12 +491,14 @@
                                                        long format)
             throws IOException;
 
+    @Override
     protected native String[] dragQueryFile(byte[] bytes);
 }
 
 final class WToolkitThreadBlockedHandler extends Mutex
         implements ToolkitThreadBlockedHandler {
 
+    @Override
     public void enter() {
         if (!isOwned()) {
             throw new IllegalMonitorStateException();
@@ -497,6 +508,7 @@
         lock();
     }
 
+    @Override
     public void exit() {
         if (!isOwned()) {
             throw new IllegalMonitorStateException();
@@ -880,6 +892,7 @@
         descriptionParsed = true;
     }
 
+    @Override
     public synchronized int read() throws IOException {
         if( closed ){
             throw new IOException("Stream closed");
@@ -900,6 +913,7 @@
         return retval;
     }
 
+    @Override
     public synchronized void close() throws IOException {
         if( !closed ){
             closed = true;
diff --git a/src/windows/classes/sun/awt/windows/WDefaultFontCharset.java b/src/windows/classes/sun/awt/windows/WDefaultFontCharset.java
index cf71e52..7632e17 100644
--- a/src/windows/classes/sun/awt/windows/WDefaultFontCharset.java
+++ b/src/windows/classes/sun/awt/windows/WDefaultFontCharset.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, 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
@@ -27,7 +27,7 @@
 import java.nio.charset.*;
 import sun.awt.AWTCharset;
 
-public class WDefaultFontCharset extends AWTCharset
+final class WDefaultFontCharset extends AWTCharset
 {
     static {
        initIDs();
@@ -36,22 +36,24 @@
     // Name for Windows FontSet.
     private String fontName;
 
-    public WDefaultFontCharset(String name){
+    WDefaultFontCharset(String name){
         super("WDefaultFontCharset", Charset.forName("windows-1252"));
         fontName = name;
     }
 
+    @Override
     public CharsetEncoder newEncoder() {
         return new Encoder();
     }
 
     private class Encoder extends AWTCharset.Encoder {
+        @Override
         public boolean canEncode(char c){
             return canConvert(c);
         }
     }
 
-    public synchronized native boolean canConvert(char ch);
+    private synchronized native boolean canConvert(char ch);
 
     /**
      * Initialize JNI field and method IDs
diff --git a/src/windows/classes/sun/awt/windows/WDesktopPeer.java b/src/windows/classes/sun/awt/windows/WDesktopPeer.java
index 8661f61..c3d68c7 100644
--- a/src/windows/classes/sun/awt/windows/WDesktopPeer.java
+++ b/src/windows/classes/sun/awt/windows/WDesktopPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -39,33 +39,39 @@
  *
  * @see DesktopPeer
  */
-public class WDesktopPeer implements DesktopPeer {
+final class WDesktopPeer implements DesktopPeer {
     /* Contants for the operation verbs */
     private static String ACTION_OPEN_VERB = "open";
     private static String ACTION_EDIT_VERB = "edit";
     private static String ACTION_PRINT_VERB = "print";
 
+    @Override
     public boolean isSupported(Action action) {
         // OPEN, EDIT, PRINT, MAIL, BROWSE all supported on windows.
         return true;
     }
 
+    @Override
     public void open(File file) throws IOException {
         this.ShellExecute(file, ACTION_OPEN_VERB);
     }
 
+    @Override
     public void edit(File file) throws IOException {
         this.ShellExecute(file, ACTION_EDIT_VERB);
     }
 
+    @Override
     public void print(File file) throws IOException {
         this.ShellExecute(file, ACTION_PRINT_VERB);
     }
 
+    @Override
     public void mail(URI uri) throws IOException {
         this.ShellExecute(uri, ACTION_OPEN_VERB);
     }
 
+    @Override
     public void browse(URI uri) throws IOException {
         this.ShellExecute(uri, ACTION_OPEN_VERB);
     }
diff --git a/src/windows/classes/sun/awt/windows/WDesktopProperties.java b/src/windows/classes/sun/awt/windows/WDesktopProperties.java
index 6ed8737..367bb12 100644
--- a/src/windows/classes/sun/awt/windows/WDesktopProperties.java
+++ b/src/windows/classes/sun/awt/windows/WDesktopProperties.java
@@ -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
@@ -52,7 +52,7 @@
  * like the Windows Pluggable Look-and-Feel can better adapt
  * itself when running on a Windows platform.
  */
-class WDesktopProperties {
+final class WDesktopProperties {
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WDesktopProperties");
     private static final String PREFIX = "win.";
     private static final String FILE_PREFIX = "awt.file.";
@@ -210,6 +210,7 @@
             this.winEventName = winEventName;
         }
 
+        @Override
         public void run() {
             WDesktopProperties.this.playWindowsSound(winEventName);
         }
diff --git a/src/windows/classes/sun/awt/windows/WDialogPeer.java b/src/windows/classes/sun/awt/windows/WDialogPeer.java
index 673e39f..390ec6e 100644
--- a/src/windows/classes/sun/awt/windows/WDialogPeer.java
+++ b/src/windows/classes/sun/awt/windows/WDialogPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, 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
@@ -24,14 +24,13 @@
  */
 package sun.awt.windows;
 
-import java.util.*;
 import java.awt.*;
 import java.awt.peer.*;
 
 import sun.awt.*;
 import sun.awt.im.*;
 
-class WDialogPeer extends WWindowPeer implements DialogPeer {
+final class WDialogPeer extends WWindowPeer implements DialogPeer {
     // Toolkit & peer internals
 
     // Platform default background for dialogs.  Gets set on target if
@@ -54,6 +53,7 @@
     }
 
     native void createAwtDialog(WComponentPeer parent);
+    @Override
     void create(WComponentPeer parent) {
         preCreate(parent);
         createAwtDialog(parent);
@@ -62,6 +62,7 @@
     native void showModal();
     native void endModal();
 
+    @Override
     void initialize() {
         Dialog target = (Dialog)this.target;
         // Need to set target's background to default _before_ a call
@@ -78,6 +79,7 @@
         setResizable(target.isResizable());
     }
 
+    @Override
     protected void realShow() {
         Dialog dlg = (Dialog)target;
         if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
@@ -87,8 +89,9 @@
         }
     }
 
+    @Override
     @SuppressWarnings("deprecation")
-    public void hide() {
+    void hide() {
         Dialog dlg = (Dialog)target;
         if (dlg.getModalityType() != Dialog.ModalityType.MODELESS) {
             endModal();
@@ -97,6 +100,7 @@
         }
     }
 
+    @Override
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
             WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@@ -106,6 +110,7 @@
         }
     }
 
+    @Override
     public Dimension getMinimumSize() {
         if (((Dialog)target).isUndecorated()) {
             return super.getMinimumSize();
@@ -119,6 +124,7 @@
         return ((Dialog)target).isUndecorated();
     }
 
+    @Override
     public void reshape(int x, int y, int width, int height) {
         if (((Dialog)target).isUndecorated()) {
             super.reshape(x, y, width, height);
diff --git a/src/windows/classes/sun/awt/windows/WDropTargetContextPeer.java b/src/windows/classes/sun/awt/windows/WDropTargetContextPeer.java
index b5453e8..b6d33b0 100644
--- a/src/windows/classes/sun/awt/windows/WDropTargetContextPeer.java
+++ b/src/windows/classes/sun/awt/windows/WDropTargetContextPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -79,6 +79,7 @@
         return new WDropTargetContextPeerIStream(istream);
     }
 
+    @Override
     protected Object getNativeData(long format) {
         return getData(getNativeDragContext(), format);
     }
@@ -87,14 +88,17 @@
      * signal drop complete
      */
 
+    @Override
     protected void doDropDone(boolean success, int dropAction,
                               boolean isLocal) {
         dropDone(getNativeDragContext(), success, dropAction);
     }
 
+    @Override
     protected void eventPosted(final SunDropTargetEvent e) {
         if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
             Runnable runnable = new Runnable() {
+                    @Override
                     public void run() {
                         e.getDispatcher().unregisterAllEvents();
                     }
@@ -124,7 +128,7 @@
  * package private class to handle file transfers
  */
 
-class WDropTargetContextPeerFileStream extends FileInputStream {
+final class WDropTargetContextPeerFileStream extends FileInputStream {
 
     /**
      * construct file input stream
@@ -142,6 +146,7 @@
      * close
      */
 
+    @Override
     public void close() throws IOException {
         if (stgmedium != 0) {
             super.close();
@@ -167,7 +172,7 @@
  * Package private class to access IStream objects
  */
 
-class WDropTargetContextPeerIStream extends InputStream {
+final class WDropTargetContextPeerIStream extends InputStream {
 
     /**
      * construct a WDropTargetContextPeerIStream wrapper
@@ -185,6 +190,7 @@
      * @return bytes available
      */
 
+    @Override
     public int available() throws IOException {
         if (istream == 0) throw new IOException("No IStream");
         return Available(istream);
@@ -196,6 +202,7 @@
      * read
      */
 
+    @Override
     public int read() throws IOException {
         if (istream == 0) throw new IOException("No IStream");
         return Read(istream);
@@ -207,6 +214,7 @@
      * read into buffer
      */
 
+    @Override
     public int read(byte[] b, int off, int len) throws IOException {
         if (istream == 0) throw new IOException("No IStream");
         return ReadBytes(istream, b, off, len);
@@ -218,6 +226,7 @@
      * close
      */
 
+    @Override
     public void close() throws IOException {
         if (istream != 0) {
             super.close();
diff --git a/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java b/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java
index 269c06b..25d45dc 100644
--- a/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java
+++ b/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -203,11 +203,11 @@
     }
 
 
-    protected native boolean isPrinterDC(long hdc);
+    private native boolean isPrinterDC(long hdc);
 
-    protected native void printBand(long hdc, byte[] data, int offset,
-                                    int sx, int sy, int swidth, int sheight,
-                                    int dx, int dy, int dwidth, int dheight);
+    private native void printBand(long hdc, byte[] data, int offset, int sx,
+                                  int sy, int swidth, int sheight, int dx,
+                                  int dy, int dwidth, int dheight);
 
     /**
      * Initialize JNI field IDs
diff --git a/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java b/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java
index 736a796..930b447 100644
--- a/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java
+++ b/src/windows/classes/sun/awt/windows/WEmbeddedFramePeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -38,12 +38,15 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
     // suppress printing of an embedded frame.
+    @Override
     public void print(Graphics g) {}
 
     // supress calling native setMinSize()
+    @Override
     public void updateMinimumSize() {}
 
     @Override
@@ -59,10 +62,12 @@
         ((EmbeddedFrame)target).notifyModalBlocked(blocker, false);
     }
 
+    @Override
     public void setBoundsPrivate(int x, int y, int width, int height) {
         setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK);
     }
 
+    @Override
     public native Rectangle getBoundsPrivate();
 
     @Override
diff --git a/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
index bac55be..beeb103 100644
--- a/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
+++ b/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -34,11 +34,10 @@
 import java.util.ResourceBundle;
 import java.util.MissingResourceException;
 import java.util.Vector;
-import sun.awt.AppContext;
 import sun.awt.CausedFocusEvent;
 import sun.awt.AWTAccessor;
 
-public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
+final class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
 
     static {
         initIDs();
@@ -47,11 +46,12 @@
     private WComponentPeer parent;
     private FilenameFilter fileFilter;
 
-    private Vector<WWindowPeer> blockedWindows = new Vector<WWindowPeer>();
+    private Vector<WWindowPeer> blockedWindows = new Vector<>();
 
     //Needed to fix 4152317
     private static native void setFilterString(String allFilter);
 
+    @Override
     public void setFilenameFilter(FilenameFilter filter) {
         this.fileFilter = filter;
     }
@@ -70,19 +70,23 @@
         super(target);
     }
 
+    @Override
     void create(WComponentPeer parent) {
         this.parent = parent;
     }
 
     // don't use checkCreation() from WComponentPeer to avoid hwnd check
+    @Override
     protected void checkCreation() {
     }
 
+    @Override
     void initialize() {
         setFilenameFilter(((FileDialog) target).getFilenameFilter());
     }
 
     private native void _dispose();
+    @Override
     protected void disposeImpl() {
         WToolkit.targetDisposedPeer(target, this);
         _dispose();
@@ -91,15 +95,18 @@
     private native void _show();
     private native void _hide();
 
+    @Override
     public void show() {
         new Thread(new Runnable() {
+            @Override
             public void run() {
                 _show();
             }
         }).start();
     }
 
-    public void hide() {
+    @Override
+    void hide() {
         _hide();
     }
 
@@ -169,6 +176,7 @@
         fileDialogAccessor.setFiles(fileDialog, jFiles);
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
+             @Override
              public void run() {
                  fileDialog.setVisible(false);
              }
@@ -185,6 +193,7 @@
         AWTAccessor.getFileDialogAccessor().setDirectory(fileDialog, null);
 
         WToolkit.executeOnEventHandlerThread(fileDialog, new Runnable() {
+             @Override
              public void run() {
                  fileDialog.setVisible(false);
              }
@@ -195,6 +204,7 @@
     static {
         String filterString = AccessController.doPrivileged(
             new PrivilegedAction<String>() {
+                @Override
                 public String run() {
                     try {
                         ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
@@ -224,6 +234,7 @@
         }
     }
 
+    @Override
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
             WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@@ -233,31 +244,47 @@
         }
     }
 
+    @Override
     public native void toFront();
+    @Override
     public native void toBack();
 
     // unused methods.  Overridden to disable this functionality as
     // it requires HWND which is not available for FileDialog
+    @Override
     public void updateAlwaysOnTopState() {}
+    @Override
     public void setDirectory(String dir) {}
+    @Override
     public void setFile(String file) {}
+    @Override
     public void setTitle(String title) {}
 
+    @Override
     public void setResizable(boolean resizable) {}
-    public void enable() {}
-    public void disable() {}
+    @Override
+    void enable() {}
+    @Override
+    void disable() {}
+    @Override
     public void reshape(int x, int y, int width, int height) {}
     public boolean handleEvent(Event e) { return false; }
+    @Override
     public void setForeground(Color c) {}
+    @Override
     public void setBackground(Color c) {}
+    @Override
     public void setFont(Font f) {}
+    @Override
     public void updateMinimumSize() {}
+    @Override
     public void updateIconImages() {}
     public boolean requestFocus(boolean temporary,
                                 boolean focusedWindowChangeAllowed) {
         return false;
     }
 
+    @Override
     public boolean requestFocus
          (Component lightweightChild, boolean temporary,
           boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
@@ -265,13 +292,20 @@
         return false;
     }
 
+    @Override
     void start() {}
+    @Override
     public void beginValidate() {}
+    @Override
     public void endValidate() {}
     void invalidate(int x, int y, int width, int height) {}
+    @Override
     public void addDropTarget(DropTarget dt) {}
+    @Override
     public void removeDropTarget(DropTarget dt) {}
+    @Override
     public void updateFocusableWindowState() {}
+    @Override
     public void setZOrder(ComponentPeer above) {}
 
     /**
@@ -280,8 +314,11 @@
     private static native void initIDs();
 
     // The effects are not supported for system dialogs.
+    @Override
     public void applyShape(sun.java2d.pipe.Region shape) {}
+    @Override
     public void setOpacity(float opacity) {}
+    @Override
     public void setOpaque(boolean isOpaque) {}
     public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
 
diff --git a/src/windows/classes/sun/awt/windows/WFontConfiguration.java b/src/windows/classes/sun/awt/windows/WFontConfiguration.java
index 53be0d1..7315b97 100644
--- a/src/windows/classes/sun/awt/windows/WFontConfiguration.java
+++ b/src/windows/classes/sun/awt/windows/WFontConfiguration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2005, 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
@@ -29,12 +29,10 @@
 import java.util.Hashtable;
 import sun.awt.FontDescriptor;
 import sun.awt.FontConfiguration;
-import sun.font.FontManager;
 import sun.font.SunFontManager;
-import sun.java2d.SunGraphicsEnvironment;
 import java.nio.charset.*;
 
-public class WFontConfiguration extends FontConfiguration {
+public final class WFontConfiguration extends FontConfiguration {
 
     // whether compatibility fallbacks for TimesRoman and Co. are used
     private boolean useCompatibilityFallbacks;
@@ -52,6 +50,7 @@
         useCompatibilityFallbacks = "windows-1252".equals(encoding);
     }
 
+    @Override
     protected void initReorderMap() {
         if (encoding.equalsIgnoreCase("windows-31j")) {
             localeMap = new Hashtable();
@@ -81,6 +80,7 @@
 //      reorderMap.put("windows-1252", "alphabetic");
     }
 
+    @Override
     protected void setOsNameAndVersion(){
         super.setOsNameAndVersion();
         if (osName.startsWith("Windows")){
@@ -103,6 +103,7 @@
     }
 
     // overrides FontConfiguration.getFallbackFamilyName
+    @Override
     public String getFallbackFamilyName(String fontName, String defaultFallback) {
         // maintain compatibility with old font.properties files, where
         // default file had aliases for timesroman & Co, while others didn't.
@@ -115,6 +116,7 @@
         return defaultFallback;
     }
 
+    @Override
     protected String makeAWTFontName(String platformFontName, String characterSubsetName) {
         String windowsCharset = (String) subsetCharsetMap.get(characterSubsetName);
         if (windowsCharset == null) {
@@ -123,6 +125,7 @@
         return platformFontName + "," + windowsCharset;
     }
 
+    @Override
     protected String getEncoding(String awtFontName, String characterSubsetName) {
         String encoding = (String) subsetEncodingMap.get(characterSubsetName);
         if (encoding == null) {
@@ -131,15 +134,18 @@
         return encoding;
     }
 
+    @Override
     protected Charset getDefaultFontCharset(String fontName) {
         return new WDefaultFontCharset(fontName);
     }
 
+    @Override
     public String getFaceNameFromComponentFontName(String componentFontName) {
         // for Windows, the platform name is the face name
         return componentFontName;
     }
 
+    @Override
     protected String getFileNameFromComponentFontName(String componentFontName) {
         return getFileNameFromPlatformName(componentFontName);
     }
diff --git a/src/windows/classes/sun/awt/windows/WFontMetrics.java b/src/windows/classes/sun/awt/windows/WFontMetrics.java
index 0e24737..b92f3b0 100644
--- a/src/windows/classes/sun/awt/windows/WFontMetrics.java
+++ b/src/windows/classes/sun/awt/windows/WFontMetrics.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1997, 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
@@ -33,7 +33,7 @@
  *
  * @author Jim Graham
  */
-class WFontMetrics extends FontMetrics {
+final class WFontMetrics extends FontMetrics {
 
     static {
         initIDs();
@@ -117,6 +117,7 @@
     /**
      * Get leading
      */
+    @Override
     public int getLeading() {
         return leading;
     }
@@ -124,6 +125,7 @@
     /**
      * Get ascent.
      */
+    @Override
     public int getAscent() {
         return ascent;
     }
@@ -131,6 +133,7 @@
     /**
      * Get descent
      */
+    @Override
     public int getDescent() {
         return descent;
     }
@@ -138,6 +141,7 @@
     /**
      * Get height
      */
+    @Override
     public int getHeight() {
         return height;
     }
@@ -145,6 +149,7 @@
     /**
      * Get maxAscent
      */
+    @Override
     public int getMaxAscent() {
         return maxAscent;
     }
@@ -152,6 +157,7 @@
     /**
      * Get maxDescent
      */
+    @Override
     public int getMaxDescent() {
         return maxDescent;
     }
@@ -159,6 +165,7 @@
     /**
      * Get maxAdvance
      */
+    @Override
     public int getMaxAdvance() {
         return maxAdvance;
     }
@@ -166,21 +173,25 @@
     /**
      * Return the width of the specified string in this Font.
      */
+    @Override
     public native int stringWidth(String str);
 
     /**
      * Return the width of the specified char[] in this Font.
      */
+    @Override
     public native int charsWidth(char data[], int off, int len);
 
     /**
      * Return the width of the specified byte[] in this Font.
      */
+    @Override
     public native int bytesWidth(byte data[], int off, int len);
 
     /**
      * Get the widths of the first 256 characters in the font.
      */
+    @Override
     public int[] getWidths() {
         return widths;
     }
diff --git a/src/windows/classes/sun/awt/windows/WFontPeer.java b/src/windows/classes/sun/awt/windows/WFontPeer.java
index 65991d0..7b8305f 100644
--- a/src/windows/classes/sun/awt/windows/WFontPeer.java
+++ b/src/windows/classes/sun/awt/windows/WFontPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2007, 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
@@ -27,7 +27,7 @@
 
 import sun.awt.PlatformFont;
 
-public class WFontPeer extends PlatformFont {
+final class WFontPeer extends PlatformFont {
 
     private String textComponentFontName;
 
@@ -38,6 +38,7 @@
         }
     }
 
+    @Override
     protected char getMissingGlyphCharacter() {
         return '\u2751';
     }
diff --git a/src/windows/classes/sun/awt/windows/WFramePeer.java b/src/windows/classes/sun/awt/windows/WFramePeer.java
index 9a64d07..37486e1 100644
--- a/src/windows/classes/sun/awt/windows/WFramePeer.java
+++ b/src/windows/classes/sun/awt/windows/WFramePeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -41,7 +41,9 @@
     private static native void initIDs();
 
     // FramePeer implementation
+    @Override
     public native void setState(int state);
+    @Override
     public native int getState();
 
     // sync target and peer
@@ -62,6 +64,7 @@
             new GetPropertyAction(
             "sun.awt.keepWorkingSetOnMinimize")));
 
+    @Override
     public void setMaximizedBounds(Rectangle b) {
         if (b == null) {
             clearMaximizedBounds();
@@ -123,6 +126,7 @@
         return ((Frame)target).isUndecorated();
     }
 
+    @Override
     public void reshape(int x, int y, int width, int height) {
         if (((Frame)target).isUndecorated()) {
             super.reshape(x, y, width, height);
@@ -131,6 +135,7 @@
         }
     }
 
+    @Override
     public Dimension getMinimumSize() {
         Dimension d = new Dimension();
         if (!((Frame)target).isUndecorated()) {
@@ -145,6 +150,7 @@
     // Note: Because this method calls resize(), which may be overridden
     // by client code, this method must not be executed on the toolkit
     // thread.
+    @Override
     public void setMenuBar(MenuBar mb) {
         WMenuBarPeer mbPeer = (WMenuBarPeer) WToolkit.targetToPeer(mb);
         setMenuBar0(mbPeer);
@@ -170,11 +176,13 @@
     }
 
     native void createAwtFrame(WComponentPeer parent);
+    @Override
     void create(WComponentPeer parent) {
         preCreate(parent);
         createAwtFrame(parent);
     }
 
+    @Override
     void initialize() {
         super.initialize();
 
@@ -194,14 +202,17 @@
       InputMethodManager.getInstance().notifyChangeRequest((Component)target);
     }
 
+    @Override
     public void setBoundsPrivate(int x, int y, int width, int height) {
         setBounds(x, y, width, height, SET_BOUNDS);
     }
+    @Override
     public Rectangle getBoundsPrivate() {
         return getBounds();
     }
 
     // TODO: implement it in peers. WLightweightFramePeer may implement lw version.
+    @Override
     public void emulateActivation(boolean activate) {
         synthesizeWmActivate(activate);
     }
diff --git a/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java b/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java
index b579f15..b4eb652 100644
--- a/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java
+++ b/src/windows/classes/sun/awt/windows/WGlobalCursorManager.java
@@ -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
@@ -28,7 +28,7 @@
 import java.awt.*;
 import sun.awt.GlobalCursorManager;
 
-public final class WGlobalCursorManager extends GlobalCursorManager {
+final class WGlobalCursorManager extends GlobalCursorManager {
     private static WGlobalCursorManager manager;
 
     public static GlobalCursorManager getCursorManager() {
@@ -46,12 +46,16 @@
         WGlobalCursorManager.getCursorManager().updateCursorLater(heavy);
     }
 
+    @Override
     protected native void setCursor(Component comp, Cursor cursor, boolean u);
+    @Override
     protected native void getCursorPos(Point p);
     /*
      * two native methods to call corresponding methods in Container and
      * Component
      */
+    @Override
     protected native Component findHeavyweightUnderCursor(boolean useCache);
+    @Override
     protected native Point getLocationOnScreen(Component com);
 }
diff --git a/src/windows/classes/sun/awt/windows/WInputMethod.java b/src/windows/classes/sun/awt/windows/WInputMethod.java
index 4e76b1d..de7c478 100644
--- a/src/windows/classes/sun/awt/windows/WInputMethod.java
+++ b/src/windows/classes/sun/awt/windows/WInputMethod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, 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
@@ -42,7 +42,7 @@
 import java.util.Map;
 import sun.awt.im.InputMethodAdapter;
 
-public class WInputMethod extends InputMethodAdapter
+final class WInputMethod extends InputMethodAdapter
 {
     /**
      * The input method context, which is used to dispatch input method
@@ -127,6 +127,7 @@
         }
     }
 
+    @Override
     protected void finalize() throws Throwable
     {
         // Release the resources used by the native input context.
@@ -137,10 +138,12 @@
         super.finalize();
     }
 
+    @Override
     public synchronized void setInputMethodContext(InputMethodContext context) {
         inputContext = context;
     }
 
+    @Override
     public final void dispose() {
         // Due to a memory management problem in Windows 98, we should retain
         // the native input context until this object is finalized. So do
@@ -152,10 +155,12 @@
      *
      * @see java.awt.im.spi.InputMethod#getControlObject
      */
+    @Override
     public Object getControlObject() {
         return null;
     }
 
+    @Override
     public boolean setLocale(Locale lang) {
         return setLocale(lang, false);
     }
@@ -178,6 +183,7 @@
         return false;
     }
 
+    @Override
     public Locale getLocale() {
         if (isActive) {
             currentLocale = getNativeLocale();
@@ -193,6 +199,7 @@
      *
      * @see java.awt.im.spi.InputMethod#setCharacterSubsets
      */
+    @Override
     public void setCharacterSubsets(Subset[] subsets) {
         if (subsets == null){
             setConversionStatus(context, cmode);
@@ -266,6 +273,7 @@
         }
     }
 
+    @Override
     public void dispatchEvent(AWTEvent e) {
         if (e instanceof ComponentEvent) {
             Component comp = ((ComponentEvent) e).getComponent();
@@ -281,6 +289,7 @@
         }
     }
 
+    @Override
     public void activate() {
         boolean isAc = haveActiveClient();
 
@@ -317,6 +326,7 @@
 
     }
 
+    @Override
     public void deactivate(boolean isTemporary)
     {
         // Sync currentLocale with the Windows keyboard layout which might be changed
@@ -336,6 +346,7 @@
      * Explicitly disable the native IME. Native IME is not disabled when
      * deactivate is called.
      */
+    @Override
     public void disableInputMethod() {
         if (lastFocussedComponentPeer != null) {
             disableNativeIME(lastFocussedComponentPeer);
@@ -348,6 +359,7 @@
      * Returns a string with information about the windows input method,
      * or null.
      */
+    @Override
     public String getNativeInputMethodInfo() {
         return getNativeIMMDescription();
     }
@@ -358,6 +370,7 @@
      * Calling stopListening to give other input method the keybaord input
      * focus.
      */
+    @Override
     protected void stopListening() {
         // Since the native input method is not disabled when deactivate is
         // called, we need to call disableInputMethod to explicitly turn off the
@@ -366,6 +379,7 @@
     }
 
     // implements sun.awt.im.InputMethodAdapter.setAWTFocussedComponent
+    @Override
     protected void setAWTFocussedComponent(Component component) {
         if (component == null) {
             return;
@@ -386,6 +400,7 @@
     }
 
     // implements java.awt.im.spi.InputMethod.hideWindows
+    @Override
     public void hideWindows() {
         if (awtFocussedComponentPeer != null) {
             /* Hide the native status window including the Windows language
@@ -401,6 +416,7 @@
     /**
      * @see java.awt.im.spi.InputMethod#removeNotify
      */
+    @Override
     public void removeNotify() {
         endCompositionNative(context, DISCARD_INPUT);
         awtFocussedComponent = null;
@@ -427,10 +443,12 @@
     }
 
     // see sun.awt.im.InputMethodAdapter.supportsBelowTheSpot
+    @Override
     protected boolean supportsBelowTheSpot() {
         return true;
     }
 
+    @Override
     public void endComposition()
     {
         //right now the native endCompositionNative() just cancel
@@ -442,6 +460,7 @@
     /**
      * @see java.awt.im.spi.InputMethod#setCompositionEnabled(boolean)
      */
+    @Override
     public void setCompositionEnabled(boolean enable) {
         setOpenStatus(context, enable);
     }
@@ -449,6 +468,7 @@
     /**
      * @see java.awt.im.spi.InputMethod#isCompositionEnabled
      */
+    @Override
     public boolean isCompositionEnabled() {
         return getOpenStatus(context);
     }
@@ -557,6 +577,7 @@
         // AWT Event thread.  Otherwise, a potential deadlock
         // could happen.
         Runnable r = new Runnable() {
+            @Override
             public void run() {
                 int x = 0;
                 int y = 0;
diff --git a/src/windows/classes/sun/awt/windows/WInputMethodDescriptor.java b/src/windows/classes/sun/awt/windows/WInputMethodDescriptor.java
index 0d33c45..1885b0a 100644
--- a/src/windows/classes/sun/awt/windows/WInputMethodDescriptor.java
+++ b/src/windows/classes/sun/awt/windows/WInputMethodDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2007, 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
@@ -40,11 +40,12 @@
  * @since JDK1.3
  */
 
-class WInputMethodDescriptor implements InputMethodDescriptor {
+final class WInputMethodDescriptor implements InputMethodDescriptor {
 
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#getAvailableLocales
      */
+    @Override
     public Locale[] getAvailableLocales() {
         // returns a copy of internal list for public API
         Locale[] locales = getAvailableLocalesInternal();
@@ -60,6 +61,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList
      */
+    @Override
     public boolean hasDynamicLocaleList() {
         return true;
     }
@@ -67,6 +69,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
      */
+    @Override
     public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
         // We ignore the input locale.
         // When displaying for the default locale, rely on the localized AWT properties;
@@ -81,6 +84,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodIcon
      */
+    @Override
     public Image getInputMethodIcon(Locale inputLocale) {
         return null;
     }
@@ -88,6 +92,7 @@
     /**
      * @see java.awt.im.spi.InputMethodDescriptor#createInputMethod
      */
+    @Override
     public InputMethod createInputMethod() throws Exception {
         return new WInputMethod();
     }
diff --git a/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java b/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java
index 34ba53f..20b515b 100644
--- a/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java
+++ b/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -31,7 +31,7 @@
 import sun.awt.KeyboardFocusManagerPeerImpl;
 import sun.awt.CausedFocusEvent;
 
-class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
+final class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
     static native void setNativeFocusOwner(ComponentPeer peer);
     static native Component getNativeFocusOwner();
     static native Window getNativeFocusedWindow();
diff --git a/src/windows/classes/sun/awt/windows/WListPeer.java b/src/windows/classes/sun/awt/windows/WListPeer.java
index 0c090b5..96ce7da 100644
--- a/src/windows/classes/sun/awt/windows/WListPeer.java
+++ b/src/windows/classes/sun/awt/windows/WListPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -31,12 +31,14 @@
 
 final class WListPeer extends WComponentPeer implements ListPeer {
 
+    @Override
     public boolean isFocusable() {
         return true;
     }
 
     // ListPeer implementation
 
+    @Override
     public int[] getSelectedIndexes() {
         List l = (List)target;
         int len = l.countItems();
@@ -53,26 +55,31 @@
     }
 
     /* New method name for 1.1 */
+    @Override
     public void add(String item, int index) {
         addItem(item, index);
     }
 
     /* New method name for 1.1 */
+    @Override
     public void removeAll() {
         clear();
     }
 
     /* New method name for 1.1 */
+    @Override
     public void setMultipleMode (boolean b) {
         setMultipleSelections(b);
     }
 
     /* New method name for 1.1 */
+    @Override
     public Dimension getPreferredSize(int rows) {
         return preferredSize(rows);
     }
 
     /* New method name for 1.1 */
+    @Override
     public Dimension getMinimumSize(int rows) {
         return minimumSize(rows);
     }
@@ -83,13 +90,17 @@
     }
     native void addItems(String[] items, int index, int width);
 
+    @Override
     public native void delItems(int start, int end);
     public void clear() {
         List l = (List)target;
         delItems(0, l.countItems());
     }
+    @Override
     public native void select(int index);
+    @Override
     public native void deselect(int index);
+    @Override
     public native void makeVisible(int index);
     public native void setMultipleSelections(boolean v);
     public native int  getMaxWidth();
@@ -114,8 +125,10 @@
         super(target);
     }
 
+    @Override
     native void create(WComponentPeer parent);
 
+    @Override
     void initialize() {
         List li = (List)target;
 
@@ -169,6 +182,7 @@
         super.initialize();
     }
 
+    @Override
     public boolean shouldClearRectBeforePaint() {
         return false;
     }
@@ -178,7 +192,8 @@
     /*public*/ native boolean isSelected(int index);
 
     // update the fontmetrics when the font changes
-    public synchronized void _setFont(Font f)
+    @Override
+    synchronized void _setFont(Font f)
     {
         super._setFont( f );
             fm = getFontMetrics( ((List)target).getFont() );
@@ -190,6 +205,7 @@
     void handleAction(final int index, final long when, final int modifiers) {
         final List l = (List)target;
         WToolkit.executeOnEventHandlerThread(l, new Runnable() {
+            @Override
             public void run() {
                 l.select(index);
                 postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
@@ -201,6 +217,7 @@
     void handleListChanged(final int index) {
         final List l = (List)target;
         WToolkit.executeOnEventHandlerThread(l, new Runnable() {
+            @Override
             public void run() {
                 postEvent(new ItemEvent(l, ItemEvent.ITEM_STATE_CHANGED,
                                 Integer.valueOf(index),
diff --git a/src/windows/classes/sun/awt/windows/WMenuBarPeer.java b/src/windows/classes/sun/awt/windows/WMenuBarPeer.java
index c7ec3fb..3a661da 100644
--- a/src/windows/classes/sun/awt/windows/WMenuBarPeer.java
+++ b/src/windows/classes/sun/awt/windows/WMenuBarPeer.java
@@ -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
@@ -27,13 +27,16 @@
 import java.awt.*;
 import java.awt.peer.*;
 
-class WMenuBarPeer extends WMenuPeer implements MenuBarPeer {
+final class WMenuBarPeer extends WMenuPeer implements MenuBarPeer {
 
     // MenuBarPeer implementation
 
+    @Override
     public native void addMenu(Menu m);
+    @Override
     public native void delMenu(int index);
 
+    @Override
     public void addHelpMenu(Menu m) {
         addMenu(m);
     }
diff --git a/src/windows/classes/sun/awt/windows/WMenuPeer.java b/src/windows/classes/sun/awt/windows/WMenuPeer.java
index f29c043..567af92 100644
--- a/src/windows/classes/sun/awt/windows/WMenuPeer.java
+++ b/src/windows/classes/sun/awt/windows/WMenuPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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
@@ -31,10 +31,13 @@
 
     // MenuPeer implementation
 
+    @Override
     public native void addSeparator();
+    @Override
     public void addItem(MenuItem item) {
         WMenuItemPeer itemPeer = (WMenuItemPeer) WToolkit.targetToPeer(item);
     }
+    @Override
     public native void delItem(int index);
 
     // Toolkit & peer internals
diff --git a/src/windows/classes/sun/awt/windows/WMouseDragGestureRecognizer.java b/src/windows/classes/sun/awt/windows/WMouseDragGestureRecognizer.java
index 91bb5e8..22b0da1 100644
--- a/src/windows/classes/sun/awt/windows/WMouseDragGestureRecognizer.java
+++ b/src/windows/classes/sun/awt/windows/WMouseDragGestureRecognizer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, 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
@@ -25,19 +25,14 @@
 
 package sun.awt.windows;
 
-import java.awt.Toolkit;
 import java.awt.Component;
-
 import java.awt.Point;
 import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureListener;
 import java.awt.dnd.DragSource;
 import java.awt.dnd.MouseDragGestureRecognizer;
-import java.awt.dnd.DragGestureListener;
-
 import java.awt.event.InputEvent;
 import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
 
 import sun.awt.dnd.SunDragSourceContextPeer;
 
@@ -54,7 +49,7 @@
  * @see java.awt.dnd.DragSource
  */
 
-class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
+final class WMouseDragGestureRecognizer extends MouseDragGestureRecognizer {
 
     private static final long serialVersionUID = -3527844310018033570L;
 
@@ -140,6 +135,7 @@
      * Invoked when the mouse has been clicked on a component.
      */
 
+    @Override
     public void mouseClicked(MouseEvent e) {
         // do nothing
     }
@@ -148,6 +144,7 @@
      * Invoked when a mouse button has been pressed on a component.
      */
 
+    @Override
     public void mousePressed(MouseEvent e) {
         events.clear();
 
@@ -165,6 +162,7 @@
      * Invoked when a mouse button has been released on a component.
      */
 
+    @Override
     public void mouseReleased(MouseEvent e) {
         events.clear();
     }
@@ -173,6 +171,7 @@
      * Invoked when the mouse enters a component.
      */
 
+    @Override
     public void mouseEntered(MouseEvent e) {
         events.clear();
     }
@@ -181,6 +180,7 @@
      * Invoked when the mouse exits a component.
      */
 
+    @Override
     public void mouseExited(MouseEvent e) {
 
         if (!events.isEmpty()) { // gesture pending
@@ -196,6 +196,7 @@
      * Invoked when a mouse button is pressed on a component.
      */
 
+    @Override
     public void mouseDragged(MouseEvent e) {
         if (!events.isEmpty()) { // gesture pending
             int dop = mapDragOperationFromModifiers(e);
@@ -225,6 +226,7 @@
      * (with no buttons no down).
      */
 
+    @Override
     public void mouseMoved(MouseEvent e) {
         // do nothing
     }
diff --git a/src/windows/classes/sun/awt/windows/WPageDialog.java b/src/windows/classes/sun/awt/windows/WPageDialog.java
index 041b66b..16d707b 100644
--- a/src/windows/classes/sun/awt/windows/WPageDialog.java
+++ b/src/windows/classes/sun/awt/windows/WPageDialog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -34,7 +34,7 @@
 import java.awt.print.PageFormat;
 import java.awt.print.Printable;
 
-public class WPageDialog extends WPrintDialog {
+final class WPageDialog extends WPrintDialog {
     static {
         initIDs();
     }
@@ -55,6 +55,7 @@
         this.painter = painter;
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized(getTreeLock()) {
diff --git a/src/windows/classes/sun/awt/windows/WPageDialogPeer.java b/src/windows/classes/sun/awt/windows/WPageDialogPeer.java
index 6c90904..78a1c04 100644
--- a/src/windows/classes/sun/awt/windows/WPageDialogPeer.java
+++ b/src/windows/classes/sun/awt/windows/WPageDialogPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,7 +25,7 @@
 
 package sun.awt.windows;
 
-public class WPageDialogPeer extends WPrintDialogPeer {
+final class WPageDialogPeer extends WPrintDialogPeer {
 
     WPageDialogPeer(WPageDialog target) {
         super(target);
@@ -37,8 +37,10 @@
      */
     private native boolean _show();
 
+    @Override
     public void show() {
         new Thread(new Runnable() {
+                @Override
                 public void run() {
                     // Call pageSetup even with no printer installed, this
                     // will display Windows error dialog and return false.
diff --git a/src/windows/classes/sun/awt/windows/WPanelPeer.java b/src/windows/classes/sun/awt/windows/WPanelPeer.java
index 80ae113..e6cf356 100644
--- a/src/windows/classes/sun/awt/windows/WPanelPeer.java
+++ b/src/windows/classes/sun/awt/windows/WPanelPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, 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
@@ -27,14 +27,13 @@
 import java.awt.*;
 import java.awt.peer.*;
 
-import java.util.Vector;
-
 import sun.awt.SunGraphicsCallback;
 
 class WPanelPeer extends WCanvasPeer implements PanelPeer {
 
     // ComponentPeer overrides
 
+    @Override
     public void paint(Graphics g) {
         super.paint(g);
         SunGraphicsCallback.PaintHeavyweightComponentsCallback.getInstance().
@@ -42,6 +41,7 @@
                           SunGraphicsCallback.LIGHTWEIGHTS |
                           SunGraphicsCallback.HEAVYWEIGHTS);
     }
+    @Override
     public void print(Graphics g) {
         super.print(g);
         SunGraphicsCallback.PrintHeavyweightComponentsCallback.getInstance().
@@ -52,6 +52,7 @@
 
     // ContainerPeer (via PanelPeer) implementation
 
+    @Override
     public Insets getInsets() {
         return insets_;
     }
@@ -73,6 +74,7 @@
         super(target);
     }
 
+    @Override
     void initialize() {
         super.initialize();
         insets_ = new Insets(0,0,0,0);
diff --git a/src/windows/classes/sun/awt/windows/WPathGraphics.java b/src/windows/classes/sun/awt/windows/WPathGraphics.java
index 1b43fbb..8e44064 100644
--- a/src/windows/classes/sun/awt/windows/WPathGraphics.java
+++ b/src/windows/classes/sun/awt/windows/WPathGraphics.java
@@ -74,7 +74,7 @@
 import sun.print.PathGraphics;
 import sun.print.ProxyGraphics2D;
 
-class WPathGraphics extends PathGraphics {
+final class WPathGraphics extends PathGraphics {
 
     /**
      * For a drawing application the initial user space
@@ -896,6 +896,7 @@
      * @param   handlingTransparency if being recursively called to
      *                    print opaque region of transparent image
      */
+    @Override
     protected boolean drawImageToPlatform(Image image, AffineTransform xform,
                                           Color bgcolor,
                                           int srcX, int srcY,
@@ -1335,6 +1336,7 @@
      * Have the printing application redraw everything that falls
      * within the page bounds defined by <code>region</code>.
      */
+    @Override
     public void redrawRegion(Rectangle2D region, double scaleX, double scaleY,
                              Shape savedClip, AffineTransform savedTransform)
             throws PrinterException {
@@ -1434,6 +1436,7 @@
      * with the specified color.
      * The path is provided in device coordinates.
      */
+    @Override
     protected void deviceFill(PathIterator pathIter, Color color) {
 
         WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
@@ -1448,6 +1451,7 @@
      * path defined by <code>pathIter</code>
      * The path is provided in device coordinates.
      */
+    @Override
     protected void deviceClip(PathIterator pathIter) {
 
         WPrinterJob wPrinterJob = (WPrinterJob) getPrinterJob();
@@ -1459,6 +1463,7 @@
     /**
      * Draw the bounding rectangle using transformed coordinates.
      */
+     @Override
      protected void deviceFrameRect(int x, int y, int width, int height,
                                      Color color) {
 
@@ -1548,6 +1553,7 @@
       * GDI fillRect function.
       * Boundaries are determined by the given coordinates.
       */
+    @Override
     protected void deviceFillRect(int x, int y, int width, int height,
                                   Color color) {
         /*
@@ -1584,6 +1590,7 @@
      * Draw a line using a pen created using the specified color
      * and current stroke properties.
      */
+    @Override
     protected void deviceDrawLine(int xBegin, int yBegin, int xEnd, int yEnd,
                                   Color color) {
         Stroke stroke = getStroke();
diff --git a/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java b/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java
index 2bb9ba8..6818be3 100644
--- a/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java
+++ b/src/windows/classes/sun/awt/windows/WPopupMenuPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, 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
@@ -29,12 +29,12 @@
 
 import sun.awt.AWTAccessor;
 
-public class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
+final class WPopupMenuPeer extends WMenuPeer implements PopupMenuPeer {
     // We can't use target.getParent() for TrayIcon popup
     // because this method should return null for the TrayIcon
     // popup regardless of that whether it has parent or not.
 
-    public WPopupMenuPeer(PopupMenu target) {
+    WPopupMenuPeer(PopupMenu target) {
         this.target = target;
         MenuContainer parent = null;
 
@@ -67,7 +67,7 @@
         }
     }
 
-    native void createMenu(WComponentPeer parent);
+    private native void createMenu(WComponentPeer parent);
 
     public void show(Event e) {
         Component origin = (Component)e.target;
@@ -106,5 +106,5 @@
         _show(e);
     }
 
-    public native void _show(Event e);
+    private native void _show(Event e);
 }
diff --git a/src/windows/classes/sun/awt/windows/WPrintDialog.java b/src/windows/classes/sun/awt/windows/WPrintDialog.java
index 6f07a45..c3d0295 100644
--- a/src/windows/classes/sun/awt/windows/WPrintDialog.java
+++ b/src/windows/classes/sun/awt/windows/WPrintDialog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -30,7 +30,9 @@
 
 import java.awt.print.PrinterJob;
 
-public class WPrintDialog extends Dialog {
+import sun.awt.AWTAccessor;
+
+class WPrintDialog extends Dialog {
     static {
         initIDs();
     }
@@ -38,21 +40,23 @@
     protected PrintJob job;
     protected PrinterJob pjob;
 
-    public WPrintDialog(Frame parent, PrinterJob control) {
+    WPrintDialog(Frame parent, PrinterJob control) {
         super(parent, true);
         this.pjob = control;
         setLayout(null);
     }
 
-    public WPrintDialog(Dialog parent, PrinterJob control) {
+    WPrintDialog(Dialog parent, PrinterJob control) {
         super(parent, "", true);
         this.pjob = control;
         setLayout(null);
     }
 
-    // Use native code to circumvent access restrictions on Component.peer
-    protected native void setPeer(ComponentPeer peer);
+    final void setPeer(final ComponentPeer p){
+        AWTAccessor.getComponentAccessor().setPeer(this, p);
+    }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void addNotify() {
         synchronized(getTreeLock()) {
@@ -72,11 +76,11 @@
 
     private boolean retval = false;
 
-    public void setRetVal(boolean ret) {
+    final void setRetVal(boolean ret) {
         retval = ret;
     }
 
-    public boolean getRetVal() {
+    final boolean getRetVal() {
         return retval;
     }
 
diff --git a/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java b/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
index ee116d4..d1efab0 100644
--- a/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
+++ b/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
@@ -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
@@ -30,11 +30,10 @@
 import java.awt.peer.ComponentPeer;
 import java.awt.dnd.DropTarget;
 import java.util.Vector;
-import sun.awt.AppContext;
 import sun.awt.CausedFocusEvent;
 import sun.awt.AWTAccessor;
 
-public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
+class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
 
     static {
         initIDs();
@@ -42,29 +41,34 @@
 
     private WComponentPeer parent;
 
-    private Vector<WWindowPeer> blockedWindows = new Vector<WWindowPeer>();
+    private Vector<WWindowPeer> blockedWindows = new Vector<>();
 
     WPrintDialogPeer(WPrintDialog target) {
         super(target);
     }
 
+    @Override
     void create(WComponentPeer parent) {
         this.parent = parent;
     }
 
     // fix for CR 6178323:
     // don't use checkCreation() from WComponentPeer to avoid hwnd check
+    @Override
     protected void checkCreation() {
     }
 
+    @Override
     protected void disposeImpl() {
         WToolkit.targetDisposedPeer(target, this);
     }
 
     private native boolean _show();
 
+    @Override
     public void show() {
         new Thread(new Runnable() {
+            @Override
             public void run() {
                 try {
                     ((WPrintDialog)target).setRetVal(_show());
@@ -102,6 +106,7 @@
         }
     }
 
+    @Override
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
             WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
@@ -111,28 +116,43 @@
         }
     }
 
+    @Override
     public native void toFront();
+    @Override
     public native void toBack();
 
     // unused methods.  Overridden to disable this functionality as
     // it requires HWND which is not available for FileDialog
+    @Override
     void initialize() {}
+    @Override
     public void updateAlwaysOnTopState() {}
+    @Override
     public void setResizable(boolean resizable) {}
-    public void hide() {}
-    public void enable() {}
-    public void disable() {}
+    @Override
+    void hide() {}
+    @Override
+    void enable() {}
+    @Override
+    void disable() {}
+    @Override
     public void reshape(int x, int y, int width, int height) {}
     public boolean handleEvent(Event e) { return false; }
+    @Override
     public void setForeground(Color c) {}
+    @Override
     public void setBackground(Color c) {}
+    @Override
     public void setFont(Font f) {}
+    @Override
     public void updateMinimumSize() {}
+    @Override
     public void updateIconImages() {}
     public boolean requestFocus(boolean temporary, boolean focusedWindowChangeAllowed) {
         return false;
     }
 
+    @Override
     public boolean requestFocus
          (Component lightweightChild, boolean temporary,
           boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
@@ -141,13 +161,20 @@
         return false;
     }
 
+    @Override
     public void updateFocusableWindowState() {}
+    @Override
     void start() {}
+    @Override
     public void beginValidate() {}
+    @Override
     public void endValidate() {}
     void invalidate(int x, int y, int width, int height) {}
+    @Override
     public void addDropTarget(DropTarget dt) {}
+    @Override
     public void removeDropTarget(DropTarget dt) {}
+    @Override
     public void setZOrder(ComponentPeer above) {}
 
     /**
@@ -156,8 +183,11 @@
     private static native void initIDs();
 
     // The effects are not supported for system dialogs.
+    @Override
     public void applyShape(sun.java2d.pipe.Region shape) {}
+    @Override
     public void setOpacity(float opacity) {}
+    @Override
     public void setOpaque(boolean isOpaque) {}
     public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
 
diff --git a/src/windows/classes/sun/awt/windows/WPrinterJob.java b/src/windows/classes/sun/awt/windows/WPrinterJob.java
index 6a1dfaa..5121562 100644
--- a/src/windows/classes/sun/awt/windows/WPrinterJob.java
+++ b/src/windows/classes/sun/awt/windows/WPrinterJob.java
@@ -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
@@ -57,26 +57,19 @@
 import java.awt.print.PrinterException;
 import javax.print.PrintService;
 
-import java.io.IOException;
 import java.io.File;
 
-import java.util.Hashtable;
-import java.util.Properties;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
-import sun.awt.Win32GraphicsEnvironment;
-
 import sun.print.PeekGraphics;
 import sun.print.PeekMetrics;
 
-import java.net.URL;
 import java.net.URI;
 import java.net.URISyntaxException;
 
 import javax.print.PrintServiceLookup;
 import javax.print.attribute.PrintRequestAttributeSet;
-import javax.print.attribute.HashPrintServiceAttributeSet;
 import javax.print.attribute.HashPrintRequestAttributeSet;
 import javax.print.attribute.Attribute;
 import javax.print.attribute.standard.Sides;
@@ -84,7 +77,6 @@
 import javax.print.attribute.standard.PrintQuality;
 import javax.print.attribute.standard.PrinterResolution;
 import javax.print.attribute.standard.SheetCollate;
-import javax.print.attribute.IntegerSyntax;
 import javax.print.attribute.standard.Copies;
 import javax.print.attribute.standard.Destination;
 import javax.print.attribute.standard.OrientationRequested;
@@ -92,17 +84,13 @@
 import javax.print.attribute.standard.MediaSizeName;
 import javax.print.attribute.standard.MediaSize;
 import javax.print.attribute.standard.MediaTray;
-import javax.print.attribute.standard.PrinterName;
-import javax.print.attribute.standard.JobMediaSheetsSupported;
 import javax.print.attribute.standard.PageRanges;
-import javax.print.attribute.Size2DSyntax;
 
 import sun.awt.Win32FontManager;
 
 import sun.print.RasterPrinterJob;
 import sun.print.SunAlternateMedia;
 import sun.print.SunPageSelection;
-import sun.print.SunMinMaxPage;
 import sun.print.Win32MediaTray;
 import sun.print.Win32PrintService;
 import sun.print.Win32PrintServiceLookup;
@@ -121,7 +109,8 @@
  *
  * @author Richard Blanchard
  */
-public class WPrinterJob extends RasterPrinterJob implements DisposerTarget {
+public final class WPrinterJob extends RasterPrinterJob
+        implements DisposerTarget {
 
  /* Class Constants */
 
@@ -290,6 +279,7 @@
         private long mPrintHDevMode;
         private long mPrintHDevNames;
 
+        @Override
         public void dispose() {
             WPrinterJob.deleteDC(mPrintDC, mPrintHDevMode, mPrintHDevNames);
         }
@@ -402,6 +392,7 @@
      */
     private Object disposerReferent = new Object();
 
+    @Override
     public Object getDisposerReferent() {
         return disposerReferent;
     }
@@ -430,6 +421,7 @@
      * @see java.awt.GraphicsEnvironment#isHeadless
      * @since     JDK1.2
      */
+    @Override
     public PageFormat pageDialog(PageFormat page) throws HeadlessException {
         if (GraphicsEnvironment.isHeadless()) {
             throw new HeadlessException();
@@ -570,6 +562,7 @@
      * returns true.
      * @see java.awt.GraphicsEnvironment#isHeadless
      */
+    @Override
     public boolean printDialog() throws HeadlessException {
 
         if (GraphicsEnvironment.isHeadless()) {
@@ -603,6 +596,7 @@
      * @throws PrinterException if the specified service does not support
      * 2D printing.
      */
+    @Override
     public void setPrintService(PrintService service)
         throws PrinterException {
         super.setPrintService(service);
@@ -628,6 +622,7 @@
         }
     }
 
+    @Override
     public PrintService getPrintService() {
         if (myService == null) {
             String printerName = getNativePrintService();
@@ -681,6 +676,7 @@
      * In the event that the user changes the printer using the
       dialog, then it is up to GDI to report back all changed values.
      */
+    @Override
     protected void setAttributes(PrintRequestAttributeSet attributes)
         throws PrinterException {
 
@@ -705,7 +701,9 @@
                     setColorAttrib(attr);
                 }
                 else if (attr.getCategory() == PrinterResolution.class) {
-                    setResolutionAttrib(attr);
+                    if (myService.isAttributeValueSupported(attr, null, null)) {
+                        setResolutionAttrib(attr);
+                    }
                 }
                 else if (attr.getCategory() == PrintQuality.class) {
                     setQualityAttrib(attr);
@@ -750,6 +748,7 @@
      * Note: PageFormat.getPaper() returns a clone and getDefaultPage()
      * gets that clone so it won't overwrite the original paper.
      */
+    @Override
     public PageFormat defaultPage(PageFormat page) {
         PageFormat newPage = (PageFormat)page.clone();
         getDefaultPage(newPage);
@@ -759,6 +758,7 @@
     /**
      * validate the paper size against the current printer.
      */
+    @Override
     protected native void validatePaper(Paper origPaper, Paper newPaper );
 
     /**
@@ -774,6 +774,7 @@
      * causes the print job to be rasterized.
      */
 
+    @Override
     protected Graphics2D createPathGraphics(PeekGraphics peekGraphics,
                                             PrinterJob printerJob,
                                             Printable painter,
@@ -810,6 +811,7 @@
     }
 
 
+    @Override
     protected double getXRes() {
         if (mAttXRes != 0) {
             return mAttXRes;
@@ -818,6 +820,7 @@
         }
     }
 
+    @Override
     protected double getYRes() {
         if (mAttYRes != 0) {
             return mAttYRes;
@@ -826,26 +829,32 @@
         }
     }
 
+    @Override
     protected double getPhysicalPrintableX(Paper p) {
         return mPrintPhysX;
     }
 
+    @Override
     protected double getPhysicalPrintableY(Paper p) {
         return mPrintPhysY;
     }
 
+    @Override
     protected double getPhysicalPrintableWidth(Paper p) {
         return mPrintWidth;
     }
 
+    @Override
     protected double getPhysicalPrintableHeight(Paper p) {
         return mPrintHeight;
     }
 
+    @Override
     protected double getPhysicalPageWidth(Paper p) {
         return mPageWidth;
     }
 
+    @Override
     protected double getPhysicalPageHeight(Paper p) {
         return mPageHeight;
     }
@@ -857,6 +866,7 @@
      * collation requests - which can only originate from the print dialog.
      * REMIND: check if this can be deleted already.
      */
+    @Override
     protected boolean isCollated() {
         return userRequestedCollation;
     }
@@ -869,6 +879,7 @@
      * book need only be printed once and the copies
      * will be collated and made in the printer.
      */
+    @Override
     protected int getCollatedCopies() {
         debug_println("driverDoesMultipleCopies="+driverDoesMultipleCopies
                       +" driverDoesCollation="+driverDoesCollation);
@@ -891,6 +902,7 @@
      * iterate over the number of copies, this method always returns
      * 1.
      */
+    @Override
     protected int getNoncollatedCopies() {
         if (driverDoesMultipleCopies || super.isCollated()) {
             return 1;
@@ -1128,6 +1140,7 @@
     /**
      * Remove control characters.
      */
+    @Override
     protected String removeControlChars(String str) {
         return super.removeControlChars(str);
     }
@@ -1267,6 +1280,7 @@
     /**
      * Begin a new page.
      */
+    @Override
     protected void startPage(PageFormat format, Printable painter,
                              int index, boolean paperChanged) {
 
@@ -1283,6 +1297,7 @@
     /**
      * End a page.
      */
+    @Override
     protected void endPage(PageFormat format, Printable painter,
                            int index) {
 
@@ -1302,6 +1317,7 @@
     /**
      * Set the number of copies to be printed.
      */
+    @Override
     public void setCopies(int copies) {
         super.setCopies(copies);
         defaultCopies = false;
@@ -1315,7 +1331,7 @@
     /**
      * Set copies in device.
      */
-    public native void setNativeCopies(int copies);
+    private native void setNativeCopies(int copies);
 
     /**
      * Displays the print dialog and records the user's settings
@@ -1328,6 +1344,7 @@
     /* Make sure printer DC is intialised and that info about the printer
      * is reflected back up to Java code
      */
+    @Override
     protected native void initPrinter();
 
     /**
@@ -1343,6 +1360,7 @@
      */
     private native boolean _startDoc(String dest, String jobName)
                                      throws PrinterException;
+    @Override
     protected void startDoc() throws PrinterException {
         if (!_startDoc(mDestination, getJobName())) {
             cancel();
@@ -1353,12 +1371,14 @@
      * Call Window's EndDoc routine to end a
      * print job.
      */
+    @Override
     protected native void endDoc();
 
     /**
      * Call Window's AbortDoc routine to abort a
      * print job.
      */
+    @Override
     protected native void abortDoc();
 
     /**
@@ -1386,6 +1406,7 @@
      * page. The width and height of the band is
      * specified by the caller.
      */
+    @Override
     protected native void printBand(byte[] data, int x, int y,
                                     int width, int height);
 
@@ -2204,6 +2225,7 @@
         }
     }
 
+    @Override
     public void actionPerformed(ActionEvent event) {
         setVisible(false);
         dispose();
diff --git a/src/windows/classes/sun/awt/windows/WRobotPeer.java b/src/windows/classes/sun/awt/windows/WRobotPeer.java
index 04ffa9f..8521ec7 100644
--- a/src/windows/classes/sun/awt/windows/WRobotPeer.java
+++ b/src/windows/classes/sun/awt/windows/WRobotPeer.java
@@ -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
@@ -28,7 +28,7 @@
 import java.awt.*;
 import java.awt.peer.RobotPeer;
 
-class WRobotPeer extends WObjectPeer implements RobotPeer
+final class WRobotPeer extends WObjectPeer implements RobotPeer
 {
     WRobotPeer() {
         create();
@@ -39,27 +39,36 @@
 
     private synchronized native void _dispose();
 
+    @Override
     protected void disposeImpl() {
         _dispose();
     }
 
     public native void create();
     public native void mouseMoveImpl(int x, int y);
+    @Override
     public void mouseMove(int x, int y) {
         mouseMoveImpl(x, y);
     }
+    @Override
     public native void mousePress(int buttons);
+    @Override
     public native void mouseRelease(int buttons);
+    @Override
     public native void mouseWheel(int wheelAmt);
 
+    @Override
     public native void keyPress( int keycode );
+    @Override
     public native void keyRelease( int keycode );
 
+    @Override
     public int getRGBPixel(int x, int y) {
          // See 7002846: that's ineffective, but works correctly with non-opaque windows
         return getRGBPixels(new Rectangle(x, y, 1, 1))[0];
     }
 
+    @Override
     public int [] getRGBPixels(Rectangle bounds) {
         int pixelArray[] = new int[bounds.width*bounds.height];
         getRGBPixels(bounds.x, bounds.y, bounds.width, bounds.height, pixelArray);
diff --git a/src/windows/classes/sun/awt/windows/WScrollPanePeer.java b/src/windows/classes/sun/awt/windows/WScrollPanePeer.java
index 38a4338..654c502 100644
--- a/src/windows/classes/sun/awt/windows/WScrollPanePeer.java
+++ b/src/windows/classes/sun/awt/windows/WScrollPanePeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -33,7 +33,7 @@
 
 import sun.util.logging.PlatformLogger;
 
-class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
+final class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WScrollPanePeer");
 
@@ -47,6 +47,7 @@
     }
 
     static native void initIDs();
+    @Override
     native void create(WComponentPeer parent);
     native int getOffset(int orient);
 
@@ -56,6 +57,7 @@
         scrollbarHeight = _getHScrollbarHeight();
     }
 
+    @Override
     void initialize() {
         super.initialize();
         setInsets();
@@ -63,22 +65,27 @@
         setScrollPosition(-i.left,-i.top);
     }
 
+    @Override
     public void setUnitIncrement(Adjustable adj, int p) {
         // The unitIncrement is grabbed from the target as needed.
     }
 
+    @Override
     public Insets insets() {
         return getInsets();
     }
     private native void setInsets();
 
+    @Override
     public native synchronized void setScrollPosition(int x, int y);
 
+    @Override
     public int getHScrollbarHeight() {
         return scrollbarHeight;
     }
     private native int _getHScrollbarHeight();
 
+    @Override
     public int getVScrollbarWidth() {
         return scrollbarWidth;
     }
@@ -96,6 +103,7 @@
      * the actual windows may not have changed yet, so the size
      * information from the java-level is passed down and used.
      */
+    @Override
     public void childResized(int width, int height) {
         ScrollPane sp = (ScrollPane)target;
         Dimension vs = sp.getSize();
@@ -112,6 +120,7 @@
      * of adjustables, whether it was modified externally or from the
      * native scrollbars themselves.
      */
+    @Override
     public void setValue(Adjustable adj, int v) {
         Component c = getScrollChild();
         if (c == null) {
@@ -160,6 +169,7 @@
             super(source, runnable, 0L);
         }
 
+        @Override
         public PeerEvent coalesceEvents(PeerEvent newEvent) {
             if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                 log.finest("ScrollEvent coalesced: " + newEvent);
@@ -187,6 +197,7 @@
             this.isAdjusting = isAdjusting;
         }
 
+        @Override
         public void run() {
             if (getScrollChild() == null) {
                 return;
diff --git a/src/windows/classes/sun/awt/windows/WSystemTrayPeer.java b/src/windows/classes/sun/awt/windows/WSystemTrayPeer.java
index b097b35..cc6c4b9 100644
--- a/src/windows/classes/sun/awt/windows/WSystemTrayPeer.java
+++ b/src/windows/classes/sun/awt/windows/WSystemTrayPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -30,11 +30,12 @@
 import java.awt.Toolkit;
 import java.awt.peer.SystemTrayPeer;
 
-public class WSystemTrayPeer extends WObjectPeer implements SystemTrayPeer {
+final class WSystemTrayPeer extends WObjectPeer implements SystemTrayPeer {
     WSystemTrayPeer(SystemTray target) {
         this.target = target;
     }
 
+    @Override
     public Dimension getTrayIconSize() {
         return new Dimension(WTrayIconPeer.TRAY_ICON_WIDTH, WTrayIconPeer.TRAY_ICON_HEIGHT);
     }
@@ -43,6 +44,7 @@
         return ((WToolkit)Toolkit.getDefaultToolkit()).isTraySupported();
     }
 
+    @Override
     protected void disposeImpl() {
     }
 }
diff --git a/src/windows/classes/sun/awt/windows/WTextAreaPeer.java b/src/windows/classes/sun/awt/windows/WTextAreaPeer.java
index 746f277..a13c24a 100644
--- a/src/windows/classes/sun/awt/windows/WTextAreaPeer.java
+++ b/src/windows/classes/sun/awt/windows/WTextAreaPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -53,6 +53,7 @@
     public Dimension getPreferredSize(int rows, int cols) {
         return getMinimumSize(rows, cols);
     }
+
     @Override
     public Dimension getMinimumSize(int rows, int cols) {
         FontMetrics fm = getFontMetrics(((TextArea)target).getFont());
diff --git a/src/windows/classes/sun/awt/windows/WToolkit.java b/src/windows/classes/sun/awt/windows/WToolkit.java
index a0187b2..6086cd4 100644
--- a/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -42,6 +42,7 @@
 import sun.awt.SunToolkit;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.Win32GraphicsEnvironment;
+import sun.awt.datatransfer.DataTransferer;
 import sun.java2d.d3d.D3DRenderQueue;
 import sun.java2d.opengl.OGLRenderQueue;
 
@@ -66,7 +67,7 @@
 import sun.misc.PerformanceLogger;
 import sun.util.logging.PlatformLogger;
 
-public class WToolkit extends SunToolkit implements Runnable {
+public final class WToolkit extends SunToolkit implements Runnable {
 
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.windows.WToolkit");
 
@@ -97,6 +98,7 @@
         if (!loaded) {
             java.security.AccessController.doPrivileged(
                 new java.security.PrivilegedAction<Void>() {
+                    @Override
                     public Void run() {
                         System.loadLibrary("awt");
                         return null;
@@ -120,6 +122,7 @@
         AccessController.doPrivileged(
             new PrivilegedAction <Void> ()
         {
+            @Override
             public Void run() {
                 String browserProp = System.getProperty("browser");
                 if (browserProp != null && browserProp.equals("sun.plugin")) {
@@ -210,9 +213,8 @@
      */
     public native void embeddedEventLoopIdleProcessing();
 
-    public static final String DATA_TRANSFERER_CLASS_NAME = "sun.awt.windows.WDataTransferer";
-
     static class ToolkitDisposer implements sun.java2d.DisposerRecord {
+        @Override
         public void dispose() {
             WToolkit.postDispose();
         }
@@ -255,8 +257,6 @@
             // swallow the exception
         }
 
-        SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
-
         // Enabled "live resizing" by default.  It remains controlled
         // by the native system though.
         setDynamicLayout(true);
@@ -269,6 +269,7 @@
 
     private final void registerShutdownHook() {
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
+            @Override
             public Void run() {
                 ThreadGroup currentTG =
                     Thread.currentThread().getThreadGroup();
@@ -278,6 +279,7 @@
                     parentTG = currentTG.getParent();
                 }
                 Thread shutdown = new Thread(currentTG, new Runnable() {
+                    @Override
                     public void run() {
                         shutdown();
                     }
@@ -289,6 +291,7 @@
         });
      }
 
+    @Override
     public void run() {
         Thread.currentThread().setPriority(Thread.NORM_PRIORITY+1);
         boolean startPump = init();
@@ -333,85 +336,98 @@
      * WARNING: startSecondaryEventLoop must only be called from the "AWT-
      * Windows" thread.
      */
-    public static native void startSecondaryEventLoop();
-    public static native void quitSecondaryEventLoop();
+    static native void startSecondaryEventLoop();
+    static native void quitSecondaryEventLoop();
 
     /*
      * Create peer objects.
      */
 
+    @Override
     public ButtonPeer createButton(Button target) {
         ButtonPeer peer = new WButtonPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public TextFieldPeer createTextField(TextField target) {
         TextFieldPeer peer = new WTextFieldPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public LabelPeer createLabel(Label target) {
         LabelPeer peer = new WLabelPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ListPeer createList(List target) {
         ListPeer peer = new WListPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public CheckboxPeer createCheckbox(Checkbox target) {
         CheckboxPeer peer = new WCheckboxPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ScrollbarPeer createScrollbar(Scrollbar target) {
         ScrollbarPeer peer = new WScrollbarPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ScrollPanePeer createScrollPane(ScrollPane target) {
         ScrollPanePeer peer = new WScrollPanePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public TextAreaPeer createTextArea(TextArea target) {
         TextAreaPeer peer = new WTextAreaPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public ChoicePeer createChoice(Choice target) {
         ChoicePeer peer = new WChoicePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public FramePeer  createFrame(Frame target) {
         FramePeer peer = new WFramePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public FramePeer createLightweightFrame(LightweightFrame target) {
         FramePeer peer = new WLightweightFramePeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public CanvasPeer createCanvas(Canvas target) {
         CanvasPeer peer = new WCanvasPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void disableBackgroundErase(Canvas canvas) {
         WCanvasPeer peer = (WCanvasPeer)canvas.getPeer();
@@ -421,60 +437,70 @@
         peer.disableBackgroundErase();
     }
 
+    @Override
     public PanelPeer createPanel(Panel target) {
         PanelPeer peer = new WPanelPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public WindowPeer createWindow(Window target) {
         WindowPeer peer = new WWindowPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public DialogPeer createDialog(Dialog target) {
         DialogPeer peer = new WDialogPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public FileDialogPeer createFileDialog(FileDialog target) {
         FileDialogPeer peer = new WFileDialogPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public MenuBarPeer createMenuBar(MenuBar target) {
         MenuBarPeer peer = new WMenuBarPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public MenuPeer createMenu(Menu target) {
         MenuPeer peer = new WMenuPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public PopupMenuPeer createPopupMenu(PopupMenu target) {
         PopupMenuPeer peer = new WPopupMenuPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public MenuItemPeer createMenuItem(MenuItem target) {
         MenuItemPeer peer = new WMenuItemPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
         CheckboxMenuItemPeer peer = new WCheckboxMenuItemPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
         // (target is unused for now)
         // Robot's don't need to go in the peer map since
@@ -500,28 +526,38 @@
         return peer;
     }
 
+    @Override
     public TrayIconPeer createTrayIcon(TrayIcon target) {
         WTrayIconPeer peer = new WTrayIconPeer(target);
         targetCreatedPeer(target, peer);
         return peer;
     }
 
+    @Override
     public SystemTrayPeer createSystemTray(SystemTray target) {
         return new WSystemTrayPeer(target);
     }
 
+    @Override
     public boolean isTraySupported() {
         return true;
     }
 
+    @Override
+    public DataTransferer getDataTransferer() {
+        return WDataTransferer.getInstanceImpl();
+    }
+
+    @Override
     public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer()
       throws HeadlessException
     {
         return WKeyboardFocusManagerPeer.getInstance();
     }
 
-    protected native void setDynamicLayoutNative(boolean b);
+    private native void setDynamicLayoutNative(boolean b);
 
+    @Override
     public void setDynamicLayout(boolean b) {
         if (b == dynamicLayoutSetting) {
             return;
@@ -531,6 +567,7 @@
         setDynamicLayoutNative(b);
     }
 
+    @Override
     protected boolean isDynamicLayoutSet() {
         return dynamicLayoutSetting;
     }
@@ -539,8 +576,9 @@
      * Called from lazilyLoadDynamicLayoutSupportedProperty because
      * Windows doesn't always send WM_SETTINGCHANGE when it should.
      */
-    protected native boolean isDynamicLayoutSupportedNative();
+    private native boolean isDynamicLayoutSupportedNative();
 
+    @Override
     public boolean isDynamicLayoutActive() {
         return (isDynamicLayoutSet() && isDynamicLayoutSupported());
     }
@@ -548,6 +586,7 @@
     /**
      * Returns <code>true</code> if this frame state is supported.
      */
+    @Override
     public boolean isFrameStateSupported(int state) {
         switch (state) {
           case Frame.NORMAL:
@@ -572,25 +611,31 @@
         return config.getColorModel();
     }
 
+    @Override
     public ColorModel getColorModel() {
         return getStaticColorModel();
     }
 
+    @Override
     public Insets getScreenInsets(GraphicsConfiguration gc)
     {
         return getScreenInsets(((Win32GraphicsDevice) gc.getDevice()).getScreen());
     }
 
+    @Override
     public int getScreenResolution() {
         Win32GraphicsEnvironment ge = (Win32GraphicsEnvironment)
             GraphicsEnvironment.getLocalGraphicsEnvironment();
         return ge.getXResolution();
     }
+    @Override
     protected native int getScreenWidth();
+    @Override
     protected native int getScreenHeight();
-    protected native Insets getScreenInsets(int screen);
+    private native Insets getScreenInsets(int screen);
 
 
+    @Override
     public FontMetrics getFontMetrics(Font font) {
         // This is an unsupported hack, but left in for a customer.
         // Do not remove.
@@ -602,6 +647,7 @@
         return super.getFontMetrics(font);
     }
 
+    @Override
     public FontPeer getFontPeer(String name, int style) {
         FontPeer retval = null;
         String lcName = name.toLowerCase();
@@ -625,6 +671,7 @@
 
     private native void nativeSync();
 
+    @Override
     public void sync() {
         // flush the GDI/DD buffers
         nativeSync();
@@ -634,11 +681,13 @@
         D3DRenderQueue.sync();
     }
 
+    @Override
     public PrintJob getPrintJob(Frame frame, String doctitle,
                                 Properties props) {
         return getPrintJob(frame, doctitle, null, null);
     }
 
+    @Override
     public PrintJob getPrintJob(Frame frame, String doctitle,
                                 JobAttributes jobAttributes,
                                 PageAttributes pageAttributes)
@@ -657,8 +706,10 @@
         return printJob;
     }
 
+    @Override
     public native void beep();
 
+    @Override
     public boolean getLockingKeyState(int key) {
         if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
                key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
@@ -667,8 +718,9 @@
         return getLockingKeyStateNative(key);
     }
 
-    public native boolean getLockingKeyStateNative(int key);
+    private native boolean getLockingKeyStateNative(int key);
 
+    @Override
     public void setLockingKeyState(int key, boolean on) {
         if (! (key == KeyEvent.VK_CAPS_LOCK || key == KeyEvent.VK_NUM_LOCK ||
                key == KeyEvent.VK_SCROLL_LOCK || key == KeyEvent.VK_KANA_LOCK)) {
@@ -677,8 +729,9 @@
         setLockingKeyStateNative(key, on);
     }
 
-    public native void setLockingKeyStateNative(int key, boolean on);
+    private native void setLockingKeyStateNative(int key, boolean on);
 
+    @Override
     public Clipboard getSystemClipboard() {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
@@ -692,6 +745,7 @@
         return clipboard;
     }
 
+    @Override
     protected native void loadSystemColors(int[] systemColors);
 
     public static final Object targetToPeer(Object target) {
@@ -705,6 +759,7 @@
     /**
      * Returns a new input method adapter descriptor for native input methods.
      */
+    @Override
     public InputMethodDescriptor getInputMethodAdapterDescriptor() {
         return new WInputMethodDescriptor();
     }
@@ -712,6 +767,7 @@
     /**
      * Returns a style map for the input method highlight.
      */
+    @Override
     public Map<java.awt.font.TextAttribute,?> mapInputMethodHighlight(
         InputMethodHighlight highlight)
     {
@@ -722,6 +778,7 @@
      * Returns whether enableInputMethods should be set to true for peered
      * TextComponent instances on this platform.
      */
+    @Override
     public boolean enableInputMethodsForTextComponent() {
         return true;
     }
@@ -729,6 +786,7 @@
     /**
      * Returns the default keyboard locale of the underlying operating system
      */
+    @Override
     public Locale getDefaultKeyboardLocale() {
         Locale locale = WInputMethod.getNativeLocale();
 
@@ -742,6 +800,7 @@
     /**
      * Returns a new custom cursor.
      */
+    @Override
     public Cursor createCustomCursor(Image cursor, Point hotSpot, String name)
         throws IndexOutOfBoundsException {
         return new WCustomCursor(cursor, hotSpot, name);
@@ -750,11 +809,13 @@
     /**
      * Returns the supported cursor size (Win32 only has one).
      */
+    @Override
     public Dimension getBestCursorSize(int preferredWidth, int preferredHeight) {
         return new Dimension(WCustomCursor.getCursorWidth(),
                              WCustomCursor.getCursorHeight());
     }
 
+    @Override
     public native int getMaximumCursorColors();
 
     static void paletteChanged() {
@@ -770,6 +831,7 @@
      */
     static public void displayChanged() {
         EventQueue.invokeLater(new Runnable() {
+            @Override
             public void run() {
                 ((Win32GraphicsEnvironment)GraphicsEnvironment
                 .getLocalGraphicsEnvironment())
@@ -782,10 +844,12 @@
      * create the peer for a DragSourceContext
      */
 
+    @Override
     public DragSourceContextPeer createDragSourceContextPeer(DragGestureEvent dge) throws InvalidDnDOperationException {
         return WDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
+    @Override
     public <T extends DragGestureRecognizer> T
         createDragGestureRecognizer(Class<T> abstractRecognizerClass,
                                     DragSource ds, Component c, int srcActions,
@@ -806,6 +870,7 @@
     private static final String awtPrefix  = "awt.";
     private static final String dndPrefix  = "DnD.";
 
+    @Override
     protected Object lazilyLoadDesktopProperty(String name) {
         if (name.startsWith(prefix)) {
             String cursorName = name.substring(prefix.length(), name.length()) + postfix;
@@ -872,6 +937,7 @@
      */
     private void windowsSettingChange() {
         EventQueue.invokeLater(new Runnable() {
+            @Override
             public void run() {
                 updateProperties();
             }
@@ -894,6 +960,7 @@
         }
     }
 
+    @Override
     public synchronized void addPropertyChangeListener(String name, PropertyChangeListener pcl) {
         if (name == null) {
             // See JavaDoc for the Toolkit.addPropertyChangeListener() method
@@ -914,6 +981,7 @@
      * initialize only static props here and do not try to initialize props which depends on wprops,
      * this should be done in lazilyLoadDesktopProperty() only.
      */
+    @Override
     protected synchronized void initializeDesktopProperties() {
         desktopProperties.put("DnD.Autoscroll.initialDelay",
                               Integer.valueOf(50));
@@ -929,6 +997,7 @@
      * This returns the value for the desktop property "awt.font.desktophints"
      * This requires that the Windows properties have already been gathered.
      */
+    @Override
     protected synchronized RenderingHints getDesktopAAHints() {
         if (wprops == null) {
             return null;
@@ -937,6 +1006,7 @@
         }
     }
 
+    @Override
     public boolean isModalityTypeSupported(Dialog.ModalityType modalityType) {
         return (modalityType == null) ||
                (modalityType == Dialog.ModalityType.MODELESS) ||
@@ -945,6 +1015,7 @@
                (modalityType == Dialog.ModalityType.TOOLKIT_MODAL);
     }
 
+    @Override
     public boolean isModalExclusionTypeSupported(Dialog.ModalExclusionType exclusionType) {
         return (exclusionType == null) ||
                (exclusionType == Dialog.ModalExclusionType.NO_EXCLUDE) ||
@@ -984,6 +1055,7 @@
         return !Win32GraphicsEnvironment.isDWMCompositionEnabled();
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void grab(Window w) {
         if (w.getPeer() != null) {
@@ -991,6 +1063,7 @@
         }
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void ungrab(Window w) {
         if (w.getPeer() != null) {
@@ -998,17 +1071,21 @@
         }
     }
 
+    @Override
     public native boolean syncNativeQueue(final long timeout);
+    @Override
     public boolean isDesktopSupported() {
         return true;
     }
 
+    @Override
     public DesktopPeer createDesktopPeer(Desktop target) {
         return new WDesktopPeer();
     }
 
-    public static native void setExtraMouseButtonsEnabledNative(boolean enable);
+    private static native void setExtraMouseButtonsEnabledNative(boolean enable);
 
+    @Override
     public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
         return areExtraMouseButtonsEnabled;
     }
diff --git a/src/windows/classes/sun/awt/windows/WTrayIconPeer.java b/src/windows/classes/sun/awt/windows/WTrayIconPeer.java
index 93dc4b1..0cc7873 100644
--- a/src/windows/classes/sun/awt/windows/WTrayIconPeer.java
+++ b/src/windows/classes/sun/awt/windows/WTrayIconPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -36,9 +36,8 @@
 import java.awt.image.*;
 import sun.awt.SunToolkit;
 import sun.awt.image.IntegerComponentRaster;
-import sun.awt.windows.WPopupMenuPeer;
 
-public class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
+final class WTrayIconPeer extends WObjectPeer implements TrayIconPeer {
     final static int TRAY_ICON_WIDTH = 16;
     final static int TRAY_ICON_HEIGHT = 16;
     final static int TRAY_ICON_MASK_SIZE = (TRAY_ICON_WIDTH * TRAY_ICON_HEIGHT) / 8;
@@ -48,6 +47,7 @@
     Frame popupParent = new Frame("PopupMessageWindow");
     PopupMenu popup;
 
+    @Override
     protected void disposeImpl() {
         if (popupParent != null) {
             popupParent.dispose();
@@ -64,6 +64,7 @@
         updateImage();
     }
 
+    @Override
     public void updateImage() {
         Image image = ((TrayIcon)target).getImage();
         if (image != null) {
@@ -71,13 +72,16 @@
         }
     }
 
+    @Override
     public native void setToolTip(String tooltip);
 
+    @Override
     public synchronized void showPopupMenu(final int x, final int y) {
         if (isDisposed())
             return;
 
         SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
+                @Override
                 public void run() {
                     PopupMenu newPopup = ((TrayIcon)target).getPopupMenu();
                     if (popup != newPopup) {
@@ -96,6 +100,7 @@
             });
     }
 
+    @Override
     public void displayMessage(String caption, String text, String messageType) {
         // The situation when both caption and text are null is processed in the shared code.
         if (caption == null) {
@@ -185,6 +190,7 @@
     native void _displayMessage(String caption, String text, String messageType);
 
     class IconObserver implements ImageObserver {
+        @Override
         public boolean imageUpdate(Image image, int flags, int x, int y, int width, int height) {
             if (image != ((TrayIcon)target).getImage() || // if the image has been changed
                 isDisposed())
diff --git a/src/windows/classes/sun/awt/windows/WWindowPeer.java b/src/windows/classes/sun/awt/windows/WWindowPeer.java
index 16ed261..33f27ac 100644
--- a/src/windows/classes/sun/awt/windows/WWindowPeer.java
+++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, 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
@@ -90,6 +90,7 @@
     }
 
     // WComponentPeer overrides
+    @Override
     @SuppressWarnings("unchecked")
     protected void disposeImpl() {
         AppContext appContext = SunToolkit.targetToAppContext(target);
@@ -118,24 +119,30 @@
 
     // WindowPeer implementation
 
+    @Override
     public void toFront() {
         updateFocusableWindowState();
         _toFront();
     }
-    native void _toFront();
+    private native void _toFront();
+
+    @Override
     public native void toBack();
 
-    public native void setAlwaysOnTopNative(boolean value);
+    private native void setAlwaysOnTopNative(boolean value);
+
     public void setAlwaysOnTop(boolean value) {
         if ((value && ((Window)target).isVisible()) || !value) {
             setAlwaysOnTopNative(value);
         }
     }
 
+    @Override
     public void updateAlwaysOnTopState() {
         setAlwaysOnTop(((Window)target).isAlwaysOnTop());
     }
 
+    @Override
     public void updateFocusableWindowState() {
         setFocusableWindow(((Window)target).isFocusableWindow());
     }
@@ -150,12 +157,13 @@
         }
         _setTitle(title);
     }
-    native void _setTitle(String title);
+    private native void _setTitle(String title);
 
     public void setResizable(boolean resizable) {
         _setResizable(resizable);
     }
-    public native void _setResizable(boolean resizable);
+
+    private native void _setResizable(boolean resizable);
 
     // Toolkit & peer internals
 
@@ -163,6 +171,7 @@
         super(target);
     }
 
+    @Override
     void initialize() {
         super.initialize();
 
@@ -210,6 +219,7 @@
         windowType = ((Window)target).getType();
     }
 
+    @Override
     void create(WComponentPeer parent) {
         preCreate(parent);
         createAwtWindow(parent);
@@ -226,6 +236,7 @@
         super.show();
     }
 
+    @Override
     public void show() {
         updateFocusableWindowState();
 
@@ -289,7 +300,7 @@
         }
         return requestWindowFocus(cause == CausedFocusEvent.Cause.MOUSE_EVENT);
     }
-    public native boolean requestWindowFocus(boolean isMouseEventCause);
+    private native boolean requestWindowFocus(boolean isMouseEventCause);
 
     public boolean focusAllowedFor() {
         Window window = (Window)this.target;
@@ -305,7 +316,8 @@
         return true;
     }
 
-    public void hide() {
+    @Override
+    void hide() {
         WindowListener listener = windowListener;
         if (listener != null) {
             // We're not getting WINDOW_CLOSING from the native code when hiding
@@ -316,6 +328,7 @@
     }
 
     // WARNING: it's called on the Toolkit thread!
+    @Override
     void preprocessPostEvent(AWTEvent event) {
         if (event instanceof WindowEvent) {
             WindowListener listener = windowListener;
@@ -340,6 +353,7 @@
         windowListener = AWTEventMulticaster.remove(windowListener, l);
     }
 
+    @Override
     public void updateMinimumSize() {
         Dimension minimumSize = null;
         if (((Component)target).isMinimumSizeSet()) {
@@ -356,6 +370,7 @@
         }
     }
 
+    @Override
     public void updateIconImages() {
         java.util.List<Image> imageList = ((Window)target).getIconImages();
         if (imageList == null || imageList.size() == 0) {
@@ -393,6 +408,7 @@
         return modalBlocker != null;
     }
 
+     @Override
      @SuppressWarnings("deprecation")
     public void setModalBlocked(Dialog dialog, boolean blocked) {
         synchronized (((Component)getTarget()).getTreeLock()) // State lock should always be after awtLock
@@ -459,6 +475,7 @@
     void draggedToNewScreen() {
         SunToolkit.executeOnEventHandlerThread((Component)target,new Runnable()
         {
+            @Override
             public void run() {
                 displayChanged();
             }
@@ -519,6 +536,7 @@
      * reflects the current display depth information, which has
      * just changed).
      */
+    @Override
     public void displayChanged() {
         updateGC();
     }
@@ -527,6 +545,7 @@
      * Part of the DisplayChangedListener interface: components
      * do not need to react to this event
      */
+    @Override
     public void paletteChanged() {
     }
 
@@ -565,6 +584,7 @@
      private volatile int sysW = 0;
      private volatile int sysH = 0;
 
+     @Override
      public native void repositionSecurityWarning();
 
      @Override
@@ -620,6 +640,7 @@
     private native void setOpacity(int iOpacity);
     private float opacity = 1.0f;
 
+    @Override
     public void setOpacity(float opacity) {
         if (!((SunToolkit)((Window)target).getToolkit()).
             isWindowOpacitySupported())
@@ -663,6 +684,7 @@
 
     private native void setOpaqueImpl(boolean isOpaque);
 
+    @Override
     public void setOpaque(boolean isOpaque) {
         synchronized (getStateLock()) {
             if (this.isOpaque == isOpaque) {
@@ -720,8 +742,9 @@
         }
     }
 
-    public native void updateWindowImpl(int[] data, int width, int height);
+    native void updateWindowImpl(int[] data, int width, int height);
 
+    @Override
     public void updateWindow() {
         updateWindow(false);
     }
@@ -770,6 +793,7 @@
      * unregisters ActiveWindowListener listener.
      */
     private static class GuiDisposedListener implements PropertyChangeListener {
+        @Override
         public void propertyChange(PropertyChangeEvent e) {
             boolean isDisposed = (Boolean)e.getNewValue();
             if (isDisposed != true) {
@@ -795,6 +819,7 @@
      */
     @SuppressWarnings( value = {"deprecation", "unchecked"})
     private static class ActiveWindowListener implements PropertyChangeListener {
+        @Override
         public void propertyChange(PropertyChangeEvent e) {
             Window w = (Window)e.getNewValue();
             if (w == null) {
diff --git a/src/windows/classes/sun/awt/windows/WingDings.java b/src/windows/classes/sun/awt/windows/WingDings.java
index f15d9df..b7cac01 100644
--- a/src/windows/classes/sun/awt/windows/WingDings.java
+++ b/src/windows/classes/sun/awt/windows/WingDings.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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
@@ -29,11 +29,12 @@
 import java.nio.CharBuffer;
 import java.nio.charset.*;
 
-public class WingDings extends Charset {
+final class WingDings extends Charset {
     public WingDings () {
         super("WingDings", null);
     }
 
+    @Override
     public CharsetEncoder newEncoder() {
         return new Encoder(this);
     }
@@ -41,10 +42,12 @@
     /* Seems like supporting a decoder is required, but we aren't going
      * to be publically exposing this class, so no need to waste work
      */
+    @Override
     public CharsetDecoder newDecoder() {
         throw new Error("Decoder isn't implemented for WingDings Charset");
     }
 
+    @Override
     public boolean contains(Charset cs) {
         return cs instanceof WingDings;
     }
@@ -54,6 +57,7 @@
             super(cs, 1.0f, 1.0f);
         }
 
+        @Override
         public boolean canEncode(char c) {
             if(c >= 0x2701 && c <= 0x27be){
                 if (table[c - 0x2700] != 0x00)
@@ -64,6 +68,7 @@
             return false;
         }
 
+        @Override
         protected CoderResult encodeLoop(CharBuffer src, ByteBuffer dst) {
             char[] sa = src.array();
             int sp = src.arrayOffset() + src.position();
@@ -156,6 +161,7 @@
         };
 
         /* The default implementation creates a decoder and we don't have one */
+        @Override
         public boolean isLegalReplacement(byte[] repl) {
             return true;
         }
diff --git a/src/windows/native/sun/net/spi/DefaultProxySelector.c b/src/windows/native/sun/net/spi/DefaultProxySelector.c
index e6727a7..20e54df 100644
--- a/src/windows/native/sun/net/spi/DefaultProxySelector.c
+++ b/src/windows/native/sun/net/spi/DefaultProxySelector.c
@@ -127,12 +127,13 @@
   char regserver[MAX_STR_LEN];
   char override[MAX_STR_LEN];
   char *s, *s2;
+  char *ctx = NULL;
   int pport = 0;
   int defport = 0;
   char *phost;
 
   /**
-   * Let's opem the Registry entry. We'll check a few values in it:
+   * Let's open the Registry entry. We'll check a few values in it:
    *
    * - ProxyEnable: 0 means no proxy, 1 means use the proxy
    * - ProxyServer: a string that can take 2 forms:
@@ -177,7 +178,7 @@
            * The semicolons (;) separated entries have to be matched with the
            * the beginning of the hostname.
            */
-          s = strtok(override, "; ");
+          s = strtok_s(override, "; ", &ctx);
           urlhost = (*env)->GetStringUTFChars(env, host, &isCopy);
           if (urlhost == NULL) {
             if (!(*env)->ExceptionCheck(env))
@@ -194,7 +195,7 @@
                 (*env)->ReleaseStringUTFChars(env, host, urlhost);
               goto noproxy;
             }
-            s = strtok(NULL, "; ");
+            s = strtok_s(NULL, "; ", &ctx);
           }
           if (isCopy == JNI_TRUE)
             (*env)->ReleaseStringUTFChars(env, host, urlhost);
diff --git a/src/windows/native/sun/windows/MouseInfo.cpp b/src/windows/native/sun/windows/MouseInfo.cpp
index 4878fa2..b109f28 100644
--- a/src/windows/native/sun/windows/MouseInfo.cpp
+++ b/src/windows/native/sun/windows/MouseInfo.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,7 +95,9 @@
         env->DeleteLocalRef(pointClassLocal);
     }
     xID = env->GetFieldID(pointClass, "x", "I");
+    CHECK_NULL_RETURN(xID, (jint)0);
     yID = env->GetFieldID(pointClass, "y", "I");
+    CHECK_NULL_RETURN(yID, (jint)0);
     env->SetIntField(point, xID, pt.x);
     env->SetIntField(point, yID, pt.y);
 
diff --git a/src/windows/native/sun/windows/awt_DataTransferer.cpp b/src/windows/native/sun/windows/awt_DataTransferer.cpp
index 77a87b2..9ebc2c6 100644
--- a/src/windows/native/sun/windows/awt_DataTransferer.cpp
+++ b/src/windows/native/sun/windows/awt_DataTransferer.cpp
@@ -274,6 +274,9 @@
 
         jclass str_clazz = env->FindClass("java/lang/String");
         DASSERT(str_clazz != NULL);
+        if (str_clazz == NULL) {
+           throw std::bad_alloc();
+        }
         jobjectArray filenames = env->NewObjectArray(nFilenames, str_clazz,
                                                      NULL);
         if (filenames == NULL) {
@@ -827,6 +830,7 @@
     TRY;
 
     LPCTSTR cStr = JNU_GetStringPlatformChars(env, str, NULL);
+    CHECK_NULL_RETURN(cStr, 0);
     jlong value = ::RegisterClipboardFormat(cStr);
     JNU_ReleaseStringPlatformChars(env, str, cStr);
 
diff --git a/src/windows/native/sun/windows/awt_Insets.cpp b/src/windows/native/sun/windows/awt_Insets.cpp
index 3241bc8..ee90495 100644
--- a/src/windows/native/sun/windows/awt_Insets.cpp
+++ b/src/windows/native/sun/windows/awt_Insets.cpp
@@ -46,14 +46,20 @@
     TRY;
 
     AwtInsets::leftID = env->GetFieldID(cls, "left", "I");
-    AwtInsets::rightID = env->GetFieldID(cls, "right", "I");
-    AwtInsets::topID = env->GetFieldID(cls, "top", "I");
-    AwtInsets::bottomID = env->GetFieldID(cls, "bottom", "I");
-
     DASSERT(AwtInsets::leftID != NULL);
+    CHECK_NULL(AwtInsets::leftID);
+
+    AwtInsets::rightID = env->GetFieldID(cls, "right", "I");
     DASSERT(AwtInsets::rightID != NULL);
+    CHECK_NULL(AwtInsets::rightID);
+
+    AwtInsets::topID = env->GetFieldID(cls, "top", "I");
     DASSERT(AwtInsets::topID != NULL);
+    CHECK_NULL(AwtInsets::topID);
+
+    AwtInsets::bottomID = env->GetFieldID(cls, "bottom", "I");
     DASSERT(AwtInsets::bottomID != NULL);
+    CHECK_NULL(AwtInsets::bottomID);
 
     CATCH_BAD_ALLOC;
 }
diff --git a/src/windows/native/sun/windows/awt_Label.cpp b/src/windows/native/sun/windows/awt_Label.cpp
index 0a7d69a..d755d5f 100644
--- a/src/windows/native/sun/windows/awt_Label.cpp
+++ b/src/windows/native/sun/windows/awt_Label.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, 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
@@ -319,10 +319,12 @@
 
     /* init field ids */
     AwtLabel::textID = env->GetFieldID(cls, "text", "Ljava/lang/String;");
-    AwtLabel::alignmentID = env->GetFieldID(cls, "alignment", "I");
-
     DASSERT(AwtLabel::textID != NULL);
+    CHECK_NULL(AwtLabel::textID);
+
+    AwtLabel::alignmentID = env->GetFieldID(cls, "alignment", "I");
     DASSERT(AwtLabel::alignmentID != NULL);
+    CHECK_NULL(AwtLabel::alignmentID);
 
     CATCH_BAD_ALLOC;
 }
diff --git a/src/windows/native/sun/windows/awt_PrintDialog.cpp b/src/windows/native/sun/windows/awt_PrintDialog.cpp
index 614f109..8244be5 100644
--- a/src/windows/native/sun/windows/awt_PrintDialog.cpp
+++ b/src/windows/native/sun/windows/awt_PrintDialog.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2008, 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
@@ -166,17 +166,6 @@
 }
 
 JNIEXPORT void JNICALL
-Java_sun_awt_windows_WPrintDialog_setPeer(JNIEnv *env, jobject target,
-                                          jobject peer)
-{
-    TRY;
-
-    env->SetObjectField(target, AwtComponent::peerID, peer);
-
-    CATCH_BAD_ALLOC;
-}
-
-JNIEXPORT void JNICALL
 Java_sun_awt_windows_WPrintDialogPeer_initIDs(JNIEnv *env, jclass cls)
 {
     TRY;
diff --git a/src/windows/native/sun/windows/awt_Rectangle.cpp b/src/windows/native/sun/windows/awt_Rectangle.cpp
index 59f4c48..07ec535 100644
--- a/src/windows/native/sun/windows/awt_Rectangle.cpp
+++ b/src/windows/native/sun/windows/awt_Rectangle.cpp
@@ -46,14 +46,20 @@
     TRY;
 
     AwtRectangle::xID = env->GetFieldID(cls, "x", "I");
-    AwtRectangle::yID = env->GetFieldID(cls, "y", "I");
-    AwtRectangle::widthID = env->GetFieldID(cls, "width", "I");
-    AwtRectangle::heightID = env->GetFieldID(cls, "height", "I");
-
     DASSERT(AwtRectangle::xID != NULL);
+    CHECK_NULL(AwtRectangle::xID);
+
+    AwtRectangle::yID = env->GetFieldID(cls, "y", "I");
     DASSERT(AwtRectangle::yID != NULL);
+    CHECK_NULL(AwtRectangle::yID);
+
+    AwtRectangle::widthID = env->GetFieldID(cls, "width", "I");
     DASSERT(AwtRectangle::widthID != NULL);
+    CHECK_NULL(AwtRectangle::widthID);
+
+    AwtRectangle::heightID = env->GetFieldID(cls, "height", "I");
     DASSERT(AwtRectangle::heightID != NULL);
+    CHECK_NULL(AwtRectangle::heightID);
 
     CATCH_BAD_ALLOC;
 }
diff --git a/src/windows/native/sun/windows/awt_TrayIcon.cpp b/src/windows/native/sun/windows/awt_TrayIcon.cpp
index c26769b..d453101 100644
--- a/src/windows/native/sun/windows/awt_TrayIcon.cpp
+++ b/src/windows/native/sun/windows/awt_TrayIcon.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -503,6 +503,7 @@
             env->GetMethodID(mouseEventCls, "<init>",
                              "(Ljava/awt/Component;IJIIIIIIZI)V");
         DASSERT(mouseEventConst);
+        CHECK_NULL(mouseEventConst);
     }
     if (env->EnsureLocalCapacity(2) < 0) {
         return;
@@ -556,6 +557,7 @@
             env->GetMethodID(actionEventCls, "<init>",
                              "(Ljava/lang/Object;ILjava/lang/String;JI)V");
         DASSERT(actionEventConst);
+        CHECK_NULL(actionEventConst);
     }
     if (env->EnsureLocalCapacity(2) < 0) {
         return;
@@ -736,6 +738,7 @@
     }
 
     tooltipStr = JNU_GetStringPlatformChars(env, jtooltip, (jboolean *)NULL);
+    if (env->ExceptionCheck()) goto ret;
     trayIcon->SetToolTip(tooltipStr);
     JNU_ReleaseStringPlatformChars(env, jtooltip, tooltipStr);
 ret:
@@ -855,9 +858,18 @@
     trayIcon = (AwtTrayIcon *)pData;
 
     captionStr = JNU_GetStringPlatformChars(env, jcaption, (jboolean *)NULL);
+    if (env->ExceptionCheck()) goto ret;
     textStr = JNU_GetStringPlatformChars(env, jtext, (jboolean *)NULL);
+    if (env->ExceptionCheck()) {
+        JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
+        goto ret;
+    }
     msgTypeStr = JNU_GetStringPlatformChars(env, jmsgType, (jboolean *)NULL);
-
+    if (env->ExceptionCheck()) {
+        JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
+        JNU_ReleaseStringPlatformChars(env, jtext, textStr);
+        goto ret;
+    }
     trayIcon->DisplayMessage(captionStr, textStr, msgTypeStr);
 
     JNU_ReleaseStringPlatformChars(env, jcaption, captionStr);
@@ -889,10 +901,12 @@
 
     /* init field ids */
     AwtTrayIcon::idID = env->GetFieldID(cls, "id", "I");
-    AwtTrayIcon::actionCommandID = env->GetFieldID(cls, "actionCommand", "Ljava/lang/String;");
-
     DASSERT(AwtTrayIcon::idID != NULL);
+    CHECK_NULL(AwtTrayIcon::idID);
+
+    AwtTrayIcon::actionCommandID = env->GetFieldID(cls, "actionCommand", "Ljava/lang/String;");
     DASSERT(AwtTrayIcon::actionCommandID != NULL);
+    CHECK_NULL( AwtTrayIcon::actionCommandID);
 
     CATCH_BAD_ALLOC;
 }
@@ -981,8 +995,11 @@
     jint *intRasterDataPtr = NULL;
     HBITMAP hColor = NULL;
     try {
-        intRasterDataPtr =
-            (jint *)env->GetPrimitiveArrayCritical(intRasterData, 0);
+        intRasterDataPtr = (jint *)env->GetPrimitiveArrayCritical(intRasterData, 0);
+        if (intRasterDataPtr == NULL) {
+            ::DeleteObject(hMask);
+            return;
+        }
         hColor = AwtTrayIcon::CreateBMP(NULL, (int *)intRasterDataPtr, nSS, nW, nH);
     } catch (...) {
         if (intRasterDataPtr != NULL) {
diff --git a/test/ProblemList.txt b/test/ProblemList.txt
index 8c5f946..0b55de3 100644
--- a/test/ProblemList.txt
+++ b/test/ProblemList.txt
@@ -221,15 +221,6 @@
 java/security/KeyPairGenerator/SolarisShortDSA.java             solaris-all
 sun/security/tools/keytool/standard.sh                          solaris-all
 
-# 8000439: NPG: REGRESSION : sun/security/krb5/auto/MaxRetries.java fails with timeout
-sun/security/krb5/auto/MaxRetries.java                          solaris-sparcv9
-
-# 8006690: sun/security/krb5/auto/BadKdc1.java fails intermittently
-sun/security/krb5/auto/BadKdc1.java                             solaris-sparcv9
-sun/security/krb5/auto/BadKdc2.java                             solaris-sparcv9
-sun/security/krb5/auto/BadKdc3.java                             solaris-sparcv9
-sun/security/krb5/auto/BadKdc4.java                             solaris-sparcv9
-
 ############################################################################
 
 # jdk_sound
diff --git a/test/com/sun/awt/SecurityWarning/CustomSecurityManager.java b/test/com/sun/awt/SecurityWarning/CustomSecurityManager.java
index 3885f16..ccf2b98 100644
--- a/test/com/sun/awt/SecurityWarning/CustomSecurityManager.java
+++ b/test/com/sun/awt/SecurityWarning/CustomSecurityManager.java
@@ -1,10 +1,35 @@
-import sun.security.util.SecurityConstants;
+/*
+ * 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.
+ */
+
+import sun.awt.AWTPermissions;
 import java.security.Permission;
 
 public class CustomSecurityManager extends SecurityManager {
     @Override
     public void checkPermission(Permission perm) {
-        if (perm.implies(SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION)) {
+        if (perm.implies(AWTPermissions.TOPLEVEL_WINDOW_PERMISSION)) {
             throw new SecurityException();
         }
     }
diff --git a/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java b/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java
index 4afa7b1..f235df6 100644
--- a/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java
+++ b/test/com/sun/crypto/provider/Cipher/DES/PerformanceTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2007, 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
@@ -24,12 +24,9 @@
 /*
  * @test
  * @bug 0000000
- * @ignore run main/timeout=900 PerformanceTest
- * @summary PerformanceTest
+ * @summary This test checks performance of various ciphers.
  * @author Jan Luehe
- *
- * ignore since this test exists for performance
- * purpose and can be run separately if needed.
+ * @run main/manual PerformanceTest
  */
 import java.security.*;
 import java.security.spec.*;
diff --git a/test/com/sun/security/auth/callback/TextCallbackHandler/Default.java b/test/com/sun/security/auth/callback/TextCallbackHandler/Default.java
index 2110986..606a1ad 100644
--- a/test/com/sun/security/auth/callback/TextCallbackHandler/Default.java
+++ b/test/com/sun/security/auth/callback/TextCallbackHandler/Default.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 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
@@ -25,8 +25,7 @@
  * @test
  * @bug 4470717
  * @summary fix default handling and other misc
- *
- * @ignore run these by hand
+ * @run main/manual Default
  */
 
 import com.sun.security.auth.callback.TextCallbackHandler;
diff --git a/test/com/sun/security/auth/callback/TextCallbackHandler/Password.java b/test/com/sun/security/auth/callback/TextCallbackHandler/Password.java
index 3516e72..b34ef04 100644
--- a/test/com/sun/security/auth/callback/TextCallbackHandler/Password.java
+++ b/test/com/sun/security/auth/callback/TextCallbackHandler/Password.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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,7 +25,7 @@
  * @test
  * @bug 6825240
  * @summary Password.readPassword() echos the input when System.Console is null
- * @ignore run these by hand
+ * @run main/manual Password
  */
 
 import com.sun.security.auth.callback.TextCallbackHandler;
diff --git a/test/com/sun/security/sasl/gsskerb/AuthOnly.java b/test/com/sun/security/sasl/gsskerb/AuthOnly.java
index 554d243..fa8105a 100644
--- a/test/com/sun/security/sasl/gsskerb/AuthOnly.java
+++ b/test/com/sun/security/sasl/gsskerb/AuthOnly.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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,11 +25,14 @@
  * @test
  * @bug 4634892
  * @summary Ensure authentication via GSS-API/Kerberos v5 works.
- * @ignore see runwjaas.csh for instructions for how to run this test
+ * @run main/manual AuthOnly
  */
+
 /*
- * Can set logging to FINEST to view exchange.
+ * Set logging to FINEST to view exchange.
+ * See runwjaas.csh for instructions for how to run this test.
  */
+
 import javax.security.sasl.*;
 import javax.security.auth.callback.*;
 import java.security.*;
diff --git a/test/com/sun/security/sasl/gsskerb/ConfSecurityLayer.java b/test/com/sun/security/sasl/gsskerb/ConfSecurityLayer.java
index 38791ed..88df348 100644
--- a/test/com/sun/security/sasl/gsskerb/ConfSecurityLayer.java
+++ b/test/com/sun/security/sasl/gsskerb/ConfSecurityLayer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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,12 +25,15 @@
  * @test
  * @bug 5014493
  * @summary SaslServer.wrap throws NullPointerException when security
- *    layer negotiated
- * @ignore see run-conf-wjaas.csh for instructions for how to run this test
+ *    layer negotiated.
+ * @run main/manual ConfSecurityLayer
  */
+
 /*
- * Can set logging to FINEST to view exchange.
+ * Set logging to FINEST to view exchange.
+ * See run-conf-wjaas.csh for instructions for how to run this test.
  */
+
 import javax.security.sasl.*;
 import javax.security.auth.callback.*;
 import java.security.*;
diff --git a/test/com/sun/security/sasl/gsskerb/NoSecurityLayer.java b/test/com/sun/security/sasl/gsskerb/NoSecurityLayer.java
index 94833ec..63a759d 100644
--- a/test/com/sun/security/sasl/gsskerb/NoSecurityLayer.java
+++ b/test/com/sun/security/sasl/gsskerb/NoSecurityLayer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -24,13 +24,16 @@
 /*
  * @test
  * @bug 4873552
- * @summary GSS-API/krb5 SASL mechanism should throw IllegalStateException for auth-only
+ * @summary GSS-API/krb5 SASL mechanism should throw IllegalStateException
+ *     for auth-only
+ * @run main/manual NoSecurityLayer
+ */
 
- * @ignore see run-nosec-wjaas.csh for instructions for how to run this test
- */
 /*
- * Can set logging to FINEST to view exchange.
+ * Set logging to FINEST to view exchange.
+ * See run-nosec-wjaas.csh for instructions for how to run this test.
  */
+
 import javax.security.sasl.*;
 import javax.security.auth.callback.*;
 import java.security.*;
diff --git a/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java b/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
new file mode 100644
index 0000000..c3bc890
--- /dev/null
+++ b/test/java/awt/Choice/ChoiceLocationTest/ChoiceLocationTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+/*
+ @test
+  @bug 7159566
+  @summary The choice positioned in the top of applet when clicking the choice.
+  @author Petr Pchelko
+  @library ../../regtesthelpers
+  @build Util
+  @run main ChoiceLocationTest
+ */
+
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.InputEvent;
+import java.util.stream.Stream;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class ChoiceLocationTest {
+
+    private static final int FRAME_LOCATION = 100;
+    private static final int FRAME_SIZE = 400;
+    private static final int CLICK_STEP = 5;
+
+    private static String[] choiceItems = new String[] {
+            "test item 1",
+            "test item 2",
+            "test item 3"
+    };
+
+    private static volatile Frame frame;
+    private static volatile Choice choice;
+
+    public static void main(String[] args) throws Exception {
+        try {
+            SwingUtilities.invokeAndWait(ChoiceLocationTest::initAndShowUI);
+            Robot r = new Robot();
+            r.waitForIdle();
+            r.delay(100);
+
+            Util.clickOnComp(choice, r);
+
+            choice.addItemListener(event -> {throw new RuntimeException("Failed: the choice popup is in the wrong place");});
+
+            // Test: click in several places on the top of the frame an ensure there' no choice there
+            Point locOnScreen = frame.getLocationOnScreen();
+            int x = locOnScreen.x + FRAME_SIZE / 2;
+            for (int y = locOnScreen.y + frame.getInsets().top + 10; y < locOnScreen.y + FRAME_SIZE / 3 ; y += CLICK_STEP) {
+                r.mouseMove(x, y);
+                r.waitForIdle();
+                r.mousePress(InputEvent.BUTTON1_MASK);
+                r.mouseRelease(InputEvent.BUTTON1_MASK);
+                r.waitForIdle();
+                r.delay(100);
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+
+    }
+
+    private static void initAndShowUI() {
+        frame = new Frame("Test frame");
+        choice = new Choice();
+        Stream.of(choiceItems).forEach(choice::add);
+        frame.add(choice);
+        frame.setBounds(FRAME_LOCATION, FRAME_LOCATION, FRAME_SIZE, FRAME_SIZE);
+        frame.setVisible(true);
+    }
+
+
+}
diff --git a/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.html b/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.html
new file mode 100644
index 0000000..85e187d
--- /dev/null
+++ b/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.html
@@ -0,0 +1,32 @@
+<!--
+ Copyright (c) 2013, 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.
+
+ 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.
+-->
+
+<html>
+    <head>
+        <title>High resolution custom cursor test, bug ID 8028212</title>
+    </head>
+    <body>
+    <applet CODE="MultiResolutionCursorTest.class" WIDTH=300 HEIGHT=100></applet>
+    <p> See the dialog box (usually in upper left corner) for instructions</p>
+</body>
+</html>
\ No newline at end of file
diff --git a/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java b/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java
new file mode 100644
index 0000000..9507bb4
--- /dev/null
+++ b/test/java/awt/Cursor/MultiResolutionCursorTest/MultiResolutionCursorTest.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Label;
+import java.awt.Point;
+import java.awt.TextArea;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.util.LinkedList;
+import java.util.List;
+import javax.swing.JApplet;
+import sun.awt.OSInfo;
+import sun.awt.image.MultiResolutionImage;
+
+/**
+ * @test
+ * @bug 8028212
+ * @summary [macosx] Custom Cursor HiDPI support
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno MultiResolutionCursorTest.html
+ */
+public class MultiResolutionCursorTest extends JApplet {
+    //Declare things used in the test, like buttons and labels here
+
+    static final int sizes[] = {16, 32, 128};
+    static final Color colors[] = {Color.WHITE, Color.RED, Color.GREEN, Color.BLUE};
+
+    public void init() {
+        //Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout(new BorderLayout());
+
+        if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            String[] instructions = {
+                "Verify that high resolution custom cursor is used"
+                + " on HiDPI displays.",
+                "1) Run the test on Retina display or enable the Quartz Debug"
+                + " and select the screen resolution with (HiDPI) label",
+                "2) Move the cursor to the Test Frame",
+                "3) Check that cursor has red, green or blue color",
+                "If so, press PASS, else press FAIL."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+
+        } else {
+            String[] instructions = {
+                "This test is not applicable to the current platform. Press PASS."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+        }
+    }//End  init()
+
+    public void start() {
+        //Get things going.  Request focus, set size, et cetera
+        setSize(200, 200);
+        setVisible(true);
+        validate();
+
+        final Image image = new MultiResolutionCursor();
+
+        int center = sizes[0] / 2;
+        Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(
+                image, new Point(center, center), "multi-resolution cursor");
+
+        Frame frame = new Frame("Test Frame");
+        frame.setSize(300, 300);
+        frame.setLocation(300, 50);
+        frame.add(new Label("Move cursor here"));
+        frame.setCursor(cursor);
+        frame.setVisible(true);
+    }// start()
+
+
+    static class MultiResolutionCursor extends BufferedImage implements MultiResolutionImage {
+
+        List<Image> highResolutionImages;
+
+        public MultiResolutionCursor() {
+            super(sizes[0], sizes[0], BufferedImage.TYPE_INT_RGB);
+
+            draw(getGraphics(), 0);
+            highResolutionImages = new LinkedList<>();
+            highResolutionImages.add(this);
+
+            for (int i = 1; i < sizes.length; i++) {
+                BufferedImage highResolutionImage =
+                        new BufferedImage(sizes[i], sizes[i], BufferedImage.TYPE_INT_RGB);
+                draw(highResolutionImage.getGraphics(), i);
+                highResolutionImages.add(highResolutionImage);
+            }
+        }
+
+        @Override
+        public Image getResolutionVariant(int width, int height) {
+
+            for (int i = 0; i < sizes.length; i++) {
+                Image image = highResolutionImages.get(i);
+                int w = image.getWidth(null);
+                int h = image.getHeight(null);
+
+                if (width <= w && height <= h) {
+                    return image;
+                }
+            }
+
+            return highResolutionImages.get(highResolutionImages.size() - 1);
+        }
+
+        void draw(Graphics graphics, int index) {
+            Graphics2D g2 = (Graphics2D) graphics;
+            Color color = colors[index];
+            g2.setColor(color);
+            g2.fillRect(0, 0, sizes[index], sizes[index]);
+        }
+
+        @Override
+        public List<Image> getResolutionVariants() {
+            return highResolutionImages;
+        }
+    }
+}// class BlockedWindowTest
+
+/* Place other classes related to the test after this line */
+/**
+ * **************************************************
+ * Standard Test Machinery DO NOT modify anything below -- it's a standard chunk
+ * of code whose purpose is to make user interaction uniform, and thereby make
+ * it simpler to read and understand someone else's test.
+ * **************************************************
+ */
+/**
+ * This is part of the standard test machinery. It creates a dialog (with the
+ * instructions), and is the interface for sending text messages to the user. To
+ * print the instructions, send an array of strings to Sysout.createDialog
+ * WithInstructions method. Put one line of instructions per array entry. To
+ * display a message for the tester to see, simply call Sysout.println with the
+ * string to be displayed. This mimics System.out.println but works within the
+ * test harness as well as standalone.
+ */
+class Sysout {
+
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+    }
+}// Sysout  class
+
+/**
+ * This is part of the standard test machinery. It provides a place for the test
+ * instructions to be displayed, and a place for interactive messages to the
+ * user to be displayed. To have the test instructions displayed, see Sysout. To
+ * have a message to the user be displayed, see Sysout. Do not call anything in
+ * this dialog directly.
+ */
+class TestDialog extends Dialog {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) {
+                        posOfSpace = maxStringLength - 1;
+                    }
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                } //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+        System.out.println(messageIn);
+    }
+}// Te
\ No newline at end of file
diff --git a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java
index d66982d..587db43 100644
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java
+++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/InterprocessMessages.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -24,5 +24,6 @@
 interface InterprocessMessages {
     final static int EXECUTION_IS_SUCCESSFULL = 0;
     final static int DATA_IS_CORRUPTED = 212;
+    final static int NO_DROP_HAPPENED = 112;
 }
 
diff --git a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
index af168b4..7f2a48d 100644
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
+++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.html
@@ -1,5 +1,5 @@
 <!--
- Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2013, 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
@@ -24,7 +24,7 @@
 <html>
 <!--  
   @test
-  @bug 8005932
+  @bug 8005932 8017456
   @summary Java 7 on mac os x only provides text clipboard formats
   @author mikhail.cherkasov@oracle.com
   @library ../../regtesthelpers
diff --git a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
index 598426f..4c303cc 100644
--- a/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
+++ b/test/java/awt/DataFlavor/MissedHtmlAndRtfBug/MissedHtmlAndRtfBug.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -21,17 +21,6 @@
  * questions.
  */
 
-/*
-  @bug 8005932
-  @summary Java 7 on mac os x only provides text clipboard formats
-  @author mikhail.cherkasov@oracle.com
-  @library ../../regtesthelpers
-  @library ../../regtesthelpers/process
-  @build Util
-  @build ProcessResults ProcessCommunicator
-  @run applet/othervm MissedHtmlAndRtfBug.html
-*/
-
 import java.awt.*;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.event.*;
@@ -47,6 +36,7 @@
 import static java.lang.Thread.sleep;
 
 public class MissedHtmlAndRtfBug extends Applet {
+
     public void init() {
         setLayout(new BorderLayout());
     }//End  init()
@@ -82,9 +72,6 @@
         args.add(concatStrings(DataFlavorSearcher.RICH_TEXT_NAMES));
 
         ProcessResults processResults =
-//                ProcessCommunicator.executeChildProcess(this.getClass(), "/Users/mcherkasov/ws/clipboard/DataFlover/out/production/DataFlover" +
-//                        " -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005 ",
-//                        args.toArray(new String[0]));
                 ProcessCommunicator.executeChildProcess(this.getClass(),
                         "." + File.separator + System.getProperty("java.class.path"), args.toArray(new String[]{}));
 
@@ -117,6 +104,13 @@
             throw new RuntimeException("TEST IS FAILED: Target has received" +
                     " corrupted data.");
         }
+        if (InterprocessMessages.NO_DROP_HAPPENED ==
+                processResults.getExitValue()) {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("Error. Drop did not happen." +
+                " Target frame is possibly covered by a window of other application." +
+                " Please, rerun the test with all windows minimized.");
+        }
         processResults.verifyStdErr(System.err);
         processResults.verifyProcessExitValue(System.err);
         processResults.printProcessStandartOutput(System.out);
@@ -184,7 +178,7 @@
         }
     }
 
-    public static void main(String[] args) {
+    public static void main(String[] args) throws InterruptedException {
         Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extractInt(args),
                 InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extractInt(args));
         Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extractInt(args),
@@ -197,6 +191,8 @@
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
+        sleep(5000);
+        System.exit(InterprocessMessages.NO_DROP_HAPPENED);
     }
 
 
diff --git a/test/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java b/test/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java
index 052f36f..9a5d075 100644
--- a/test/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java
+++ b/test/java/awt/Desktop/OpenByUNCPathNameTest/OpenByUNCPathNameTest.java
@@ -45,6 +45,10 @@
             System.out.println("java.awt.Desktop is not supported on this platform.");
         } else {
             Desktop desktop = Desktop.getDesktop();
+            if (!desktop.isSupported(Desktop.Action.OPEN)) {
+                System.out.println("Action.OPEN is not supported on this platform.");
+                return;
+            }
             File file = File.createTempFile("Read Me File", ".txt");
             try {
                 // Test opening of the file with Windows local file path.
diff --git a/test/java/awt/EventDispatchThread/EDTShutdownTest/EDTShutdownTest.java b/test/java/awt/EventDispatchThread/EDTShutdownTest/EDTShutdownTest.java
new file mode 100644
index 0000000..7a671b7
--- /dev/null
+++ b/test/java/awt/EventDispatchThread/EDTShutdownTest/EDTShutdownTest.java
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+  @test
+  @bug 8031694
+  @summary [macosx] TwentyThousandTest test intermittently hangs
+  @author Oleg Pekhovskiy
+  @run main EDTShutdownTest
+ */
+
+import java.awt.EventQueue;
+import java.awt.Toolkit;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import sun.awt.AWTAccessor;
+
+public class EDTShutdownTest {
+
+    private static boolean passed = false;
+
+    public static void main(String[] args) {
+        // Force EDT start with InvocationEvent
+        EventQueue.invokeLater(() -> {
+            // EventQueue is empty now
+            EventQueue queue = Toolkit.getDefaultToolkit()
+                               .getSystemEventQueue();
+            Thread thread = AWTAccessor.getEventQueueAccessor()
+                            .getDispatchThread(queue);
+            try {
+                /*
+                 * Clear EventDispatchThread.doDispatch flag to break message
+                 * loop in EventDispatchThread.pumpEventsForFilter()
+                 */
+                Method stopDispatching = thread.getClass()
+                        .getDeclaredMethod("stopDispatching", null);
+                stopDispatching.setAccessible(true);
+                stopDispatching.invoke(thread, null);
+
+                /*
+                 * Post another InvocationEvent that must be handled by another
+                 * instance of EDT
+                 */
+                EventQueue.invokeLater(() -> {
+                    passed = true;
+                });
+            }
+            catch (InvocationTargetException | NoSuchMethodException
+                   | IllegalAccessException e) {
+            }
+        });
+
+        // Wait for EDT shutdown
+        EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+        Thread thread = AWTAccessor.getEventQueueAccessor()
+                        .getDispatchThread(queue);
+        try {
+            thread.join();
+
+            /*
+             * Wait for another EDT instance to handle the InvocationEvent
+             * and shutdown
+             */
+            thread = AWTAccessor.getEventQueueAccessor()
+                     .getDispatchThread(queue);
+            if (thread != null) {
+                thread.join();
+            }
+        }
+        catch (InterruptedException e) {
+        }
+
+        if (passed) {
+            System.out.println("Test PASSED!");
+        }
+        else {
+            throw new RuntimeException("Test FAILED!");
+        }
+    }
+}
diff --git a/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html b/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html
new file mode 100644
index 0000000..e1900dc
--- /dev/null
+++ b/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.html
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2013, 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.
+
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug 8026869
+  @summary Support apple.awt.use-file-dialog-packages property.
+  @author Petr Pchelko area=awt.filedialog
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno FileDialogForPackages.html
+  -->
+<head>
+    <title> FileDialogForPackages </title>
+</head>
+<body>
+
+<h1>FileDialogForPackages<br>Bug ID: 8026869</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="FileDialogForPackages.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
diff --git a/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java b/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java
new file mode 100644
index 0000000..6a23a1d
--- /dev/null
+++ b/test/java/awt/FileDialog/FileDialogForPackages/FileDialogForPackages.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+
+import sun.awt.OSInfo;
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.Button;
+import java.awt.FileDialog;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class FileDialogForPackages extends Applet implements ActionListener {
+    private static final String APPLICATIONS_FOLDER = "/Applications";
+
+    private volatile Button showBtn;
+    private volatile FileDialog fd;
+
+    @Override
+    public void init() {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            Sysout.createDialogWithInstructions(new String[]{
+                    "Press PASS, this test is for MacOS X only."});
+            return;
+        }
+
+        System.setProperty("apple.awt.use-file-dialog-packages", "true");
+
+        setLayout(new GridLayout(1, 1));
+
+        fd = new FileDialog(new Frame(), "Open");
+        fd.setDirectory(APPLICATIONS_FOLDER);
+
+        showBtn = new Button("Show File Dialog");
+        showBtn.addActionListener(this);
+        add(showBtn);
+        String[] instructions = {
+                "1) Click on 'Show File Dialog' button. A file dialog will come up.",
+                "2) Navigate to the Applications folder if not already there",
+                "3) Check that the application bundles can be selected and can not be navigated",
+                "4) If it's true then the test passed, otherwise it failed."};
+        Sysout.createDialogWithInstructions(instructions);
+    }
+
+    @Override
+    public void start() {
+        setSize(200, 200);
+        show();
+    }
+
+    @Override
+    public void actionPerformed(ActionEvent e) {
+        if (e.getSource() == showBtn) {
+            fd.setVisible(true);
+            String output = fd.getFile();
+            if (output != null) {
+                Sysout.println(output + " is selected");
+            }
+        }
+    }
+}
diff --git a/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java b/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
new file mode 100644
index 0000000..b0f3c63
--- /dev/null
+++ b/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/* @test
+   @bug 8032078
+   @summary Frame.setExtendedState throws RuntimeException, if
+            windowState=ICONIFIED|MAXIMIZED_BOTH, on OS X
+   @author Anton Litvinov
+*/
+
+import java.awt.*;
+
+import sun.awt.SunToolkit;
+
+public class ExceptionOnSetExtendedStateTest {
+    private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
+    private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+
+    private static boolean validatePlatform() {
+        String osName = System.getProperty("os.name");
+        if (osName == null) {
+            throw new RuntimeException("Name of the current OS could not be retrieved.");
+        }
+        return osName.startsWith("Mac");
+    }
+
+    private static void testStateChange(int oldState, int newState, boolean decoratedFrame) {
+        System.out.println(String.format(
+            "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'",
+            oldState, newState, decoratedFrame));
+
+        Frame frame = new Frame("ExceptionOnSetExtendedStateTest");
+        frame.setSize(200, 200);
+        frame.setUndecorated(!decoratedFrame);
+        frame.setVisible(true);
+        toolkit.realSync();
+
+        frame.setExtendedState(oldState);
+        sleep(1000);
+        frame.setExtendedState(newState);
+
+        boolean stateWasNotChanged = true;
+        int currentState = 0;
+        for (int i = 0; (i < 3) && stateWasNotChanged; i++) {
+            sleep(1000);
+            currentState = frame.getExtendedState();
+            if ((currentState == newState) ||
+                (((newState & Frame.ICONIFIED) != 0) && ((currentState & Frame.ICONIFIED) != 0))) {
+                stateWasNotChanged = false;
+            }
+        }
+        frame.dispose();
+
+        if (stateWasNotChanged) {
+            throw new RuntimeException(String.format(
+                "Frame state was not changed. currentState='%d'", currentState));
+        }
+    }
+
+    private static void sleep(int millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public static void main(String[] args) {
+        if (!validatePlatform()) {
+            System.out.println("This test is only for OS X.");
+            return;
+        }
+
+        // Verify that changing states of decorated/undecorated frame to/from supported states
+        // and the state bit mask ICONIFIED | MAXIMIZED_BOTH does not raise RuntimeException.
+        for (int i = 0; i < frameStates.length; i++) {
+            testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, true);
+            testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, false);
+            testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], true);
+            testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], false);
+        }
+    }
+}
diff --git a/test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java b/test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java
new file mode 100644
index 0000000..ea20ccf
--- /dev/null
+++ b/test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+  @test
+  @bug 8017472
+  @summary MouseEvent has wrong coordinates when using multiple monitors
+  @run main MouseEventTest
+ */
+
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+public class MouseEventTest {
+    static volatile boolean crossed = false;
+
+    static void sleep() throws InterruptedException {
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Thread.sleep(500);
+    }
+
+    public static void main(String[] args) throws AWTException, InterruptedException {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.out.println("It's a multiscreen test... skipping!");
+            return;
+        }
+
+        for (int i = 0; i < gds.length; ++i) {
+            GraphicsDevice gd = gds[i];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            Rectangle screen = gc.getBounds();
+            Robot robot = new Robot(gd);
+            robot.setAutoDelay(100);
+
+
+            Frame frame = new Frame(gc);
+            frame.setUndecorated(true);
+            frame.setSize(200, 200);
+            frame.setLocation(screen.x + 200, screen.y + 200);
+            frame.setBackground(Color.YELLOW);
+            frame.setVisible(true);
+            sleep();
+
+            Point loc = frame.getLocationOnScreen();
+            Dimension size = frame.getSize();
+            final Point point = new Point(
+                    loc.x + size.width / 2,
+                    loc.y + size.height / 2);
+
+            crossed = false;
+
+            frame.addMouseMotionListener(new MouseAdapter() {
+                @Override
+                public void mouseMoved(MouseEvent e) {
+                    if (point.equals(e.getLocationOnScreen())) {
+                        crossed = true;
+                    }
+                }
+            });
+
+            robot.mouseMove(point.x - 1, point.y - 1);
+            robot.mouseMove(point.x, point.y);
+
+            sleep();
+            frame.dispose();
+
+            if (!crossed) {
+                throw new RuntimeException("An expected mouse motion event was not received on the screen #" + i);
+            }
+        }
+
+        System.out.println("Test PASSED!");
+    }
+}
diff --git a/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java b/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java
new file mode 100644
index 0000000..8005c03
--- /dev/null
+++ b/test/java/awt/Multiscreen/MultiScreenInsetsTest/MultiScreenInsetsTest.java
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+  @test
+  @bug 8020443
+  @summary Frame is not created on the specified GraphicsDevice with two
+monitors
+  @author Oleg Pekhovskiy
+  @run main MultiScreenInsetsTest
+ */
+
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.awt.Toolkit;
+import sun.awt.OSInfo;
+
+public class MultiScreenInsetsTest {
+    private static final int SIZE = 100;
+
+    public static void main(String[] args) throws InterruptedException {
+        OSInfo.OSType type = OSInfo.getOSType();
+        if (type != OSInfo.OSType.LINUX && type != OSInfo.OSType.SOLARIS) {
+            System.out.println("This test is for Solaris and Linux only..." +
+                               "skipping!");
+            return;
+        }
+
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.out.println("It's a multi-screen test... skipping!");
+            return;
+        }
+
+        for (int screen = 0; screen < gds.length; ++screen) {
+            GraphicsDevice gd = gds[screen];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            Rectangle bounds = gc.getBounds();
+            Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
+
+            Frame frame = new Frame(gc);
+            frame.setLocation(bounds.x + (bounds.width - SIZE) / 2,
+                              bounds.y + (bounds.height - SIZE) / 2);
+            frame.setSize(SIZE, SIZE);
+            frame.setUndecorated(true);
+            frame.setVisible(true);
+
+            // Maximize Frame to reach the struts
+            frame.setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
+            Thread.sleep(2000);
+
+            Rectangle frameBounds = frame.getBounds();
+            frame.dispose();
+            if (bounds.x + insets.left != frameBounds.x
+                || bounds.y + insets.top != frameBounds.y
+                || bounds.width - insets.right - insets.left != frameBounds.width
+                || bounds.height - insets.bottom - insets.top != frameBounds.height) {
+                throw new RuntimeException("Test FAILED! Wrong screen #" +
+                                           screen + " insets: " + insets);
+            }
+        }
+        System.out.println("Test PASSED!");
+    }
+}
diff --git a/test/java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java b/test/java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java
new file mode 100644
index 0000000..6937a10
--- /dev/null
+++ b/test/java/awt/Multiscreen/MultiScreenLocationTest/MultiScreenLocationTest.java
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+  @test
+  @bug 8013116
+  @summary Robot moves mouse to point which differs from set in mouseMove on
+ Unity shell
+  @author Oleg Pekhovskiy
+  @library ../../regtesthelpers
+  @build Util
+  @run main MultiScreenLocationTest
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.MouseInfo;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.image.BufferedImage;
+import test.java.awt.regtesthelpers.Util;
+
+public class MultiScreenLocationTest {
+    private static final Point mouseOffset = new Point(150, 150);
+    private static final Point frameOffset = new Point(100, 100);
+    private static final Color color = Color.YELLOW;
+
+    private static String getErrorText(final String name, int screen)
+    {
+        return name + " test failed on Screen #" + screen + "!";
+    }
+
+    public static void main(String[] args) throws AWTException
+    {
+        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+        GraphicsDevice[] gds = ge.getScreenDevices();
+        if (gds.length < 2) {
+            System.out.println("It's a multiscreen test... skipping!");
+            return;
+        }
+
+        for (int i = 0; i < gds.length; ++i) {
+            GraphicsDevice gd = gds[i];
+            GraphicsConfiguration gc = gd.getDefaultConfiguration();
+            Rectangle screen = gc.getBounds();
+            Robot robot = new Robot(gd);
+
+            // check Robot.mouseMove()
+            robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
+            Point mouse = MouseInfo.getPointerInfo().getLocation();
+            Point point = screen.getLocation();
+            point.translate(mouseOffset.x, mouseOffset.y);
+            if (!point.equals(mouse)) {
+                throw new RuntimeException(getErrorText("Robot.mouseMove", i));
+            }
+
+            // check Robot.getPixelColor()
+            Frame frame = new Frame(gc);
+            frame.setUndecorated(true);
+            frame.setSize(100, 100);
+            frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
+            frame.setBackground(color);
+            frame.setVisible(true);
+            robot.waitForIdle();
+            Rectangle bounds = frame.getBounds();
+            if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
+                throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
+            }
+
+            // check Robot.createScreenCapture()
+            BufferedImage image = robot.createScreenCapture(bounds);
+            int rgb = color.getRGB();
+            if (image.getRGB(0, 0) != rgb
+                || image.getRGB(image.getWidth() - 1, 0) != rgb
+                || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
+                || image.getRGB(0, image.getHeight() - 1) != rgb) {
+                    throw new RuntimeException(
+                            getErrorText("Robot.createScreenCapture", i));
+            }
+            frame.dispose();
+        }
+
+        System.out.println("Test PASSED!");
+    }
+}
diff --git a/test/java/awt/Paint/PaintNativeOnUpdate.java b/test/java/awt/Paint/PaintNativeOnUpdate.java
new file mode 100644
index 0000000..56e45aa
--- /dev/null
+++ b/test/java/awt/Paint/PaintNativeOnUpdate.java
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Label;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 7157680
+ * @author Sergey Bylokhov
+ */
+public final class PaintNativeOnUpdate extends Label {
+
+    private boolean fullUpdate = true;
+
+    public static void main(final String[] args) throws AWTException {
+        final Frame frame = new Frame();
+        final Component label = new PaintNativeOnUpdate();
+        frame.setBackground(Color.RED);
+        frame.add(label);
+        frame.setSize(300, 300);
+        frame.setUndecorated(true);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+        sleep();
+        label.repaint();// first paint
+        sleep();
+        label.repaint();// incremental paint
+        sleep();
+
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+        Point point = label.getLocationOnScreen();
+        Color color = robot.getPixelColor(point.x + label.getWidth() / 2,
+                                          point.y + label.getHeight() / 2);
+        if (!color.equals(Color.GREEN)) {
+            System.err.println("Expected color = " + Color.GREEN);
+            System.err.println("Actual color = " + color);
+            throw new RuntimeException();
+        }
+        frame.dispose();
+    }
+
+    @Override
+    public void update(final Graphics g) {
+        if (fullUpdate) {
+            //full paint
+            g.setColor(Color.GREEN);
+            g.fillRect(0, 0, getWidth(), getHeight());
+            fullUpdate = false;
+        } else {
+            // Do nothing
+            // incremental paint
+        }
+    }
+
+    @Override
+    public void paint(final Graphics g) {
+        // Do nothing
+    }
+
+    private static void sleep() {
+        try {
+            ((SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
+            Thread.sleep(1000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+}
diff --git a/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java b/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java
new file mode 100644
index 0000000..b5e019e
--- /dev/null
+++ b/test/java/awt/SplashScreen/FullscreenAfterSplash/FullScreenAfterSplash.java
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2013, 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.
+*
+* 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.
+*/
+
+import sun.awt.OSInfo;
+
+import java.awt.*;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.lang.InterruptedException;
+import java.lang.System;
+import java.lang.Thread;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import javax.swing.*;
+
+/*
+ * @test
+ * @bug 8024185
+ * @summary Native Mac OS X full screen does not work after showing the splash
+ * @library ../
+ * @build GenerateTestImage
+ * @run main GenerateTestImage
+ * @author Petr Pchelko area=awt.event
+ * @run main/othervm -splash:test.png FullScreenAfterSplash
+ */
+public class FullScreenAfterSplash {
+
+    private static JFrame frame;
+
+    private static volatile boolean windowEnteringFullScreen = false;
+    private static volatile boolean windowEnteredFullScreen = false;
+
+    public static void main(String[] args) throws Exception {
+
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            System.out.println("The test is applicable only to Mac OS X. Passed");
+            return;
+        }
+        try {
+            //Move the mouse out, because it could interfere with the test.
+            Robot r = new Robot();
+            r.mouseMove(0, 0);
+            sleep();
+
+            SwingUtilities.invokeAndWait(FullScreenAfterSplash::createAndShowGUI);
+            sleep();
+
+            Point fullScreenButtonPos = frame.getLocation();
+            fullScreenButtonPos.translate(frame.getWidth() - 10, 10);
+            r.mouseMove(fullScreenButtonPos.x, fullScreenButtonPos.y);
+
+            //Cant use waitForIdle for full screen transition.
+            int waitCount = 0;
+            while (!windowEnteringFullScreen) {
+                r.mousePress(InputEvent.BUTTON1_MASK);
+                r.mouseRelease(InputEvent.BUTTON1_MASK);
+                Thread.sleep(100);
+                if (waitCount++ > 10) {
+                    System.err.println("Can't enter full screen mode. Failed.");
+                    System.exit(1);
+                }
+            }
+
+            waitCount = 0;
+            while (!windowEnteredFullScreen) {
+                Thread.sleep(100);
+                if (waitCount++ > 10) {
+                    System.err.println("Can't enter full screen mode. Failed.");
+                    System.exit(1);
+                }
+            }
+        } finally {
+            if (frame != null) {
+                frame.dispose();
+            }
+        }
+    }
+
+    private static void createAndShowGUI() {
+        frame = new JFrame(" Fullscreen OSX Bug ");
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+        enableFullScreen(frame);
+        frame.setBounds(100, 100, 100, 100);
+        frame.pack();
+        frame.setVisible(true);
+    }
+
+    /*
+     *  Use reflection to make a test compilable on not Mac OS X
+     */
+    private static void enableFullScreen(Window window) {
+        try {
+            Class<?> fullScreenUtilities = Class.forName("com.apple.eawt.FullScreenUtilities");
+            Method setWindowCanFullScreen = fullScreenUtilities.getMethod("setWindowCanFullScreen", Window.class, boolean.class);
+            setWindowCanFullScreen.invoke(fullScreenUtilities, window, true);
+            Class fullScreenListener = Class.forName("com.apple.eawt.FullScreenListener");
+            Object listenerObject = Proxy.newProxyInstance(fullScreenListener.getClassLoader(), new Class[]{fullScreenListener}, (proxy, method, args) -> {
+                switch (method.getName()) {
+                    case "windowEnteringFullScreen":
+                        windowEnteringFullScreen = true;
+                        break;
+                    case "windowEnteredFullScreen":
+                        windowEnteredFullScreen = true;
+                        break;
+                }
+                return null;
+            });
+            Method addFullScreenListener = fullScreenUtilities.getMethod("addFullScreenListenerTo", Window.class, fullScreenListener);
+            addFullScreenListener.invoke(fullScreenUtilities, window, listenerObject);
+        } catch (Exception e) {
+            throw new RuntimeException("FullScreen utilities not available", e);
+        }
+    }
+
+    private static void sleep() {
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException ignored) { }
+    }
+}
diff --git a/test/java/awt/SplashScreen/GenerateTestImage.java b/test/java/awt/SplashScreen/GenerateTestImage.java
new file mode 100644
index 0000000..9c06133
--- /dev/null
+++ b/test/java/awt/SplashScreen/GenerateTestImage.java
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2013, 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.
+*
+* 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.
+*/
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.FileOutputStream;
+
+/**
+ * A utility to generate a test image for the SplashScreen test
+ */
+public class GenerateTestImage {
+    private static final int IMAGE_SIZE = 20;
+
+    public static void main(String[] args) throws Exception {
+        String path = System.getProperty("test.classes") + File.separator + "test.png";
+
+        BufferedImage image = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_ARGB);
+        Graphics2D graphics2D = image.createGraphics();
+        graphics2D.setColor(Color.red);
+        graphics2D.fillOval(0, 0, IMAGE_SIZE, IMAGE_SIZE);
+        graphics2D.dispose();;
+
+        try(FileOutputStream fos = new FileOutputStream(path)) {
+            ImageIO.write(image, "png", fos);
+        }
+    }
+}
diff --git a/test/java/awt/TextArea/SelectionVisible/SelectionVisible.java b/test/java/awt/TextArea/SelectionVisible/SelectionVisible.java
index c34f75f..08698d8 100644
--- a/test/java/awt/TextArea/SelectionVisible/SelectionVisible.java
+++ b/test/java/awt/TextArea/SelectionVisible/SelectionVisible.java
@@ -31,32 +31,32 @@
 
 public final class SelectionVisible extends Applet {
 
-    TextArea tf;
+    private TextArea ta;
 
     @Override
     public void init() {
-        tf = new TextArea(3, 20);
-        tf.setText("0123456789");
-        tf.select(0, 6);
+        ta = new TextArea(4, 20);
+        ta.setText("01234\n56789");
+        ta.select(3, 9);
 
-        final TextArea ta = new TextArea("INSTRUCTIONS:\n"
-                                                 + "The text 012345 should be selected in the TextArea.\n"
+        final TextArea instruction = new TextArea("INSTRUCTIONS:\n"
+                                                 + "The text 34567 should be selected in the TextArea.\n"
                                                  + "If this is what you observe, then the test passes.\n"
                                                  + "Otherwise, the test fails.", 40, 5,
                                          TextArea.SCROLLBARS_NONE);
-        ta.setEditable(false);
-        ta.setPreferredSize(new Dimension(300, 70));
+        instruction.setEditable(false);
+        instruction.setPreferredSize(new Dimension(300, 70));
         final Panel panel = new Panel();
         panel.setLayout(new FlowLayout());
-        panel.add(tf);
+        panel.add(ta);
         setLayout(new BorderLayout());
-        add(ta, BorderLayout.CENTER);
+        add(instruction, BorderLayout.CENTER);
         add(panel, BorderLayout.PAGE_END);
     }
 
     @Override
     public void start() {
         setVisible(true);
-        tf.requestFocus();
+        ta.requestFocus();
     }
 }
diff --git a/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.html b/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.html
new file mode 100644
index 0000000..a7851c7
--- /dev/null
+++ b/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.html
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2013, 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.
+
+ 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.
+-->
+
+<html>
+<!--
+  @test
+  @bug 8007220
+  @summary The popup menu is not added to the tray icon after it was added to tray
+  @author Petr Pchelko
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno AddPopupAfterShowTest.html
+  -->
+<head>
+    <title> AddPopupAfterShowTest </title>
+</head>
+<body>
+
+<h1>AddPopupAfterShowTest<br>Bug ID: 8007220</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="AddPopupAfterShowTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
diff --git a/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.java b/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.java
new file mode 100644
index 0000000..4335b6c
--- /dev/null
+++ b/test/java/awt/TrayIcon/AddPopupAfterShowTest/AddPopupAfterShowTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+
+public class AddPopupAfterShowTest extends Applet {
+    @Override
+    public void init() {
+        if (!SystemTray.isSupported()) {
+            Sysout.createDialogWithInstructions(new String[]{
+                    "Press PASS, the System Tray is not supported"});
+            return;
+        }
+
+
+        String[] instructions = {
+                "1) The red circle icon was added to the system tray.",
+                "2) Check that a popup menu is opened when the icon is clicked.",
+                "3) If true the test is passed, otherwise failed."};
+        Sysout.createDialogWithInstructions(instructions);
+    }
+
+    @Override
+    public void start() {
+        setSize(200, 200);
+        show();
+
+        createSystemTrayIcon();
+    }
+
+    private static void createSystemTrayIcon() {
+        final TrayIcon trayIcon = new TrayIcon(createTrayIconImage());
+        trayIcon.setImageAutoSize(true);
+
+        try {
+            // Add tray icon to system tray *before* adding popup menu to demonstrate buggy behaviour
+            SystemTray.getSystemTray().add(trayIcon);
+            trayIcon.setPopupMenu(createTrayIconPopupMenu());
+        } catch (final AWTException awte) {
+            awte.printStackTrace();
+        }
+    }
+
+    private static Image createTrayIconImage() {
+        /**
+         * Create a small image of a red circle to use as the icon for the tray icon
+         */
+        int trayIconImageSize = 32;
+        final BufferedImage trayImage = new BufferedImage(trayIconImageSize, trayIconImageSize, BufferedImage.TYPE_INT_ARGB);
+        final Graphics2D trayImageGraphics = (Graphics2D) trayImage.getGraphics();
+
+        trayImageGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+        trayImageGraphics.setColor(new Color(255, 255, 255, 0));
+        trayImageGraphics.fillRect(0, 0, trayImage.getWidth(), trayImage.getHeight());
+
+        trayImageGraphics.setColor(Color.red);
+
+        int trayIconImageInset = 4;
+        trayImageGraphics.fillOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        trayImageGraphics.setColor(Color.darkGray);
+
+        trayImageGraphics.drawOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        return trayImage;
+    }
+
+    private static PopupMenu createTrayIconPopupMenu() {
+        final PopupMenu trayIconPopupMenu = new PopupMenu();
+        final MenuItem popupMenuItem = new MenuItem("TEST PASSED!");
+        trayIconPopupMenu.add(popupMenuItem);
+        return trayIconPopupMenu;
+    }
+}
diff --git a/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java b/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
new file mode 100644
index 0000000..4d5dd72
--- /dev/null
+++ b/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+/*
+ @test
+  @bug 8007220
+  @summary Reference to the popup leaks after the TrayIcon is removed
+  @author Petr Pchelko
+  @run main/othervm -Xmx50m PopupMenuLeakTest
+ */
+
+import java.awt.*;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+
+import java.awt.image.BufferedImage;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class PopupMenuLeakTest {
+
+    static final AtomicReference<WeakReference<TrayIcon>> iconWeakReference = new AtomicReference<>();
+    static final AtomicReference<WeakReference<PopupMenu>> popupWeakReference = new AtomicReference<>();
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(PopupMenuLeakTest::createSystemTrayIcon);
+        sleep();
+        // To make the test automatic we explicitly call addNotify on a popup to create the peer
+        SwingUtilities.invokeAndWait(PopupMenuLeakTest::addNotifyPopup);
+        sleep();
+        SwingUtilities.invokeAndWait(PopupMenuLeakTest::removeIcon);
+        sleep();
+        assertCollected(popupWeakReference.get(), "Failed, reference to popup not collected");
+        assertCollected(iconWeakReference.get(), "Failed, reference to tray icon not collected");
+    }
+
+    private static void addNotifyPopup() {
+        PopupMenu menu = popupWeakReference.get().get();
+        if (menu == null) {
+            throw new RuntimeException("Failed: popup collected too early");
+        }
+        menu.addNotify();
+    }
+
+    private static void removeIcon() {
+        TrayIcon icon = iconWeakReference.get().get();
+        if (icon == null) {
+            throw new RuntimeException("Failed: TrayIcon collected too early");
+        }
+        SystemTray.getSystemTray().remove(icon);
+    }
+
+    private static void assertCollected(WeakReference<?> reference, String message) {
+        java.util.List<byte[]> bytes = new ArrayList<>();
+        for (int i = 0; i < 5; i ++) {
+            try {
+                while (true) {
+                    bytes.add(new byte[1024]);
+                }
+            } catch (OutOfMemoryError err) {
+                bytes = new ArrayList<>();
+            }
+        }
+        if (reference.get() != null) {
+            throw new RuntimeException(message);
+        }
+    }
+
+    private static void createSystemTrayIcon() {
+        final TrayIcon trayIcon = new TrayIcon(createTrayIconImage());
+        trayIcon.setImageAutoSize(true);
+
+        try {
+            // Add tray icon to system tray *before* adding popup menu to demonstrate buggy behaviour
+            trayIcon.setPopupMenu(createTrayIconPopupMenu());
+            SystemTray.getSystemTray().add(trayIcon);
+            iconWeakReference.set(new WeakReference<>(trayIcon));
+            popupWeakReference.set(new WeakReference<>(trayIcon.getPopupMenu()));
+        } catch (final AWTException awte) {
+            awte.printStackTrace();
+        }
+    }
+
+    private static Image createTrayIconImage() {
+        /**
+         * Create a small image of a red circle to use as the icon for the tray icon
+         */
+        int trayIconImageSize = 32;
+        final BufferedImage trayImage = new BufferedImage(trayIconImageSize, trayIconImageSize, BufferedImage.TYPE_INT_ARGB);
+        final Graphics2D trayImageGraphics = (Graphics2D) trayImage.getGraphics();
+
+        trayImageGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+        trayImageGraphics.setColor(new Color(255, 255, 255, 0));
+        trayImageGraphics.fillRect(0, 0, trayImage.getWidth(), trayImage.getHeight());
+
+        trayImageGraphics.setColor(Color.red);
+
+        int trayIconImageInset = 4;
+        trayImageGraphics.fillOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        trayImageGraphics.setColor(Color.darkGray);
+
+        trayImageGraphics.drawOval(trayIconImageInset,
+                trayIconImageInset,
+                trayImage.getWidth() - 2 * trayIconImageInset,
+                trayImage.getHeight() - 2 * trayIconImageInset);
+
+        return trayImage;
+    }
+
+    private static PopupMenu createTrayIconPopupMenu() {
+        final PopupMenu trayIconPopupMenu = new PopupMenu();
+        final MenuItem popupMenuItem = new MenuItem("TEST!");
+        trayIconPopupMenu.add(popupMenuItem);
+        return trayIconPopupMenu;
+    }
+
+    private static void sleep() {
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(100);
+        } catch (InterruptedException ignored) { }
+    }
+}
diff --git a/test/java/awt/Window/AlwaysOnTop/TestAlwaysOnTopBeforeShow.java b/test/java/awt/Window/AlwaysOnTop/TestAlwaysOnTopBeforeShow.java
new file mode 100644
index 0000000..21ddb23
--- /dev/null
+++ b/test/java/awt/Window/AlwaysOnTop/TestAlwaysOnTopBeforeShow.java
@@ -0,0 +1,472 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+/*
+@test
+@bug 6236247
+@summary Test that setting of always-on-top flags before showing window works
+@author dom@sparc.spb.su: area=awt.toplevel
+@run main TestAlwaysOnTopBeforeShow
+*/
+
+/**
+ * TestAlwaysOnTopBeforeShow.java
+ *
+ * summary:  Test that always-on-top works in the following situations:
+ * - when set on a window before showing
+ * - when set on a child dialog
+ * - that it doesn't generate focus event when set on an invisible window
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.concurrent.atomic.AtomicBoolean;
+import sun.awt.SunToolkit;
+
+
+//*** global search and replace TestAlwaysOnTopBeforeShow with name of the test ***
+
+public class TestAlwaysOnTopBeforeShow
+{
+
+    //*** test-writer defined static variables go here ***
+
+    private static AtomicBoolean focused = new AtomicBoolean();
+    private static AtomicBoolean pressed = new AtomicBoolean();
+    private static volatile Object pressedTarget;
+    private static void init()
+    {
+        //*** Create instructions for the user here ***
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    if (e.getID() == MouseEvent.MOUSE_PRESSED) {
+                        synchronized(pressed) {
+                            pressed.set(true);
+                            pressedTarget = e.getSource();
+                            pressed.notifyAll();
+                        }
+                    }
+                }
+            }, AWTEvent.MOUSE_EVENT_MASK);
+
+        Frame f = new Frame("always-on-top");
+        f.setBounds(0, 0, 200, 200);
+        f.addFocusListener(new FocusAdapter() {
+                public void focusGained(FocusEvent e) {
+                    synchronized(focused) {
+                        focused.set(true);
+                        focused.notifyAll();
+                    }
+                }
+            });
+
+        f.setAlwaysOnTop(true);
+
+        waitForIdle(1000);
+        if (focused.get()) {
+            throw new RuntimeException("Always-on-top generated focus event");
+        }
+
+        f.setVisible(true);
+
+        waitFocused(f, focused);
+        focused.set(false);
+
+        Frame f2 = new Frame("auxilary");
+        f2.setBounds(100, 0, 200, 100);
+        f2.setVisible(true);
+        f2.toFront();
+        waitForIdle(1000);
+
+        Point location = f.getLocationOnScreen();
+        Dimension size = f.getSize();
+        checkOnTop(f, f2, location.x + size.width / 2, location.y + size.height / 2);
+
+        Dialog d = new Dialog(f, "Always-on-top");
+        d.pack();
+        d.setBounds(0, 0, 100, 100);
+
+        waitForIdle(1000);
+        checkOnTop(f, f2, location.x + size.width / 2, location.y + size.height / 2);
+        waitForIdle(1000);
+
+        focused.set(false);
+        f.setVisible(false);
+        f.setAlwaysOnTop(false);
+        waitForIdle(1000);
+        if (focused.get()) {
+            throw new RuntimeException("Always-on-top generated focus event");
+        }
+
+        TestAlwaysOnTopBeforeShow.pass();
+
+    }//End  init()
+
+    private static void waitForIdle(int mls) {
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(mls);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    static void waitFocused(Window w, AtomicBoolean b) {
+        try {
+            synchronized(b) {
+                if (w.isFocusOwner()) {
+                    return;
+                }
+                b.wait(3000);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        if (!w.isFocusOwner()) {
+            throw new RuntimeException("Can't make " + w + " focus owner");
+        }
+    }
+
+    static void checkOnTop(Window ontop, Window under, int x, int y) {
+        under.toFront();
+        try {
+            Robot robot = new Robot();
+            robot.mouseMove(x, y);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            synchronized(pressed) {
+                if (pressed.get()) {
+                    if (pressedTarget != ontop) {
+                        throw new RuntimeException("Pressed at wrong location: " + pressedTarget);
+                    }
+                } else {
+                    pressed.wait(5000);
+                }
+            }
+            if (!pressed.get() || pressedTarget != ontop) {
+                throw new RuntimeException("Pressed at wrong location: " + pressedTarget);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class TestAlwaysOnTopBeforeShow
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+   static int newVar = 0;
+
+   public void eventDispatched(AWTEvent e)
+    {
+      //Counting events to see if we get enough
+      eventCount++;
+
+      if( eventCount == 20 )
+       {
+         //got enough events, so pass
+
+         TestAlwaysOnTopBeforeShow.pass();
+       }
+      else if( tries == 20 )
+       {
+         //tried too many times without getting enough events so fail
+
+         TestAlwaysOnTopBeforeShow.fail();
+       }
+
+    }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
diff --git a/test/java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java b/test/java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java
new file mode 100644
index 0000000..003c093
--- /dev/null
+++ b/test/java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.Window;
+
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8001472
+ * @summary Background of the window should not depend from the paint()/update()
+ * @author Sergey Bylokhov
+ */
+public final class BackgroundIsNotUpdated extends Window {
+
+    public BackgroundIsNotUpdated(final Frame owner) {
+        super(owner);
+    }
+
+    @Override
+    public void paint(final Graphics ignored) {
+        // Intentionally left blank
+    }
+
+    @Override
+    public void update(final Graphics ignored) {
+        // Intentionally left blank
+    }
+
+    public static void main(final String[] args) throws AWTException {
+        final Window window = new BackgroundIsNotUpdated(null);
+        window.setSize(300, 300);
+        window.setLocationRelativeTo(null);
+        window.setVisible(true);
+        sleep();
+        window.setBackground(Color.GREEN);
+        sleep();
+        final Robot robot = new Robot();
+        robot.setAutoDelay(200);
+        Point point = window.getLocationOnScreen();
+        Color color = robot.getPixelColor(point.x + window.getWidth() / 2,
+                                          point.y + window.getHeight() / 2);
+        window.dispose();
+        if (!color.equals(Color.GREEN)) {
+            throw new RuntimeException(
+                    "Expected: " + Color.GREEN + " , Actual: " + color);
+        }
+    }
+
+    private static void sleep() {
+        try {
+            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            Thread.sleep(1000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+}
diff --git a/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java b/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java
new file mode 100644
index 0000000..a2a4f51
--- /dev/null
+++ b/test/java/awt/dnd/AcceptDropMultipleTimes/AcceptDropMultipleTimes.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8029979
+ * @summary Checks if acceptDrop() can be called several times
+ * @library ../../regtesthelpers
+ * @build Util
+ * @compile AcceptDropMultipleTimes.java
+ * @run main/othervm AcceptDropMultipleTimes
+ * @author anthony.petrov@oracle.com
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.dnd.*;
+import java.awt.event.InputEvent;
+
+public class AcceptDropMultipleTimes {
+
+    private static final int FRAME_SIZE = 100;
+    private static final int FRAME_LOCATION = 100;
+
+    private static volatile Frame f;
+
+    private static void initAndShowUI() {
+        f = new Frame("Test frame");
+        f.setBounds(FRAME_LOCATION, FRAME_LOCATION, FRAME_SIZE, FRAME_SIZE);
+
+        final DraggablePanel dragSource = new DraggablePanel();
+        dragSource.setBackground(Color.yellow);
+        DropTarget dt = new DropTarget(dragSource, new DropTargetAdapter() {
+            @Override public void drop(DropTargetDropEvent dtde) {
+                // The first call always succeeds
+                dtde.acceptDrop(DnDConstants.ACTION_COPY);
+
+                // The second call should succeed if the fix works
+                dtde.acceptDrop(DnDConstants.ACTION_MOVE);
+
+                dtde.dropComplete(true);
+            }
+        });
+        dragSource.setDropTarget(dt);
+        f.add(dragSource);
+
+        f.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Throwable {
+        try {
+
+            SwingUtilities.invokeAndWait(() -> initAndShowUI());
+
+            Robot r = new Robot();
+            Util.waitForIdle(r);
+            Util.drag(r,
+                    new Point(FRAME_LOCATION + FRAME_SIZE / 3, FRAME_LOCATION + FRAME_SIZE / 3),
+                    new Point(FRAME_LOCATION + FRAME_SIZE / 3 * 2, FRAME_LOCATION + FRAME_SIZE / 3 * 2),
+                    InputEvent.BUTTON1_MASK);
+            Util.waitForIdle(r);
+        } finally {
+            if (f != null) {
+                f.dispose();
+            }
+        }
+    }
+
+    private static class DraggablePanel extends Panel implements DragGestureListener {
+
+        public DraggablePanel() {
+            (new DragSource()).createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, this);
+        }
+
+        @Override
+        public void dragGestureRecognized(DragGestureEvent dge) {
+            dge.startDrag(Cursor.getDefaultCursor(), new StringSelection("test"));
+        }
+    }
+}
diff --git a/test/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java b/test/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java
new file mode 100644
index 0000000..5198b52
--- /dev/null
+++ b/test/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8030050
+ * @summary Validate fields on DnD class deserialization
+ * @author petr.pchelko@oracle.com
+ */
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInputStream;
+import java.util.stream.Stream;
+
+public class BadSerializationTest {
+
+    private static final String[] badSerialized = new String[] {
+            "badAction",
+            "noEvents",
+            "nullComponent",
+            "nullDragSource",
+            "nullOrigin"
+    };
+
+    private static final String goodSerialized = "good";
+
+    public static void main(String[] args) throws Exception {
+        String testSrc = System.getProperty("test.src") + File.separator;
+        testReadObject(testSrc + goodSerialized, false);
+        Stream.of(badSerialized).forEach(file -> testReadObject(testSrc + file, true));
+    }
+
+    private static void testReadObject(String filename, boolean expectException) {
+        Exception exceptionCaught = null;
+        try (FileInputStream fileInputStream = new FileInputStream(filename);
+             ObjectInputStream ois = new ObjectInputStream(fileInputStream)) {
+            ois.readObject();
+        } catch (InvalidObjectException e) {
+            exceptionCaught = e;
+        } catch (IOException e) {
+            throw new RuntimeException("FAILED: IOException", e);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("FAILED: ClassNotFoundException", e);
+        }
+        if (exceptionCaught != null && !expectException) {
+            throw new RuntimeException("FAILED: UnexpectedException", exceptionCaught);
+        }
+        if (exceptionCaught == null && expectException) {
+            throw new RuntimeException("FAILED: Invalid object was created with no exception");
+        }
+    }
+}
diff --git a/test/java/awt/dnd/BadSerializaionTest/badAction b/test/java/awt/dnd/BadSerializaionTest/badAction
new file mode 100644
index 0000000..d8b58ee
--- /dev/null
+++ b/test/java/awt/dnd/BadSerializaionTest/badAction
Binary files differ
diff --git a/test/java/awt/dnd/BadSerializaionTest/good b/test/java/awt/dnd/BadSerializaionTest/good
new file mode 100644
index 0000000..3580da63
--- /dev/null
+++ b/test/java/awt/dnd/BadSerializaionTest/good
Binary files differ
diff --git a/test/java/awt/dnd/BadSerializaionTest/noEvents b/test/java/awt/dnd/BadSerializaionTest/noEvents
new file mode 100644
index 0000000..eee6a49
--- /dev/null
+++ b/test/java/awt/dnd/BadSerializaionTest/noEvents
Binary files differ
diff --git a/test/java/awt/dnd/BadSerializaionTest/nullComponent b/test/java/awt/dnd/BadSerializaionTest/nullComponent
new file mode 100644
index 0000000..3166bcb
--- /dev/null
+++ b/test/java/awt/dnd/BadSerializaionTest/nullComponent
Binary files differ
diff --git a/test/java/awt/dnd/BadSerializaionTest/nullDragSource b/test/java/awt/dnd/BadSerializaionTest/nullDragSource
new file mode 100644
index 0000000..62a9bb6
--- /dev/null
+++ b/test/java/awt/dnd/BadSerializaionTest/nullDragSource
Binary files differ
diff --git a/test/java/awt/dnd/BadSerializaionTest/nullOrigin b/test/java/awt/dnd/BadSerializaionTest/nullOrigin
new file mode 100644
index 0000000..e5daa2a
--- /dev/null
+++ b/test/java/awt/dnd/BadSerializaionTest/nullOrigin
Binary files differ
diff --git a/test/java/awt/dnd/Button2DragTest/Button2DragTest.java b/test/java/awt/dnd/Button2DragTest/Button2DragTest.java
index 11a7bf9..33bb505 100644
--- a/test/java/awt/dnd/Button2DragTest/Button2DragTest.java
+++ b/test/java/awt/dnd/Button2DragTest/Button2DragTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -112,6 +112,7 @@
         Util.drag(robot, startPoint, endPoint, InputEvent.BUTTON2_MASK);
 
         Util.waitForIdle(robot);
+        robot.delay(500);
 
         if (dropSuccess) {
             System.err.println("test passed");
diff --git a/src/macosx/native/sun/awt/CWrapper.h b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/InterprocessMessages.java
similarity index 75%
rename from src/macosx/native/sun/awt/CWrapper.h
rename to test/java/awt/dnd/URIListToFileListBetweenJVMsTest/InterprocessMessages.java
index 416bac7..343b9fc 100644
--- a/src/macosx/native/sun/awt/CWrapper.h
+++ b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/InterprocessMessages.java
@@ -1,12 +1,10 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
+ * published by the Free Software Foundation.
  *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -22,3 +20,8 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
+public interface InterprocessMessages {
+    final static int EXECUTION_IS_SUCCESSFULL = 0;
+    final static int WRONG_FILES_NUMBER_ON_TARGET = 212;
+}
diff --git a/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/SourceFileListFrame.java b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/SourceFileListFrame.java
new file mode 100644
index 0000000..c41299c
--- /dev/null
+++ b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/SourceFileListFrame.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+
+class SourceFileListFrame extends Frame implements DragGestureListener {
+
+    private final static int SOURCE_POINT_SHIFT = 3;
+
+    private List list = new List(URIListToFileListBetweenJVMsTest.VISIBLE_RAWS_IN_LIST);
+    private File[] files;
+
+    SourceFileListFrame() {
+        super("Source File List Frame");
+        extractFilesFromTheWorkingDirectory();
+        initList();
+        initGUI();
+        new DragSource().createDefaultDragGestureRecognizer(list,
+                DnDConstants.ACTION_COPY,this);
+    }
+
+    private void extractFilesFromTheWorkingDirectory() {
+        files = new File(System.getProperty("java.home", "")).listFiles();
+    }
+
+    private void initList() {
+        for (File currFile:files) {
+            list.add(currFile.getName());
+        }
+    }
+
+    private void initGUI() {
+        this.addWindowListener(Util.getClosingWindowAdapter());
+        this.setLocation(300,250);
+        this.add(new Panel().add(list));
+        this.pack();
+        this.setVisible(true);
+    }
+
+    int getNextLocationX() {
+        return getX()+getWidth();
+    }
+
+    int getNextLocationY() {
+        return getY();
+    }
+
+    int getDragSourcePointX() {
+        return (int)list.getLocationOnScreen().getX()+(list.getWidth()/2);
+    }
+
+   int getDragSourcePointY() {
+        return (int)list.getLocationOnScreen().getY()+ SOURCE_POINT_SHIFT;
+    }
+
+    int getSourceFilesNumber() {
+        return files.length;
+    }
+
+    public void dragGestureRecognized(DragGestureEvent dge) {
+        java.util.List<URI> uriList = Stream.of(list.getItems())
+                                                .map(File::new)
+                                                .map(File::toURI)
+                                                .collect(Collectors.toList());
+
+        dge.startDrag(null, new URIListTransferable(uriList));
+    }
+}
diff --git a/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/TargetFileListFrame.java b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/TargetFileListFrame.java
new file mode 100644
index 0000000..ac5ce74
--- /dev/null
+++ b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/TargetFileListFrame.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.*;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.File;
+import java.io.IOException;
+
+class TargetFileListFrame extends Frame implements DropTargetListener {
+
+    private List list = new List(URIListToFileListBetweenJVMsTest.VISIBLE_RAWS_IN_LIST);
+    private int expectationTransferredFilesNumber;
+
+    TargetFileListFrame(Point location, int expectationTransferredFilesNumber) {
+        this.expectationTransferredFilesNumber = expectationTransferredFilesNumber;
+        initGUI(location);
+        setDropTarget(new DropTarget(list, DnDConstants.ACTION_COPY, this));
+    }
+
+    private void initGUI(Point location) {
+        this.setLocation(location);
+        this.addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                TargetFileListFrame.this.dispose();
+            }
+        });
+        this.add(new Panel().add(list));
+        this.pack();
+        this.setVisible(true);
+    }
+
+    public void dragEnter(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dragOver(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dropActionChanged(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dragExit(DropTargetEvent dte) {}
+
+    public void drop(DropTargetDropEvent dtde) {
+        list.removeAll();
+        dtde.acceptDrop(DnDConstants.ACTION_COPY);
+        java.util.List<File> fileList = extractListOfFiles(dtde);
+        for (File file:fileList) {
+            list.add(file.getName());
+        }
+
+        if (fileList.size() != expectationTransferredFilesNumber)
+        {
+            System.err.println("ERROR: Expected file number:"
+                    + expectationTransferredFilesNumber
+                    + "; Received file number: "
+                    + fileList.size());
+            TargetFileListFrame.this.dispose();
+            System.exit(InterprocessMessages.WRONG_FILES_NUMBER_ON_TARGET);
+        }
+
+        TargetFileListFrame.this.dispose();
+
+    }
+
+    private java.util.List<File> extractListOfFiles(DropTargetDropEvent dtde) {
+        java.util.List<File> fileList = null;
+        try {
+            fileList = (java.util.List<File>)dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
+        } catch (UnsupportedFlavorException | IOException e) {
+            e.printStackTrace();
+        }
+        return fileList;
+    }
+
+    Point getDropTargetPoint() {
+       return new Point((int)list.getLocationOnScreen().getX()+(list.getWidth()/2),
+                        (int)list.getLocationOnScreen().getY()+(list.getHeight()/2));
+    }
+}
diff --git a/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html
new file mode 100644
index 0000000..19ee5de
--- /dev/null
+++ b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.html
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2013, 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.
+
+ 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 8029565
+  @summary Conversion of a URI list to File list fails
+  @author Petr Pchelko <petr.pchelko@oracle.com>
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator
+  @run applet/othervm URIListToFileListBetweenJVMsTest.html
+
+-->
+<head>
+<title> DnD of File-List across JVM </title>
+</head>
+<body>
+
+<h1>URIListToFileListBetweenJVMsTest<br>Bug ID: 5079469</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="URIListToFileListBetweenJVMsTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
diff --git a/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java
new file mode 100644
index 0000000..9e78362
--- /dev/null
+++ b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+/*
+  test
+  @bug 8029565
+  @summary Conversion of a URI list to File list fails
+  @author Petr Pchelko <petr.pchelko@oracle.com>
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator
+  @run applet/othervm URIListToFileListBetweenJVMsTest.html
+ */
+
+/**
+ * URIListToFileListBetweenJVMsTest.java
+ *
+ * summary: DnD of File-List across JVM adds two empty items to the list
+ */
+
+import test.java.awt.regtesthelpers.Util;
+import test.java.awt.regtesthelpers.process.ProcessCommunicator;
+import test.java.awt.regtesthelpers.process.ProcessResults;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+import static java.lang.Thread.sleep;
+
+public class URIListToFileListBetweenJVMsTest extends Applet {
+
+    // information related to the test in common
+    static int VISIBLE_RAWS_IN_LIST=15;
+
+    public void init() {
+        setLayout(new BorderLayout());
+    }
+
+    public void start() {
+
+        SourceFileListFrame sourceFrame = new SourceFileListFrame();
+
+        Util.waitForIdle(null);
+
+        String [] args = new String [] {
+                String.valueOf(sourceFrame.getNextLocationX()),
+                String.valueOf(sourceFrame.getNextLocationY()),
+                String.valueOf(sourceFrame.getDragSourcePointX()),
+                String.valueOf(sourceFrame.getDragSourcePointY()),
+                String.valueOf(sourceFrame.getSourceFilesNumber())
+        };
+
+        ProcessResults processResults = ProcessCommunicator.executeChildProcess(this.getClass(), args);
+
+        verifyTestResults(processResults);
+
+    }
+
+    private static void verifyTestResults(ProcessResults processResults) {
+        if ( InterprocessMessages.WRONG_FILES_NUMBER_ON_TARGET == processResults.getExitValue()) {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: Target has recieved wrong number of files.");
+        }
+        processResults.verifyStdErr(System.err);
+        processResults.verifyProcessExitValue(System.err);
+        processResults.printProcessStandartOutput(System.out);
+    }
+
+    //We cannot make an instance of the applet without the default constructor
+    public URIListToFileListBetweenJVMsTest() {
+        super();
+    }
+
+    //We need in this constructor to pass frame position between JVMs
+    public URIListToFileListBetweenJVMsTest(Point targetFrameLocation,
+                                            Point dragSourcePoint,
+                                            int transferredFilesNumber) throws InterruptedException
+    {
+        TargetFileListFrame targetFrame = new TargetFileListFrame(targetFrameLocation, transferredFilesNumber);
+
+        Util.waitForIdle(null);
+
+        final Robot robot = Util.createRobot();
+
+        robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
+        sleep(100);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        sleep(100);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        sleep(100);
+
+        Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(), InputEvent.BUTTON1_MASK);
+
+    }
+
+    enum InterprocessArguments {
+        TARGET_FRAME_X_POSITION_ARGUMENT,
+        TARGET_FRAME_Y_POSITION_ARGUMENT,
+        DRAG_SOURCE_POINT_X_ARGUMENT,
+        DRAG_SOURCE_POINT_Y_ARGUMENT,
+        FILES_IN_THE_LIST_NUMBER_ARGUMENT;
+
+        int extract (String [] args) {
+            return Integer.parseInt(args[this.ordinal()]);
+        }
+    }
+
+    public static void main (String [] args) throws Exception {
+        Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
+                InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
+        Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
+                InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
+        int transferredFilesNumber = InterprocessArguments.FILES_IN_THE_LIST_NUMBER_ARGUMENT.extract(args);
+
+        new URIListToFileListBetweenJVMsTest(targetFrameLocation, dragSourcePoint, transferredFilesNumber);
+    }
+}
diff --git a/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListTransferable.java b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListTransferable.java
new file mode 100644
index 0000000..51fc93e
--- /dev/null
+++ b/test/java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListTransferable.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.net.URI;
+import java.util.List;
+
+class URIListTransferable implements Transferable {
+
+    private final DataFlavor supportedFlavor;
+
+    private List<URI> list;
+
+    public URIListTransferable(List<URI> list) {
+        try {
+            this.supportedFlavor = new DataFlavor("text/uri-list;class=java.lang.String");
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("FAILED: could not create a DataFlavor");
+        }
+        this.list = list;
+    }
+
+    public DataFlavor[] getTransferDataFlavors() {
+        return new DataFlavor[] { supportedFlavor };
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        return supportedFlavor.equals(flavor);
+    }
+
+    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+        if (supportedFlavor.equals(flavor)) {
+            return list.stream()
+                    .map(URI::toASCIIString)
+                    .collect(StringBuilder::new,
+                             (builder, uri)-> { builder.append(uri).append("\r\n"); },
+                             StringBuilder::append).toString();
+        }
+        throw new UnsupportedFlavorException(flavor);
+    }
+}
diff --git a/test/java/awt/dnd/URLDragTest/URLDragTest.html b/test/java/awt/dnd/URLDragTest/URLDragTest.html
new file mode 100644
index 0000000..0ff497a
--- /dev/null
+++ b/test/java/awt/dnd/URLDragTest/URLDragTest.html
@@ -0,0 +1,45 @@
+<!--
+ 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.
+
+ 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.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 8031964
+  @summary Dragging images from the browser does not work
+  @author Petr Pchelko : area=dnd
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno URLDragTest.html
+-->
+<head>
+<title> DnD of URL across JVM </title>
+</head>
+<body>
+
+<h1>URLDragTest<br>Bug ID: 8031964</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="URLDragTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
diff --git a/test/java/awt/dnd/URLDragTest/URLDragTest.java b/test/java/awt/dnd/URLDragTest/URLDragTest.java
new file mode 100644
index 0000000..9893332
--- /dev/null
+++ b/test/java/awt/dnd/URLDragTest/URLDragTest.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+  test
+  @bug 8031964
+  @summary Dragging images from the browser does not work
+  @author Petr Pchelko : area=dnd
+  @library ../../regtesthelpers
+  @build Sysout
+  @run applet/manual=yesno URLDragTest.html
+*/
+
+import test.java.awt.regtesthelpers.Sysout;
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetAdapter;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+
+public class URLDragTest extends Applet {
+
+
+    @Override
+    public void init() {
+        setBackground(Color.red);
+        setDropTarget(new DropTarget(this,
+                DnDConstants.ACTION_COPY,
+                new DropTargetAdapter() {
+                    @Override
+                    public void dragEnter(DropTargetDragEvent dtde) {
+                        dtde.acceptDrag(DnDConstants.ACTION_COPY);
+                    }
+
+                    @Override
+                    public void dragOver(DropTargetDragEvent dtde) {
+                        dtde.acceptDrag(DnDConstants.ACTION_COPY);
+                    }
+
+                    @Override
+                    public void drop(DropTargetDropEvent dtde) {
+                        dtde.acceptDrop(DnDConstants.ACTION_COPY);
+                        dtde.getCurrentDataFlavorsAsList()
+                                .stream()
+                                .map(DataFlavor::toString)
+                                .forEach(Sysout::println);
+                    }
+                }));
+
+        String[] instructions = {
+                "1) Open the browser.",
+                "2) Drag any image from the browser page to the red square",
+                "3) When the image is dropped you should se the list of available DataFlavors",
+                "4) If you see application/x-java-url and text/uri-list flavors - test PASSED",
+                "5) Otherwise the test is FAILED"};
+        Sysout.createDialogWithInstructions(instructions);
+    }
+
+    @Override
+    public void start() {
+        setSize(200, 200);
+        setVisible(true);
+    }
+}
diff --git a/test/java/awt/image/MultiResolutionImageTest.java b/test/java/awt/image/MultiResolutionImageTest.java
new file mode 100644
index 0000000..21864f9
--- /dev/null
+++ b/test/java/awt/image/MultiResolutionImageTest.java
@@ -0,0 +1,620 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URL;
+import javax.imageio.ImageIO;
+import sun.awt.OSInfo;
+import sun.awt.SunHints;
+import java.awt.MediaTracker;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ImageObserver;
+import java.util.Arrays;
+import java.util.List;
+import javax.swing.JPanel;
+import sun.awt.SunToolkit;
+import sun.awt.image.MultiResolutionImage;
+
+/**
+ * @test
+ * @bug 8011059
+ * @author Alexander Scherbatiy
+ * @summary [macosx] Make JDK demos look perfect on retina displays
+ * @run main MultiResolutionImageTest CUSTOM
+ * @run main MultiResolutionImageTest TOOLKIT_PREPARE
+ * @run main MultiResolutionImageTest TOOLKIT_LOAD
+ * @run main MultiResolutionImageTest TOOLKIT
+ */
+public class MultiResolutionImageTest {
+
+    private static final int IMAGE_WIDTH = 300;
+    private static final int IMAGE_HEIGHT = 200;
+    private static final Color COLOR_1X = Color.GREEN;
+    private static final Color COLOR_2X = Color.BLUE;
+    private static final String IMAGE_NAME_1X = "image.png";
+    private static final String IMAGE_NAME_2X = "image@2x.png";
+
+    public static void main(String[] args) throws Exception {
+
+        System.out.println("args: " + args.length);
+
+        if (args.length == 0) {
+            throw new RuntimeException("Not found a test");
+        }
+
+        String test = args[0];
+
+        System.out.println("TEST: " + test);
+        System.out.println("CHECK OS: " + checkOS());
+
+        if ("CUSTOM".equals(test)) {
+            testCustomMultiResolutionImage();
+        } else if (checkOS()) {
+            switch (test) {
+                case "CUSTOM":
+                    break;
+                case "TOOLKIT_PREPARE":
+                    testToolkitMultiResolutionImagePrepare();
+                    break;
+                case "TOOLKIT_LOAD":
+                    testToolkitMultiResolutionImageLoad();
+                    break;
+                case "TOOLKIT":
+                    testToolkitMultiResolutionImage();
+                    testImageNameTo2xParsing();
+                    break;
+                default:
+                    throw new RuntimeException("Unknown test: " + test);
+            }
+        }
+    }
+
+    static boolean checkOS() {
+        return OSInfo.getOSType() == OSInfo.OSType.MACOSX;
+    }
+
+    public static void testCustomMultiResolutionImage() {
+        testCustomMultiResolutionImage(false);
+        testCustomMultiResolutionImage(true);
+    }
+
+    public static void testCustomMultiResolutionImage(boolean enableImageScaling) {
+
+        Image image = new MultiResolutionBufferedImage();
+
+        // Same image size
+        BufferedImage bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, 0, 0, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        // Twice image size
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        // Scale 2x
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.scale(2, 2);
+        g2d.drawImage(image, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        // Rotate
+        bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, 0, 0, null);
+        g2d.rotate(Math.PI / 4);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        // Scale 2x and Rotate
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.scale(-2, 2);
+        g2d.rotate(-Math.PI / 10);
+        g2d.drawImage(image, -IMAGE_WIDTH, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        // General Transform
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        float delta = 0.05f;
+        float cos = 1 - delta * delta / 2;
+        float sin = 1 + delta;
+        AffineTransform transform = new AffineTransform(2 * cos, 0.1, 0.3, -2 * sin, 10, -5);
+        g2d.setTransform(transform);
+        g2d.drawImage(image, 0, -IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        int D = 10;
+        // From Source to small Destination region
+        bufferedImage = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D,
+                D, D, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        // From Source to large Destination region
+        bufferedImage = new BufferedImage(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        g2d = (Graphics2D) bufferedImage.getGraphics();
+        setImageScalingHint(g2d, enableImageScaling);
+        g2d.drawImage(image, D, D, 2 * IMAGE_WIDTH - D, 2 * IMAGE_HEIGHT - D,
+                IMAGE_WIDTH / 2, IMAGE_HEIGHT / 2, IMAGE_WIDTH - D, IMAGE_HEIGHT - D, null);
+        checkColor(bufferedImage.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+    }
+
+    static class MultiResolutionBufferedImage extends BufferedImage
+            implements MultiResolutionImage {
+
+        Image highResolutionImage;
+
+        public MultiResolutionBufferedImage() {
+            super(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+            highResolutionImage = new BufferedImage(
+                    2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+            draw(getGraphics(), 1);
+            draw(highResolutionImage.getGraphics(), 2);
+        }
+
+        void draw(Graphics graphics, float resolution) {
+            Graphics2D g2 = (Graphics2D) graphics;
+            g2.scale(resolution, resolution);
+            g2.setColor((resolution == 1) ? COLOR_1X : COLOR_2X);
+            g2.fillRect(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
+        }
+
+        @Override
+        public Image getResolutionVariant(int width, int height) {
+            return ((width <= getWidth() && height <= getHeight()))
+                    ? this : highResolutionImage;
+        }
+
+        @Override
+        public List<Image> getResolutionVariants() {
+            return Arrays.asList(this, highResolutionImage);
+        }
+    }
+
+    static void testToolkitMultiResolutionImagePrepare() throws Exception {
+
+        generateImages();
+
+        File imageFile = new File(IMAGE_NAME_1X);
+        String fileName = imageFile.getAbsolutePath();
+
+        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.prepareImage(image, IMAGE_WIDTH, IMAGE_HEIGHT, new LoadImageObserver(image));
+
+        testToolkitMultiResolutionImageLoad(image);
+    }
+
+    static void testToolkitMultiResolutionImageLoad() throws Exception {
+
+        generateImages();
+
+        File imageFile = new File(IMAGE_NAME_1X);
+        String fileName = imageFile.getAbsolutePath();
+        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+        testToolkitMultiResolutionImageLoad(image);
+    }
+
+    static void testToolkitMultiResolutionImageLoad(Image image) throws Exception {
+
+        MediaTracker tracker = new MediaTracker(new JPanel());
+        tracker.addImage(image, 0);
+        tracker.waitForID(0);
+        if (tracker.isErrorAny()) {
+            throw new RuntimeException("Error during image loading");
+        }
+        tracker.removeImage(image, 0);
+
+        testImageLoaded(image);
+
+        int w = image.getWidth(null);
+        int h = image.getHeight(null);
+
+        Image resolutionVariant = ((MultiResolutionImage) image)
+                .getResolutionVariant(2 * w, 2 * h);
+
+        if (image == resolutionVariant) {
+            throw new RuntimeException("Resolution variant is not loaded");
+        }
+
+        testImageLoaded(resolutionVariant);
+    }
+
+    static void testImageLoaded(Image image) {
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        int flags = toolkit.checkImage(image, IMAGE_WIDTH, IMAGE_WIDTH, new SilentImageObserver());
+        if ((flags & (ImageObserver.FRAMEBITS | ImageObserver.ALLBITS)) == 0) {
+            throw new RuntimeException("Image is not loaded!");
+        }
+    }
+
+    static class SilentImageObserver implements ImageObserver {
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+            throw new RuntimeException("Observer should not be called!");
+        }
+    }
+
+    static class LoadImageObserver implements ImageObserver {
+
+        Image image;
+
+        public LoadImageObserver(Image image) {
+            this.image = image;
+        }
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+
+            if (image != img) {
+                throw new RuntimeException("Original image is not passed to the observer");
+            }
+
+            if ((infoflags & ImageObserver.WIDTH) != 0) {
+                if (width != IMAGE_WIDTH) {
+                    throw new RuntimeException("Original width is not passed to the observer");
+                }
+            }
+
+            if ((infoflags & ImageObserver.HEIGHT) != 0) {
+                if (height != IMAGE_HEIGHT) {
+                    throw new RuntimeException("Original height is not passed to the observer");
+                }
+            }
+
+            return (infoflags & ALLBITS) == 0;
+        }
+
+    }
+
+    static void testToolkitMultiResolutionImage() throws Exception {
+
+        generateImages();
+
+        File imageFile = new File(IMAGE_NAME_1X);
+        String fileName = imageFile.getAbsolutePath();
+        URL url = imageFile.toURI().toURL();
+        testToolkitMultiResolutionImageChache(fileName, url);
+
+        Image image = Toolkit.getDefaultToolkit().getImage(fileName);
+        testToolkitImageObserver(image);
+        testToolkitMultiResolutionImage(image, false);
+        testToolkitMultiResolutionImage(image, true);
+
+        image = Toolkit.getDefaultToolkit().getImage(url);
+        testToolkitImageObserver(image);
+        testToolkitMultiResolutionImage(image, false);
+        testToolkitMultiResolutionImage(image, true);
+    }
+
+    static void testToolkitMultiResolutionImageChache(String fileName, URL url) {
+
+        Image img1 = Toolkit.getDefaultToolkit().getImage(fileName);
+        if (!(img1 instanceof MultiResolutionImage)) {
+            throw new RuntimeException("Not a MultiResolutionImage");
+        }
+
+        Image img2 = Toolkit.getDefaultToolkit().getImage(fileName);
+        if (img1 != img2) {
+            throw new RuntimeException("Image is not cached");
+        }
+
+        img1 = Toolkit.getDefaultToolkit().getImage(url);
+        if (!(img1 instanceof MultiResolutionImage)) {
+            throw new RuntimeException("Not a MultiResolutionImage");
+        }
+
+        img2 = Toolkit.getDefaultToolkit().getImage(url);
+        if (img1 != img2) {
+            throw new RuntimeException("Image is not cached");
+        }
+    }
+
+    static void testToolkitMultiResolutionImage(Image image, boolean enableImageScaling)
+            throws Exception {
+
+        MediaTracker tracker = new MediaTracker(new JPanel());
+        tracker.addImage(image, 0);
+        tracker.waitForID(0);
+        if (tracker.isErrorAny()) {
+            throw new RuntimeException("Error during image loading");
+        }
+
+        final BufferedImage bufferedImage1x = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics2D g1x = (Graphics2D) bufferedImage1x.getGraphics();
+        setImageScalingHint(g1x, false);
+        g1x.drawImage(image, 0, 0, null);
+        checkColor(bufferedImage1x.getRGB(3 * IMAGE_WIDTH / 4, 3 * IMAGE_HEIGHT / 4), false);
+
+        Image resolutionVariant = ((MultiResolutionImage) image).
+                getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
+
+        if (resolutionVariant == null) {
+            throw new RuntimeException("Resolution variant is null");
+        }
+
+        MediaTracker tracker2x = new MediaTracker(new JPanel());
+        tracker2x.addImage(resolutionVariant, 0);
+        tracker2x.waitForID(0);
+        if (tracker2x.isErrorAny()) {
+            throw new RuntimeException("Error during scalable image loading");
+        }
+
+        final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
+                2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
+        setImageScalingHint(g2x, enableImageScaling);
+        g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, null);
+        checkColor(bufferedImage2x.getRGB(3 * IMAGE_WIDTH / 2, 3 * IMAGE_HEIGHT / 2), enableImageScaling);
+
+        if (!(image instanceof MultiResolutionImage)) {
+            throw new RuntimeException("Not a MultiResolutionImage");
+        }
+
+        MultiResolutionImage multiResolutionImage = (MultiResolutionImage) image;
+
+        Image image1x = multiResolutionImage.getResolutionVariant(IMAGE_WIDTH, IMAGE_HEIGHT);
+        Image image2x = multiResolutionImage.getResolutionVariant(2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT);
+
+        if (image1x.getWidth(null) * 2 != image2x.getWidth(null)
+                || image1x.getHeight(null) * 2 != image2x.getHeight(null)) {
+            throw new RuntimeException("Wrong resolution variant size");
+        }
+    }
+
+    static void testToolkitImageObserver(final Image image) {
+
+        ImageObserver observer = new ImageObserver() {
+
+            @Override
+            public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+
+                if (img != image) {
+                    throw new RuntimeException("Wrong image in observer");
+                }
+
+                if ((infoflags & (ImageObserver.ERROR | ImageObserver.ABORT)) != 0) {
+                    throw new RuntimeException("Error during image loading");
+                }
+
+                return (infoflags & ImageObserver.ALLBITS) == 0;
+
+            }
+        };
+
+        final BufferedImage bufferedImage2x = new BufferedImage(2 * IMAGE_WIDTH,
+                2 * IMAGE_HEIGHT, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2x = (Graphics2D) bufferedImage2x.getGraphics();
+        setImageScalingHint(g2x, true);
+
+        g2x.drawImage(image, 0, 0, 2 * IMAGE_WIDTH, 2 * IMAGE_HEIGHT, 0, 0, IMAGE_WIDTH, IMAGE_HEIGHT, observer);
+
+    }
+
+    static void setImageScalingHint(Graphics2D g2d, boolean enableImageScaling) {
+        g2d.setRenderingHint(SunHints.KEY_RESOLUTION_VARIANT, enableImageScaling
+                ? SunHints.VALUE_RESOLUTION_VARIANT_ON
+                : SunHints.VALUE_RESOLUTION_VARIANT_OFF);
+    }
+
+    static void checkColor(int rgb, boolean isImageScaled) {
+
+        if (!isImageScaled && COLOR_1X.getRGB() != rgb) {
+            throw new RuntimeException("Wrong 1x color: " + new Color(rgb));
+        }
+
+        if (isImageScaled && COLOR_2X.getRGB() != rgb) {
+            throw new RuntimeException("Wrong 2x color" + new Color(rgb));
+        }
+    }
+
+    static void generateImages() throws Exception {
+        if (!new File(IMAGE_NAME_1X).exists()) {
+            generateImage(1);
+        }
+
+        if (!new File(IMAGE_NAME_2X).exists()) {
+            generateImage(2);
+        }
+    }
+
+    static void generateImage(int scale) throws Exception {
+        BufferedImage image = new BufferedImage(scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT,
+                BufferedImage.TYPE_INT_RGB);
+        Graphics g = image.getGraphics();
+        g.setColor(scale == 1 ? COLOR_1X : COLOR_2X);
+        g.fillRect(0, 0, scale * IMAGE_WIDTH, scale * IMAGE_HEIGHT);
+        File file = new File(scale == 1 ? IMAGE_NAME_1X : IMAGE_NAME_2X);
+        ImageIO.write(image, "png", file);
+    }
+
+    static void testImageNameTo2xParsing() throws Exception {
+
+        for (String[] testNames : TEST_FILE_NAMES) {
+            String testName = testNames[0];
+            String goldenName = testNames[1];
+            String resultName = getTestScaledImageName(testName);
+
+            if (!isValidPath(testName) && resultName == null) {
+                continue;
+            }
+
+            if (goldenName.equals(resultName)) {
+                continue;
+            }
+
+            throw new RuntimeException("Test name " + testName
+                    + ", result name: " + resultName);
+        }
+
+        for (URL[] testURLs : TEST_URLS) {
+            URL testURL = testURLs[0];
+            URL goldenURL = testURLs[1];
+            URL resultURL = getTestScaledImageURL(testURL);
+
+            if (!isValidPath(testURL.getPath()) && resultURL == null) {
+                continue;
+            }
+
+            if (goldenURL.equals(resultURL)) {
+                continue;
+            }
+
+            throw new RuntimeException("Test url: " + testURL
+                    + ", result url: " + resultURL);
+        }
+
+    }
+
+    static URL getTestScaledImageURL(URL url) throws Exception {
+        Method method = getScalableImageMethod("getScaledImageURL", URL.class);
+        return (URL) method.invoke(null, url);
+    }
+
+    static String getTestScaledImageName(String name) throws Exception {
+        Method method = getScalableImageMethod("getScaledImageName", String.class);
+        return (String) method.invoke(null, name);
+    }
+
+    private static boolean isValidPath(String path) {
+        return !path.isEmpty() && !path.endsWith("/") && !path.endsWith(".")
+                && !path.contains("@2x");
+    }
+
+    private static Method getScalableImageMethod(String name,
+            Class... parameterTypes) throws Exception {
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        Method method = toolkit.getClass().getDeclaredMethod(name, parameterTypes);
+        method.setAccessible(true);
+        return method;
+    }
+    private static final String[][] TEST_FILE_NAMES;
+    private static final URL[][] TEST_URLS;
+
+    static {
+        TEST_FILE_NAMES = new String[][]{
+            {"", null},
+            {".", null},
+            {"..", null},
+            {"/", null},
+            {"/.", null},
+            {"dir/", null},
+            {"dir/.", null},
+            {"aaa@2x.png", null},
+            {"/dir/aaa@2x.png", null},
+            {"image", "image@2x"},
+            {"image.ext", "image@2x.ext"},
+            {"image.aaa.ext", "image.aaa@2x.ext"},
+            {"dir/image", "dir/image@2x"},
+            {"dir/image.ext", "dir/image@2x.ext"},
+            {"dir/image.aaa.ext", "dir/image.aaa@2x.ext"},
+            {"dir/aaa.bbb/image", "dir/aaa.bbb/image@2x"},
+            {"dir/aaa.bbb/image.ext", "dir/aaa.bbb/image@2x.ext"},
+            {"dir/aaa.bbb/image.ccc.ext", "dir/aaa.bbb/image.ccc@2x.ext"},
+            {"/dir/image", "/dir/image@2x"},
+            {"/dir/image.ext", "/dir/image@2x.ext"},
+            {"/dir/image.aaa.ext", "/dir/image.aaa@2x.ext"},
+            {"/dir/aaa.bbb/image", "/dir/aaa.bbb/image@2x"},
+            {"/dir/aaa.bbb/image.ext", "/dir/aaa.bbb/image@2x.ext"},
+            {"/dir/aaa.bbb/image.ccc.ext", "/dir/aaa.bbb/image.ccc@2x.ext"}
+        };
+        try {
+            TEST_URLS = new URL[][]{
+                // file
+                {new URL("file:/aaa"), new URL("file:/aaa@2x")},
+                {new URL("file:/aaa.ext"), new URL("file:/aaa@2x.ext")},
+                {new URL("file:/aaa.bbb.ext"), new URL("file:/aaa.bbb@2x.ext")},
+                {new URL("file:/ccc/aaa.bbb.ext"),
+                    new URL("file:/ccc/aaa.bbb@2x.ext")},
+                {new URL("file:/ccc.ddd/aaa.bbb.ext"),
+                    new URL("file:/ccc.ddd/aaa.bbb@2x.ext")},
+                {new URL("file:///~/image"), new URL("file:///~/image@2x")},
+                {new URL("file:///~/image.ext"),
+                    new URL("file:///~/image@2x.ext")},
+                // http
+                {new URL("http://www.test.com"), null},
+                {new URL("http://www.test.com/"), null},
+                {new URL("http://www.test.com///"), null},
+                {new URL("http://www.test.com/image"),
+                    new URL("http://www.test.com/image@2x")},
+                {new URL("http://www.test.com/image.ext"),
+                    new URL("http://www.test.com/image@2x.ext")},
+                {new URL("http://www.test.com/dir/image"),
+                    new URL("http://www.test.com/dir/image@2x")},
+                {new URL("http://www.test.com:80/dir/image.aaa.ext"),
+                    new URL("http://www.test.com:80/dir/image.aaa@2x.ext")},
+                {new URL("http://www.test.com:8080/dir/image.aaa.ext"),
+                    new URL("http://www.test.com:8080/dir/image.aaa@2x.ext")},
+                // jar
+                {new URL("jar:file:/dir/Java2D.jar!/image"),
+                    new URL("jar:file:/dir/Java2D.jar!/image@2x")},
+                {new URL("jar:file:/dir/Java2D.jar!/image.aaa.ext"),
+                    new URL("jar:file:/dir/Java2D.jar!/image.aaa@2x.ext")},
+                {new URL("jar:file:/dir/Java2D.jar!/images/image"),
+                    new URL("jar:file:/dir/Java2D.jar!/images/image@2x")},
+                {new URL("jar:file:/dir/Java2D.jar!/images/image.ext"),
+                    new URL("jar:file:/dir/Java2D.jar!/images/image@2x.ext")},
+                {new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image.ext"),
+                    new URL("jar:file:/aaa.bbb/Java2D.jar!/images/image@2x.ext")},
+                {new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image.ext"),
+                    new URL("jar:file:/dir/Java2D.jar!/aaa.bbb/image@2x.ext")},};
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    static class PreloadedImageObserver implements ImageObserver {
+
+        @Override
+        public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
+            throw new RuntimeException("Image should be already preloaded");
+        }
+    }
+}
diff --git a/test/java/awt/regtesthelpers/Util.java b/test/java/awt/regtesthelpers/Util.java
index 2a606bc..95ad563 100644
--- a/test/java/awt/regtesthelpers/Util.java
+++ b/test/java/awt/regtesthelpers/Util.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -51,6 +51,7 @@
 import java.awt.IllegalComponentStateException;
 import java.awt.AWTException;
 import java.awt.AWTEvent;
+import java.awt.Color;
 
 import java.awt.event.InputEvent;
 import java.awt.event.WindowAdapter;
@@ -184,6 +185,57 @@
         }
     }
 
+    /**
+     * Tests whether screen pixel has the expected color performing several
+     * attempts. This method is useful for asynchronous window manager where
+     * it's impossible to determine when drawing actually takes place.
+     *
+     * @param x X position of pixel
+     * @param y Y position of pixel
+     * @param color expected color
+     * @param attempts number of attempts to undertake
+     * @param delay delay before each attempt
+     * @param robot a robot to use for retrieving pixel color
+     * @return true if pixel color matches the color expected, otherwise false
+     */
+    public static boolean testPixelColor(int x, int y, final Color color, int attempts, int delay, final Robot robot) {
+        while (attempts-- > 0) {
+            robot.delay(delay);
+            Color screen = robot.getPixelColor(x, y);
+            if (screen.equals(color)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Tests whether the area within boundaries has the expected color
+     * performing several attempts. This method is useful for asynchronous
+     * window manager where it's impossible to determine when drawing actually
+     * takes place.
+     *
+     * @param bounds position of area
+     * @param color expected color
+     * @param attempts number of attempts to undertake
+     * @param delay delay before each attempt
+     * @param robot a robot to use for retrieving pixel color
+     * @return true if area color matches the color expected, otherwise false
+     */
+    public static boolean testBoundsColor(final Rectangle bounds, final Color color, int attempts, int delay, final Robot robot) {
+        int right = bounds.x + bounds.width - 1;
+        int bottom = bounds.y + bounds.height - 1;
+        while (attempts-- > 0) {
+            if (testPixelColor(bounds.x, bounds.y, color, 1, delay, robot)
+                && testPixelColor(right, bounds.y, color, 1, 0, robot)
+                && testPixelColor(right, bottom, color, 1, 0, robot)
+                && testPixelColor(bounds.x, bottom, color, 1, 0, robot)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public static void waitForIdle(final Robot robot) {
         // we do not use robot for now, use SunToolkit.realSync() instead
         ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
diff --git a/test/java/beans/Introspector/Test4168833.java b/test/java/beans/Introspector/Test4168833.java
index 26cdb25..f3eea2c 100644
--- a/test/java/beans/Introspector/Test4168833.java
+++ b/test/java/beans/Introspector/Test4168833.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug 4168833
+ * @bug 4168833 8034085
  * @summary Tests that Introspector does not create IndexedPropertyDescriptor
  *          from non-indexed PropertyDescriptor
  * @author Mark Davidson
+ * @author Sergey Malenkov
  */
 
 import java.awt.Color;
@@ -42,10 +43,6 @@
  */
 public class Test4168833 {
     public static void main(String[] args) throws Exception {
-        IndexedPropertyDescriptor ipd = BeanUtils.getIndexedPropertyDescriptor(Base.class, "prop");
-        if (!ipd.getIndexedPropertyType().equals(Dimension.class)) {
-            error(ipd, "Base.prop property should a Dimension");
-        }
         // When the Sub class is introspected,
         // the property type should be color.
         // The complete "classic" set of properties
diff --git a/test/java/beans/Introspector/Test8034085.java b/test/java/beans/Introspector/Test8034085.java
new file mode 100644
index 0000000..25745a9
--- /dev/null
+++ b/test/java/beans/Introspector/Test8034085.java
@@ -0,0 +1,236 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+import java.awt.Window;
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.PropertyDescriptor;
+
+/*
+ * @test
+ * @bug 8034085
+ * @summary Tests that Introspector ignores indexed getter and setter for incorrect types
+ * @author Sergey Malenkov
+ */
+
+public class Test8034085 {
+    public static final StringBuilder ERROR = new StringBuilder();
+
+    public static void main(String[] args) {
+        test(Window.class, false, true, false, false);
+
+        test(Bean0000.class, false, false, false, false);
+        test(Bean0001.class, false, false, false, true);
+        test(Bean0010.class, false, false, true, false);
+        test(Bean0011.class, false, false, true, true);
+        test(Bean0100.class, false, true, false, false);
+        test(Bean0101.class, false, true, false, false);
+        test(Bean0110.class, false, true, false, false);
+        test(Bean0111.class, false, true, false, false);
+        test(Bean1000.class, true, false, false, false);
+        test(Bean1001.class, true, false, false, false);
+        test(Bean1010.class, true, false, false, false);
+        test(Bean1011.class, true, false, false, false);
+        test(Bean1100.class, true, true, false, false);
+        test(Bean1101.class, true, true, false, false);
+        test(Bean1110.class, true, true, false, false);
+        test(Bean1111.class, true, true, false, false);
+
+        if (0 < ERROR.length()) {
+            throw new Error(ERROR.toString());
+        }
+    }
+
+    private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
+        PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
+        if (pd != null) {
+            test(type, "read", read, null != pd.getReadMethod());
+            test(type, "write", write, null != pd.getWriteMethod());
+            if (pd instanceof IndexedPropertyDescriptor) {
+                IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+                test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
+                test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
+            } else if (readIndexed || writeIndexed) {
+                error(type, "indexed property does not exist");
+            }
+        } else if (read || write || readIndexed || writeIndexed) {
+            error(type, "property does not exist");
+        }
+    }
+
+    private static void test(Class<?> type, String name, boolean expected, boolean actual) {
+        if (expected && !actual) {
+            error(type, name + " method does not exist");
+        } else if (!expected && actual) {
+            error(type, name + " method is not expected");
+        }
+    }
+
+    private static void error(Class<?> type, String message) {
+        ERROR.append("\n\t\t").append(type.getSimpleName()).append(".size: ").append(message);
+    }
+
+    public static class Bean0000 {
+    }
+
+    public static class Bean0001 {
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0010 {
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0011 {
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0100 {
+        public void setSize(int value) {
+        }
+    }
+
+    public static class Bean0101 {
+        public void setSize(int value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0110 {
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0111 {
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1000 {
+        public int getSize() {
+            return 0;
+        }
+    }
+
+    public static class Bean1001 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1010 {
+        public int getSize() {
+            return 0;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1011 {
+        public int getSize() {
+            return 0;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1100 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+    }
+
+    public static class Bean1101 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1110 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1111 {
+        public int getSize() {
+            return 0;
+        }
+
+        public void setSize(int value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+}
diff --git a/test/java/beans/Introspector/Test8034164.java b/test/java/beans/Introspector/Test8034164.java
new file mode 100644
index 0000000..d359960
--- /dev/null
+++ b/test/java/beans/Introspector/Test8034164.java
@@ -0,0 +1,233 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.PropertyDescriptor;
+
+/*
+ * @test
+ * @bug 8034164
+ * @summary Tests that Introspector does not ignore indexed getter and setter for correct types
+ * @author Sergey Malenkov
+ */
+
+public class Test8034164 {
+    public static final StringBuilder ERROR = new StringBuilder();
+
+    public static void main(String[] args) {
+        test(Bean0000.class, false, false, false, false);
+        test(Bean0001.class, false, false, false, true);
+        test(Bean0010.class, false, false, true, false);
+        test(Bean0011.class, false, false, true, true);
+        test(Bean0100.class, false, true, false, false);
+        test(Bean0101.class, false, true, false, true);
+        test(Bean0110.class, false, true, true, false);
+        test(Bean0111.class, false, true, true, true);
+        test(Bean1000.class, true, false, false, false);
+        test(Bean1001.class, true, false, false, true);
+        test(Bean1010.class, true, false, true, false);
+        test(Bean1011.class, true, false, true, true);
+        test(Bean1100.class, true, true, false, false);
+        test(Bean1101.class, true, true, false, true);
+        test(Bean1110.class, true, true, true, false);
+        test(Bean1111.class, true, true, true, true);
+
+        if (0 < ERROR.length()) {
+            throw new Error(ERROR.toString());
+        }
+    }
+
+    private static void test(Class<?> type, boolean read, boolean write, boolean readIndexed, boolean writeIndexed) {
+        PropertyDescriptor pd = BeanUtils.findPropertyDescriptor(type, "size");
+        if (pd != null) {
+            test(type, "read", read, null != pd.getReadMethod());
+            test(type, "write", write, null != pd.getWriteMethod());
+            if (pd instanceof IndexedPropertyDescriptor) {
+                IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
+                test(type, "indexed read", readIndexed, null != ipd.getIndexedReadMethod());
+                test(type, "indexed write", writeIndexed, null != ipd.getIndexedWriteMethod());
+            } else if (readIndexed || writeIndexed) {
+                error(type, "indexed property does not exist");
+            }
+        } else if (read || write || readIndexed || writeIndexed) {
+            error(type, "property does not exist");
+        }
+    }
+
+    private static void test(Class<?> type, String name, boolean expected, boolean actual) {
+        if (expected && !actual) {
+            error(type, name + " method does not exist");
+        } else if (!expected && actual) {
+            error(type, name + " method is not expected");
+        }
+    }
+
+    private static void error(Class<?> type, String message) {
+        ERROR.append("\n\t\t").append(type.getSimpleName()).append(".size: ").append(message);
+    }
+
+    public static class Bean0000 {
+    }
+
+    public static class Bean0001 {
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0010 {
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0011 {
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0100 {
+        public void setSize(int[] value) {
+        }
+    }
+
+    public static class Bean0101 {
+        public void setSize(int[] value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean0110 {
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean0111 {
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1000 {
+        public int[] getSize() {
+            return null;
+        }
+    }
+
+    public static class Bean1001 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1010 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1011 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1100 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+    }
+
+    public static class Bean1101 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+
+    public static class Bean1110 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+    }
+
+    public static class Bean1111 {
+        public int[] getSize() {
+            return null;
+        }
+
+        public void setSize(int[] value) {
+        }
+
+        public int getSize(int index) {
+            return 0;
+        }
+
+        public void setSize(int index, int value) {
+        }
+    }
+}
diff --git a/test/java/io/SequenceInputStream/LotsOfStreams.java b/test/java/io/SequenceInputStream/LotsOfStreams.java
new file mode 100644
index 0000000..3ad0d27
--- /dev/null
+++ b/test/java/io/SequenceInputStream/LotsOfStreams.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/* @test
+ * @bug 7011804
+ * @summary SequenceInputStream#read() was implemented recursivly,
+ *          which may cause stack overflow
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.SequenceInputStream;
+import java.util.Enumeration;
+
+public class LotsOfStreams {
+
+    static final int MAX_SUBSTREAMS = 32000;
+
+    public static void main(String[] argv) throws Exception {
+        try (InputStream stream =
+                new SequenceInputStream(new LOSEnumeration())) {
+            stream.read();
+        }
+        try (InputStream stream =
+                new SequenceInputStream(new LOSEnumeration())) {
+            byte[] b = new byte[1];
+            stream.read(b, 0, 1);
+        }
+    }
+
+    static class LOSEnumeration
+            implements Enumeration<InputStream> {
+
+        private static InputStream inputStream =
+                new ByteArrayInputStream(new byte[0]);
+        private int left = MAX_SUBSTREAMS;
+
+        public boolean hasMoreElements() {
+            return (left > 0);
+        }
+        public InputStream nextElement() {
+            left--;
+            return inputStream;
+        }
+    }
+}
diff --git a/test/java/lang/ClassLoader/Assert.java b/test/java/lang/ClassLoader/Assert.java
index d8f4184..2abe45a 100644
--- a/test/java/lang/ClassLoader/Assert.java
+++ b/test/java/lang/ClassLoader/Assert.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, 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
@@ -24,7 +24,8 @@
 /*
  * @test
  * @bug 4290640 4785473
- * @run shell/timeout=300 Assert.sh
+ * @build package1.Class1 package2.Class2 package1.package3.Class3 Assert
+ * @run main/othervm Assert
  * @summary Test the assertion facility
  * @author Mike McCloskey
  */
diff --git a/test/java/lang/ClassLoader/Assert.sh b/test/java/lang/ClassLoader/Assert.sh
deleted file mode 100644
index 24dadd1..0000000
--- a/test/java/lang/ClassLoader/Assert.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# Copyright (c) 2001, 2013, 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.
-#
-# 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.
-#
-
-#
-
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    FS="/"
-    CHMOD="${FS}bin${FS}chmod"
-    ;;
-  Windows* | CYGWIN* )
-    CHMOD="chmod"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${COMPILEJAVA}" = "" ]; then
-  COMPILEJAVA="${TESTJAVA}"
-fi
-echo "COMPILEJAVA=${COMPILEJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-cp ${TESTSRC}/Assert.java .
-cp -R ${TESTSRC}/package1 .
-cp -R ${TESTSRC}/package2 .
-${CHMOD} -R u+w *
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} Assert.java 
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} Assert
-
-result=$?
-if [ $result -eq 0 ]
-then
-  echo "Passed"
-else
-  echo "Failed"
-fi
-exit $result
-
-
diff --git a/test/java/lang/ProcessBuilder/CloseRace.java b/test/java/lang/ProcessBuilder/CloseRace.java
index ff2e81f..a9afbd2 100644
--- a/test/java/lang/ProcessBuilder/CloseRace.java
+++ b/test/java/lang/ProcessBuilder/CloseRace.java
@@ -33,6 +33,8 @@
 import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
 
 public class CloseRace {
     private static final String BIG_FILE = "bigfile";
@@ -43,6 +45,9 @@
     private static final int testDurationSeconds
         = Integer.getInteger("test.duration", 600);
 
+    private static final CountDownLatch threadsStarted
+        = new CountDownLatch(2);
+
     static boolean fdInUse(int i) {
         return new File("/proc/self/fd/" + i).exists();
     }
@@ -61,6 +66,18 @@
         return count;
     }
 
+    static void dumpAllStacks() {
+        System.err.println("Start of dump");
+        final Map<Thread, StackTraceElement[]> allStackTraces
+                = Thread.getAllStackTraces();
+        for (Thread thread : allStackTraces.keySet()) {
+            System.err.println("Thread " + thread.getName());
+            for (StackTraceElement element : allStackTraces.get(thread))
+                System.err.println("\t" + element);
+        }
+        System.err.println("End of dump");
+    }
+
     public static void main(String args[]) throws Exception {
         if (!(new File("/proc/self/fd").isDirectory()))
             return;
@@ -84,26 +101,41 @@
         for (Thread thread : threads)
             thread.start();
 
+        threadsStarted.await();
         Thread.sleep(testDurationSeconds * 1000);
 
         for (Thread thread : threads)
             thread.interrupt();
-        for (Thread thread : threads)
-            thread.join();
+        for (Thread thread : threads) {
+            thread.join(10_000);
+            if (thread.isAlive()) {
+                dumpAllStacks();
+                throw new Error("At least one child thread ("
+                        + thread.getName()
+                        + ") failed to finish gracefully");
+            }
+        }
     }
 
     static class OpenLoop implements Runnable {
         public void run() {
+            threadsStarted.countDown();
             while (!Thread.interrupted()) {
                 try {
                     // wait for ExecLoop to finish creating process
-                    do {} while (count(procFDsInUse()) != 3);
+                    do {
+                        if (Thread.interrupted())
+                            return;
+                    } while (count(procFDsInUse()) != 3);
                     List<InputStream> iss = new ArrayList<>(4);
 
                     // eat up three "holes" (closed ends of pipe fd pairs)
                     for (int i = 0; i < 3; i++)
                         iss.add(new FileInputStream(BIG_FILE));
-                    do {} while (count(procFDsInUse()) == procFDs.length);
+                    do {
+                        if (Thread.interrupted())
+                            return;
+                    } while (count(procFDsInUse()) == procFDs.length);
                     // hopefully this will racily occupy empty fd slot
                     iss.add(new FileInputStream(BIG_FILE));
                     Thread.sleep(1); // Widen race window
@@ -120,11 +152,15 @@
 
     static class ExecLoop implements Runnable {
         public void run() {
+            threadsStarted.countDown();
             ProcessBuilder builder = new ProcessBuilder("/bin/true");
             while (!Thread.interrupted()) {
                 try {
                     // wait for OpenLoop to finish
-                    do {} while (count(procFDsInUse()) > 0);
+                    do {
+                        if (Thread.interrupted())
+                            return;
+                    } while (count(procFDsInUse()) > 0);
                     Process process = builder.start();
                     InputStream is = process.getInputStream();
                     process.waitFor();
diff --git a/test/java/lang/invoke/MethodHandles/TestCatchException.java b/test/java/lang/invoke/MethodHandles/TestCatchException.java
index 8f1abfc..8197129 100644
--- a/test/java/lang/invoke/MethodHandles/TestCatchException.java
+++ b/test/java/lang/invoke/MethodHandles/TestCatchException.java
@@ -72,19 +72,55 @@
         assertEquals(x, 17);
     }
 
+    final static Object masterParam = new Object();
+    final static Object[] masterTail = new Object[] { "str" };
+    static Exception masterEx = new Exception();
 
     public static Object m1(Object o1, Object o2, Object o3, Object o4, Object o5,
                             Object o6, Object o7, Object o8, Object... tail) {
+        assertEquals(masterParam, o1);
+        assertEquals(masterParam, o2);
+        assertEquals(masterParam, o3);
+        assertEquals(masterParam, o4);
+        assertEquals(masterParam, o5);
+        assertEquals(masterParam, o6);
+        assertEquals(masterParam, o7);
+        assertEquals(masterParam, o8);
+        assertEquals(masterTail, tail);
         return tail;
     }
 
     public static Object m2(Exception e, Object o1, Object o2, Object o3, Object o4,
                             Object o5, Object o6, Object o7, Object o8, Object... tail) {
+        assertEquals(masterEx, e);
+        assertEquals(masterParam, o1);
+        assertEquals(masterParam, o2);
+        assertEquals(masterParam, o3);
+        assertEquals(masterParam, o4);
+        assertEquals(masterParam, o5);
+        assertEquals(masterParam, o6);
+        assertEquals(masterParam, o7);
+        assertEquals(masterParam, o8);
+        assertEquals(masterTail, tail);
         return tail;
     }
 
+    public static Object throwEx(Object o1, Object o2, Object o3, Object o4, Object o5,
+                                 Object o6, Object o7, Object o8, Object... tail) throws Exception {
+        assertEquals(masterParam, o1);
+        assertEquals(masterParam, o2);
+        assertEquals(masterParam, o3);
+        assertEquals(masterParam, o4);
+        assertEquals(masterParam, o5);
+        assertEquals(masterParam, o6);
+        assertEquals(masterParam, o7);
+        assertEquals(masterParam, o8);
+        assertEquals(masterTail, tail);
+        throw masterEx;
+    }
+
     @Test
-    public void testVarargsCollector() throws Throwable {
+    public void testVarargsCollectorNoThrow() throws Throwable {
         MethodType t1 = MethodType.methodType(Object.class, Object.class, Object.class, Object.class, Object.class,
                 Object.class, Object.class, Object.class, Object.class, Object[].class);
 
@@ -92,17 +128,34 @@
 
         MethodHandle target = LOOKUP.findStatic(TestCatchException.class, "m1", t1)
                                     .asVarargsCollector(Object[].class);
-
-        MethodHandle catcher = LOOKUP.findStatic(TestCatchException.class, "m2", t2);
-
+        MethodHandle catcher = LOOKUP.findStatic(TestCatchException.class, "m2", t2)
+                                     .asVarargsCollector(Object[].class);
         MethodHandle gwc = MethodHandles.catchException(target, Exception.class, catcher);
 
-        Object o = new Object();
-        Object[] obj1 = new Object[] { "str" };
+        Object o = masterParam;
+        Object[] obj1 = masterTail;
 
-        Object r1 = target.invokeExact(o, o, o, o, o, o, o, o, obj1);
         Object r2 = gwc.invokeExact(o, o, o, o, o, o, o, o, obj1);
-        assertEquals(r1, obj1);
+        assertEquals(r2, obj1);
+    }
+
+    @Test
+    public void testVarargsCollectorThrow() throws Throwable {
+        MethodType t1 = MethodType.methodType(Object.class, Object.class, Object.class, Object.class, Object.class,
+                Object.class, Object.class, Object.class, Object.class, Object[].class);
+
+        MethodType t2 = t1.insertParameterTypes(0, Exception.class);
+
+        MethodHandle target = LOOKUP.findStatic(TestCatchException.class, "throwEx", t1)
+                                    .asVarargsCollector(Object[].class);
+        MethodHandle catcher = LOOKUP.findStatic(TestCatchException.class, "m2", t2)
+                                     .asVarargsCollector(Object[].class);
+        MethodHandle gwc = MethodHandles.catchException(target, Exception.class, catcher);
+
+        Object o = masterParam;
+        Object[] obj1 = masterTail;
+
+        Object r2 = gwc.invokeExact(o, o, o, o, o, o, o, o, obj1);
         assertEquals(r2, obj1);
     }
 
@@ -110,7 +163,8 @@
         TestCatchException test = new TestCatchException();
         test.testNoThrowPath();
         test.testThrowPath();
-        test.testVarargsCollector();
+        test.testVarargsCollectorNoThrow();
+        test.testVarargsCollectorThrow();
         System.out.println("TEST PASSED");
     }
 }
diff --git a/test/java/lang/management/ThreadMXBean/Locks.java b/test/java/lang/management/ThreadMXBean/Locks.java
index e65d363..14273b5 100644
--- a/test/java/lang/management/ThreadMXBean/Locks.java
+++ b/test/java/lang/management/ThreadMXBean/Locks.java
@@ -166,6 +166,9 @@
     private static CheckerThread checker;
     static class WaitingThread extends Thread {
         private final Phaser p;
+
+        volatile boolean waiting = false;
+
         public WaitingThread(Phaser p) {
             super("WaitingThread");
             this.p = p;
@@ -175,7 +178,9 @@
                 System.out.println("WaitingThread about to wait on objC");
                 try {
                     // Signal checker thread, about to wait on objC.
+                    waiting = false;
                     p.arriveAndAwaitAdvance(); // Phase 1 (waiting)
+                    waiting = true;
                     objC.wait();
                 } catch (InterruptedException e) {
                     e.printStackTrace();
@@ -194,7 +199,9 @@
             synchronized(objC) {
                 try {
                     // signal checker thread, about to wait on objC
+                    waiting = false;
                     p.arriveAndAwaitAdvance(); // Phase 3 (waiting)
+                    waiting = true;
                     objC.wait();
                 } catch (InterruptedException e) {
                     e.printStackTrace();
@@ -203,25 +210,35 @@
             }
             System.out.println("WaitingThread about to exit waiting on objC 2");
         }
-    }
-    static class CheckerThread extends Thread {
-        private final Phaser p;
-        public CheckerThread(Phaser p) {
-            super("CheckerThread");
-            this.p = p;
+
+        public void waitForWaiting() {
+            p.arriveAndAwaitAdvance();
+            while (!waiting) {
+                goSleep(10);
+            }
+            waitForState(State.WAITING);
+        }
+
+        public void waitForBlocked() {
+            p.arriveAndAwaitAdvance();
+            waitForState(State.BLOCKED);
         }
 
         private void waitForState(Thread.State state) {
-            p.arriveAndAwaitAdvance();
             while (!waiter.isInterrupted() && waiter.getState() != state) {
-                goSleep(10);
+                Thread.yield();
             }
         }
+    }
+    static class CheckerThread extends Thread {
+        public CheckerThread() {
+            super("CheckerThread");
+        }
 
         public void run() {
             synchronized (ready) {
                 // wait until WaitingThread about to wait for objC
-                waitForState(Thread.State.WAITING); // Phase 1 (waiting)
+                waiter.waitForWaiting(); // Phase 1 (waiting)
                 checkBlockedObject(waiter, objC, null, Thread.State.WAITING);
 
                 synchronized (objC) {
@@ -230,13 +247,13 @@
 
                 // wait for waiter thread to about to enter
                 // synchronized object ready.
-                waitForState(Thread.State.BLOCKED); // Phase 2 (waiting)
+                waiter.waitForBlocked(); // Phase 2 (waiting)
                 checkBlockedObject(waiter, ready, this, Thread.State.BLOCKED);
             }
 
             // wait for signal from waiting thread that it is about
             // wait for objC.
-            waitForState(Thread.State.WAITING); // Phase 3 (waiting)
+            waiter.waitForWaiting(); // Phase 3 (waiting)
             synchronized(objC) {
                 checkBlockedObject(waiter, objC, Thread.currentThread(), Thread.State.WAITING);
                 objC.notify();
@@ -284,7 +301,7 @@
         waiter = new WaitingThread(p);
         waiter.start();
 
-        checker = new CheckerThread(p);
+        checker = new CheckerThread();
         checker.start();
 
         try {
diff --git a/test/java/security/Policy/Root/Root.java b/test/java/security/Policy/Root/Root.java
index 7a760a9..497156e 100644
--- a/test/java/security/Policy/Root/Root.java
+++ b/test/java/security/Policy/Root/Root.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 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
@@ -25,12 +25,13 @@
  *
  * @bug 4619757
  * @summary User Policy Setting is not recognized on Netscape 6
- *              when invoked as root
- * @ignore - must run test as root
- *
- * place Root.policy in the root home directory (/), as /.java.policy
- * run this test as root:
- *      java Root
+ *          when invoked as root.
+ * @run main/manual Root
+ */
+
+/*
+ * Place Root.policy in the root home directory (/),
+ * as /.java.policy and run as test as root user.
  */
 
 import java.security.*;
diff --git a/test/java/security/cert/X509Certificate/X509BadCertificate.java b/test/java/security/cert/X509Certificate/X509BadCertificate.java
index b2a6c69..c2b4a88 100644
--- a/test/java/security/cert/X509Certificate/X509BadCertificate.java
+++ b/test/java/security/cert/X509Certificate/X509BadCertificate.java
@@ -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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8028431
+ * @bug 8028431 8028591
  * @summary Make sure that proper CertificateException is thrown
  *          when loading bad x509 certificate
  * @author Artem Smotrakov
@@ -39,6 +39,7 @@
 
     public static void main(String[] args) throws Exception {
         test("bad-cert-1.pem");
+        test("bad-cert-2.pem");
     }
 
     /**
diff --git a/test/java/security/cert/X509Certificate/bad-cert-2.pem b/test/java/security/cert/X509Certificate/bad-cert-2.pem
new file mode 100644
index 0000000..6b92ced
--- /dev/null
+++ b/test/java/security/cert/X509Certificate/bad-cert-2.pem
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDZzCCAk+gAwIBAgIJAJYB3qu9C2kiMA0GCSqGSIb3DQEBBQUAMEoxDTALBgNV
+BAMMBFRlc3QxDTALBgNVBAsMBEphdmExDzANBgNVBAoMBk9yYWNsZTEMMAoGA1UE
+BwwDU1BCMQswCQYDVQQGEwJSVTAeFw0xMzEyMjMwNzA4MDhaFw0yMzEyMjEwNzA4
+MDhaMEoxDTALBgNVBAMMBFRlc3QxDTALBgNVBAsMBEphdmExDzANBgNVBAoMBk9y
+YWNsZTEMMAoGA1UEBwwDU1BCMQswCQYDVQQGEwJSVTCCASIwDQYJKoZIhvcNAQEB
+BQADgGEPADCCAQoCggEBAOqiCN4gFxehl547Q7/VNGbGApr+wszLdanHPucAH6Wf
+LtcRhKNUSqtBAQxEpFrTpMNEqm2GElAjiPa6m48qIjLVSvOb/9w3G/yXB8zyZbIm
+/Nfp2sT4OEaa1JSEZSpolhS4FfqYzjGQp5cn4Xn4zKjDgiceHgfLls5x2dRydQZO
+Yf91qSIioZxVHUtlo8yztkieiSaqPWt3nJ4PIwhFbsu1HVmWaYZD+nBYCKgVHqrS
+cueO98Ca4Doz73O27X1dVbQBdLS0JI7qVAG8LD388iPL8qbsOkgWPzmEQ+kLRKO4
+g7RpuwlXuwaMSh95NWaxlu4Ob6GRJQmpconYoe13+7ECAwEAAaNQME4wHQYDVR0O
+BBYEFIG8TPobXcbNbDi+zKudd9whpxoNMB8GA1UdIwQYMBaAFIG8TPobXcbNbDi+
+zKudd9whpxoNMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAynN+e7
+h+ufT5SBKN/gBuJAnF1mKIPESiipuv5KoYUGZOY8ShgYLcwY+qnbuHYFUlvq6Zns
+K4/e+x/16h32vD7dEPkNvukbvER4YJQQiN6osDfXpTPzixYftWdmtX0u8xQfwb/g
+R8DS7bazz99jVXk+jTK4yWBY+gMwEat+LyNQ5cyq8Qhi1oBKUbGRbiOts19B97fn
+Rv8TsyXN3INLGYhdVxZoD7E5tyG1ydSFmOMadulAC2epBXDHOXZnz2UWauJc0XW5
+1L/YQVri47VkdHS3tisBzELEJdLmdMDb+5tAU+lItXmTXe2/PB53WIvsEIb4t+eQ
+wY0hCj9lVJlajTQ=
+-----END CERTIFICATE-----
diff --git a/test/java/util/Collection/CollectionDefaults.java b/test/java/util/Collection/CollectionDefaults.java
index bbfd330..c2d147f 100644
--- a/test/java/util/Collection/CollectionDefaults.java
+++ b/test/java/util/Collection/CollectionDefaults.java
@@ -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
@@ -21,6 +21,7 @@
  * questions.
  */
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -44,8 +45,8 @@
 import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentSkipListMap;
+import java.util.function.Function;
 import java.util.function.Predicate;
-import java.util.function.Supplier;
 
 /**
  * @test
@@ -59,26 +60,25 @@
     public static final Predicate<Integer> pEven = x -> 0 == x % 2;
     public static final Predicate<Integer> pOdd = x -> 1 == x % 2;
 
-    @SuppressWarnings("unchecked")
-    private static final Supplier<?>[] TEST_CLASSES = {
-        // Collection
-        ExtendsAbstractCollection<Integer>::new,
+    private static final List<Function<Collection<Integer>, Collection<Integer>>> TEST_SUPPLIERS = Arrays.asList(
+            // Collection
+            ExtendsAbstractCollection<Integer>::new,
 
-        // Lists
-        java.util.ArrayList<Integer>::new,
-        java.util.LinkedList<Integer>::new,
-        java.util.Vector<Integer>::new,
-        java.util.concurrent.CopyOnWriteArrayList<Integer>::new,
-        ExtendsAbstractList<Integer>::new,
+            // Lists
+            java.util.ArrayList<Integer>::new,
+            java.util.LinkedList<Integer>::new,
+            java.util.Vector<Integer>::new,
+            java.util.concurrent.CopyOnWriteArrayList<Integer>::new,
+            ExtendsAbstractList<Integer>::new,
 
-        // Sets
-        java.util.HashSet<Integer>::new,
-        java.util.LinkedHashSet<Integer>::new,
-        java.util.TreeSet<Integer>::new,
-        java.util.concurrent.ConcurrentSkipListSet<Integer>::new,
-        java.util.concurrent.CopyOnWriteArraySet<Integer>::new,
-        ExtendsAbstractSet<Integer>::new
-    };
+            // Sets
+            java.util.HashSet<Integer>::new,
+            java.util.LinkedHashSet<Integer>::new,
+            java.util.TreeSet<Integer>::new,
+            java.util.concurrent.ConcurrentSkipListSet<Integer>::new,
+            java.util.concurrent.CopyOnWriteArraySet<Integer>::new,
+            ExtendsAbstractSet<Integer>::new
+       );
 
     private static final int SIZE = 100;
 
@@ -94,7 +94,7 @@
         cases.add(new Object[] { new ExtendsAbstractSet<>() });
 
         cases.add(new Object[] { Collections.newSetFromMap(new HashMap<>()) });
-        cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap()) });
+        cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap<>()) });
         cases.add(new Object[] { Collections.newSetFromMap(new TreeMap<>()) });
         cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentHashMap<>()) });
         cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentSkipListMap<>()) });
@@ -107,24 +107,23 @@
     }
 
     @Test(dataProvider = "setProvider")
-    public void testProvidedWithNull(final Set<Integer> set) throws Exception {
+    public void testProvidedWithNull(final Set<Integer> set) {
         try {
             set.forEach(null);
             fail("expected NPE not thrown");
-        } catch (NullPointerException expected) {
-                ; // expected
-            }
+        } catch (NullPointerException expected) { // expected
+        }
         try {
             set.removeIf(null);
             fail("expected NPE not thrown");
-        } catch (NullPointerException expected) {
-               ; // expected
+        } catch (NullPointerException expected) { // expected
         }
     }
 
     @Test
-    public void testForEach() throws Exception {
-        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier((Supplier<Collection<Integer>>[]) TEST_CLASSES, SIZE);
+    public void testForEach() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier(TEST_SUPPLIERS, SIZE);
 
         for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) {
             final Collection<Integer> original = test.expected;
@@ -133,8 +132,7 @@
             try {
                 set.forEach(null);
                 fail("expected NPE not thrown");
-            } catch (NullPointerException expected) {
-                ; // expected
+            } catch (NullPointerException expected) { // expected
             }
             if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) {
                 CollectionAsserts.assertContentsUnordered(set, original, test.toString());
@@ -155,8 +153,9 @@
     }
 
     @Test
-    public void testRemoveIf() throws Exception {
-        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier((Supplier<Collection<Integer>>[]) TEST_CLASSES, SIZE);
+    public void testRemoveIf() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier(TEST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) {
             final Collection<Integer> original = test.expected;
             final Collection<Integer> set = test.collection;
@@ -164,8 +163,7 @@
             try {
                 set.removeIf(null);
                 fail("expected NPE not thrown");
-            } catch (NullPointerException expected) {
-                ; // expected
+            } catch (NullPointerException expected) { // expected
             }
             if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) {
                 CollectionAsserts.assertContentsUnordered(set, original, test.toString());
diff --git a/test/java/util/Collection/testlibrary/CollectionSupplier.java b/test/java/util/Collection/testlibrary/CollectionSupplier.java
index 4a8b735..714bc73 100644
--- a/test/java/util/Collection/testlibrary/CollectionSupplier.java
+++ b/test/java/util/Collection/testlibrary/CollectionSupplier.java
@@ -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
@@ -25,6 +25,7 @@
 import java.lang.Integer;
 import java.lang.Iterable;
 import java.lang.Override;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
@@ -36,6 +37,7 @@
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.function.Function;
 import java.util.function.Supplier;
 
 /**
@@ -44,20 +46,24 @@
  */
 public final class CollectionSupplier<C extends Collection<Integer>> implements Supplier<Iterable<CollectionSupplier.TestCase<C>>> {
 
-    private final Supplier<C>[] classes;
+    private final List<Function<Collection<Integer>, C>> suppliers;
     private final int size;
 
     /**
      * A Collection test case.
      */
     public static final class TestCase<C extends Collection<Integer>> {
-
         /**
          * The name of the test case.
          */
         public final String name;
 
         /**
+         * The supplier of a collection
+         */
+        public Function<Collection<Integer>, C> supplier;
+
+        /**
          * Unmodifiable reference collection, useful for comparisons.
          */
         public final List<Integer> expected;
@@ -71,11 +77,11 @@
          * Create a Collection test case.
          *
          * @param name name of the test case
-         * @param expected reference collection
          * @param collection the modifiable test collection
          */
-        public TestCase(String name, C collection) {
+        public TestCase(String name, Function<Collection<Integer>, C> supplier, C collection) {
             this.name = name;
+            this.supplier = supplier;
             this.expected = Collections.unmodifiableList(
                 Arrays.asList(collection.toArray(new Integer[0])));
             this.collection = collection;
@@ -107,54 +113,52 @@
     }
 
     /**
-     * Create a {@code Supplier} that creates instances of specified collection
-     * classes of specified length.
+     * Create a {@code CollectionSupplier} that creates instances of specified
+     * collection suppliers of the specified size.
      *
-     * @param classNames class names that implement {@code Collection}
+     * @param suppliers the suppliers names that supply {@code Collection}
+     *        instances
      * @param size the desired size of each collection
      */
-    public CollectionSupplier(Supplier<C>[] classes, int size) {
-        this.classes = Arrays.copyOf(classes, classes.length);
+    public CollectionSupplier(List<Function<Collection<Integer>, C>> suppliers, int size) {
+        this.suppliers = suppliers;
         this.size = size;
     }
 
     @Override
     public Iterable<TestCase<C>> get() {
         final Collection<TestCase<C>> cases = new LinkedList<>();
-        for (final Supplier<C> type : classes) {
+        for (final Function<Collection<Integer>, C> supplier : suppliers)
             try {
-                final Collection<Integer> empty = type.get();
-                cases.add(new TestCase("empty", empty));
+                cases.add(new TestCase<>("empty", supplier, supplier.apply(Collections.emptyList())));
 
-                final Collection<Integer> single = type.get();
-                single.add(42);
-                cases.add(new TestCase("single", single));
+                cases.add(new TestCase<>("single", supplier, supplier.apply(Arrays.asList(42))));
 
-                final Collection<Integer> regular = type.get();
+                final Collection<Integer> regular = new ArrayList<>();
                 for (int i = 0; i < size; i++) {
                     regular.add(i);
                 }
-                cases.add(new TestCase("regular", regular));
+                cases.add(new TestCase<>("regular", supplier, supplier.apply(regular)));
 
-                final Collection<Integer> reverse = type.get();
+                final Collection<Integer> reverse = new ArrayList<>();
                 for (int i = size; i >= 0; i--) {
                     reverse.add(i);
                 }
-                cases.add(new TestCase("reverse", reverse));
+                cases.add(new TestCase<>("reverse", supplier, supplier.apply(reverse)));
 
-                final Collection<Integer> odds = type.get();
+                final Collection<Integer> odds = new ArrayList<>();
                 for (int i = 0; i < size; i++) {
                     odds.add((i * 2) + 1);
                 }
-                cases.add(new TestCase("odds", odds));
+                cases.add(new TestCase<>("odds", supplier, supplier.apply(odds)));
 
-                final Collection<Integer> evens = type.get();
+                final Collection<Integer> evens = new ArrayList<>();
                 for (int i = 0; i < size; i++) {
                     evens.add(i * 2);
                 }
-                cases.add(new TestCase("evens", evens));
+                cases.add(new TestCase<>("evens", supplier, supplier.apply(evens)));
 
-                final Collection<Integer> fibonacci = type.get();
+                final Collection<Integer> fibonacci = new ArrayList<>();
                 int prev2 = 0;
                 int prev1 = 1;
                 for (int i = 0; i < size; i++) {
@@ -166,58 +170,62 @@
                     prev2 = prev1;
                     prev1 = n;
                 }
-                cases.add(new TestCase("fibonacci", fibonacci));
+                cases.add(new TestCase<>("fibonacci", supplier, supplier.apply(fibonacci)));
 
-            // variants where the size of the backing storage != reported size
+
+                boolean isStructurallyModifiable = false;
+                try {
+                    C t = supplier.apply(Collections.emptyList());
+                    t.add(1);
+                    isStructurallyModifiable = true;
+                } catch (UnsupportedOperationException e) { }
+
+                if (!isStructurallyModifiable)
+                    continue;
+
+
+                // variants where the size of the backing storage != reported size
                 // created by removing half of the elements
-                final Collection<Integer> emptyWithSlack = type.get();
+                final C emptyWithSlack = supplier.apply(Collections.emptyList());
                 emptyWithSlack.add(42);
                 assertTrue(emptyWithSlack.remove(42));
-                cases.add(new TestCase("emptyWithSlack", emptyWithSlack));
+                cases.add(new TestCase<>("emptyWithSlack", supplier, emptyWithSlack));
 
-                final Collection<Integer> singleWithSlack = type.get();
+                final C singleWithSlack = supplier.apply(Collections.emptyList());
                 singleWithSlack.add(42);
                 singleWithSlack.add(43);
                 assertTrue(singleWithSlack.remove(43));
-                cases.add(new TestCase("singleWithSlack", singleWithSlack));
+                cases.add(new TestCase<>("singleWithSlack", supplier, singleWithSlack));
 
-                final Collection<Integer> regularWithSlack = type.get();
+                final C regularWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 0; i < (2 * size); i++) {
                     regularWithSlack.add(i);
                 }
-                assertTrue(regularWithSlack.removeIf((x) -> {
-                    return x >= size;
-                }));
-                cases.add(new TestCase("regularWithSlack", regularWithSlack));
+                assertTrue(regularWithSlack.removeIf(x -> x < size));
+                cases.add(new TestCase<>("regularWithSlack", supplier, regularWithSlack));
 
-                final Collection<Integer> reverseWithSlack = type.get();
+                final C reverseWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 2 * size; i >= 0; i--) {
                     reverseWithSlack.add(i);
                 }
-                assertTrue(reverseWithSlack.removeIf((x) -> {
-                    return x < size;
-                }));
-                cases.add(new TestCase("reverseWithSlack", reverseWithSlack));
+                assertTrue(reverseWithSlack.removeIf(x -> x < size));
+                cases.add(new TestCase<>("reverseWithSlack", supplier, reverseWithSlack));
 
-                final Collection<Integer> oddsWithSlack = type.get();
+                final C oddsWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 0; i < 2 * size; i++) {
                     oddsWithSlack.add((i * 2) + 1);
                 }
-                assertTrue(oddsWithSlack.removeIf((x) -> {
-                    return x >= size;
-                }));
-                cases.add(new TestCase("oddsWithSlack", oddsWithSlack));
+                assertTrue(oddsWithSlack.removeIf(x -> x >= size));
+                cases.add(new TestCase<>("oddsWithSlack", supplier, oddsWithSlack));
 
-                final Collection<Integer> evensWithSlack = type.get();
+                final C evensWithSlack = supplier.apply(Collections.emptyList());
                 for (int i = 0; i < 2 * size; i++) {
                     evensWithSlack.add(i * 2);
                 }
-                assertTrue(evensWithSlack.removeIf((x) -> {
-                    return x >= size;
-                }));
-                cases.add(new TestCase("evensWithSlack", evensWithSlack));
+                assertTrue(evensWithSlack.removeIf(x -> x >= size));
+                cases.add(new TestCase<>("evensWithSlack", supplier, evensWithSlack));
 
-                final Collection<Integer> fibonacciWithSlack = type.get();
+                final C fibonacciWithSlack = supplier.apply(Collections.emptyList());
                 prev2 = 0;
                 prev1 = 1;
                 for (int i = 0; i < size; i++) {
@@ -229,15 +237,12 @@
                     prev2 = prev1;
                     prev1 = n;
                 }
-                assertTrue(fibonacciWithSlack.removeIf((x) -> {
-                    return x < 20;
-                }));
-                cases.add(new TestCase("fibonacciWithSlack",
-                    fibonacciWithSlack));
-            } catch (Exception failed) {
+                assertTrue(fibonacciWithSlack.removeIf(x -> x < 20));
+                cases.add(new TestCase<>("fibonacciWithSlack", supplier, fibonacciWithSlack));
+            }
+            catch (Exception failed) {
                 throw new TestException(failed);
             }
-        }
 
         return cases;
     }
diff --git a/test/java/util/List/ListDefaults.java b/test/java/util/List/ListDefaults.java
index 8e36d5f..2d5260e 100644
--- a/test/java/util/List/ListDefaults.java
+++ b/test/java/util/List/ListDefaults.java
@@ -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
@@ -23,6 +23,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -43,31 +44,45 @@
 
 import java.lang.reflect.Constructor;
 import java.util.ConcurrentModificationException;
+import java.util.function.Consumer;
+import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.function.Supplier;
 
 /**
  * @test
  * @summary Unit tests for extension methods on List
- * @bug 8023367
+ * @bug 8023367 8037106
  * @library ../Collection/testlibrary
  * @build CollectionAsserts CollectionSupplier ExtendsAbstractList
  * @run testng ListDefaults
  */
 public class ListDefaults {
 
-    private static final Supplier<?>[] LIST_CLASSES = {
-        java.util.ArrayList::new,
-        java.util.LinkedList::new,
-        java.util.Vector::new,
-        java.util.concurrent.CopyOnWriteArrayList::new,
-        ExtendsAbstractList::new
-     };
+    // Suppliers of lists that can support structural modifications
+    private static final List<Function<Collection, List>> LIST_STRUCT_MOD_SUPPLIERS = Arrays.asList(
+            java.util.ArrayList::new,
+            java.util.LinkedList::new,
+            java.util.Vector::new,
+            java.util.concurrent.CopyOnWriteArrayList::new,
+            ExtendsAbstractList::new
+    );
 
-    private static final Supplier<?>[] LIST_CME_CLASSES = {
-        java.util.ArrayList::new,
-        java.util.Vector::new
-     };
+    // Suppliers of lists that can support in place modifications
+    private static final List<Function<Collection, List>> LIST_SUPPLIERS = Arrays.asList(
+            java.util.ArrayList::new,
+            java.util.LinkedList::new,
+            java.util.Vector::new,
+            java.util.concurrent.CopyOnWriteArrayList::new,
+            ExtendsAbstractList::new,
+            c -> Arrays.asList(c.toArray())
+    );
+
+    // Suppliers of lists supporting CMEs
+    private static final List<Function<Collection, List>> LIST_CME_SUPPLIERS = Arrays.asList(
+            java.util.ArrayList::new,
+            java.util.Vector::new
+    );
 
     private static final Predicate<Integer> pEven = x -> 0 == x % 2;
     private static final Predicate<Integer> pOdd = x -> 1 == x % 2;
@@ -83,17 +98,13 @@
     private static final int SUBLIST_TO = SIZE - 5;
     private static final int SUBLIST_SIZE = SUBLIST_TO - SUBLIST_FROM;
 
-    private static interface Callback {
-        void call(List<Integer> list);
-    }
-
     // call the callback for each recursive subList
-    private void trimmedSubList(final List<Integer> list, final Callback callback) {
+    private void trimmedSubList(final List<Integer> list, final Consumer<List<Integer>> callback) {
         int size = list.size();
         if (size > 1) {
             // trim 1 element from both ends
             final List<Integer> subList = list.subList(1, size - 1);
-            callback.call(subList);
+            callback.accept(subList);
             trimmedSubList(subList, callback);
         }
     }
@@ -107,17 +118,21 @@
         cases.add(new Object[] { new Vector<>() });
         cases.add(new Object[] { new Stack<>() });
         cases.add(new Object[] { new CopyOnWriteArrayList<>() });
+        cases.add(new Object[] { Arrays.asList() });
 
-        cases.add(new Object[] { new ArrayList(){{add(42);}} });
-        cases.add(new Object[] { new LinkedList(){{add(42);}} });
-        cases.add(new Object[] { new Vector(){{add(42);}} });
-        cases.add(new Object[] { new Stack(){{add(42);}} });
-        cases.add(new Object[] { new CopyOnWriteArrayList(){{add(42);}} });
+        List<Integer> l = Arrays.asList(42);
+        cases.add(new Object[] { new ArrayList<>(l) });
+        cases.add(new Object[] { new LinkedList<>(l) });
+        cases.add(new Object[] { new Vector<>(l) });
+        Stack<Integer> s = new Stack<>(); s.addAll(l);
+        cases.add(new Object[]{s});
+        cases.add(new Object[] { new CopyOnWriteArrayList<>(l) });
+        cases.add(new Object[] { l });
         return cases.toArray(new Object[0][cases.size()]);
     }
 
     @Test(dataProvider = "listProvider")
-    public void testProvidedWithNull(final List<Integer> list) throws Exception {
+    public void testProvidedWithNull(final List<Integer> list) {
         try {
             list.forEach(null);
             fail("expected NPE not thrown");
@@ -138,11 +153,12 @@
     }
 
     @Test
-    public void testForEach() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+    public void testForEach() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
 
             try {
                 list.forEach(null);
@@ -165,23 +181,21 @@
                 }
             }
 
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> actual = new LinkedList<>();
-                    list.forEach(actual::add);
-                    CollectionAsserts.assertContents(actual, list);
-                }
-            });
+            trimmedSubList(list, l -> {
+                    final List<Integer> a = new LinkedList<>();
+                    l.forEach(a::add);
+                    CollectionAsserts.assertContents(a, l);
+                });
         }
     }
 
     @Test
-    public void testRemoveIf() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+    public void testRemoveIf() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_STRUCT_MOD_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
 
             try {
                 list.removeIf(null);
@@ -195,9 +209,9 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
             list.removeIf(pOdd);
             for (int i : list) {
                 assertTrue((i % 2) == 0);
@@ -211,9 +225,9 @@
             assertTrue(list.isEmpty());
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
             final List<Integer> listCopy = new ArrayList<>(list);
             if (original.size() > SUBLIST_SIZE) {
                 final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
@@ -237,22 +251,19 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> copy = new ArrayList<>(list);
-                    list.removeIf(pOdd);
-                    for (int i : list) {
-                        assertTrue((i % 2) == 0);
-                    }
-                    for (int i : copy) {
-                        if (i % 2 == 0) {
-                            assertTrue(list.contains(i));
-                        } else {
-                            assertFalse(list.contains(i));
-                        }
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> list = test.collection;
+            trimmedSubList(list, l -> {
+                final List<Integer> copy = new ArrayList<>(l);
+                l.removeIf(pOdd);
+                for (int i : l) {
+                    assertTrue((i % 2) == 0);
+                }
+                for (int i : copy) {
+                    if (i % 2 == 0) {
+                        assertTrue(l.contains(i));
+                    } else {
+                        assertFalse(l.contains(i));
                     }
                 }
             });
@@ -267,12 +278,13 @@
     }
 
     @Test
-    public void testReplaceAll() throws Exception {
+    public void testReplaceAll() {
         final int scale = 3;
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
 
             try {
                 list.replaceAll(null);
@@ -281,7 +293,7 @@
             CollectionAsserts.assertContents(list, original);
 
             list.replaceAll(x -> scale * x);
-            for (int i=0; i < original.size(); i++) {
+            for (int i = 0; i < original.size(); i++) {
                 assertTrue(list.get(i) == (scale * original.get(i)), "mismatch at index " + i);
             }
 
@@ -306,28 +318,26 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> copy = new ArrayList<>(list);
-                    final int offset = 5;
-                    list.replaceAll(x -> offset + x);
-                    for (int i=0; i < copy.size(); i++) {
-                        assertTrue(list.get(i) == (offset + copy.get(i)), "mismatch at index " + i);
-                    }
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> list = test.collection;
+            trimmedSubList(list, l -> {
+                final List<Integer> copy = new ArrayList<>(l);
+                final int offset = 5;
+                l.replaceAll(x -> offset + x);
+                for (int i = 0; i < copy.size(); i++) {
+                    assertTrue(l.get(i) == (offset + copy.get(i)), "mismatch at index " + i);
                 }
             });
         }
     }
 
     @Test
-    public void testSort() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CLASSES, SIZE);
+    public void testSort() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> original = test.expected;
+            final List<Integer> list = test.collection;
             CollectionSupplier.shuffle(list);
             list.sort(Integer::compare);
             CollectionAsserts.assertSorted(list, Integer::compare);
@@ -338,23 +348,23 @@
 
             CollectionSupplier.shuffle(list);
             list.sort(null);
-            CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
+            CollectionAsserts.assertSorted(list, Comparator.naturalOrder());
             if (test.name.startsWith("reverse")) {
                 Collections.reverse(list);
             }
             CollectionAsserts.assertContents(list, original);
 
             CollectionSupplier.shuffle(list);
-            list.sort(Comparator.<Integer>naturalOrder());
-            CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
+            list.sort(Comparator.naturalOrder());
+            CollectionAsserts.assertSorted(list, Comparator.naturalOrder());
             if (test.name.startsWith("reverse")) {
                 Collections.reverse(list);
             }
             CollectionAsserts.assertContents(list, original);
 
             CollectionSupplier.shuffle(list);
-            list.sort(Comparator.<Integer>reverseOrder());
-            CollectionAsserts.assertSorted(list, Comparator.<Integer>reverseOrder());
+            list.sort(Comparator.reverseOrder());
+            CollectionAsserts.assertSorted(list, Comparator.reverseOrder());
             if (!test.name.startsWith("reverse")) {
                 Collections.reverse(list);
             }
@@ -365,32 +375,35 @@
             CollectionAsserts.assertSorted(list, BIT_COUNT_COMPARATOR);
             // check sort by verifying that bitCount increases and never drops
             int minBitCount = 0;
-            int bitCount = 0;
             for (final Integer i : list) {
-                bitCount = Integer.bitCount(i);
+                int bitCount = Integer.bitCount(i);
                 assertTrue(bitCount >= minBitCount);
                 minBitCount = bitCount;
             }
 
-            @SuppressWarnings("unchecked")
-            final Constructor<? extends List<?>> defaultConstructor = ((Class<? extends List<?>>)test.collection.getClass()).getConstructor();
-            final List<AtomicInteger> incomparables = (List<AtomicInteger>) defaultConstructor.newInstance();
-
-            for (int i=0; i < test.expected.size(); i++) {
-                incomparables.add(new AtomicInteger(i));
+            // Resuse the supplier to store AtomicInteger instead of Integer
+            // Hence the use of raw type and cast
+            List<AtomicInteger> incomparablesData = new ArrayList<>();
+            for (int i = 0; i < test.expected.size(); i++) {
+                incomparablesData.add(new AtomicInteger(i));
             }
+            Function f = test.supplier;
+            @SuppressWarnings("unchecked")
+            List<AtomicInteger> incomparables = (List<AtomicInteger>) f.apply(incomparablesData);
+
             CollectionSupplier.shuffle(incomparables);
             incomparables.sort(ATOMIC_INTEGER_COMPARATOR);
-            for (int i=0; i < test.expected.size(); i++) {
+            for (int i = 0; i < test.expected.size(); i++) {
                 assertEquals(i, incomparables.get(i).intValue());
             }
 
+
             if (original.size() > SUBLIST_SIZE) {
                 final List<Integer> copy = new ArrayList<>(list);
                 final List<Integer> subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
                 CollectionSupplier.shuffle(subList);
-                subList.sort(Comparator.<Integer>naturalOrder());
-                CollectionAsserts.assertSorted(subList, Comparator.<Integer>naturalOrder());
+                subList.sort(Comparator.naturalOrder());
+                CollectionAsserts.assertSorted(subList, Comparator.naturalOrder());
                 // verify that elements [0, from) remain unmodified
                 for (int i = 0; i < SUBLIST_FROM; i++) {
                     assertTrue(list.get(i) == copy.get(i),
@@ -404,25 +417,22 @@
             }
         }
 
-        for (final CollectionSupplier.TestCase test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
-            trimmedSubList(list, new Callback() {
-                @Override
-                public void call(final List<Integer> list) {
-                    final List<Integer> copy = new ArrayList<>(list);
-                    CollectionSupplier.shuffle(list);
-                    list.sort(Comparator.<Integer>naturalOrder());
-                    CollectionAsserts.assertSorted(list, Comparator.<Integer>naturalOrder());
-                }
+        for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
+            final List<Integer> list = test.collection;
+            trimmedSubList(list, l -> {
+                CollectionSupplier.shuffle(l);
+                l.sort(Comparator.naturalOrder());
+                CollectionAsserts.assertSorted(l, Comparator.naturalOrder());
             });
         }
     }
 
     @Test
-    public void testForEachThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testForEachThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -430,7 +440,7 @@
             boolean gotException = false;
             try {
                 // bad predicate that modifies its list, should throw CME
-                list.forEach((x) -> {list.add(x);});
+                list.forEach(list::add);
             } catch (ConcurrentModificationException cme) {
                 gotException = true;
             }
@@ -441,11 +451,11 @@
     }
 
     @Test
-    public void testRemoveIfThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testRemoveIfThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> original = ((List<Integer>) test.expected);
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -453,7 +463,7 @@
             boolean gotException = false;
             try {
                 // bad predicate that modifies its list, should throw CME
-                list.removeIf((x) -> {return list.add(x);});
+                list.removeIf(list::add);
             } catch (ConcurrentModificationException cme) {
                 gotException = true;
             }
@@ -464,10 +474,11 @@
     }
 
     @Test
-    public void testReplaceAllThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testReplaceAllThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -486,10 +497,11 @@
     }
 
     @Test
-    public void testSortThrowsCME() throws Exception {
-        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier((Supplier<List<Integer>>[])LIST_CME_CLASSES, SIZE);
+    public void testSortThrowsCME() {
+        @SuppressWarnings("unchecked")
+        final CollectionSupplier<List<Integer>> supplier = new CollectionSupplier(LIST_CME_SUPPLIERS, SIZE);
         for (final CollectionSupplier.TestCase<List<Integer>> test : supplier.get()) {
-            final List<Integer> list = ((List<Integer>) test.collection);
+            final List<Integer> list = test.collection;
 
             if (list.size() <= 1) {
                 continue;
@@ -523,7 +535,7 @@
     }
 
     @Test(dataProvider = "shortIntListProvider")
-    public void testRemoveIfFromSlice(final List<Integer> list) throws Exception {
+    public void testRemoveIfFromSlice(final List<Integer> list) {
         final List<Integer> sublist = list.subList(3, 6);
         assertTrue(sublist.removeIf(x -> x == 4));
         CollectionAsserts.assertContents(list, SLICED_EXPECTED);
diff --git a/test/javax/print/PrintServiceLookup/CountPrintServices.java b/test/javax/print/PrintServiceLookup/CountPrintServices.java
new file mode 100644
index 0000000..fc1dc8d
--- /dev/null
+++ b/test/javax/print/PrintServiceLookup/CountPrintServices.java
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.AttributeSet;
+import javax.print.attribute.HashAttributeSet;
+import javax.print.attribute.standard.PrinterName;
+
+/*
+ * @test
+ * @bug 8032693
+ * @summary Test that lpstat and JDK agree whether there are printers.
+ */
+public class CountPrintServices {
+
+  public static void main(String[] args) throws Exception {
+    String os = System.getProperty("os.name").toLowerCase();
+    System.out.println("OS is " + os);
+    if (!os.equals("linux")) {
+        System.out.println("Linux specific test. No need to continue");
+        return;
+    }
+    PrintService services[] =
+        PrintServiceLookup.lookupPrintServices(null, null);
+    if (services.length > 0) {
+       System.out.println("Services found. No need to test further.");
+       return;
+    }
+    String[] lpcmd = { "lpstat", "-a" };
+    Process proc = Runtime.getRuntime().exec(lpcmd);
+    proc.waitFor();
+    InputStreamReader ir = new InputStreamReader(proc.getInputStream());
+    BufferedReader br = new BufferedReader(ir);
+    int count = 0;
+    String printer;
+    while ((printer = br.readLine()) != null) {
+       System.out.println("lpstat:: " + printer);
+       count++;
+    }
+    if (count > 0) {
+        throw new RuntimeException("Services exist, but not found by JDK.");
+    }
+ }
+}
+
diff --git a/test/javax/print/attribute/TestUnsupportedResolution.java b/test/javax/print/attribute/TestUnsupportedResolution.java
new file mode 100644
index 0000000..8b45b45
--- /dev/null
+++ b/test/javax/print/attribute/TestUnsupportedResolution.java
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+
+/**
+ * @test
+ * @bug 8033277
+ * @summary Confirm that scaling of printout is correct.  Manual comparison with printout using a supported resolution is needed.
+ * @run main/manual TestUnsupportedResolution
+ */
+
+import java.awt.Graphics;
+import java.awt.print.PageFormat;
+import java.awt.print.Printable;
+import java.awt.print.PrinterException;
+import java.awt.print.PrinterJob;
+
+import javax.print.*;
+import javax.print.attribute.HashPrintRequestAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.*;
+import javax.print.attribute.ResolutionSyntax;
+
+public class TestUnsupportedResolution implements Printable
+{
+public static void main(String[] args)
+{
+    System.out.println("USAGE: default or no args: it will test 300 dpi\n       args is \"600\" : it will test 600 dpi\n------------------------------------------------------\n");
+    TestUnsupportedResolution pt=new TestUnsupportedResolution();
+    pt.printWorks(args);
+}
+
+public void printWorks(String[] args)
+{
+    PrinterJob job=PrinterJob.getPrinterJob();
+    job.setPrintable(this);
+    PrintRequestAttributeSet settings=new HashPrintRequestAttributeSet();
+    PrinterResolution pr = new PrinterResolution(300, 300, ResolutionSyntax.DPI);
+    if (args.length > 0 && (args[0].compareTo("600") == 0)) {
+        pr = new PrinterResolution(600, 600, ResolutionSyntax.DPI);
+        System.out.println("Adding 600 Dpi attribute");
+    } else {
+        System.out.println("Adding 300 Dpi attribute");
+    }
+    PrintService ps = job.getPrintService();
+    boolean resolutionSupported = ps.isAttributeValueSupported(pr, null, null);
+    System.out.println("Is "+pr+" supported by "+ps+"?    "+resolutionSupported);
+    if (resolutionSupported) {
+        System.out.println("Resolution is supported.\nTest is not applicable, PASSED");
+    }
+    settings.add(pr);
+    if (args.length > 0 && (args[0].equalsIgnoreCase("fidelity"))) {
+        settings.add(Fidelity.FIDELITY_TRUE);
+        System.out.println("Adding Fidelity.FIDELITY_TRUE attribute");
+   }
+
+   if (job.printDialog(settings))
+   {
+        try {
+            job.print(settings);
+        } catch (PrinterException e) {
+            e.printStackTrace();
+        }
+    }
+}
+
+public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
+{
+    if (pageIndex>0)
+    {
+        return NO_SUCH_PAGE;
+    }
+
+    StringBuffer s=new StringBuffer();
+    for (int i=0;i<10;i++)
+    {
+        s.append("1234567890ABCDEFGHIJ");
+    }
+
+    int x=(int) pageFormat.getImageableX();
+    int y=(int) (pageFormat.getImageableY()+50);
+    graphics.drawString(s.toString(), x, y);
+
+    return PAGE_EXISTS;
+}
+}
+
diff --git a/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java b/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java
index e2274b8..906700c 100644
--- a/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java
+++ b/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,7 +25,11 @@
  * @test
  * @bug 4641821
  * @summary hashCode() and equals() for KerberosKey and KerberosTicket
- * @ignore Must set up KDC and setup Kerberos configuration file
+ * @run main/manual KerberosHashEqualsTest
+ */
+
+/*
+ * Must setup KDC and Kerberos configuration file
  */
 
 import java.net.InetAddress;
diff --git a/test/javax/security/auth/kerberos/KerberosTixDateTest.java b/test/javax/security/auth/kerberos/KerberosTixDateTest.java
index c061d1b..2fed8d0 100644
--- a/test/javax/security/auth/kerberos/KerberosTixDateTest.java
+++ b/test/javax/security/auth/kerberos/KerberosTixDateTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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,7 +25,11 @@
  * @test
  * @bug 6659990
  * @summary test the immutability of the Date fields in KerberosTicket class.
- * @ignore Must set up KDC and setup Kerberos configuration file
+ * @run main/manual KerberosTixDateTest
+ */
+
+/*
+ * Must setup KDC and Kerberos configuration file
  */
 
 import java.net.InetAddress;
diff --git a/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java b/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
new file mode 100644
index 0000000..75e4996
--- /dev/null
+++ b/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+
+import java.awt.Graphics;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8009919
+ * @author Sergey Bylokhov
+ */
+public final class JButtonPaintNPE {
+
+    private static JFrame frame;
+
+    public static void main(final String[] args)
+            throws InvocationTargetException, InterruptedException {
+        SwingUtilities.invokeAndWait(() -> {
+            frame = new JFrame();
+            frame.add(new JButton() {
+                @Override
+                protected void paintComponent(final Graphics g) {
+                    Graphics gg = new BufferedImage(getWidth(), getHeight(),
+                                  BufferedImage.TYPE_INT_ARGB).createGraphics();
+                    super.paintComponent(gg);
+                    gg.dispose();
+                }
+            });
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            frame.setVisible(true);
+        });
+        sleep();
+        SwingUtilities.invokeAndWait(() -> {
+            if (frame != null) {
+                frame.dispose();
+            }
+        });
+    }
+
+    private static void sleep() {
+        try {
+            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            Thread.sleep(1000);
+        } catch (final InterruptedException ignored) {
+        }
+    }
+}
diff --git a/test/javax/swing/JFileChooser/8010718/bug8010718.java b/test/javax/swing/JFileChooser/8010718/bug8010718.java
new file mode 100644
index 0000000..a841846
--- /dev/null
+++ b/test/javax/swing/JFileChooser/8010718/bug8010718.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8010718
+ * @summary [macosx] JFileChooser current filter nullified by addChoosableFileFilter
+ * @author Tomas Hurka
+ */
+import java.io.File;
+import javax.swing.*;
+import javax.swing.filechooser.FileFilter;
+
+public class bug8010718 {
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                JFileChooser fileChooser = new JFileChooser();
+                fileChooser.addChoosableFileFilter(new FileFilter() {
+                    @Override
+                    public boolean accept(File f) {
+                        return f.isDirectory() || f.getName().toLowerCase().endsWith(".xml");
+                    }
+
+                    @Override
+                    public String getDescription() {
+                        return "XML";
+                    }
+                });
+                fileChooser.addChoosableFileFilter(new FileFilter() {
+                    @Override
+                    public boolean accept(File f) {
+                        return f.isDirectory() || f.getName().toLowerCase().endsWith(".txt");
+                    }
+
+                    @Override
+                    public String getDescription() {
+                        return "TXT";
+                    }
+                });
+                if (fileChooser.getFileFilter() == null) {
+                    throw new RuntimeException("getFileFilter() should not return null");
+                }
+            }
+        });
+    }
+}
diff --git a/test/javax/swing/JMenuItem/8031573/bug8031573.html b/test/javax/swing/JMenuItem/8031573/bug8031573.html
new file mode 100644
index 0000000..b61bbf8
--- /dev/null
+++ b/test/javax/swing/JMenuItem/8031573/bug8031573.html
@@ -0,0 +1,40 @@
+<!--
+ 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.
+
+ 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.
+-->
+
+<html>
+<body>
+
+Verify that high resolution system icons are used JCheckBoxMenuItem 
+on HiDPI displays.
+
+If the display does not support HiDPI mode press PASS.
+
+1. Run the test on HiDPI Display.
+2. Press the Menu in the applet
+3. Check that the icon on the JCheckBoxMenuItem is smooth
+If so, press PASS, else press FAIL.
+
+<applet  code="bug8031573.class" width=250 height=250></applet>
+
+</body>
+</html>
diff --git a/test/javax/swing/JMenuItem/8031573/bug8031573.java b/test/javax/swing/JMenuItem/8031573/bug8031573.java
new file mode 100644
index 0000000..5cb1dc5
--- /dev/null
+++ b/test/javax/swing/JMenuItem/8031573/bug8031573.java
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+import java.awt.FlowLayout;
+import javax.swing.JApplet;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.SwingUtilities;
+
+/* @test
+ * @bug 8031573
+ * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
+ *           in high resolution on Retina
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno bug8031573.html
+ */
+public class bug8031573 extends JApplet {
+
+    @Override
+    public void init() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+
+                @Override
+                public void run() {
+                    JMenuBar bar = new JMenuBar();
+                    JMenu menu = new JMenu("Menu");
+                    JCheckBoxMenuItem checkBoxMenuItem
+                            = new JCheckBoxMenuItem("JCheckBoxMenuItem");
+                    checkBoxMenuItem.setSelected(true);
+                    menu.add(checkBoxMenuItem);
+                    bar.add(menu);
+                    setJMenuBar(bar);
+                }
+            });
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/test/javax/swing/JOptionPane/8024926/bug8024926.html b/test/javax/swing/JOptionPane/8024926/bug8024926.html
new file mode 100644
index 0000000..e63e0ea
--- /dev/null
+++ b/test/javax/swing/JOptionPane/8024926/bug8024926.html
@@ -0,0 +1,32 @@
+<!--
+ Copyright (c) 2013, 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.
+
+ 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.
+-->
+
+<html>
+    <head>
+        <title>High resolution icon test, bug ID 8024926</title>
+    </head>
+    <body>
+    <applet CODE="bug8024926.class" WIDTH=300 HEIGHT=100></applet>
+    <p> See the dialog box (usually in upper left corner) for instructions</p>
+</body>
+</html>
diff --git a/test/javax/swing/JOptionPane/8024926/bug8024926.java b/test/javax/swing/JOptionPane/8024926/bug8024926.java
new file mode 100644
index 0000000..42f976b
--- /dev/null
+++ b/test/javax/swing/JOptionPane/8024926/bug8024926.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.TextArea;
+import javax.swing.JApplet;
+import javax.swing.JOptionPane;
+import sun.awt.OSInfo;
+
+/**
+ * @test
+ * @bug 8024926
+ * @summary [macosx] AquaIcon HiDPI support
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno bug8024926.html
+ */
+public class bug8024926 extends JApplet {
+    //Declare things used in the test, like buttons and labels here
+
+    public void init() {
+        //Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout(new BorderLayout());
+
+
+        if (OSInfo.getOSType().equals(OSInfo.OSType.MACOSX)) {
+            String[] instructions = {
+                "Verify that high resolution system icons are used"
+                + " in JOptionPane on HiDPI displays.",
+                "1) Run the test on Retina display or enable the Quartz Debug"
+                + " and select the screen resolution with (HiDPI) label",
+                "2) Check that the error icon on the JOptionPane is smooth",
+                "If so, press PASS, else press FAIL."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+
+        } else {
+            String[] instructions = {
+                "This test is not applicable to the current platform. Press PASS."
+            };
+            Sysout.createDialogWithInstructions(instructions);
+        }
+
+
+    }//End  init()
+
+    public void start() {
+        //Get things going.  Request focus, set size, et cetera
+        setSize(200, 200);
+        setVisible(true);
+        validate();
+        EventQueue.invokeLater(new Runnable() {
+
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+    }// start()
+
+    //The rest of this class is the actions which perform the test...
+    //Use Sysout.println to communicate with the user NOT System.out!!
+    //Sysout.println ("Something Happened!");
+    private static void createAndShowGUI() {
+        JOptionPane.showMessageDialog(null,
+                "Icons should have high resolution.",
+                "High resolution icon test.",
+                JOptionPane.ERROR_MESSAGE);
+    }
+}// class BlockedWindowTest
+
+/* Place other classes related to the test after this line */
+/**
+ * **************************************************
+ * Standard Test Machinery DO NOT modify anything below -- it's a standard chunk
+ * of code whose purpose is to make user interaction uniform, and thereby make
+ * it simpler to read and understand someone else's test.
+ * **************************************************
+ */
+/**
+ * This is part of the standard test machinery. It creates a dialog (with the
+ * instructions), and is the interface for sending text messages to the user. To
+ * print the instructions, send an array of strings to Sysout.createDialog
+ * WithInstructions method. Put one line of instructions per array entry. To
+ * display a message for the tester to see, simply call Sysout.println with the
+ * string to be displayed. This mimics System.out.println but works within the
+ * test harness as well as standalone.
+ */
+class Sysout {
+
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+    }
+}// Sysout  class
+
+/**
+ * This is part of the standard test machinery. It provides a place for the test
+ * instructions to be displayed, and a place for interactive messages to the
+ * user to be displayed. To have the test instructions displayed, see Sysout. To
+ * have a message to the user be displayed, see Sysout. Do not call anything in
+ * this dialog directly.
+ */
+class TestDialog extends Dialog {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) {
+                        posOfSpace = maxStringLength - 1;
+                    }
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                } //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+        System.out.println(messageIn);
+    }
+}// TestDialog  class
diff --git a/test/javax/swing/JPopupMenu/6694823/bug6694823.java b/test/javax/swing/JPopupMenu/6694823/bug6694823.java
index eb2b364..045cc68 100644
--- a/test/javax/swing/JPopupMenu/6694823/bug6694823.java
+++ b/test/javax/swing/JPopupMenu/6694823/bug6694823.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -34,7 +34,7 @@
 import java.awt.*;
 import sun.awt.SunToolkit;
 import java.security.Permission;
-import sun.security.util.SecurityConstants;
+import sun.awt.AWTPermissions;
 
 public class bug6694823 {
     private static JFrame frame;
@@ -61,7 +61,8 @@
 
         System.setSecurityManager(new SecurityManager(){
 
-            private String allowsAlwaysOnTopPermission = SecurityConstants.AWT.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();
+            private String allowsAlwaysOnTopPermission =
+                AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();
 
             @Override
             public void checkPermission(Permission perm) {
diff --git a/test/javax/swing/JPopupMenu/7154841/bug7154841.java b/test/javax/swing/JPopupMenu/7154841/bug7154841.java
new file mode 100644
index 0000000..c1e6ac8
--- /dev/null
+++ b/test/javax/swing/JPopupMenu/7154841/bug7154841.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+/*
+  @test
+  @bug 7154841
+  @summary JPopupMenu is overlapped by a Dock on Mac OS X
+  @author Petr Pchelko
+ */
+
+import sun.awt.OSInfo;
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class bug7154841 {
+
+    private static final int STEP = 10;
+
+    private static volatile boolean passed = false;
+    private static JFrame frame;
+    private static JPopupMenu popupMenu;
+    private static AtomicReference<Rectangle> screenBounds = new AtomicReference<>();
+
+    private static void initAndShowUI() {
+        popupMenu = new JPopupMenu();
+        for (int i = 0; i < 100; i++) {
+            JRadioButtonMenuItem item = new JRadioButtonMenuItem(" Test " + i);
+            item.addMouseMotionListener(new MouseMotionAdapter() {
+                @Override
+                public void mouseMoved(MouseEvent e) {
+                    passed = true;
+                }
+            });
+            popupMenu.add(item);
+        }
+
+        frame = new JFrame();
+        screenBounds.set(getScreenBounds());
+        frame.setBounds(screenBounds.get());
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (OSInfo.getOSType() != OSInfo.OSType.MACOSX) {
+            return; // Test only for Mac OS X
+        }
+
+        try {
+            Robot r = new Robot();
+            r.setAutoDelay(100);
+            r.setAutoWaitForIdle(true);
+            r.mouseMove(0, 0);
+
+            SwingUtilities.invokeAndWait(bug7154841::initAndShowUI);
+
+            sleep();
+
+            SwingUtilities.invokeAndWait(() -> {
+                popupMenu.show(frame, frame.getX() + frame.getWidth() / 2, frame.getY() + frame.getHeight() / 2);
+            });
+
+            sleep();
+
+            int y = (int)screenBounds.get().getY() + (int)screenBounds.get().getHeight() - 10;
+            int center = (int)(screenBounds.get().getX() + screenBounds.get().getWidth() / 2);
+            for (int x = center - 10 * STEP; x < center + 10 * STEP; x += STEP) {
+                r.mouseMove(x, y);
+            }
+
+            if (!passed) {
+                throw new RuntimeException("Failed: no mouse events on the popup menu");
+            }
+        } finally {
+            SwingUtilities.invokeLater(() -> {
+                if (frame != null) {
+                    frame.dispose();
+                }
+            });
+        }
+    }
+
+    public static Rectangle getScreenBounds() {
+        return GraphicsEnvironment
+                .getLocalGraphicsEnvironment()
+                .getDefaultScreenDevice()
+                .getDefaultConfiguration()
+                .getBounds();
+    }
+
+    private static void sleep() {
+        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Thread.sleep(200);
+        } catch (InterruptedException ignored) { }
+    }
+}
diff --git a/test/javax/swing/JPopupMenu/7160604/bug7160604.java b/test/javax/swing/JPopupMenu/7160604/bug7160604.java
index dfbff70..cf73ba6 100644
--- a/test/javax/swing/JPopupMenu/7160604/bug7160604.java
+++ b/test/javax/swing/JPopupMenu/7160604/bug7160604.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -38,16 +38,24 @@
 import javax.swing.JPopupMenu;
 import javax.swing.JWindow;
 import javax.swing.SwingUtilities;
-import java.awt.BorderLayout;
-import java.awt.Color;
+import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import static java.awt.GraphicsDevice.WindowTranslucency.*;
 
 public class bug7160604 extends JApplet {
 
     public void init() {
         SwingUtilities.invokeLater(() -> {
+            if (!GraphicsEnvironment
+                    .getLocalGraphicsEnvironment()
+                    .getDefaultScreenDevice()
+                    .isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
+                // Tested translucency is not supported. Test passed
+                return;
+            }
+
             final JWindow window = new JWindow();
             window.setLocation(200, 200);
             window.setSize(300, 300);
diff --git a/test/javax/swing/JSpinner/8008657/bug8008657.java b/test/javax/swing/JSpinner/8008657/bug8008657.java
new file mode 100644
index 0000000..63e0773
--- /dev/null
+++ b/test/javax/swing/JSpinner/8008657/bug8008657.java
@@ -0,0 +1,155 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+import java.awt.ComponentOrientation;
+import java.awt.Toolkit;
+import java.util.Calendar;
+import java.util.Date;
+import javax.swing.JFrame;
+import javax.swing.JSpinner;
+import javax.swing.JTextField;
+import javax.swing.SpinnerDateModel;
+import javax.swing.SpinnerModel;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingUtilities;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8008657
+ * @author Alexander Scherbatiy
+ * @summary JSpinner setComponentOrientation doesn't affect on text orientation
+ * @run main bug8008657
+ */
+public class bug8008657 {
+
+    private static SunToolkit toolkit;
+    private static JSpinner spinner;
+
+    public static void main(String[] args) throws Exception {
+
+        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        SwingUtilities.invokeAndWait(() -> {
+            createDateSpinner();
+            createAndShowUI();
+        });
+
+        toolkit.realSync();
+        testSpinner(false);
+
+        SwingUtilities.invokeAndWait(() -> {
+            createNumberSpinner();
+            createAndShowUI();
+        });
+
+        toolkit.realSync();
+        testSpinner(true);
+    }
+
+    static void testSpinner(boolean checkHorizontalAligment)
+            throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+            spinner.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        });
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(() -> {
+
+            JTextField textField = getTextField();
+            if (!ComponentOrientation.RIGHT_TO_LEFT.equals(
+                    textField.getComponentOrientation())) {
+                throw new RuntimeException("Wrong orientation!");
+            }
+
+            if (checkHorizontalAligment
+                    && textField.getHorizontalAlignment() != JTextField.LEFT) {
+                throw new RuntimeException("Wrong horizontal aligment!");
+            }
+
+            spinner.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        });
+
+        toolkit.realSync();
+
+        SwingUtilities.invokeAndWait(() -> {
+            JTextField textField = getTextField();
+            if (!ComponentOrientation.LEFT_TO_RIGHT.equals(
+                    textField.getComponentOrientation())) {
+                throw new RuntimeException("Wrong orientation!");
+            }
+
+            if (checkHorizontalAligment
+                    && textField.getHorizontalAlignment() != JTextField.RIGHT) {
+                throw new RuntimeException("Wrong horizontal aligment!");
+            }
+
+            spinner.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+        });
+    }
+
+    static JTextField getTextField() {
+        return ((JSpinner.DefaultEditor) spinner.getEditor()).getTextField();
+    }
+
+    static String getOrientation(ComponentOrientation orientation) {
+        return orientation == ComponentOrientation.LEFT_TO_RIGHT ? "LEFT_TO_RIGHT" : "RIGHT_TO_LEFT";
+    }
+
+    static void createDateSpinner() {
+        Calendar calendar = Calendar.getInstance();
+        Date initDate = calendar.getTime();
+        calendar.add(Calendar.YEAR, -1);
+        Date earliestDate = calendar.getTime();
+        calendar.add(Calendar.YEAR, 1);
+        Date latestDate = calendar.getTime();
+        SpinnerModel dateModel = new SpinnerDateModel(initDate,
+                earliestDate,
+                latestDate,
+                Calendar.YEAR);
+        spinner = new JSpinner();
+        spinner.setModel(dateModel);
+    }
+
+    static void createNumberSpinner() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.add(Calendar.YEAR, -1);
+        calendar.add(Calendar.YEAR, 1);
+        int currentYear = calendar.get(Calendar.YEAR);
+        SpinnerModel yearModel = new SpinnerNumberModel(currentYear, //initial value
+                currentYear - 1, //min
+                currentYear + 2, //max
+                1);                //step
+        spinner = new JSpinner();
+        spinner.setModel(yearModel);
+    }
+
+    static void createAndShowUI() {
+        JFrame frame = new JFrame("Test");
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setSize(300, 100);
+        frame.getContentPane().add(spinner);
+        frame.setVisible(true);
+    }
+}
\ No newline at end of file
diff --git a/test/javax/swing/JTable/8031971/bug8031971.java b/test/javax/swing/JTable/8031971/bug8031971.java
new file mode 100644
index 0000000..72e5193
--- /dev/null
+++ b/test/javax/swing/JTable/8031971/bug8031971.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+import java.util.Date;
+import java.util.Hashtable;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8031971
+ * @author Alexander Scherbatiy
+ * @summary Use only public methods in the SwingLazyValue
+ * @run main bug8031971
+ */
+public class bug8031971 {
+
+    static Object[][] RENDERERS = {
+        {Object.class, "javax.swing.table.DefaultTableCellRenderer$UIResource"},
+        {Number.class, "javax.swing.JTable$NumberRenderer"},
+        {Float.class, "javax.swing.JTable$DoubleRenderer"},
+        {Double.class, "javax.swing.JTable$DoubleRenderer"},
+        {Date.class, "javax.swing.JTable$DateRenderer"},
+        {Icon.class, "javax.swing.JTable$IconRenderer"},
+        {ImageIcon.class, "javax.swing.JTable$IconRenderer"},
+        {Boolean.class, "javax.swing.JTable$BooleanRenderer"}
+    };
+
+    static Object[][] EDITORS = {
+        {Object.class, "javax.swing.JTable$GenericEditor"},
+        {Number.class, "javax.swing.JTable$NumberEditor"},
+        {Boolean.class, "javax.swing.JTable$BooleanEditor"}
+    };
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(() -> {
+
+            TestTable table = new TestTable();
+            test(table.getDefaultRenderersByColumnClass(), RENDERERS);
+            test(table.getDefaultEditorsByColumnClass(), EDITORS);
+        });
+    }
+
+    static void test(Hashtable table, Object[][] values) {
+        for (int i = 0; i < values.length; i++) {
+            test(table.get(values[i][0]), (String) values[i][1]);
+        }
+    }
+
+    static void test(Object obj, String className) {
+        if (!obj.getClass().getCanonicalName().equals(className.replace('$', '.'))) {
+            throw new RuntimeException("Wrong value!");
+        }
+    }
+
+    static class TestTable extends JTable {
+
+        Hashtable getDefaultRenderersByColumnClass() {
+            return defaultRenderersByColumnClass;
+        }
+
+        Hashtable getDefaultEditorsByColumnClass() {
+            return defaultEditorsByColumnClass;
+        }
+    }
+}
diff --git a/test/javax/swing/text/AbstractDocument/7146146/bug7146146.java b/test/javax/swing/text/AbstractDocument/7146146/bug7146146.java
deleted file mode 100644
index f4d5bc7..0000000
--- a/test/javax/swing/text/AbstractDocument/7146146/bug7146146.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- */
-
-/* @test
-   @bug 7146146
-   @summary Deadlock between subclass of AbstractDocument and UndoManager
-   @author Pavel Porvatov
-*/
-
-import javax.swing.text.BadLocationException;
-import javax.swing.text.PlainDocument;
-import javax.swing.text.StringContent;
-import javax.swing.undo.UndoManager;
-
-public class bug7146146 {
-    public static void main(String[] args) throws Exception {
-        for (int i = 0; i < 1000; i++) {
-            System.out.print("Iteration " + i);
-
-            test();
-
-            System.out.print(" passed");
-        }
-    }
-
-    private static void test() throws Exception {
-        final PlainDocument doc = new PlainDocument(new StringContent());
-        final UndoManager undoManager = new UndoManager();
-
-        doc.addUndoableEditListener(undoManager);
-        doc.insertString(0, "<Test 1>", null);
-
-        Thread t1 = new Thread("Thread 1") {
-            @Override
-            public void run() {
-                try {
-                    doc.insertString(0, "<Test 2>", null);
-                } catch (BadLocationException e) {
-                    throw new RuntimeException(e);
-                }
-            }
-        };
-
-        Thread t2 = new Thread("Thread 2") {
-            @Override
-            public void run() {
-                undoManager.undo();
-            }
-        };
-
-        t1.start();
-        t2.start();
-
-        t1.join();
-        t2.join();
-    }
-}
diff --git a/test/javax/swing/text/AbstractDocument/8030118/Test8030118.java b/test/javax/swing/text/AbstractDocument/8030118/Test8030118.java
new file mode 100644
index 0000000..02bb2a0
--- /dev/null
+++ b/test/javax/swing/text/AbstractDocument/8030118/Test8030118.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2013, 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.
+ *
+ * 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.
+ */
+
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/*
+ * @test
+ * @bug 8030118
+ * @summary Tests that AbstractDocument cannot be modified from another thread
+ * @author Sergey Malenkov
+ */
+
+public class Test8030118 implements DocumentListener, Runnable {
+    private final CountDownLatch latch = new CountDownLatch(1);
+    private final PlainDocument doc = new PlainDocument();
+
+    private Test8030118(String string) throws Exception {
+        this.doc.addDocumentListener(this);
+        this.doc.insertString(0, string, null);
+    }
+
+    @Override
+    public void run() {
+        try {
+            this.doc.remove(0, this.doc.getLength());
+        } catch (BadLocationException exception) {
+            throw new Error("unexpected", exception);
+        }
+        this.latch.countDown();
+    }
+
+    @Override
+    public void insertUpdate(DocumentEvent event) {
+        new Thread(this).start();
+        try {
+            this.latch.await(10, TimeUnit.SECONDS);
+        } catch (InterruptedException exception) {
+            throw new Error("unexpected", exception);
+        }
+        try {
+            event.getDocument().getText(event.getOffset(), event.getLength());
+        } catch (BadLocationException exception) {
+            throw new Error("concurrent modification", exception);
+        }
+    }
+
+    @Override
+    public void removeUpdate(DocumentEvent event) {
+    }
+
+    @Override
+    public void changedUpdate(DocumentEvent event) {
+    }
+
+    public static void main(String[] args) throws Exception {
+        new Test8030118("string");
+    }
+}
diff --git a/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java b/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java
new file mode 100644
index 0000000..9b713d3
--- /dev/null
+++ b/test/javax/swing/text/html/parser/Parser/8028616/bug8028616.java
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8028616
+ * @summary Tests correct parsing of the text with leading slash (/)
+ * @author Dmitry Markov
+ */
+
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import java.io.StringReader;
+
+public class bug8028616 {
+    private static final String text = "/ at start is bad";
+    private static Object lock = new Object();
+    private static boolean isCallbackInvoked = false;
+    private static Exception exception = null;
+
+    public static void main(String[] args) throws Exception {
+        ParserCB cb = new ParserCB();
+        HTMLEditorKit htmlKit = new HTMLEditorKit();
+        HTMLDocument htmlDoc = (HTMLDocument) htmlKit.createDefaultDocument();
+
+        htmlDoc.getParser().parse(new StringReader(text), cb, true);
+
+        synchronized (lock) {
+            if (!isCallbackInvoked) {
+                lock.wait(5000);
+            }
+        }
+
+        if (!isCallbackInvoked) {
+            throw new RuntimeException("Test Failed: ParserCallback.handleText() is not invoked for text - " + text);
+        }
+
+        if (exception != null) {
+            throw exception;
+        }
+    }
+
+    private static class ParserCB extends HTMLEditorKit.ParserCallback {
+        @Override
+        public void handleText(char[] data, int pos) {
+            synchronized (lock) {
+                if (!text.equals(new String(data)) || pos != 0) {
+                    exception = new RuntimeException(
+                        "Test Failed: the data passed to ParserCallback.handleText() does not meet the expectation");
+                }
+                isCallbackInvoked = true;
+                lock.notifyAll();
+            }
+        }
+    }
+}
+
diff --git a/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java b/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java
index 2ad8a0f..2ad4ba5 100644
--- a/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java
+++ b/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxy.java
@@ -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
@@ -98,6 +98,7 @@
             ServerSocketFactory ssf =
                 PostThruProxy.getServerSocketFactory(useSSL);
             ServerSocket ss = ssf.createServerSocket(serverPort);
+            ss.setSoTimeout(30000);  // 30 seconds
             serverPort = ss.getLocalPort();
             new TestServer(ss);
         } catch (Exception e) {
diff --git a/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java b/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java
index 1a505ac..4572d08 100644
--- a/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java
+++ b/test/sun/net/www/protocol/https/HttpsURLConnection/PostThruProxyWithAuth.java
@@ -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
@@ -100,6 +100,7 @@
             ServerSocketFactory ssf =
                 PostThruProxyWithAuth.getServerSocketFactory(useSSL);
             ServerSocket ss = ssf.createServerSocket(serverPort);
+            ss.setSoTimeout(30000);  // 30 seconds
             serverPort = ss.getLocalPort();
             new TestServer(ss);
         } catch (Exception e) {
diff --git a/test/sun/security/krb5/auto/BadKdc.java b/test/sun/security/krb5/auto/BadKdc.java
index 1c10ccd..d1ace1a 100644
--- a/test/sun/security/krb5/auto/BadKdc.java
+++ b/test/sun/security/krb5/auto/BadKdc.java
@@ -39,7 +39,29 @@
     //                                               ^ kdc#         ^ timeout
     static final Pattern re = Pattern.compile(
             ">>> KDCCommunication: kdc=kdc.rabbit.hole UDP:(\\d)...., " +
-            "timeout=(\\d)000,");
+            "timeout=(\\d+),");
+
+    // Ratio for timeout values of all timeout tests. Not final so that
+    // each test can choose their own.
+    static float ratio = 2f;
+
+    static void setRatio(float ratio) {
+        BadKdc.ratio = ratio;
+    }
+
+    static float getRatio() {
+        return ratio;
+    }
+
+    // Gets real timeout value. This method is called when writing krb5.conf
+    static int toReal(int from) {
+        return (int)(from * ratio + .5);
+    }
+
+    // De-ratio a millisecond value to second
+    static int toSymbolicSec(int from) {
+        return (int)(from / ratio / 1000f + 0.5);
+    }
 
     /*
      * There are several cases this test fails:
@@ -101,7 +123,7 @@
 
         fw.write("[libdefaults]\n" +
                 "default_realm = " + OneKDC.REALM + "\n" +
-                "kdc_timeout = 2000\n");
+                "kdc_timeout = " + toReal(2000) + "\n");
         fw.write("[realms]\n" + OneKDC.REALM + " = {\n" +
                 "kdc = " + OneKDC.KDCHOST + ":" + p1 + "\n" +
                 "kdc = " + OneKDC.KDCHOST + ":" + p2 + "\n" +
@@ -184,7 +206,8 @@
             Matcher m = re.matcher(line);
             if (m.find()) {
                 System.out.println(line);
-                sb.append(m.group(1)).append(m.group(2));
+                sb.append(m.group(1))
+                        .append(toSymbolicSec(Integer.parseInt(m.group(2))));
             }
         }
         if (failed) sb.append('-');
diff --git a/test/sun/security/krb5/auto/BadKdc1.java b/test/sun/security/krb5/auto/BadKdc1.java
index 7db7b8a..dd60893 100644
--- a/test/sun/security/krb5/auto/BadKdc1.java
+++ b/test/sun/security/krb5/auto/BadKdc1.java
@@ -28,14 +28,21 @@
  * @summary krb5 should not try to access unavailable kdc too often
  */
 
-import java.io.*;
 import java.security.Security;
 
 public class BadKdc1 {
 
    public static void main(String[] args)
            throws Exception {
-       Security.setProperty("krb5.kdc.bad.policy", "tryLess");
+
+       // 5 sec is default timeout for tryLess
+       if (BadKdc.getRatio() > 2.5) {
+           Security.setProperty("krb5.kdc.bad.policy",
+                   "tryLess:1," + BadKdc.toReal(2000));
+       } else {
+           Security.setProperty("krb5.kdc.bad.policy", "tryLess");
+       }
+
        BadKdc.go(
                "121212222222(32){1,2}1222(32){1,2}", // 1 2
                // The above line means try kdc1 for 2 seconds then kdc1
diff --git a/test/sun/security/krb5/auto/BadKdc2.java b/test/sun/security/krb5/auto/BadKdc2.java
index 7568784..4291d5c 100644
--- a/test/sun/security/krb5/auto/BadKdc2.java
+++ b/test/sun/security/krb5/auto/BadKdc2.java
@@ -35,7 +35,12 @@
 
     public static void main(String[] args)
             throws Exception {
-        Security.setProperty("krb5.kdc.bad.policy", "tryLess:2,1000");
+
+        // 1 sec is too short.
+        BadKdc.setRatio(3.0f);
+
+        Security.setProperty(
+                "krb5.kdc.bad.policy", "tryLess:2," + BadKdc.toReal(1000));
         BadKdc.go(
                 "121212222222(32){1,2}11112121(32){1,2}", // 1 2
                 "11112121(32){1,2}11112121(32){1,2}", // 1 2
diff --git a/test/sun/security/krb5/auto/MaxRetries.java b/test/sun/security/krb5/auto/MaxRetries.java
index 2e896bc..880c023 100644
--- a/test/sun/security/krb5/auto/MaxRetries.java
+++ b/test/sun/security/krb5/auto/MaxRetries.java
@@ -60,7 +60,7 @@
         test1(5000, 2);         // 2 2
 
         // For tryLess
-        Security.setProperty("krb5.kdc.bad.policy", "tryless");
+        Security.setProperty("krb5.kdc.bad.policy", "tryless:1," + BadKdc.toReal(5000));
         rewriteMaxRetries(4);
         test1(4000, 7);         // 1 1 1 1 2 1 2
         test1(4000, 4);         // 1 2 1 2
@@ -94,7 +94,7 @@
      * @param count the expected total try
      */
     private static void test1(int timeout, int count) throws Exception {
-        String timeoutTag = "timeout=" + timeout;
+        String timeoutTag = "timeout=" + BadKdc.toReal(timeout);
         ByteArrayOutputStream bo = new ByteArrayOutputStream();
         PrintStream oldout = System.out;
         System.setOut(new PrintStream(bo));
@@ -192,12 +192,12 @@
             if (s.startsWith("[realms]")) {
                 // Reconfig global setting
                 fw.write("max_retries = 2\n");
-                fw.write("kdc_timeout = 5000\n");
+                fw.write("kdc_timeout = " + BadKdc.toReal(5000) + "\n");
             } else if (s.trim().startsWith("kdc = ")) {
                 if (value != -1) {
                     // Reconfig for realm
                     fw.write("    max_retries = " + value + "\n");
-                    fw.write("    kdc_timeout = " + (value*1000) + "\n");
+                    fw.write("    kdc_timeout = " + BadKdc.toReal(value*1000) + "\n");
                 }
                 // Add a bad KDC as the first candidate
                 fw.write("    kdc = localhost:33333\n");
diff --git a/test/sun/security/krb5/auto/TcpTimeout.java b/test/sun/security/krb5/auto/TcpTimeout.java
index 325d5bb..45699fb 100644
--- a/test/sun/security/krb5/auto/TcpTimeout.java
+++ b/test/sun/security/krb5/auto/TcpTimeout.java
@@ -63,7 +63,7 @@
                     "udp_preference_limit = 1\n" +
                     "max_retries = 2\n" +
                     "default_realm = " + OneKDC.REALM + "\n" +
-                    "kdc_timeout = 5000\n");
+                    "kdc_timeout = " + BadKdc.toReal(5000) + "\n");
             fw.write("[realms]\n" + OneKDC.REALM + " = {\n" +
                     "kdc = " + OneKDC.KDCHOST + ":" + p1 + "\n" +
                     "kdc = " + OneKDC.KDCHOST + ":" + p2 + "\n" +
diff --git a/test/sun/security/krb5/config/ExtraLines.java b/test/sun/security/krb5/config/ExtraLines.java
new file mode 100644
index 0000000..babb0c0
--- /dev/null
+++ b/test/sun/security/krb5/config/ExtraLines.java
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+/*
+ * @test
+ * @bug 8036971
+ * @compile -XDignore.symbol.file ExtraLines.java
+ * @run main/othervm ExtraLines
+ * @summary krb5.conf does not accept directive lines before the first section
+ */
+
+import sun.security.krb5.Config;
+import java.nio.file.*;
+import java.util.Objects;
+
+public class ExtraLines {
+    public static void main(String[] args) throws Exception {
+        Path base = Paths.get("krb5.conf");
+        Path include = Paths.get("included.conf");
+        String baseConf = "include " + include.toAbsolutePath().toString()
+                + "\n[x]\na = b\n";
+        String includeConf = "[y]\nc = d\n";
+        Files.write(include, includeConf.getBytes());
+        Files.write(base, baseConf.getBytes());
+
+        System.setProperty("java.security.krb5.conf", base.toString());
+        Config.refresh();
+
+        if (!Objects.equals(Config.getInstance().get("x", "a"), "b")) {
+            throw new Exception("Failed");
+        }
+    }
+}
diff --git a/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java b/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
index 98dbdee..f7f288d 100644
--- a/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
+++ b/test/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, 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
@@ -26,10 +26,13 @@
  * @bug 6313675 6323647
  * @summary Verify that all ciphersuites work in FIPS mode
  * @library ..
- * @ignore JSSE supported cipher suites are changed with CR 6916074,
- *     need to update this test case in JDK 7 soon
- * @run main/othervm ClientJSSEServerJSSE
  * @author Andreas Sterbenz
+ * @run main/manual ClientJSSEServerJSSE
+ */
+
+/*
+ * JSSE supported cipher suites are changed with CR 6916074,
+ * need to update this test case in JDK 7 soon
  */
 
 import java.security.*;
diff --git a/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java b/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java
index d26c9f0..d50623e 100644
--- a/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java
+++ b/test/sun/security/provider/PolicyFile/GrantAllPermToExtWhenNoPolicy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 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
@@ -23,8 +23,7 @@
 
 /*
  * @test
- * @bug 4231980
- * @bug 4233913
+ * @bug 4231980 4233913
  * @summary Make sure that when no system policy and user policy files exist,
  * the built-in default policy will be used, which - amongst other things -
  * grants standard extensions the AllPermission. This regression is for 2
@@ -34,7 +33,7 @@
  *
  * @build SomeExtensionClass
  * @build GrantAllPermToExtWhenNoPolicy
- * @ignore shell GrantAllPermToExtWhenNoPolicy.sh
+ * @run shell/manual GrantAllPermToExtWhenNoPolicy.sh
  */
 
 import java.security.*;
diff --git a/test/sun/security/provider/PolicyParser/ExtDirs.java b/test/sun/security/provider/PolicyParser/ExtDirs.java
index 1704fd3..7cf0d2c 100644
--- a/test/sun/security/provider/PolicyParser/ExtDirs.java
+++ b/test/sun/security/provider/PolicyParser/ExtDirs.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 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
@@ -26,13 +26,16 @@
  * @bug 4215035
  * @summary standard extensions path is hard-coded in default
  *      system policy file
- * @ignore run this by hand
- *
- *      java    -Djava.security.manager \
- *              -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
- *              -Djava.security.policy==./ExtDirs.policy \
- *              -Djava.security.debug=parser \
- *              ExtDirs
+ * @run main/manual ExtDirs
+ */
+
+/*
+ * Run this test manually with:
+ * java    -Djava.security.manager \
+ *         -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
+ *         -Djava.security.policy==./ExtDirs.policy \
+ *         -Djava.security.debug=parser \
+ *         ExtDirs
  */
 
 public class ExtDirs {
diff --git a/test/sun/security/provider/PolicyParser/ExtDirsChange.java b/test/sun/security/provider/PolicyParser/ExtDirsChange.java
index ebe15e6..1d0198e 100644
--- a/test/sun/security/provider/PolicyParser/ExtDirsChange.java
+++ b/test/sun/security/provider/PolicyParser/ExtDirsChange.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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,19 @@
  * @bug 4993819
  * @summary standard extensions path is hard-coded in default
  *      system policy file
- * @ignore run this by hand
- *
- *      javac ExtDirChange
- *      rm ExtDirsA*.class ExtDirsB*.class
- *      java    -Djava.security.manager \
- *              -Dtest.src=. \
- *              -Djava.security.policy=ExtDirsChange.policy \
- *              -Djava.security.debug=parser \
- *              -cp ExtDirsA/a.jar:ExtDirsB/b.jar:. \
- *              ExtDirsChange
+ * @run main/manual ExtDirsChange
+ */
+
+/*
+ * Run this test manually with:
+ * javac ExtDirChange
+ * rm ExtDirsA*.class ExtDirsB*.class
+ * java    -Djava.security.manager \
+ *         -Dtest.src=. \
+ *         -Djava.security.policy=ExtDirsChange.policy \
+ *         -Djava.security.debug=parser \
+ *         -cp ExtDirsA/a.jar:ExtDirsB/b.jar:. \
+ *         ExtDirsChange
  */
 
 import java.io.File;
diff --git a/test/sun/security/provider/PolicyParser/ExtDirsDefaultPolicy.java b/test/sun/security/provider/PolicyParser/ExtDirsDefaultPolicy.java
index e86cc6d..e59a504 100644
--- a/test/sun/security/provider/PolicyParser/ExtDirsDefaultPolicy.java
+++ b/test/sun/security/provider/PolicyParser/ExtDirsDefaultPolicy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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,22 +26,25 @@
  * @bug 4993819
  * @summary standard extensions path is hard-coded in default
  *      system policy file
- * @ignore run this by hand
- *
- *      java    -Djava.security.manager \
- *              -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
- *              -Djava.security.debug=parser \
- *              ExtDirsDefaultPolicy
+ * @run main/manual ExtDirsDefaultPolicy
+ */
+
+/*
+ * Run this test manually with:
+ * java    -Djava.security.manager \
+ *         -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
+ *         -Djava.security.debug=parser \
+ *         ExtDirsDefaultPolicy
  *
  * To test other varients of the ${{java.ext.dirs}} protocol, remove
  * the grant statement for java.ext.dirs in $JAVA_HOME/lib/security/java.policy
  * and then run against the 3 different policy files.
  *
- *      java    -Djava.security.manager \
- *              -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
- *              -Djava.security.debug=parser \
- *              -Djava.security.policy=ExtDirs{1,2,3}.policy \
- *              ExtDirsDefaultPolicy
+ * java    -Djava.security.manager \
+ *         -Djava.ext.dirs=./ExtDirsA:./ExtDirsB \
+ *         -Djava.security.debug=parser \
+ *         -Djava.security.policy=ExtDirs{1,2,3}.policy \
+ *         ExtDirsDefaultPolicy
  */
 
 public class ExtDirsDefaultPolicy {
diff --git a/test/sun/security/provider/PolicyParser/PrincipalExpansionError.java b/test/sun/security/provider/PolicyParser/PrincipalExpansionError.java
index d587fed..f6a0246 100644
--- a/test/sun/security/provider/PolicyParser/PrincipalExpansionError.java
+++ b/test/sun/security/provider/PolicyParser/PrincipalExpansionError.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2002, 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
@@ -25,56 +25,54 @@
  * @test
  * @bug 4373996
  * @summary parser incorrectly ignores a principal if the principal name
- *      expands to nothing.  this test is a bit complicated.
+ *      expands to nothing.
+ * @run main/manual PrincipalExpansionError
+ */
+
+/*
+ * This test is a bit complicated.
+ * 1) PrincipalExpansionError.java
+ *         the test itself.  this test creates a Subject with a
+ *         SolarisPrincipal("TestPrincipal") and calls doAs
+ *         with a PrincipalExpansionErrorAction.
+ * 2) PrincipalExpansionErrorAction
+ *         this action tries to read the file, /testfile
+ * 3) to run the test:
+ *         a) jtreg -verbose:all -testjdk:<your_jdk>/build/sparc
+ *                 PrincipalExpansionError.java
+ *         b) PrincipalExpansionError is compiled and put into
+ *                 the "test.classes" directory
+ *         c) PrincipalExpansionErrorAction is compiled and put into
+ *                 the "test.classes"/apackage directory
+ *                 (since it belongs to the 'apackage' package
+ *         d) the PrincipalExpansionError shell script moves
+ *                 test.classes/apackage to test.src/apackage.
+ *                 this guarantees that the test will run
+ *                 with codebase test.classes, and the action
+ *                 will run with codebase test.src.
+ *         e) the test is executed.  permissions to read the file,
+ *                 /testfile, were granted to the PrincipalExpansionError.
+ *                 the policy entry for PrincipalExpansionErrorAction
+ *                 running as SolarisPrincipal("TestPrincipal")
+ *                 was also granted the file permission,
+ *                 but it has a bogus second SolarisPrincipal with
+ *                 a name that can't be property-expanded.
  *
- *      1) PrincipalExpansionError.java
- *              the test itself.  this test creates a Subject with a
- *              SolarisPrincipal("TestPrincipal") and calls doAs
- *              with a PrincipalExpansionErrorAction.
- *
- *      2) PrincipalExpansionErrorAction
- *              this action tries to read the file, /testfile
- *
- *      3) to run the test:
- *              a) jtreg -verbose:all -testjdk:<your_jdk>/build/sparc
- *                      PrincipalExpansionError.java
- *              b) PrincipalExpansionError is compiled and put into
- *                      the "test.classes" directory
- *              c) PrincipalExpansionErrorAction is compiled and put into
- *                      the "test.classes"/apackage directory
- *                      (since it belongs to the 'apackage' package
- *              d) the PrincipalExpansionError shell script moves
- *                      test.classes/apackage to test.src/apackage.
- *                      this guarantees that the test will run
- *                      with codebase test.classes, and the action
- *                      will run with codebase test.src.
- *              e) the test is executed.  permissions to read the file,
- *                      /testfile, were granted to the PrincipalExpansionError.
- *                      the policy entry for PrincipalExpansionErrorAction
- *                      running as SolarisPrincipal("TestPrincipal")
- *                      was also granted the file permission,
- *                      but it has a bogus second SolarisPrincipal with
- *                      a name that can't be property-expanded.
- *
- *                      the old behavior of the code would ignore the
- *                      bogus entry and incorrectly grants the file permission
- *                      to SolarisPrincipal("TestPrincipal").
- *                      the new behavior correctly ignores the entire
- *                      policy entry.
- *                      Please note that the jtreg needs to be granted
- *                      allpermissions for this test to succeed. If the codebase
- *                      for jtreg changes, the PrincipalExpansionError.policy
- *                      needs to be updated.
- *
- *              f) original @ tags:
- *                      compile PrincipalExpansionErrorAction.java
- *                      run shell PrincipalExpansionError.sh
- *                      run main/othervm/policy=PrincipalExpansionError.policy
- *                              -Djava.security.debug=access,domain,failure
- *                              PrincipalExpansionError
- *
- * @ignore unable to rely on location or javatest.jar
- *              (so we can grant it AllPermission)
+ *                 the old behavior of the code would ignore the
+ *                 bogus entry and incorrectly grants the file permission
+ *                 to SolarisPrincipal("TestPrincipal").
+ *                 the new behavior correctly ignores the entire
+ *                 policy entry.
+ *                 Please note that the jtreg needs to be granted
+ *                 allpermissions for this test to succeed. If the codebase
+ *                 for jtreg changes, the PrincipalExpansionError.policy
+ *                 needs to be updated.
+ *         f) original @ tags:
+ *                 compile PrincipalExpansionErrorAction.java
+ *                 run shell PrincipalExpansionError.sh
+ *                 run main/othervm/policy=PrincipalExpansionError.policy
+ *                         -Djava.security.debug=access,domain,failure
+ *                         PrincipalExpansionError
  */
 
 import javax.security.auth.*;
diff --git a/test/sun/security/provider/X509Factory/BigCRL.java b/test/sun/security/provider/X509Factory/BigCRL.java
index c6e4e07..72b6b9d 100644
--- a/test/sun/security/provider/X509Factory/BigCRL.java
+++ b/test/sun/security/provider/X509Factory/BigCRL.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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
@@ -45,7 +45,7 @@
     public static void main(String[] args) throws Exception {
         int n = 500000;
         String ks = System.getProperty("test.src", ".")
-                + "/../../ssl/etc/keystore";
+                + "/../../../../javax/net/ssl/etc/keystore";
         String pass = "passphrase";
         String alias = "dummy";
 
diff --git a/test/sun/security/provider/certpath/PKIXCertPathValidator/Validity.java b/test/sun/security/provider/certpath/PKIXCertPathValidator/Validity.java
new file mode 100644
index 0000000..056a369
--- /dev/null
+++ b/test/sun/security/provider/certpath/PKIXCertPathValidator/Validity.java
@@ -0,0 +1,134 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+
+
+/**
+ * @test
+ * @bug 8021804
+ * @summary CertPath should validate even if the validity period of the
+ *          root cert does not include the validity period of a subordinate
+ *          cert.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.security.cert.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+public class Validity {
+
+    /*
+     * Subject: OU=TestOrg, CN=TestCA
+     * Issuer: OU=TestOrg, CN=TestCA
+     * Validity
+     *     Not Before: Feb 26 21:33:55 2014 GMT
+           Not After : Feb 26 21:33:55 2024 GMT
+     * Version 1
+     */
+    static String CACertStr =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIBvTCCASYCCQCQRiTo4lBCFjANBgkqhkiG9w0BAQUFADAjMRAwDgYDVQQLDAdU\n" +
+        "ZXN0T3JnMQ8wDQYDVQQDDAZUZXN0Q0EwHhcNMTQwMjI2MjEzMzU1WhcNMjQwMjI2\n" +
+        "MjEzMzU1WjAjMRAwDgYDVQQLDAdUZXN0T3JnMQ8wDQYDVQQDDAZUZXN0Q0EwgZ8w\n" +
+        "DQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOtKS4ZrsM3ansd61ZxitcrN0w184I+A\n" +
+        "z0kyrSP1eMtlam+cC2U91NpTz11FYV4XUfBhqqxaXW043AWTUer8pS90Pt4sCrUX\n" +
+        "COx1+QA1M3ZhbZ4sTM7XQ90JbGaBJ/sEza9mlQP7hQ2yQO/hATKbP6J5qvgG2sT2\n" +
+        "S2WYjEgwNwmFAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAQ/CXEpnx2WY4LJtv4jwE\n" +
+        "4jIVirur3pdzV5oBhPyqqHMsyhQBkukCfX7uD7L5wN1+xuM81DfANpIxlnUfybp5\n" +
+        "CpjcmktLpmyK4kJ6XnSd2blbLOIpsr9x6FqxPxpVDlyw/ySHYrIG/GZdsLHgmzGn\n" +
+        "B06jeYzH8OLf879VxAxSsPc=\n" +
+        "-----END CERTIFICATE-----";
+
+    /*
+     * Subject: OU=TestOrg, CN=TestEE0
+     * Issuer: OU=TestOrg, CN=TestCA
+     * Validity
+     *     Not Before: Feb 26 22:55:12 2014 GMT
+     *     Not After : Feb 25 22:55:12 2025 GMT
+     * Version 1
+     */
+    static String EECertStr =
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIBtjCCAR8CAQQwDQYJKoZIhvcNAQEFBQAwIzEQMA4GA1UECwwHVGVzdE9yZzEP\n" +
+        "MA0GA1UEAwwGVGVzdENBMB4XDTE0MDIyNjIyNTUxMloXDTI1MDIyNTIyNTUxMlow\n" +
+        "JDEQMA4GA1UECwwHVGVzdE9yZzEQMA4GA1UEAwwHVGVzdEVFMDCBnzANBgkqhkiG\n" +
+        "9w0BAQEFAAOBjQAwgYkCgYEAt8xz9W3ruCTHjSOtTX6cxsUZ0nRP6EavEfzgcOYh\n" +
+        "CXGA0gr+viSHq3c2vQBxiRny2hm5rLcqpPo+2OxZtw/ajxfyrV6d/r8YyQLBvyl3\n" +
+        "xdCZdOkG1DCM1oFAQDaSRt9wN5Zm5kyg7uMig5Y4L45fP9Yee4x6Xyh36qYbsR89\n" +
+        "rFMCAwEAATANBgkqhkiG9w0BAQUFAAOBgQDZrPqSo08va1m9TOWOztTuWilGdjK/\n" +
+        "2Ed2WXg8utIpy6uAV+NaOYtHQ7ULQBVRNmwg9nKghbVbh+E/xpoihjl1x7OXass4\n" +
+        "TbwXA5GKFIFpNtDvATQ/QQZoCuCzw1FW/mH0Q7UEQ/9/iJdDad6ebkapeMwtj/8B\n" +
+        "s2IZV7s85CEOXw==\n" +
+        "-----END CERTIFICATE-----";
+
+    public static void main(String[] args) throws Exception {
+
+        String[] certStrs = {EECertStr};
+        String[] trustedCertStrs = {CACertStr};
+        runTest(certStrs, trustedCertStrs);
+
+        System.out.println("Test passed.");
+    }
+
+    private static void runTest(String[] certStrs,
+                                String[] trustedCertStrs)
+            throws Exception {
+
+        CertificateFactory cf = CertificateFactory.getInstance("X509");
+
+        // Generate the CertPath from the certs named in certStrs
+        ArrayList<X509Certificate> certs = new ArrayList<>();
+        for (String certStr : certStrs) {
+            certs.add(generateCert(certStr, cf));
+        }
+        CertPath cp = cf.generateCertPath(certs);
+
+        // Generate the set of Trust Anchors from the certs named in
+        // trustedCertStrs
+        Set<TrustAnchor> trustAnchors = new HashSet<>();
+        for (String trustedCertStr : trustedCertStrs) {
+            TrustAnchor ta = new TrustAnchor(generateCert(trustedCertStr, cf),
+                                             null);
+            trustAnchors.add(ta);
+        }
+        PKIXParameters params = new PKIXParameters(trustAnchors);
+        params.setDate(new Date(114, 3, 1));   // 2014-03-01
+        params.setRevocationEnabled(false);
+
+        // Attempt to validate the CertPath. If no exception thrown, successful.
+        CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
+        cpv.validate(cp, params);
+        System.out.println("CertPath validation successful.");
+    }
+
+    private static X509Certificate generateCert(String certStr,
+                                                CertificateFactory cf)
+            throws Exception {
+        ByteArrayInputStream stream
+                = new ByteArrayInputStream(certStr.getBytes());
+        return (X509Certificate) cf.generateCertificate(stream);
+
+    }
+}
diff --git a/test/sun/security/smartcardio/TestChannel.java b/test/sun/security/smartcardio/TestChannel.java
index bdb1bd5..75eb211 100644
--- a/test/sun/security/smartcardio/TestChannel.java
+++ b/test/sun/security/smartcardio/TestChannel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6239117
  * @summary test logical channels work
  * @author Andreas Sterbenz
- * @ignore requires special hardware
- * @run main/manual TestExclusive
+ * @run main/manual TestChannel
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestConnect.java b/test/sun/security/smartcardio/TestConnect.java
index a581ace..b2dcc92 100644
--- a/test/sun/security/smartcardio/TestConnect.java
+++ b/test/sun/security/smartcardio/TestConnect.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6293769 6294527 6309280
  * @summary test connect() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestConnect
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestConnectAgain.java b/test/sun/security/smartcardio/TestConnectAgain.java
index 0d087e2..8f44a97 100644
--- a/test/sun/security/smartcardio/TestConnectAgain.java
+++ b/test/sun/security/smartcardio/TestConnectAgain.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6239117
  * @summary test connect works correctly if called multiple times/card removed
  * @author Andreas Sterbenz
- * @ignore requires special hardware
- * @run main/manual TestTransmit
+ * @run main/manual TestConnectAgain
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestControl.java b/test/sun/security/smartcardio/TestControl.java
index cbd7825..05521bd 100644
--- a/test/sun/security/smartcardio/TestControl.java
+++ b/test/sun/security/smartcardio/TestControl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6239117 6470320
  * @summary test if transmitControlCommand() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestControl
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestDefault.java b/test/sun/security/smartcardio/TestDefault.java
index 4fa654f..7499476 100644
--- a/test/sun/security/smartcardio/TestDefault.java
+++ b/test/sun/security/smartcardio/TestDefault.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6327047
  * @summary verify that TerminalFactory.getDefault() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestDefault
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestExclusive.java b/test/sun/security/smartcardio/TestExclusive.java
index aa1e644..a43e03e 100644
--- a/test/sun/security/smartcardio/TestExclusive.java
+++ b/test/sun/security/smartcardio/TestExclusive.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6239117
  * @summary verify that beginExclusive()/endExclusive() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestExclusive
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestMultiplePresent.java b/test/sun/security/smartcardio/TestMultiplePresent.java
index faf5bcd..fe77971 100644
--- a/test/sun/security/smartcardio/TestMultiplePresent.java
+++ b/test/sun/security/smartcardio/TestMultiplePresent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6239117 6445367
  * @summary test that CardTerminals.waitForCard() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
- * @run main/manual TestPresent
+ * @run main/manual TestMultiplePresent
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestPresent.java b/test/sun/security/smartcardio/TestPresent.java
index 106c853..6aa3c49 100644
--- a/test/sun/security/smartcardio/TestPresent.java
+++ b/test/sun/security/smartcardio/TestPresent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6293769 6294527
  * @summary test that the isCardPresent()/waitForX() APIs work correctly
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestPresent
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/smartcardio/TestTransmit.java b/test/sun/security/smartcardio/TestTransmit.java
index 9ec6588..5d69931 100644
--- a/test/sun/security/smartcardio/TestTransmit.java
+++ b/test/sun/security/smartcardio/TestTransmit.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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,10 +26,11 @@
  * @bug 6293769 6294527
  * @summary test transmit() works
  * @author Andreas Sterbenz
- * @ignore requires special hardware
  * @run main/manual TestTransmit
  */
 
+// This test requires special hardware.
+
 import java.io.*;
 import java.util.*;
 
diff --git a/test/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.java b/test/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.java
index bdc11f0..af9ad60 100644
--- a/test/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.java
+++ b/test/sun/security/ssl/SSLSocketImpl/NotifyHandshakeTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2005, 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
@@ -88,6 +88,7 @@
          */
         SSLServerSocket sslss =
             (SSLServerSocket)sslssf.createServerSocket(serverPort);
+        sslss.setSoTimeout(30000);  // 30 seconds
         serverPort = sslss.getLocalPort();
         Server server = new Server(sslss);
         server.start();
diff --git a/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java b/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java
index 0bfd331..372269e 100644
--- a/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java
+++ b/test/sun/security/ssl/X509TrustManagerImpl/ClientServer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, 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
@@ -24,14 +24,17 @@
 /*
  * @test
  * @bug 4717766
- * @summary 1.0.3 JsseX509TrustManager erroneously calls isClientTrusted()
- * @run main/othervm ClientServer
- *
- *     SunJSSE does not support dynamic system properties, no way to re-use
- *     system properties in samevm/agentvm mode.
- * @ignore JSSE supports algorithm constraints with CR 6916074,
- *     need to update this test case in JDK 7 soon
  * @author Brad Wetmore
+ * @summary 1.0.3 JsseX509TrustManager erroneously calls isClientTrusted()
+ * @run main/manual ClientServer
+ */
+
+/*
+ * SunJSSE does not support dynamic system properties, no way to re-use
+ * system properties in samevm/agentvm mode.
+ *
+ * JSSE supports algorithm constraints with CR 6916074, need to update
+ * this test case in JDK 7 soon.
  *
  * This problem didn't exist in JSSE 1.4, only JSSE 1.0.3.  However,
  * this is a useful test, so I decided to include it in 1.4.2.
diff --git a/test/sun/security/tools/keytool/PrintSSL.java b/test/sun/security/tools/keytool/PrintSSL.java
index 600fa0c..6d43877 100644
--- a/test/sun/security/tools/keytool/PrintSSL.java
+++ b/test/sun/security/tools/keytool/PrintSSL.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 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
@@ -31,7 +31,8 @@
     public static void main(String[] args) throws Exception {
         System.setProperty("javax.net.ssl.keyStorePassword", "passphrase");
         System.setProperty("javax.net.ssl.keyStore",
-                System.getProperty("test.src", "./") + "/../../ssl/etc/keystore");
+                           System.getProperty("test.src", "./")
+                               + "/../../../../javax/net/ssl/etc/keystore");
         SSLServerSocketFactory sslssf =
                 (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
         final ServerSocket server = sslssf.createServerSocket(0);
diff --git a/test/sun/security/tools/keytool/console.sh b/test/sun/security/tools/keytool/console.sh
index 13830ff..1930332 100644
--- a/test/sun/security/tools/keytool/console.sh
+++ b/test/sun/security/tools/keytool/console.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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,8 +25,6 @@
 # @bug 6418647 8005527
 # @summary Doc bug 5035358 shows sun.security.util.Password.readPassword() is buggy.
 # @author Weijun Wang
-# @ignore unable to test manual tools that have input from stdin,
-#               and output to stderr and stdout
 # @run shell/manual console.sh
 
 if [ "$ALT_PASS" = "" ]; then
diff --git a/test/sun/security/tools/keytool/i18n.sh b/test/sun/security/tools/keytool/i18n.sh
index 8b9680a..58b14f1 100644
--- a/test/sun/security/tools/keytool/i18n.sh
+++ b/test/sun/security/tools/keytool/i18n.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2011, 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
@@ -25,9 +25,7 @@
 # @bug 4348369
 # @summary keytool not i18n compliant
 # @author charlie lai
-#
-# @ignore unable to test manual tools that have input from stdin,
-#		and output to stderr and stdout
+# @run shell/manual i18n.sh
 
 # set a few environment variables so that the shell-script can run stand-alone
 # in the source directory
diff --git a/test/sun/security/tools/keytool/printssl.sh b/test/sun/security/tools/keytool/printssl.sh
index 70b9277..5f92138 100644
--- a/test/sun/security/tools/keytool/printssl.sh
+++ b/test/sun/security/tools/keytool/printssl.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2008, 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
@@ -56,7 +56,15 @@
 esac
 
 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . ${TESTSRC}${FS}PrintSSL.java || exit 10
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=$TESTSRC PrintSSL | ( read PORT; ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT )
+${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Dtest.src=$TESTSRC PrintSSL | (
+      read PORT
+      if [ "$PORT" = "" ]; then
+          echo "Server not started"
+          exit 2
+      else
+          ${TESTJAVA}${FS}bin${FS}keytool -printcert -sslserver localhost:$PORT
+      fi
+)
 status=$?
 
 rm PrintSSL*.class
diff --git a/test/sun/util/calendar/zi/Zoneinfo.java b/test/sun/util/calendar/zi/Zoneinfo.java
index 277c045..9e48655 100644
--- a/test/sun/util/calendar/zi/Zoneinfo.java
+++ b/test/sun/util/calendar/zi/Zoneinfo.java
@@ -372,6 +372,7 @@
         ZoneRec zrec = zone.get(zone.size()-1);
         tz.getOffsetIndex(zrec.getGmtOffset());
 
+        int lastGmtOffsetValue = -1;
         int currentSave = 0;
         boolean usedZone;
         for (int zindex = 0; zindex < zone.size(); zindex++) {
@@ -380,9 +381,12 @@
             gmtOffset = zrec.getGmtOffset();
             int stdOffset = zrec.getDirectSave();
 
+            if (gmtOffset != lastGmtOffsetValue) {
+                tz.setRawOffset(gmtOffset, fromTime);
+                lastGmtOffsetValue = gmtOffset;
+            }
             // If this is the last zone record, take the last rule info.
             if (!zrec.hasUntil()) {
-                tz.setRawOffset(gmtOffset, fromTime);
                 if (zrec.hasRuleReference()) {
                     tz.setLastRules(zrec.getRuleRef().getLastRules());
                 } else if (stdOffset != 0) {
diff --git a/test/sun/util/calendar/zi/tzdata/VERSION b/test/sun/util/calendar/zi/tzdata/VERSION
index 2f162e0..8ab96a7 100644
--- a/test/sun/util/calendar/zi/tzdata/VERSION
+++ b/test/sun/util/calendar/zi/tzdata/VERSION
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2013i
+tzdata2014a
diff --git a/test/sun/util/calendar/zi/tzdata/asia b/test/sun/util/calendar/zi/tzdata/asia
index 1a8f83d..dc3c94b 100644
--- a/test/sun/util/calendar/zi/tzdata/asia
+++ b/test/sun/util/calendar/zi/tzdata/asia
@@ -1113,8 +1113,13 @@
 Rule	Zion	1986	only	-	Sep	 7	0:00	0	S
 Rule	Zion	1987	only	-	Apr	15	0:00	1:00	D
 Rule	Zion	1987	only	-	Sep	13	0:00	0	S
-Rule	Zion	1988	only	-	Apr	 9	0:00	1:00	D
-Rule	Zion	1988	only	-	Sep	 3	0:00	0	S
+
+# From Avigdor Finkelstein (2014-03-05):
+# I check the Parliament (Knesset) records and there it's stated that the
+# [1988] transition should take place on Saturday night, when the Sabbath
+# ends and changes to Sunday.
+Rule	Zion	1988	only	-	Apr	10	0:00	1:00	D
+Rule	Zion	1988	only	-	Sep	 4	0:00	0	S
 
 # From Ephraim Silverberg
 # (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
diff --git a/test/sun/util/calendar/zi/tzdata/australasia b/test/sun/util/calendar/zi/tzdata/australasia
index cd6b724..a0e8b5a 100644
--- a/test/sun/util/calendar/zi/tzdata/australasia
+++ b/test/sun/util/calendar/zi/tzdata/australasia
@@ -377,16 +377,18 @@
 # http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
 
 # From the Fijian Government Media Center (2013-08-30) via David Wheeler:
-# Fiji will start daylight savings on Sunday 27th October, 2013 and end at 3am
-# on Sunday 19th January, 2014....  move clocks forward by one hour from 2am
+# Fiji will start daylight savings on Sunday 27th October, 2013 ...
+# move clocks forward by one hour from 2am
 # http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
-#
-# From Paul Eggert (2013-09-09):
+
+# From Steffen Thorsen (2013-01-10):
+# Fiji will end DST on 2014-01-19 02:00:
+# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
+
+# From Paul Eggert (2014-01-10):
 # For now, guess that Fiji springs forward the Sunday before the fourth
-# Monday in October.  This matches both recent practice and
-# timeanddate.com's current spring-forward prediction.
-# For the January 2014 transition we guessed right while timeanddate.com
-# guessed wrong, so leave the fall-back prediction alone.
+# Monday in October, and springs back the penultimate Sunday in January.
+# This is ad hoc, but matches recent practice.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
@@ -395,7 +397,8 @@
 Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0	-
 Rule	Fiji	2010	max	-	Oct	Sun>=21	2:00	1:00	S
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
-Rule	Fiji	2012	max	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
+Rule	Fiji	2014	max	-	Jan	Sun>=18	2:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26	# Suva
 			12:00	Fiji	FJ%sT	# Fiji Time
diff --git a/test/sun/util/calendar/zi/tzdata/europe b/test/sun/util/calendar/zi/tzdata/europe
index 9f574a3..585e64d 100644
--- a/test/sun/util/calendar/zi/tzdata/europe
+++ b/test/sun/util/calendar/zi/tzdata/europe
@@ -2768,14 +2768,18 @@
 # According to the articles linked below, Turkey will change into summer
 # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
 # This change is due to a nationwide exam on 27th.
-#
-# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
 # http://www.worldbulletin.net/?aType=haber&ArticleID=70872
-# </a>
 # Turkish:
-# <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
 # http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
-# </a>
+
+# From Faruk Pasin (2014-02-14):
+# The DST for Turkey has been changed for this year because of the
+# Turkish Local election....
+# http://www.sabah.com.tr/Ekonomi/2014/02/12/yaz-saatinde-onemli-degisiklik
+# ... so Turkey will move clocks forward one hour on March 31 at 3:00 a.m.
+# From Paul Eggert (2014-02-17):
+# Here is an English-language source:
+# http://www.worldbulletin.net/turkey/129016/turkey-switches-to-daylight-saving-time-march-31
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
@@ -2844,6 +2848,8 @@
 			2:00	Turkey	EE%sT	2007
 			2:00	EU	EE%sT	2011 Mar 27 1:00u
 			2:00	-	EET	2011 Mar 28 1:00u
+			2:00	EU	EE%sT	2014 Mar 30 1:00u
+			2:00	-	EET	2014 Mar 31 1:00u
 			2:00	EU	EE%sT
 Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
 
@@ -2865,19 +2871,13 @@
 # approval from 266 deputies.
 #
 # Ukraine abolishes transter back to the winter time (in Russian)
-# <a href="http://news.mail.ru/politics/6861560/">
 # http://news.mail.ru/politics/6861560/
-# </a>
 #
 # The Ukrainians will no longer change the clock (in Russian)
-# <a href="http://www.segodnya.ua/news/14290482.html">
 # http://www.segodnya.ua/news/14290482.html
-# </a>
 #
 # Deputies cancelled the winter time (in Russian)
-# <a href="http://www.pravda.com.ua/rus/news/2011/09/20/6600616/">
 # http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
-# </a>
 #
 # From Philip Pizzey (2011-10-18):
 # Today my Ukrainian colleagues have informed me that the
@@ -2888,18 +2888,39 @@
 # As far as I understand, the recent change to the Ukrainian time zone
 # (Europe/Kiev) to introduce permanent daylight saving time (similar
 # to Russia) was reverted today:
-#
-# <a href="http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995">
 # http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995
-# </a>
 #
 # Also reported by Alexander Bokovoy (2011-10-18) who also noted:
 # The law documents themselves are at
-#
-# <a href="http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484">
 # http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
-# </a>
 
+# From Vladimir in Moscow via Alois Treindl re Kiev time 1991/2 (2014-02-28):
+# First in Ukraine they changed Time zone from UTC+3 to UTC+2 with DST:
+#       03 25 1990 02:00 -03.00 1       Time Zone 3 with DST
+#       07 01 1990 02:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 18.06.1990, No. 134.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/T001500.html
+#
+# They did not end DST in September, 1990 (according to the law,
+# "summer time" was still in action):
+#       09 30 1990 03:00 -02.00 1       Time Zone 2 with DST
+# * Ukrainian Government's Resolution of 21.09.1990, No. 272.
+# http://search.ligazakon.ua/l_doc2.nsf/link1/KP900272.html
+#
+# Again no change in March, 1991 ("summer time" in action):
+#       03 31 1991 02:00 -02.00 1       Time Zone 2 with DST
+#
+# DST ended in September 1991 ("summer time" ended):
+#       09 29 1991 03:00 -02.00 0       Time Zone 2, no DST
+# * Ukrainian Government's Resolution of 25.09.1991, No. 225.
+# http://www.uazakon.com/documents/date_21/pg_iwgdoc.htm
+# This is an answer.
+#
+# Since 1992 they had normal DST procedure:
+#       03 29 1992 02:00 -02.00 1       DST started
+#       09 27 1992 03:00 -02.00 0       DST ended
+# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
+# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Most of Ukraine since 1970 has been like Kiev.
@@ -2910,9 +2931,8 @@
 			2:00	-	EET	1930 Jun 21
 			3:00	-	MSK	1941 Sep 20
 			1:00	C-Eur	CE%sT	1943 Nov  6
-			3:00	Russia	MSK/MSD	1990
-			3:00	-	MSK	1990 Jul  1 2:00
-			2:00	-	EET	1992
+			3:00	Russia	MSK/MSD	1990 Jul  1 2:00
+			2:00	1:00	EEST	1991 Sep 29 3:00
 			2:00	E-Eur	EE%sT	1995
 			2:00	EU	EE%sT
 # Ruthenia used CET 1990/1991.
diff --git a/test/sun/util/calendar/zi/tzdata/northamerica b/test/sun/util/calendar/zi/tzdata/northamerica
index 9e551bb..dc0c2e9 100644
--- a/test/sun/util/calendar/zi/tzdata/northamerica
+++ b/test/sun/util/calendar/zi/tzdata/northamerica
@@ -414,9 +414,10 @@
 # US Pacific time, represented by Los Angeles
 #
 # California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
-# Idaho, Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties,
-# and the northern three-quarters of Idaho county),
-# most of Nevada, most of Oregon, and Washington
+# Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties, Idaho county
+# north of the Salmon River, and the towns of Burgdorf and Warren),
+# Nevada (except West Wendover), Oregon (except the northern 3/4 of
+# Malheur county), and Washington
 #
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
diff --git a/test/sun/util/calendar/zi/tzdata/southamerica b/test/sun/util/calendar/zi/tzdata/southamerica
index 071f890..02bf3bb 100644
--- a/test/sun/util/calendar/zi/tzdata/southamerica
+++ b/test/sun/util/calendar/zi/tzdata/southamerica
@@ -1298,6 +1298,13 @@
 # start date is 2013-09-08 00:00....
 # http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
 
+# From Jose Miguel Garrido (2014-02-19):
+# Today appeared in the Diario Oficial a decree amending the time change
+# dates to 2014.
+# DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC)
+# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
+# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
+
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
 
@@ -1631,6 +1638,9 @@
 # From Carlos Raul Perasso (2013-03-15):
 # The change in Paraguay is now final.  Decree number 10780
 # http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
+# From Carlos Raul Perasso (2014-02-28):
+# Decree 1264 can be found at:
+# http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf
 Rule	Para	2013	max	-	Mar	Sun>=22	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -1689,18 +1699,19 @@
 Zone America/Port_of_Spain -4:06:04 -	LMT	1912 Mar 2
 			-4:00	-	AST
 
+# These all agree with Trinidad and Tobago since 1970.
 Link America/Port_of_Spain America/Anguilla
 Link America/Port_of_Spain America/Dominica
 Link America/Port_of_Spain America/Grenada
 Link America/Port_of_Spain America/Guadeloupe
-Link America/Port_of_Spain America/Marigot
+Link America/Port_of_Spain America/Marigot	# St Martin (French part)
 Link America/Port_of_Spain America/Montserrat
 Link America/Port_of_Spain America/St_Barthelemy
-Link America/Port_of_Spain America/St_Kitts
+Link America/Port_of_Spain America/St_Kitts	# St Kitts & Nevis
 Link America/Port_of_Spain America/St_Lucia
-Link America/Port_of_Spain America/St_Thomas
+Link America/Port_of_Spain America/St_Thomas	# Virgin Islands (US)
 Link America/Port_of_Spain America/St_Vincent
-Link America/Port_of_Spain America/Tortola
+Link America/Port_of_Spain America/Tortola	# Virgin Islands (UK)
 
 # Uruguay
 # From Paul Eggert (1993-11-18):