changeset 9511:cac7b28b8b1e jdk9-b06

Merge
author lana
date Tue, 25 Mar 2014 12:32:28 -0700
parents e80cee907912 c0d305ea949f
children f4e624447514 1307dd128282
files make/src/classes/build/tools/stripproperties/StripProperties.java src/macosx/classes/sun/lwawt/macosx/event/NSEvent.java src/macosx/native/sun/awt/CWrapper.h src/share/classes/sun/swing/AbstractFilterComboBoxModel.java src/share/classes/sun/tools/serialver/serialver.properties src/share/classes/sun/tools/serialver/serialver_ja.properties src/share/classes/sun/tools/serialver/serialver_zh_CN.properties src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.h test/java/lang/ClassLoader/Assert.sh test/javax/swing/text/AbstractDocument/7146146/bug7146146.java
diffstat 460 files changed, 11890 insertions(+), 5499 deletions(-) [+]
line wrap: on
line diff
--- a/make/CompileJavaClasses.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/CompileJavaClasses.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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)
 
--- a/make/CompileLaunchers.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/CompileLaunchers.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/make/CompileNativeLibraries.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/CompileNativeLibraries.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/make/CopyIntoClasses.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/CopyIntoClasses.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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))))
--- a/make/CreateJars.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/CreateJars.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/make/Images.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/Images.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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 \
--- a/make/Import.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/Import.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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
 
--- a/make/Setup.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/Setup.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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), \
--- a/make/Tools.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/Tools.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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
 
 ##########################################################################################
--- a/make/data/tzdata/VERSION	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/data/tzdata/VERSION	Tue Mar 25 12:32:28 2014 -0700
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2013i
+tzdata2014a
--- a/make/data/tzdata/asia	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/data/tzdata/asia	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/make/data/tzdata/australasia	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/data/tzdata/australasia	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/make/data/tzdata/europe	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/data/tzdata/europe	Tue Mar 25 12:32:28 2014 -0700
@@ -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
+# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
+
+# 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
 #
-# <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>
-
+# 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.
--- a/make/data/tzdata/northamerica	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/data/tzdata/northamerica	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/make/data/tzdata/southamerica	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/data/tzdata/southamerica	Tue Mar 25 12:32:28 2014 -0700
@@ -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):
--- a/make/gensrc/GensrcProperties.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/gensrc/GensrcProperties.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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)
+################################################################################
+# 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)) \
+    #
 
-  # 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.
-
-#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)
--- a/make/lib/Awt2dLibraries.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/lib/Awt2dLibraries.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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) \
--- a/make/lib/ServiceabilityLibraries.gmk	Thu Mar 20 13:44:28 2014 -0700
+++ b/make/lib/ServiceabilityLibraries.gmk	Tue Mar 25 12:32:28 2014 -0700
@@ -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, \
--- a/make/src/classes/build/tools/stripproperties/StripProperties.java	Thu Mar 20 13:44:28 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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'
-    };
-}
--- a/src/macosx/classes/apple/laf/JRSUIUtils.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/apple/laf/JRSUIUtils.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaFileChooserUI.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
+            }
         }
     }
 
--- a/src/macosx/classes/com/apple/laf/AquaIcon.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaIcon.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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)
+            );
         }
     }
 }
--- a/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
+        }
+    }
 }
--- a/src/macosx/classes/com/apple/laf/AquaUtils.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaUtils.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
     }
--- a/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
     }
 }
--- a/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
                 }
             });
         }
--- a/src/macosx/classes/sun/lwawt/LWToolkit.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/LWToolkit.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
--- a/src/macosx/classes/sun/lwawt/macosx/CClipboard.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CClipboard.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CCustomCursor.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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) {
--- a/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
-        }
-    }
-}
--- a/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CDragSourceContextPeer.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/macosx/classes/sun/lwawt/macosx/CImage.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CImage.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
+    }
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformView.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
--- a/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
         }
     }
 
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterJobDialog.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterPageDialog.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
 }
--- a/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CPrinterSurfaceData.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
     }
--- a/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CTrayIcon.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
 
--- a/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CViewEmbeddedFrame.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
--- a/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
                 }
             }
         }
--- a/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/CWrapper.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
     }
 }
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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(".");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/macosx/classes/sun/lwawt/macosx/NSEvent.java	Tue Mar 25 12:32:28 2014 -0700
@@ -0,0 +1,261 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.lwawt.macosx;
+
+import java.awt.event.*;
+
+/**
+ * A class representing Cocoa NSEvent class with the fields only necessary for
+ * JDK functionality.
+ */
+final class NSEvent {
+    private int type;
+    private int modifierFlags;
+
+    // Mouse event information
+    private int clickCount;
+    private int buttonNumber;
+    private int x;
+    private int y;
+    private double scrollDeltaY;
+    private double scrollDeltaX;
+    private int absX;
+    private int absY;
+
+    // Key event information
+    private short keyCode;
+    private 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;
+    }
+
+    // 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;
+        this.modifierFlags = modifierFlags;
+        this.clickCount = clickCount;
+        this.buttonNumber = buttonNumber;
+        this.x = x;
+        this.y = y;
+        this.absX = absX;
+        this.absY = absY;
+        this.scrollDeltaY = scrollDeltaY;
+        this.scrollDeltaX = scrollDeltaX;
+    }
+
+    int getType() {
+        return type;
+    }
+
+    int getModifierFlags() {
+        return modifierFlags;
+    }
+
+    int getClickCount() {
+        return clickCount;
+    }
+
+    int getButtonNumber() {
+        return buttonNumber;
+    }
+
+    int getX() {
+        return x;
+    }
+
+    int getY() {
+        return y;
+    }
+
+    double getScrollDeltaY() {
+        return scrollDeltaY;
+    }
+
+    double getScrollDeltaX() {
+        return scrollDeltaX;
+    }
+
+    int getAbsX() {
+        return absX;
+    }
+
+    int getAbsY() {
+        return absY;
+    }
+
+    short getKeyCode() {
+        return keyCode;
+    }
+
+    String getCharactersIgnoringModifiers() {
+        return charactersIgnoringModifiers;
+    }
+
+    @Override
+    public String toString() {
+        return "NSEvent[" + getType() + " ," + getModifierFlags() + " ,"
+                + getClickCount() + " ," + getButtonNumber() + " ," + getX() + " ,"
+                + getY() + " ," + getAbsX() + " ," + getAbsY()+ " ," + getKeyCode() + " ,"
+                + getCharactersIgnoringModifiers() + "]";
+    }
+
+    /*
+     * Converts an NSEvent button number to a MouseEvent constant.
+     */
+    static int nsToJavaButton(int buttonNumber) {
+        int jbuttonNumber = buttonNumber + 1;
+        switch (buttonNumber) {
+            case CocoaConstants.kCGMouseButtonLeft:
+                jbuttonNumber = MouseEvent.BUTTON1;
+                break;
+            case CocoaConstants.kCGMouseButtonRight:
+                jbuttonNumber = MouseEvent.BUTTON3;
+                break;
+            case CocoaConstants.kCGMouseButtonCenter:
+                jbuttonNumber = MouseEvent.BUTTON2;
+                break;
+        }
+        return jbuttonNumber;
+    }
+
+    /*
+     * Converts NPCocoaEvent types to AWT event types.
+     */
+    static int npToJavaEventType(int npEventType) {
+        int jeventType = 0;
+        switch (npEventType) {
+            case CocoaConstants.NPCocoaEventMouseDown:
+                jeventType = MouseEvent.MOUSE_PRESSED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseUp:
+                jeventType = MouseEvent.MOUSE_RELEASED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseMoved:
+                jeventType = MouseEvent.MOUSE_MOVED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseEntered:
+                jeventType = MouseEvent.MOUSE_ENTERED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseExited:
+                jeventType = MouseEvent.MOUSE_EXITED;
+                break;
+            case CocoaConstants.NPCocoaEventMouseDragged:
+                jeventType = MouseEvent.MOUSE_DRAGGED;
+                break;
+            case CocoaConstants.NPCocoaEventKeyDown:
+                jeventType = KeyEvent.KEY_PRESSED;
+                break;
+            case CocoaConstants.NPCocoaEventKeyUp:
+                jeventType = KeyEvent.KEY_RELEASED;
+                break;
+        }
+        return jeventType;
+    }
+
+    /*
+     * Converts NSEvent types to AWT event types.
+     */
+    static int nsToJavaEventType(int nsEventType) {
+        int jeventType = 0;
+        switch (nsEventType) {
+            case CocoaConstants.NSLeftMouseDown:
+            case CocoaConstants.NSRightMouseDown:
+            case CocoaConstants.NSOtherMouseDown:
+                jeventType = MouseEvent.MOUSE_PRESSED;
+                break;
+            case CocoaConstants.NSLeftMouseUp:
+            case CocoaConstants.NSRightMouseUp:
+            case CocoaConstants.NSOtherMouseUp:
+                jeventType = MouseEvent.MOUSE_RELEASED;
+                break;
+            case CocoaConstants.NSMouseMoved:
+                jeventType = MouseEvent.MOUSE_MOVED;
+                break;
+            case CocoaConstants.NSLeftMouseDragged:
+            case CocoaConstants.NSRightMouseDragged:
+            case CocoaConstants.NSOtherMouseDragged:
+                jeventType = MouseEvent.MOUSE_DRAGGED;
+                break;
+            case CocoaConstants.NSMouseEntered:
+                jeventType = MouseEvent.MOUSE_ENTERED;
+                break;
+            case CocoaConstants.NSMouseExited:
+                jeventType = MouseEvent.MOUSE_EXITED;
+                break;
+            case CocoaConstants.NSScrollWheel:
+                jeventType = MouseEvent.MOUSE_WHEEL;
+                break;
+            case CocoaConstants.NSKeyDown:
+                jeventType = KeyEvent.KEY_PRESSED;
+                break;
+            case CocoaConstants.NSKeyUp:
+                jeventType = KeyEvent.KEY_RELEASED;
+                break;
+        }
+        return jeventType;
+    }
+
+    /*
+     * Converts NSEvent mouse modifiers to AWT mouse modifiers.
+     */
+    static native int nsToJavaMouseModifiers(int buttonNumber,
+                                                    int modifierFlags);
+
+    /*
+     * Converts NSEvent key modifiers to AWT key modifiers.
+     */
+    static native int nsToJavaKeyModifiers(int modifierFlags);
+
+    /*
+     * Converts NSEvent key info to AWT key info.
+     */
+    static native boolean nsToJavaKeyInfo(int[] in, int[] out);
+
+    /*
+     * Converts NSEvent key modifiers to AWT key info.
+     */
+    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.
+     */
+    static native char nsToJavaChar(char nsChar, int modifierFlags);
+
+    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);
+        return isRightButtonDown || (isControlDown && isLeftButtonDown);
+    }
+}
--- a/src/macosx/classes/sun/lwawt/macosx/event/NSEvent.java	Thu Mar 20 13:44:28 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- */
-
-package sun.lwawt.macosx.event;
-
-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 {
-    private int type;
-    private int modifierFlags;
-
-    // Mouse event information
-    private int clickCount;
-    private int buttonNumber;
-    private int x;
-    private int y;
-    private double scrollDeltaY;
-    private double scrollDeltaX;
-    private int absX;
-    private int absY;
-
-    // Key event information
-    private short keyCode;
-    private String charactersIgnoringModifiers;
-
-    public 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,
-                   int x, int y, int absX, int absY,
-                   double scrollDeltaY, double scrollDeltaX) {
-        this.type = type;
-        this.modifierFlags = modifierFlags;
-        this.clickCount = clickCount;
-        this.buttonNumber = buttonNumber;
-        this.x = x;
-        this.y = y;
-        this.absX = absX;
-        this.absY = absY;
-        this.scrollDeltaY = scrollDeltaY;
-        this.scrollDeltaX = scrollDeltaX;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public int getModifierFlags() {
-        return modifierFlags;
-    }
-
-    public int getClickCount() {
-        return clickCount;
-    }
-
-    public int getButtonNumber() {
-        return buttonNumber;
-    }
-
-    public int getX() {
-        return x;
-    }
-
-    public int getY() {
-        return y;
-    }
-
-    public double getScrollDeltaY() {
-        return scrollDeltaY;
-    }
-
-    public double getScrollDeltaX() {
-        return scrollDeltaX;
-    }
-
-    public int getAbsX() {
-        return absX;
-    }
-
-    public int getAbsY() {
-        return absY;
-    }
-
-    public short getKeyCode() {
-        return keyCode;
-    }
-
-    public String getCharactersIgnoringModifiers() {
-        return charactersIgnoringModifiers;
-    }
-
-    @Override
-    public String toString() {
-        return "NSEvent[" + getType() + " ," + getModifierFlags() + " ,"
-                + getClickCount() + " ," + getButtonNumber() + " ," + getX() + " ,"
-                + getY() + " ," + getAbsX() + " ," + getAbsY()+ " ," + getKeyCode() + " ,"
-                + getCharactersIgnoringModifiers() + "]";
-    }
-
-    /*
-     * Converts an NSEvent button number to a MouseEvent constant.
-     */
-    public static int nsToJavaButton(int buttonNumber) {
-        int jbuttonNumber = buttonNumber + 1;
-        switch (buttonNumber) {
-            case CocoaConstants.kCGMouseButtonLeft:
-                jbuttonNumber = MouseEvent.BUTTON1;
-                break;
-            case CocoaConstants.kCGMouseButtonRight:
-                jbuttonNumber = MouseEvent.BUTTON3;
-                break;
-            case CocoaConstants.kCGMouseButtonCenter:
-                jbuttonNumber = MouseEvent.BUTTON2;
-                break;
-        }
-        return jbuttonNumber;
-    }
-
-    /*
-     * Converts NPCocoaEvent types to AWT event types.
-     */
-    public static int npToJavaEventType(int npEventType) {
-        int jeventType = 0;
-        switch (npEventType) {
-            case CocoaConstants.NPCocoaEventMouseDown:
-                jeventType = MouseEvent.MOUSE_PRESSED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseUp:
-                jeventType = MouseEvent.MOUSE_RELEASED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseMoved:
-                jeventType = MouseEvent.MOUSE_MOVED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseEntered:
-                jeventType = MouseEvent.MOUSE_ENTERED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseExited:
-                jeventType = MouseEvent.MOUSE_EXITED;
-                break;
-            case CocoaConstants.NPCocoaEventMouseDragged:
-                jeventType = MouseEvent.MOUSE_DRAGGED;
-                break;
-            case CocoaConstants.NPCocoaEventKeyDown:
-                jeventType = KeyEvent.KEY_PRESSED;
-                break;
-            case CocoaConstants.NPCocoaEventKeyUp:
-                jeventType = KeyEvent.KEY_RELEASED;
-                break;
-        }
-        return jeventType;
-    }
-
-    /*
-     * Converts NSEvent types to AWT event types.
-     */
-    public static int nsToJavaEventType(int nsEventType) {
-        int jeventType = 0;
-        switch (nsEventType) {
-            case CocoaConstants.NSLeftMouseDown:
-            case CocoaConstants.NSRightMouseDown:
-            case CocoaConstants.NSOtherMouseDown:
-                jeventType = MouseEvent.MOUSE_PRESSED;
-                break;
-            case CocoaConstants.NSLeftMouseUp:
-            case CocoaConstants.NSRightMouseUp:
-            case CocoaConstants.NSOtherMouseUp:
-                jeventType = MouseEvent.MOUSE_RELEASED;
-                break;
-            case CocoaConstants.NSMouseMoved:
-                jeventType = MouseEvent.MOUSE_MOVED;
-                break;
-            case CocoaConstants.NSLeftMouseDragged:
-            case CocoaConstants.NSRightMouseDragged:
-            case CocoaConstants.NSOtherMouseDragged:
-                jeventType = MouseEvent.MOUSE_DRAGGED;
-                break;
-            case CocoaConstants.NSMouseEntered:
-                jeventType = MouseEvent.MOUSE_ENTERED;
-                break;
-            case CocoaConstants.NSMouseExited:
-                jeventType = MouseEvent.MOUSE_EXITED;
-                break;
-            case CocoaConstants.NSScrollWheel:
-                jeventType = MouseEvent.MOUSE_WHEEL;
-                break;
-            case CocoaConstants.NSKeyDown:
-                jeventType = KeyEvent.KEY_PRESSED;
-                break;
-            case CocoaConstants.NSKeyUp:
-                jeventType = KeyEvent.KEY_RELEASED;
-                break;
-        }
-        return jeventType;
-    }
-
-    /*
-     * Converts NSEvent mouse modifiers to AWT mouse modifiers.
-     */
-    public static native int nsToJavaMouseModifiers(int buttonNumber,
-                                                    int modifierFlags);
-
-    /*
-     * Converts NSEvent key modifiers to AWT key modifiers.
-     */
-    public static native int nsToJavaKeyModifiers(int modifierFlags);
-
-    /*
-     * Converts NSEvent key info to AWT key info.
-     */
-    public 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);
-
-    /*
-     * 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);
-
-    public 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);
-        return isRightButtonDown || (isControlDown && isLeftButtonDown);
-    }
-}
--- a/src/macosx/lib/flavormap.properties	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/lib/flavormap.properties	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/src/macosx/native/com/apple/laf/AquaFileView.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/com/apple/laf/AquaFileView.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/macosx/native/sun/awt/AWTEvent.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/AWTEvent.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
--- a/src/macosx/native/sun/awt/AWTView.h	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/AWTView.h	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
--- a/src/macosx/native/sun/awt/AWTView.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/AWTView.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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) {
--- a/src/macosx/native/sun/awt/CDataTransferer.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CDataTransferer.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/macosx/native/sun/awt/CDragSource.h	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CDragSource.h	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/src/macosx/native/sun/awt/CDragSource.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CDragSource.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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,15 +75,18 @@
 static NSDragOperation    sDragOperation;
 static NSPoint            sDraggingLocation;
 
-static CDragSource*        sCurrentDragSource;
 static BOOL                sNeedsEnter;
 
+@interface CDragSource ()
+// Updates from the destination to the source
+- (void) postDragEnter;
+- (void) postDragExit;
+// Utility
+- (NSPoint) mapNSScreenPointToJavaWithOffset:(NSPoint) point;
+@end
+
 @implementation CDragSource
 
-+ (CDragSource *) currentDragSource {
-    return sCurrentDragSource;
-}
-
 - (id)        init:(jobject)jDragSourceContextPeer
          component:(jobject)jComponent
            control:(id)control
@@ -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;
     }
 
--- a/src/macosx/native/sun/awt/CDragSourceContextPeer.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CDragSourceContextPeer.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
 
--- a/src/macosx/native/sun/awt/CDropTarget.h	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CDropTarget.h	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
--- a/src/macosx/native/sun/awt/CImage.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CImage.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
+}
--- a/src/macosx/native/sun/awt/CRobot.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CRobot.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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(
--- a/src/macosx/native/sun/awt/CTrayIcon.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CTrayIcon.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
 }
 
--- a/src/macosx/native/sun/awt/CWrapper.h	Thu Mar 20 13:44:28 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2011, 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.
- */
--- a/src/macosx/native/sun/awt/CWrapper.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/CWrapper.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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
  */
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
 }
 
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
 }
-
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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) {
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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!");
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPMetadata.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/common/StandardMetadataFormat.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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");
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageMetadata.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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");
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReader.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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'
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               readerClassName,
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               true,
               GIFStreamMetadata.nativeMetadataFormatName,
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriter.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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) {
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               writerClassName,
-              new Class[] { ImageOutputStream.class },
+              new Class<?>[] { ImageOutputStream.class },
               readerSpiNames,
               true,
               GIFWritableStreamMetadata.NATIVE_FORMAT_NAME,
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
                     }
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/DHTMarkerSegment.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/DQTMarkerSegment.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JFIFMarkerSegment.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageMetadataFormat.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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");
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadata.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
         }
     }
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGMetadataFormat.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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",
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -60,7 +60,7 @@
               suffixes,
               MIMETypes,
               readerClassName,
-              new Class[] { ImageInputStream.class },
+              new Class<?>[] { ImageInputStream.class },
               writerSpiNames,
               false,
               null, null,
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
         }
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -62,7 +62,7 @@
                 suffixes,
                 MIMETypes,
                 writerClassName,
-                new Class[] { ImageOutputStream.class },
+                new Class<?>[] { ImageOutputStream.class },
                 readerSpiNames,
                 false,
                 null, null,
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReader.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
     }
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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,
--- a/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/com/sun/imageio/stream/StreamCloser.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/imageio/stream/StreamCloser.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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.
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
+            }
         }
     }
 }
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
+            }
         }
     }
 
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
+            }
         }
     }
 
--- a/src/share/classes/com/sun/tracing/ProviderFactory.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/com/sun/tracing/ProviderFactory.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/java/awt/Component.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/Component.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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() + ']';
     }
 
     /**
--- a/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/DefaultKeyboardFocusManager.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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
--- a/src/share/classes/java/awt/EventQueue.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/EventQueue.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
         }
--- a/src/share/classes/java/awt/Label.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/Label.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
     }
 
     /**
--- a/src/share/classes/java/awt/MediaTracker.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/MediaTracker.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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 {
--- a/src/share/classes/java/awt/Robot.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/Robot.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
--- a/src/share/classes/java/awt/SystemColor.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/SystemColor.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
     }
 
     /**
--- a/src/share/classes/java/awt/Toolkit.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/Toolkit.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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);
-                                }
+                        }
+                    }
+                    try {
+                        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;
+                    } catch (final InstantiationException ignored) {
+                        throw new AWTError("Could not instantiate Toolkit: " + nm);
+                    } catch (final IllegalAccessException ignored) {
+                        throw new AWTError("Could not access Toolkit: " + nm);
                     }
-                });
-                loadAssistiveTechnologies();
-            } finally {
-                // Make sure to always re-enable the JIT.
-                java.lang.Compiler.enable();
-            }
+                    return null;
+                }
+            });
+            loadAssistiveTechnologies();
         }
         return toolkit;
     }
--- a/src/share/classes/java/awt/datatransfer/DataFlavor.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/datatransfer/DataFlavor.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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"));
--- a/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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));
--- a/src/share/classes/java/awt/dnd/DragGestureEvent.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/dnd/DragGestureEvent.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
     }
 
     /*
--- a/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/dnd/DragGestureRecognizer.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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();
     }
--- a/src/share/classes/java/awt/dnd/DragSourceContext.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/dnd/DragSourceContext.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
 }
--- a/src/share/classes/java/awt/event/InputEvent.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/awt/event/InputEvent.java	Tue Mar 25 12:32:28 2014 -0700
@@ -298,6 +298,10 @@
                 public int[] getButtonDownMasks() {
                     return InputEvent.getButtonDownMasks();
                 }
+
+                public boolean canAccessSystemClipboard(InputEvent event) {
+                    return event.canAccessSystemClipboard;
+                }
             });
     }
 
--- a/src/share/classes/java/beans/Introspector.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/beans/Introspector.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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 ((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) {
+                    ipd = igpd;
+                } else {
+                    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;
                     }
                 }
-                if (spd != null) {
-                    PropertyDescriptor tpd = mergePropertyDescriptor(ispd, spd);
-                    if (tpd instanceof IndexedPropertyDescriptor) {
-                        ispd = (IndexedPropertyDescriptor)tpd;
-                    }
+            } else if (gpd != null && spd != null) {
+                if (igpd != null) {
+                    gpd = mergePropertyWithIndexedProperty(gpd, igpd);
                 }
-                if (igpd == ispd) {
-                    pd = igpd;
-                } else {
-                    pd = mergePropertyDescriptor(igpd, ispd);
+                if (ispd != null) {
+                    spd = mergePropertyWithIndexedProperty(spd, ispd);
                 }
-            } else if (gpd != null && spd != null) {
                 // 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);
--- a/src/share/classes/java/io/SequenceInputStream.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/io/SequenceInputStream.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
+        while (in != null) {
+            int c = in.read();
+            if (c != -1) {
+                return c;
+            }
+            nextStream();
         }
-        int c = in.read();
-        if (c == -1) {
-            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;
     }
 
     /**
--- a/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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;
--- a/src/share/classes/java/math/BigInteger.java	Thu Mar 20 13:44:28 2014 -0700
+++ b/src/share/classes/java/math/BigInteger.java	Tue Mar 25 12:32:28 2014 -0700
@@ -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.
+    // 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 bitCount of this BigInteger. This is a stable variable.
      *
-     * @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;
+    private int bitCountPlusOne;
 
     /**
-     * One plus the bitLength of this BigInteger. Zeros means unitialized.
+     * 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;