Merge
authorduke
Wed, 05 Jul 2017 17:04:26 +0200 (2017-07-05)
changeset 4422 ade55a65b0f2
parent 4421 fcbbd4d49581 (current diff)
parent 4408 80dcc8ac5696 (diff)
child 4423 4061c66ba1af
Merge
jdk/make/tools/CharsetMapping/DoubleByte-X.java
jdk/make/tools/CharsetMapping/SingleByte-X.java
jdk/src/share/classes/javax/swing/plaf/synth/DefaultMenuLayout.java
jdk/src/share/classes/sun/awt/ComponentAccessor.java
jdk/src/share/classes/sun/awt/WindowAccessor.java
jdk/src/share/classes/sun/security/provider/IdentityDatabase.java
jdk/src/share/classes/sun/security/provider/SystemIdentity.java
jdk/src/share/classes/sun/security/provider/SystemSigner.java
jdk/src/share/classes/sun/security/x509/X500Signer.java
jdk/src/share/classes/sun/security/x509/X509Cert.java
jdk/src/share/classes/sun/swing/plaf/synth/SynthUI.java
jdk/src/share/classes/sun/tools/jar/JarVerifierStream.java
jdk/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java
jdk/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java
jdk/test/java/util/Formatter/Basic-X.java
jdk/test/sun/tools/native2ascii/test2
jdk/test/tools/launcher/SolarisDataModel.sh
jdk/test/tools/launcher/SolarisRunpath.sh
jdk/test/tools/launcher/libraryCaller.c
jdk/test/tools/launcher/libraryCaller.h
jdk/test/tools/launcher/libraryCaller.java
--- a/.hgignore	Wed Dec 16 23:39:39 2009 -0800
+++ b/.hgignore	Wed Jul 05 17:04:26 2017 +0200
@@ -1,3 +1,3 @@
 ^build/
 ^dist/
-^nbproject/private/
+/nbproject/private/
--- a/.hgtags-top-repo	Wed Dec 16 23:39:39 2009 -0800
+++ b/.hgtags-top-repo	Wed Jul 05 17:04:26 2017 +0200
@@ -51,3 +51,4 @@
 2c88089b6e1c053597418099a14232182c387edc jdk7-b74
 d1516b9f23954b29b8e76e6f4efc467c08c78133 jdk7-b75
 c8b63075403d53a208104a8a6ea5072c1cb66aab jdk7-b76
+1f17ca8353babb13f4908c1f87d11508232518c8 jdk7-b77
--- a/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -51,7 +51,7 @@
 
 # For start and finish echo lines
 TITLE_TEXT = Control $(PLATFORM) $(ARCH) $(RELEASE)
-DAYE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'`
+DATE_STAMP = `$(DATE) '+%y-%m-%d %H:%M'`
 START_ECHO  = echo "$(TITLE_TEXT) $@ build started: $(DATE_STAMP)"
 FINISH_ECHO = echo "$(TITLE_TEXT) $@ build finished: $(DATE_STAMP)"
 
@@ -188,7 +188,7 @@
 create_fresh_product_bootdir: FRC
 	@$(START_ECHO)
 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
-		NO_DOCS=true \
+		GENERATE_DOCS=false \
 		BOOT_CYCLE_SETTINGS= \
 		build_product_image
 	@$(FINISH_ECHO)
@@ -196,7 +196,7 @@
 create_fresh_debug_bootdir: FRC
 	@$(START_ECHO)
 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
-		NO_DOCS=true \
+		GENERATE_DOCS=false \
 		BOOT_CYCLE_DEBUG_SETTINGS= \
 		build_debug_image
 	@$(FINISH_ECHO)
@@ -204,7 +204,7 @@
 create_fresh_fastdebug_bootdir: FRC
 	@$(START_ECHO)
 	$(MAKE) ALT_OUTPUTDIR=$(ABS_BOOTDIR_OUTPUTDIR) \
-		NO_DOCS=true \
+		GENERATE_DOCS=false \
 		BOOT_CYCLE_DEBUG_SETTINGS= \
 		build_fastdebug_image
 	@$(FINISH_ECHO)
@@ -253,7 +253,7 @@
 	$(MAKE) \
 		ALT_OUTPUTDIR=$(ABS_OUTPUTDIR)-$(DEBUG_NAME) \
 	        DEBUG_NAME=$(DEBUG_NAME) \
-		NO_DOCS=true \
+		GENERATE_DOCS=false \
 	        $(BOOT_CYCLE_DEBUG_SETTINGS) \
 		generic_build_repo_series
 	@$(FINISH_ECHO)
@@ -323,7 +323,7 @@
 	$(MKDIR) -p $(OPENJDK_OUTPUTDIR)
 	($(CD) $(OPENJDK_BUILDDIR) && $(MAKE) \
 	  OPENJDK=true \
-	  NO_DOCS=true \
+	  GENERATE_DOCS=false \
 	  ALT_JDK_DEVTOOLS_DIR=$(JDK_DEVTOOLS_DIR) \
 	  ALT_OUTPUTDIR=$(OPENJDK_OUTPUTDIR) \
 	  ALT_BINARY_PLUGS_PATH=$(OPENJDK_PLUGS) \
--- a/corba/.hgignore	Wed Dec 16 23:39:39 2009 -0800
+++ b/corba/.hgignore	Wed Jul 05 17:04:26 2017 +0200
@@ -1,3 +1,3 @@
 ^build/
 ^dist/
-^nbproject/private/
+/nbproject/private/
--- a/corba/.hgtags	Wed Dec 16 23:39:39 2009 -0800
+++ b/corba/.hgtags	Wed Jul 05 17:04:26 2017 +0200
@@ -51,3 +51,4 @@
 5d0cf59a3203b9f57aceebc33ae656b884987955 jdk7-b74
 0fb137085952c8e47878e240d1cb40f14de463c4 jdk7-b75
 937144222e2219939101b0129d26a872a7956b13 jdk7-b76
+6881f0383f623394b5ec73f27a5f329ff55d0467 jdk7-b77
--- a/hotspot/.hgignore	Wed Dec 16 23:39:39 2009 -0800
+++ b/hotspot/.hgignore	Wed Jul 05 17:04:26 2017 +0200
@@ -1,6 +1,6 @@
 ^build/
 ^dist/
-^nbproject/private/
+/nbproject/private/
 ^src/share/tools/hsdis/build/
 ^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
 ^src/share/tools/IdealGraphVisualizer/build/
--- a/hotspot/.hgtags	Wed Dec 16 23:39:39 2009 -0800
+++ b/hotspot/.hgtags	Wed Jul 05 17:04:26 2017 +0200
@@ -51,3 +51,4 @@
 f4b900403d6e4b0af51447bd13bbe23fe3a1dac7 jdk7-b74
 d8dd291a362acb656026a9c0a9da48501505a1e7 jdk7-b75
 9174bb32e934965288121f75394874eeb1fcb649 jdk7-b76
+455105fc81d941482f8f8056afaa7aa0949c9300 jdk7-b77
--- a/jaxp/.hgignore	Wed Dec 16 23:39:39 2009 -0800
+++ b/jaxp/.hgignore	Wed Jul 05 17:04:26 2017 +0200
@@ -3,4 +3,4 @@
 ^drop/
 ^drop_included/
 ^webrev/
-^nbproject/private/
+/nbproject/private/
--- a/jaxp/.hgtags	Wed Dec 16 23:39:39 2009 -0800
+++ b/jaxp/.hgtags	Wed Jul 05 17:04:26 2017 +0200
@@ -51,3 +51,4 @@
 ea7b88c676dd8b269bc858a4a17c14dc96c8aed1 jdk7-b74
 555fb78ee4cebed082ca7ddabff46d2e5b4c9026 jdk7-b75
 233a4871d3364ec305efd4a58cfd676620a03a90 jdk7-b76
+bfadab8c7b1bf806a49d3e1bc19ec919717f057a jdk7-b77
--- a/jaxws/.hgignore	Wed Dec 16 23:39:39 2009 -0800
+++ b/jaxws/.hgignore	Wed Jul 05 17:04:26 2017 +0200
@@ -3,4 +3,4 @@
 ^drop/
 ^drop_included/
 ^webrev/
-^nbproject/private/
+/nbproject/private/
--- a/jaxws/.hgtags	Wed Dec 16 23:39:39 2009 -0800
+++ b/jaxws/.hgtags	Wed Jul 05 17:04:26 2017 +0200
@@ -51,3 +51,4 @@
 f4466e1b608088c90e11beaa4b600f102608c6a1 jdk7-b74
 fcf2b8b5d606641659419f247fcee4b284c45e6e jdk7-b75
 765d2077d1e652e234d27fe85ba58a986b488503 jdk7-b76
+5b4968c110476085225d3a71c4210fad2c1116c1 jdk7-b77
--- a/jdk/.hgignore	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/.hgignore	Wed Jul 05 17:04:26 2017 +0200
@@ -1,6 +1,5 @@
 ^build/
 ^dist/
-^nbproject/private/
-^make/netbeans/.*/nbproject/private/
+/nbproject/private/
 ^make/netbeans/.*/build/
 ^make/netbeans/.*/dist/
--- a/jdk/.hgtags	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/.hgtags	Wed Jul 05 17:04:26 2017 +0200
@@ -51,3 +51,4 @@
 eacb36e30327e7ae33baa068e82ddccbd91eaae2 jdk7-b74
 8885b22565077236a927e824ef450742e434a230 jdk7-b75
 8fb602395be0f7d5af4e7e93b7df2d960faf9d17 jdk7-b76
+e6a5d095c356a547cf5b3c8885885aca5e91e09b jdk7-b77
--- a/jdk/make/java/java/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/java/java/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -390,7 +390,7 @@
 LOCALES_GEN_SH = localelist.sh
 
 $(GENSRCDIR)/sun/util/CoreResourceBundleControl.java: \
-	$(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java $(LOCALES_GEN_SH)
+	$(SHARE_SRC)/classes/sun/util/CoreResourceBundleControl-XLocales.java.template $(LOCALES_GEN_SH)
 	@$(prep-target) 
 	NAWK="$(NAWK)" SED="$(SED)" $(SH) $(LOCALES_GEN_SH) "$(JRE_NONEXIST_LOCALES)" \
 		$< $@ 
--- a/jdk/make/java/java/genlocales.gmk	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/java/java/genlocales.gmk	Wed Jul 05 17:04:26 2017 +0200
@@ -68,7 +68,7 @@
 FILES_java := $(FILES_java_orig)
 FILES_compiled_properties := $(FILES_compiled_properties_orig)
 
-LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java
+LocaleDataMetaInfo_Src=$(SHARE_SRC)/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template
 LocaleDataMetaInfo_Dest=$(GENSRCDIR)/sun/util/LocaleDataMetaInfo.java
 LOCALEGEN_SH=localegen.sh
 RESOURCE_NAMES="FormatData CollationData TimeZoneNames LocaleNames CurrencyNames CalendarData"
--- a/jdk/make/java/java/localegen.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/java/java/localegen.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,7 @@
 
 #
 # This script is to generate the supported locale list string and replace the
-# LocaleDataMetaInfo-XLocales.java in <ws>/src/share/classes/sun/util
+# LocaleDataMetaInfo-XLocales.java.template in <ws>/src/share/classes/sun/util
 # 
 # SORT, NAWK & SED is passed in as environment variables.
 #
--- a/jdk/make/java/jli/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/java/jli/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -96,6 +96,7 @@
 
 
 ifneq ($(PLATFORM), windows)	# UNIX systems
+        LD_RUNPATH_EXTRAS += ..
 	LIB_LOCATION = $(LIBDIR)/$(LIBARCH)/jli
 	# Note: its important to keep this order meaning -lc is the
 	# last library otherwise it could cause compatibility issues
--- a/jdk/make/java/main/java/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/java/main/java/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -61,8 +61,5 @@
 
 ifeq ($(PLATFORM), solaris)
 LDFLAGS += -R$(OPENWIN_LIB)
-endif
-
-ifeq ($(PLATFORM), solaris)
 LDFLAGS += -M mapfile-$(ARCH)
 endif
--- a/jdk/make/java/nio/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/java/nio/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -834,7 +834,7 @@
 GENCSSRC = $(BUILDDIR)/tools/CharsetMapping
 CHARSETMAPPING_JARFILE = $(BUILDTOOLJARDIR)/charsetmapping.jar
 
-$(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java $(GENCSSRC)/sbcs
+$(FILES_gensbcs_out): $(GENCSSRC)/SingleByte-X.java.template $(GENCSSRC)/sbcs
 	@$(prep-target)
 	$(BOOT_JAVA_CMD) -jar $(CHARSETMAPPING_JARFILE) $(GENCSSRC) $(SCS_GEN) sbcs
 
--- a/jdk/make/java/redist/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/java/redist/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -194,10 +194,8 @@
 # For backwards compatability, make a link of the 32-bit client JVM to $(LIBDIR)
 IMPORT_LIST += $(LIB_LOCATION)/$(JVM_NAME)
 
-# create a link from lib/libjvm.so to client/libjvm.so
 $(LIB_LOCATION)/$(JVM_NAME): $(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_NAME)
 	@$(prep-target)
-	$(LN) -s $(CLIENT_LOCATION)/$(JVM_NAME) $@
 
 #  solaris   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ solaris
 endif # 32bit solaris
--- a/jdk/make/javax/sound/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/javax/sound/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -108,22 +108,14 @@
 endif # PLATFORM linux
 
 ifeq ($(PLATFORM), solaris)
-  ifneq ($(ARCH), amd64)
-    # build with ports and direct audio
-    CPPFLAGS += -DUSE_PORTS=TRUE 	\
-                -DUSE_DAUDIO=TRUE
+  # build with ports and direct audio
+  CPPFLAGS += -DUSE_PORTS=TRUE 	\
+              -DUSE_DAUDIO=TRUE
 
-    INCLUDE_PORTS = TRUE
-    INCLUDE_DAUDIO = TRUE
-    INCLUDE_MIDI = TRUE
-  else
-    # build with empty MIDI i/o
-    INCLUDE_MIDI = TRUE
-    # build with empty ports
-    INCLUDE_PORTS = TRUE
-    # build with empty direct audio
-    INCLUDE_DAUDIO = TRUE
-  endif
+  INCLUDE_PORTS = TRUE
+  INCLUDE_DAUDIO = TRUE
+  # build with empty MIDI i/o
+  INCLUDE_MIDI = TRUE
 endif # PLATFORM solaris
 
 # for dynamic inclusion of extra sound libs: these
--- a/jdk/make/netbeans/README	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/netbeans/README	Wed Jul 05 17:04:26 2017 +0200
@@ -411,7 +411,7 @@
             java/util/regex/,\
             java/util/spi/,\
             java/util/zip/,\
-            **/*-XLocales.java
+            **/*-XLocales.java.template
         jtreg.tests=\
             java/util/**/*Collection/ \
             java/util/**/*Map/ \
--- a/jdk/make/sun/nio/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/sun/nio/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -82,7 +82,9 @@
 		$(FILES_MAP) $(FILES_DAT) sjis0213
 
 
-$(FILES_genout_extcs): $(GENCSDATASRC)/SingleByte-X.java  $(GENCSDATASRC)/DoubleByte-X.java \
+$(FILES_genout_extcs): \
+                $(GENCSDATASRC)/SingleByte-X.java.template  \
+		$(GENCSDATASRC)/DoubleByte-X.java.template \
 		$(GENCSDATASRC)/extsbcs $(GENCSDATASRC)/dbcs
 	@$(prep-target)
 	$(RM) -r $(GENCSEXT)
--- a/jdk/make/sun/xawt/mapfile-vers	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/sun/xawt/mapfile-vers	Wed Jul 05 17:04:26 2017 +0200
@@ -126,6 +126,8 @@
         Java_sun_awt_X11_XlibWrapper_ServerVendor;
         Java_sun_awt_X11_XlibWrapper_VendorRelease;
         Java_sun_awt_X11_XlibWrapper_IsXsunKPBehavior;
+        Java_sun_awt_X11_XlibWrapper_IsSunKeyboard;
+        Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard;
         Java_sun_awt_X11_XlibWrapper_SetToolkitErrorHandler;
         Java_sun_awt_X11_XlibWrapper_XSetErrorHandler;
         Java_sun_awt_X11_XlibWrapper_CallErrorHandler;
@@ -306,6 +308,7 @@
         Java_sun_awt_X11_XlibWrapper_XkbTranslateKeyCode;
         Java_sun_awt_X11_XlibWrapper_XGetModifierMapping;
         Java_sun_awt_X11_XlibWrapper_XFreeModifiermap;
+        Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping;
         Java_sun_awt_X11_XlibWrapper_XChangeActivePointerGrab;
         Java_sun_awt_X11_XlibWrapper_XNextSecondaryLoopEvent;
         Java_sun_awt_X11_XlibWrapper_ExitSecondaryLoop;
--- a/jdk/make/tools/CharsetMapping/DoubleByte-X.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-// -- This file was mechanically generated: Do not edit! -- //
-
-package $PACKAGE$;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.util.Arrays;
-import sun.nio.cs.HistoricallyNamedCharset;
-import sun.nio.cs.ext.DoubleByte;
-
-public class $NAME_CLZ$ extends Charset
-                        $IMPLEMENTS$
-{
-    public $NAME_CLZ$() {
-        super("$NAME_CS$", $NAME_ALIASES$);
-    }
-
-    $HISTORICALNAME$
-
-    public boolean contains(Charset cs) {
-        $CONTAINS$
-    }
-
-    public CharsetDecoder newDecoder() {
-        initb2c();
-        return new  DoubleByte.Decoder$DECTYPE$(this, b2c, b2cSB, $B2MIN$, $B2MAX$);
-    }
-
-    public CharsetEncoder newEncoder() {
-        initc2b();
-        return new DoubleByte.Encoder$ENCTYPE$(this, c2b, c2bIndex);
-    }
-
-    $B2C$
-    static char[][] b2c = new char[b2cStr.length][];
-    static char[] b2cSB;
-    private static volatile boolean b2cInitialized = false;
-
-    static void initb2c() {
-        if (b2cInitialized)
-            return;
-        synchronized (b2c) {
-            if (b2cInitialized)
-                return;
-            for (int i = 0; i < b2cStr.length; i++) {
-                if (b2cStr[i] == null)
-                    b2c[i] = DoubleByte.B2C_UNMAPPABLE;
-                else
-                    b2c[i] = b2cStr[i].toCharArray();
-            }
-            b2cSB = b2cSBStr.toCharArray();
-            b2cInitialized = true;
-        }
-    }
-
-    static char[] c2b = new char[$C2BLENGTH$];
-    static char[] c2bIndex = new char[0x100];
-    private static volatile boolean c2bInitialized = false;
-
-    static void initc2b() {
-        if (c2bInitialized)
-            return;
-        synchronized (c2b) {
-            if (c2bInitialized)
-                return;
-            $NONROUNDTRIP_B2C$
-            $NONROUNDTRIP_C2B$
-            DoubleByte.Encoder.initC2B(b2cStr, b2cSBStr, b2cNR, c2bNR,
-                                       $B2MIN$, $B2MAX$,
-                                       c2b, c2bIndex);
-            c2bInitialized = true;
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/CharsetMapping/DoubleByte-X.java.template	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+// -- This file was mechanically generated: Do not edit! -- //
+
+package $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.util.Arrays;
+import sun.nio.cs.HistoricallyNamedCharset;
+import sun.nio.cs.ext.DoubleByte;
+
+public class $NAME_CLZ$ extends Charset
+                        $IMPLEMENTS$
+{
+    public $NAME_CLZ$() {
+        super("$NAME_CS$", $NAME_ALIASES$);
+    }
+
+    $HISTORICALNAME$
+
+    public boolean contains(Charset cs) {
+        $CONTAINS$
+    }
+
+    public CharsetDecoder newDecoder() {
+        initb2c();
+        return new  DoubleByte.Decoder$DECTYPE$(this, b2c, b2cSB, $B2MIN$, $B2MAX$);
+    }
+
+    public CharsetEncoder newEncoder() {
+        initc2b();
+        return new DoubleByte.Encoder$ENCTYPE$(this, c2b, c2bIndex);
+    }
+
+    $B2C$
+    static char[][] b2c = new char[b2cStr.length][];
+    static char[] b2cSB;
+    private static volatile boolean b2cInitialized = false;
+
+    static void initb2c() {
+        if (b2cInitialized)
+            return;
+        synchronized (b2c) {
+            if (b2cInitialized)
+                return;
+            for (int i = 0; i < b2cStr.length; i++) {
+                if (b2cStr[i] == null)
+                    b2c[i] = DoubleByte.B2C_UNMAPPABLE;
+                else
+                    b2c[i] = b2cStr[i].toCharArray();
+            }
+            b2cSB = b2cSBStr.toCharArray();
+            b2cInitialized = true;
+        }
+    }
+
+    static char[] c2b = new char[$C2BLENGTH$];
+    static char[] c2bIndex = new char[0x100];
+    private static volatile boolean c2bInitialized = false;
+
+    static void initc2b() {
+        if (c2bInitialized)
+            return;
+        synchronized (c2b) {
+            if (c2bInitialized)
+                return;
+            $NONROUNDTRIP_B2C$
+            $NONROUNDTRIP_C2B$
+            DoubleByte.Encoder.initC2B(b2cStr, b2cSBStr, b2cNR, c2bNR,
+                                       $B2MIN$, $B2MAX$,
+                                       c2b, c2bIndex);
+            c2bInitialized = true;
+        }
+    }
+}
--- a/jdk/make/tools/CharsetMapping/SingleByte-X.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
- * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package $PACKAGE$;
-
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import sun.nio.cs.StandardCharsets;
-import sun.nio.cs.SingleByte;
-import sun.nio.cs.HistoricallyNamedCharset;
-import static sun.nio.cs.CharsetMapping.*;
-
-public class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset
-{
-    public $NAME_CLZ$() {
-        super("$NAME_CS$", $NAME_ALIASES$);
-    }
-
-    public String historicalName() {
-        return "$NAME_HIS$";
-    }
-
-    public boolean contains(Charset cs) {
-        $CONTAINS$;
-    }
-
-    public CharsetDecoder newDecoder() {
-        return new SingleByte.Decoder(this, b2c);
-    }
-
-    public CharsetEncoder newEncoder() {
-        return new SingleByte.Encoder(this, c2b, c2bIndex);
-    }
-
-    public String getDecoderSingleByteMappings() {
-        return b2cTable;
-    }
-
-    public char[] getEncoderIndex2() {
-        return c2b;
-    }
-
-    public char[] getEncoderIndex1() {
-        return c2bIndex;
-    }
-
-    private final static String b2cTable = $B2CTABLE$
-
-    private final static char[] b2c = b2cTable.toCharArray();
-    private final static char[] c2b = new char[$C2BLENGTH$];
-    private final static char[] c2bIndex = new char[0x100];
-
-    static {
-        char[] b2cMap = b2c;
-        char[] c2bNR = null;
-        $NONROUNDTRIP_B2C$
-        $NONROUNDTRIP_C2B$
-        SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/make/tools/CharsetMapping/SingleByte-X.java.template	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package $PACKAGE$;
+
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import sun.nio.cs.StandardCharsets;
+import sun.nio.cs.SingleByte;
+import sun.nio.cs.HistoricallyNamedCharset;
+import static sun.nio.cs.CharsetMapping.*;
+
+public class $NAME_CLZ$ extends Charset implements HistoricallyNamedCharset
+{
+    public $NAME_CLZ$() {
+        super("$NAME_CS$", $NAME_ALIASES$);
+    }
+
+    public String historicalName() {
+        return "$NAME_HIS$";
+    }
+
+    public boolean contains(Charset cs) {
+        $CONTAINS$;
+    }
+
+    public CharsetDecoder newDecoder() {
+        return new SingleByte.Decoder(this, b2c);
+    }
+
+    public CharsetEncoder newEncoder() {
+        return new SingleByte.Encoder(this, c2b, c2bIndex);
+    }
+
+    public String getDecoderSingleByteMappings() {
+        return b2cTable;
+    }
+
+    public char[] getEncoderIndex2() {
+        return c2b;
+    }
+
+    public char[] getEncoderIndex1() {
+        return c2bIndex;
+    }
+
+    private final static String b2cTable = $B2CTABLE$
+
+    private final static char[] b2c = b2cTable.toCharArray();
+    private final static char[] c2b = new char[$C2BLENGTH$];
+    private final static char[] c2bIndex = new char[0x100];
+
+    static {
+        char[] b2cMap = b2c;
+        char[] c2bNR = null;
+        $NONROUNDTRIP_B2C$
+        $NONROUNDTRIP_C2B$
+        SingleByte.initC2B(b2cMap, c2bNR, c2b, c2bIndex);
+    }
+}
--- a/jdk/make/tools/src/build/tools/charsetmapping/GenerateDBCS.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/tools/src/build/tools/charsetmapping/GenerateDBCS.java	Wed Jul 05 17:04:26 2017 +0200
@@ -63,7 +63,7 @@
             int    b2Min    = toInteger(fields[8]);
             int    b2Max    = toInteger(fields[9]);
             System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
-            genClass(args[0], args[1], "DoubleByte-X.java",
+            genClass(args[0], args[1], "DoubleByte-X.java.template",
                     clzName, csName, hisName, pkgName,
                     isASCII, type,
                     b1Min, b1Max, b2Min, b2Max);
--- a/jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/make/tools/src/build/tools/charsetmapping/GenerateSBCS.java	Wed Jul 05 17:04:26 2017 +0200
@@ -55,7 +55,7 @@
             String pkgName  = fields[4];
             System.out.printf("%s,%s,%s,%b,%s%n", clzName, csName, hisName, isASCII, pkgName);
 
-            genClass(args[0], args[1], "SingleByte-X.java",
+            genClass(args[0], args[1], "SingleByte-X.java.template",
                      clzName, csName, hisName, pkgName, isASCII);
         }
     }
--- a/jdk/src/share/bin/java.c	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/bin/java.c	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1995-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,15 +41,13 @@
  * options are turned into "-foo" options to the vm.  This option
  * filtering is handled in a number of places in the launcher, some of
  * it in machine-dependent code.  In this file, the function
- * CheckJVMType removes vm style options and TranslateApplicationArgs
- * removes "-J" prefixes.  On unix platforms, the
- * CreateExecutionEnvironment function from the unix java_md.c file
- * processes and removes -d<n> options.  However, in case
- * CreateExecutionEnvironment does not need to exec because
- * LD_LIBRARY_PATH is set acceptably and the data model does not need
- * to be changed, ParseArguments will screen out the redundant -d<n>
- * options and prevent them from being passed to the vm; this is done
- * by RemovableOption.
+ * CheckJvmType removes vm style options and TranslateApplicationArgs
+ * removes "-J" prefixes.  The CreateExecutionEnvironment function processes
+ * and removes -d<n> options. On unix, there is a possibility that the running
+ * data model may not match to the desired data model, in this case an exec is
+ * required to start the desired model. If the data models match, then
+ * ParseArguments will remove the -d<n> flags. If the data models do not match
+ * the CreateExecutionEnviroment will remove the -d<n> flags.
  */
 
 
@@ -1891,11 +1889,11 @@
  * Return JNI_TRUE for an option string that has no effect but should
  * _not_ be passed on to the vm; return JNI_FALSE otherwise.  On
  * Solaris SPARC, this screening needs to be done if:
- * 1) LD_LIBRARY_PATH does _not_ need to be reset and
- * 2) -d32 or -d64 is passed to a binary with a matching data model
- *    (the exec in SetLibraryPath removes -d<n> options and points the
- *    exec to the proper binary).  When this exec is not done, these options
- *    would end up getting passed onto the vm.
+ *    -d32 or -d64 is passed to a binary with an unmatched data model
+ *    (the exec in CreateExecutionEnvironment removes -d<n> options and points the
+ *    exec to the proper binary).  In the case of when the data model and the
+ *    requested version is matched, an exec would not occur, and these options
+ *    were erroneously passed to the vm.
  */
 jboolean
 RemovableOption(char * option)
--- a/jdk/src/share/classes/com/sun/beans/WeakCache.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/beans/WeakCache.java	Wed Jul 05 17:04:26 2017 +0200
@@ -81,4 +81,11 @@
             this.map.remove(key);
         }
     }
+
+    /**
+     * Removes all of the mappings from this cache.
+     */
+    public void clear() {
+        this.map.clear();
+    }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/HmacCore.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/crypto/provider/HmacCore.java	Wed Jul 05 17:04:26 2017 +0200
@@ -36,7 +36,7 @@
 
 /**
  * This class constitutes the core of HMAC-<MD> algorithms, where
- * <MD> can be SHA1 or MD5, etc.
+ * <MD> can be SHA1 or MD5, etc. See RFC 2104 for spec.
  *
  * It also contains the implementation classes for the SHA-256,
  * SHA-384, and SHA-512 HMACs.
@@ -116,7 +116,7 @@
         }
 
         byte[] secret = key.getEncoded();
-        if (secret == null || secret.length == 0) {
+        if (secret == null) {
             throw new InvalidKeyException("Missing key data");
         }
 
--- a/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/crypto/provider/PBKDF2KeyImpl.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * 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,21 +25,19 @@
 
 package com.sun.crypto.provider;
 
-import java.io.*;
+import java.io.ObjectStreamException;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.security.KeyRep;
 import java.security.GeneralSecurityException;
-import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 import java.security.spec.InvalidKeySpecException;
 import javax.crypto.Mac;
 import javax.crypto.SecretKey;
 import javax.crypto.spec.PBEKeySpec;
-import javax.crypto.spec.SecretKeySpec;
 
 /**
  * This class represents a PBE key derived using PBKDF2 defined
@@ -123,7 +121,7 @@
         this.key = deriveKey(prf, passwdBytes, salt, iterCount, keyLength);
     }
 
-    private static byte[] deriveKey(Mac prf, byte[] password, byte[] salt,
+    private static byte[] deriveKey(final Mac prf, final byte[] password, byte[] salt,
                                     int iterCount, int keyLengthInBit) {
         int keyLength = keyLengthInBit/8;
         byte[] key = new byte[keyLength];
@@ -133,7 +131,34 @@
             int intR = keyLength - (intL - 1)*hlen; // residue
             byte[] ui = new byte[hlen];
             byte[] ti = new byte[hlen];
-            SecretKey macKey = new SecretKeySpec(password, prf.getAlgorithm());
+            // SecretKeySpec cannot be used, since password can be empty here.
+            SecretKey macKey = new SecretKey() {
+                @Override
+                public String getAlgorithm() {
+                    return prf.getAlgorithm();
+                }
+                @Override
+                public String getFormat() {
+                    return "RAW";
+                }
+                @Override
+                public byte[] getEncoded() {
+                    return password;
+                }
+                @Override
+                public int hashCode() {
+                    return Arrays.hashCode(password) * 41 +
+                            prf.getAlgorithm().toLowerCase().hashCode();
+                }
+                @Override
+                public boolean equals(Object obj) {
+                    if (this == obj) return true;
+                    if (this.getClass() != obj.getClass()) return false;
+                    SecretKey sk = (SecretKey)obj;
+                    return prf.getAlgorithm().equalsIgnoreCase(sk.getAlgorithm()) &&
+                            Arrays.equals(password, sk.getEncoded());
+                }
+            };
             prf.init(macKey);
 
             byte[] ibytes = new byte[4];
@@ -230,7 +255,7 @@
      * @throws ObjectStreamException if a new object representing
      * this PBE key could not be created
      */
-    private Object writeReplace() throws java.io.ObjectStreamException {
+    private Object writeReplace() throws ObjectStreamException {
             return new KeyRep(KeyRep.Type.SECRET, getAlgorithm(),
                               getFormat(), getEncoded());
     }
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,7 +24,6 @@
  */
 package com.sun.java.swing.plaf.gtk;
 
-import sun.swing.plaf.synth.SynthUI;
 import sun.awt.UNIXToolkit;
 
 import javax.swing.plaf.synth.*;
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,6 +26,7 @@
 package com.sun.jmx.mbeanserver;
 
 import java.lang.annotation.Annotation;
+import java.lang.ref.SoftReference;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
@@ -33,8 +34,13 @@
 import java.lang.reflect.Proxy;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Locale;
 import java.util.Map;
+import java.util.WeakHashMap;
 
 import javax.management.Descriptor;
 import javax.management.DescriptorKey;
@@ -506,11 +512,25 @@
             } else {
                 // Java Beans introspection
                 //
-                BeanInfo bi = java.beans.Introspector.getBeanInfo(complex.getClass());
-                PropertyDescriptor[] pds = bi.getPropertyDescriptors();
-                for (PropertyDescriptor pd : pds)
-                    if (pd.getName().equals(element))
-                        return pd.getReadMethod().invoke(complex);
+                Class<?> clazz = complex.getClass();
+                Method readMethod = null;
+                if (BeansHelper.isAvailable()) {
+                    Object bi = BeansHelper.getBeanInfo(clazz);
+                    Object[] pds = BeansHelper.getPropertyDescriptors(bi);
+                    for (Object pd: pds) {
+                        if (BeansHelper.getPropertyName(pd).equals(element)) {
+                            readMethod = BeansHelper.getReadMethod(pd);
+                            break;
+                        }
+                    }
+                } else {
+                    // Java Beans not available so use simple introspection
+                    // to locate method
+                    readMethod = SimpleIntrospector.getReadMethod(clazz, element);
+                }
+                if (readMethod != null)
+                    return readMethod.invoke(complex);
+
                 throw new AttributeNotFoundException(
                     "Could not find the getter method for the property " +
                     element + " using the Java Beans introspector");
@@ -524,4 +544,235 @@
                 new AttributeNotFoundException(e.getMessage()), e);
         }
     }
+
+    /**
+     * A simple introspector that uses reflection to analyze a class and
+     * identify its "getter" methods. This class is intended for use only when
+     * Java Beans is not present (which implies that there isn't explicit
+     * information about the bean available).
+     */
+    private static class SimpleIntrospector {
+        private SimpleIntrospector() { }
+
+        private static final String GET_METHOD_PREFIX = "get";
+        private static final String IS_METHOD_PREFIX = "is";
+
+        // cache to avoid repeated lookups
+        private static final Map<Class<?>,SoftReference<List<Method>>> cache =
+            Collections.synchronizedMap(
+                new WeakHashMap<Class<?>,SoftReference<List<Method>>> ());
+
+        /**
+         * Returns the list of methods cached for the given class, or {@code null}
+         * if not cached.
+         */
+        private static List<Method> getCachedMethods(Class<?> clazz) {
+            // return cached methods if possible
+            SoftReference<List<Method>> ref = cache.get(clazz);
+            if (ref != null) {
+                List<Method> cached = ref.get();
+                if (cached != null)
+                    return cached;
+            }
+            return null;
+        }
+
+        /**
+         * Returns {@code true} if the given method is a "getter" method (where
+         * "getter" method is a public method of the form getXXX or "boolean
+         * isXXX")
+         */
+        static boolean isReadMethod(Method method) {
+            // ignore static methods
+            int modifiers = method.getModifiers();
+            if (Modifier.isStatic(modifiers))
+                return false;
+
+            String name = method.getName();
+            Class<?>[] paramTypes = method.getParameterTypes();
+            int paramCount = paramTypes.length;
+
+            if (paramCount == 0 && name.length() > 2) {
+                // boolean isXXX()
+                if (name.startsWith(IS_METHOD_PREFIX))
+                    return (method.getReturnType() == boolean.class);
+                // getXXX()
+                if (name.length() > 3 && name.startsWith(GET_METHOD_PREFIX))
+                    return (method.getReturnType() != void.class);
+            }
+            return false;
+        }
+
+        /**
+         * Returns the list of "getter" methods for the given class. The list
+         * is ordered so that isXXX methods appear before getXXX methods - this
+         * is for compatability with the JavaBeans Introspector.
+         */
+        static List<Method> getReadMethods(Class<?> clazz) {
+            // return cached result if available
+            List<Method> cachedResult = getCachedMethods(clazz);
+            if (cachedResult != null)
+                return cachedResult;
+
+            // get list of public methods, filtering out methods that have
+            // been overridden to return a more specific type.
+            List<Method> methods =
+                StandardMBeanIntrospector.getInstance().getMethods(clazz);
+            methods = MBeanAnalyzer.eliminateCovariantMethods(methods);
+
+            // filter out the non-getter methods
+            List<Method> result = new LinkedList<Method>();
+            for (Method m: methods) {
+                if (isReadMethod(m)) {
+                    // favor isXXX over getXXX
+                    if (m.getName().startsWith(IS_METHOD_PREFIX)) {
+                        result.add(0, m);
+                    } else {
+                        result.add(m);
+                    }
+                }
+            }
+
+            // add result to cache
+            cache.put(clazz, new SoftReference<List<Method>>(result));
+
+            return result;
+        }
+
+        /**
+         * Returns the "getter" to read the given property from the given class or
+         * {@code null} if no method is found.
+         */
+        static Method getReadMethod(Class<?> clazz, String property) {
+            // first character in uppercase (compatability with JavaBeans)
+            property = property.substring(0, 1).toUpperCase(Locale.ENGLISH) +
+                property.substring(1);
+            String getMethod = GET_METHOD_PREFIX + property;
+            String isMethod = IS_METHOD_PREFIX + property;
+            for (Method m: getReadMethods(clazz)) {
+                String name = m.getName();
+                if (name.equals(isMethod) || name.equals(getMethod)) {
+                    return m;
+                }
+            }
+            return null;
+        }
+    }
+
+    /**
+     * A class that provides access to the JavaBeans Introspector and
+     * PropertyDescriptors without creating a static dependency on java.beans.
+     */
+    private static class BeansHelper {
+        private static final Class<?> introspectorClass =
+            getClass("java.beans.Introspector");
+        private static final Class<?> beanInfoClass =
+            (introspectorClass == null) ? null : getClass("java.beans.BeanInfo");
+        private static final Class<?> getPropertyDescriptorClass =
+            (beanInfoClass == null) ? null : getClass("java.beans.PropertyDescriptor");
+
+        private static final Method getBeanInfo =
+            getMethod(introspectorClass, "getBeanInfo", Class.class);
+        private static final Method getPropertyDescriptors =
+            getMethod(beanInfoClass, "getPropertyDescriptors");
+        private static final Method getPropertyName =
+            getMethod(getPropertyDescriptorClass, "getName");
+        private static final Method getReadMethod =
+            getMethod(getPropertyDescriptorClass, "getReadMethod");
+
+        private static Class<?> getClass(String name) {
+            try {
+                return Class.forName(name, true, null);
+            } catch (ClassNotFoundException e) {
+                return null;
+            }
+        }
+        private static Method getMethod(Class<?> clazz,
+                                        String name,
+                                        Class<?>... paramTypes)
+        {
+            if (clazz != null) {
+                try {
+                    return clazz.getMethod(name, paramTypes);
+                } catch (NoSuchMethodException e) {
+                    throw new AssertionError(e);
+                }
+            } else {
+                return null;
+            }
+        }
+
+        private BeansHelper() { }
+
+        /**
+         * Returns {@code true} if java.beans is available.
+         */
+        static boolean isAvailable() {
+            return introspectorClass != null;
+        }
+
+        /**
+         * Invokes java.beans.Introspector.getBeanInfo(Class)
+         */
+        static Object getBeanInfo(Class<?> clazz) throws Exception {
+            try {
+                return getBeanInfo.invoke(null, clazz);
+            } catch (InvocationTargetException e) {
+                Throwable cause = e.getCause();
+                if (cause instanceof Exception)
+                    throw (Exception)cause;
+                throw new AssertionError(e);
+            } catch (IllegalAccessException iae) {
+                throw new AssertionError(iae);
+            }
+        }
+
+        /**
+         * Invokes java.beans.BeanInfo.getPropertyDescriptors()
+         */
+        static Object[] getPropertyDescriptors(Object bi) {
+            try {
+                return (Object[])getPropertyDescriptors.invoke(bi);
+            } catch (InvocationTargetException e) {
+                Throwable cause = e.getCause();
+                if (cause instanceof RuntimeException)
+                    throw (RuntimeException)cause;
+                throw new AssertionError(e);
+            } catch (IllegalAccessException iae) {
+                throw new AssertionError(iae);
+            }
+        }
+
+        /**
+         * Invokes java.beans.PropertyDescriptor.getName()
+         */
+        static String getPropertyName(Object pd) {
+            try {
+                return (String)getPropertyName.invoke(pd);
+            } catch (InvocationTargetException e) {
+                Throwable cause = e.getCause();
+                if (cause instanceof RuntimeException)
+                    throw (RuntimeException)cause;
+                throw new AssertionError(e);
+            } catch (IllegalAccessException iae) {
+                throw new AssertionError(iae);
+            }
+        }
+
+        /**
+         * Invokes java.beans.PropertyDescriptor.getReadMethod()
+         */
+        static Method getReadMethod(Object pd) {
+            try {
+                return (Method)getReadMethod.invoke(pd);
+            } catch (InvocationTargetException e) {
+                Throwable cause = e.getCause();
+                if (cause instanceof RuntimeException)
+                    throw (RuntimeException)cause;
+                throw new AssertionError(e);
+            } catch (IllegalAccessException iae) {
+                throw new AssertionError(iae);
+            }
+        }
+    }
 }
--- a/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/jmx/mbeanserver/MBeanIntrospector.java	Wed Jul 05 17:04:26 2017 +0200
@@ -175,7 +175,7 @@
     /**
      * Get the methods to be analyzed to build the MBean interface.
      */
-    List<Method> getMethods(final Class<?> mbeanType) throws Exception {
+    List<Method> getMethods(final Class<?> mbeanType) {
         return Arrays.asList(mbeanType.getMethods());
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiDeviceReceiver.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package com.sun.media.sound;
+
+import javax.sound.midi.MidiDevice;
+import javax.sound.midi.Receiver;
+
+/**
+ * A Receiver with reference to it's MidiDevice object.
+ *
+ * @author Karl Helgason
+ */
+public interface MidiDeviceReceiver extends Receiver {
+
+    /** Obtains the MidiDevice object associated with this Receiver.
+     */
+    public MidiDevice getMidiDevice();
+
+}
--- a/jdk/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftAudioBuffer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -48,6 +48,30 @@
         converter = AudioFloatConverter.getConverter(format);
     }
 
+    public void swap(SoftAudioBuffer swap)
+    {
+        int bak_size = size;
+        float[] bak_buffer = buffer;
+        boolean bak_empty = empty;
+        AudioFormat bak_format = format;
+        AudioFloatConverter bak_converter = converter;
+        byte[] bak_converter_buffer = converter_buffer;
+
+        size = swap.size;
+        buffer = swap.buffer;
+        empty = swap.empty;
+        format = swap.format;
+        converter = swap.converter;
+        converter_buffer = swap.converter_buffer;
+
+        swap.size = bak_size;
+        swap.buffer = bak_buffer;
+        swap.empty = bak_empty;
+        swap.format = bak_format;
+        swap.converter = bak_converter;
+        swap.converter_buffer = bak_converter_buffer;
+    }
+
     public AudioFormat getFormat() {
         return format;
     }
--- a/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftChannel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -218,6 +218,15 @@
     }
 
     private int findFreeVoice(int x) {
+        if(x == -1)
+        {
+            // x = -1 means that there where no available voice
+            // last time we called findFreeVoice
+            // and it hasn't changed because no audio has been
+            // rendered in the meantime.
+            // Therefore we have to return -1.
+            return -1;
+        }
         for (int i = x; i < voices.length; i++)
             if (!voices[i].active)
                 return i;
@@ -328,7 +337,7 @@
     }
 
     protected void initVoice(SoftVoice voice, SoftPerformer p, int voiceID,
-            int noteNumber, int velocity, ModelConnectionBlock[] connectionBlocks,
+            int noteNumber, int velocity, int delay, ModelConnectionBlock[] connectionBlocks,
             ModelChannelMixer channelmixer, boolean releaseTriggered) {
         if (voice.active) {
             // Voice is active , we must steal the voice
@@ -363,7 +372,7 @@
         voice.objects.put("midi_cc", co_midi_cc);
         voice.objects.put("midi_rpn", co_midi_rpn);
         voice.objects.put("midi_nrpn", co_midi_nrpn);
-        voice.noteOn(noteNumber, velocity);
+        voice.noteOn(noteNumber, velocity, delay);
         voice.setMute(mute);
         voice.setSoloMute(solomute);
         if (releaseTriggered)
@@ -399,14 +408,21 @@
     }
 
     public void noteOn(int noteNumber, int velocity) {
+        noteOn(noteNumber, velocity, 0);
+    }
+
+    /* A special noteOn with delay parameter, which is used to
+     * start note within control buffers.
+     */
+    protected void noteOn(int noteNumber, int velocity, int delay) {
         noteNumber = restrict7Bit(noteNumber);
         velocity = restrict7Bit(velocity);
-        noteOn_internal(noteNumber, velocity);
+        noteOn_internal(noteNumber, velocity, delay);
         if (current_mixer != null)
             current_mixer.noteOn(noteNumber, velocity);
     }
 
-    private void noteOn_internal(int noteNumber, int velocity) {
+    private void noteOn_internal(int noteNumber, int velocity, int delay) {
 
         if (velocity == 0) {
             noteOff_internal(noteNumber, 64);
@@ -490,6 +506,7 @@
             int tunedKey = (int)(Math.round(tuning.getTuning()[noteNumber]/100.0));
             play_noteNumber = noteNumber;
             play_velocity = velocity;
+            play_delay = delay;
             play_releasetriggered = false;
             lastVelocity[noteNumber] = velocity;
             current_director.noteOn(tunedKey, velocity);
@@ -594,6 +611,7 @@
             play_noteNumber = noteNumber;
             play_velocity = lastVelocity[noteNumber];
             play_releasetriggered = true;
+            play_delay = 0;
             current_director.noteOff(tunedKey, velocity);
 
         }
@@ -604,12 +622,14 @@
     private int voiceNo = 0;
     private int play_noteNumber = 0;
     private int play_velocity = 0;
+    private int play_delay = 0;
     private boolean play_releasetriggered = false;
 
     public void play(int performerIndex, ModelConnectionBlock[] connectionBlocks) {
 
         int noteNumber = play_noteNumber;
         int velocity = play_velocity;
+        int delay = play_delay;
         boolean releasetriggered = play_releasetriggered;
 
         SoftPerformer p = current_instrument.getPerformers()[performerIndex];
@@ -633,7 +653,7 @@
         if (voiceNo == -1)
             return;
 
-        initVoice(voices[voiceNo], p, prevVoiceID, noteNumber, velocity,
+        initVoice(voices[voiceNo], p, prevVoiceID, noteNumber, velocity, delay,
                 connectionBlocks, current_mixer, releasetriggered);
     }
 
--- a/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java	Wed Jul 05 17:04:26 2017 +0200
@@ -79,7 +79,7 @@
             if (silentcounter > 60) {
                 if (!mix) {
                     bufferLout.clear();
-                    bufferRout.clear();
+                    if (bufferRout != null) bufferRout.clear();
                 }
                 return;
             }
--- a/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,6 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -46,28 +45,37 @@
  */
 public class SoftMainMixer {
 
+    // A private class thats contains a ModelChannelMixer and it's private buffers.
+    // This becomes necessary when we want to have separate delay buffers for each channel mixer.
+    private class SoftChannelMixerContainer
+    {
+        ModelChannelMixer mixer;
+        SoftAudioBuffer[] buffers;
+    }
+
     public final static int CHANNEL_LEFT = 0;
     public final static int CHANNEL_RIGHT = 1;
     public final static int CHANNEL_MONO = 2;
-    public final static int CHANNEL_EFFECT1 = 3;
-    public final static int CHANNEL_EFFECT2 = 4;
-    public final static int CHANNEL_EFFECT3 = 5;
-    public final static int CHANNEL_EFFECT4 = 6;
+    public final static int CHANNEL_DELAY_LEFT = 3;
+    public final static int CHANNEL_DELAY_RIGHT = 4;
+    public final static int CHANNEL_DELAY_MONO = 5;
+    public final static int CHANNEL_EFFECT1 = 6;
+    public final static int CHANNEL_EFFECT2 = 7;
+    public final static int CHANNEL_DELAY_EFFECT1 = 8;
+    public final static int CHANNEL_DELAY_EFFECT2 = 9;
     public final static int CHANNEL_LEFT_DRY = 10;
     public final static int CHANNEL_RIGHT_DRY = 11;
     public final static int CHANNEL_SCRATCH1 = 12;
     public final static int CHANNEL_SCRATCH2 = 13;
-    public final static int CHANNEL_CHANNELMIXER_LEFT = 14;
-    public final static int CHANNEL_CHANNELMIXER_RIGHT = 15;
-    public final static int CHANNEL_CHANNELMIXER_MONO = 16;
     protected boolean active_sensing_on = false;
     private long msec_last_activity = -1;
     private boolean pusher_silent = false;
     private int pusher_silent_count = 0;
-    private long msec_pos = 0;
+    private long sample_pos = 0;
     protected boolean readfully = true;
     private Object control_mutex;
     private SoftSynthesizer synth;
+    private float samplerate = 44100;
     private int nrofchannels = 2;
     private SoftVoice[] voicestatus = null;
     private SoftAudioBuffer[] buffers;
@@ -75,7 +83,10 @@
     private SoftAudioProcessor chorus;
     private SoftAudioProcessor agc;
     private long msec_buffer_len = 0;
+    private int buffer_len = 0;
     protected TreeMap<Long, Object> midimessages = new TreeMap<Long, Object>();
+    private int delay_midievent = 0;
+    private int max_delay_midievent = 0;
     double last_volume_left = 1.0;
     double last_volume_right = 1.0;
     private double[] co_master_balance = new double[1];
@@ -83,9 +94,9 @@
     private double[] co_master_coarse_tuning = new double[1];
     private double[] co_master_fine_tuning = new double[1];
     private AudioInputStream ais;
-    private Set<ModelChannelMixer> registeredMixers = null;
+    private Set<SoftChannelMixerContainer> registeredMixers = null;
     private Set<ModelChannelMixer> stoppedMixers = null;
-    private ModelChannelMixer[] cur_registeredMixers = null;
+    private SoftChannelMixerContainer[] cur_registeredMixers = null;
     protected SoftControl co_master = new SoftControl() {
 
         double[] balance = co_master_balance;
@@ -413,26 +424,68 @@
         Iterator<Entry<Long, Object>> iter = midimessages.entrySet().iterator();
         while (iter.hasNext()) {
             Entry<Long, Object> entry = iter.next();
-            if (entry.getKey() > (timeStamp + 100))
+            if (entry.getKey() >= (timeStamp + msec_buffer_len))
                 return;
+            long msec_delay = entry.getKey() - timeStamp;
+            delay_midievent = (int)(msec_delay * (samplerate / 1000000.0) + 0.5);
+            if(delay_midievent > max_delay_midievent)
+                delay_midievent = max_delay_midievent;
+            if(delay_midievent < 0)
+                delay_midievent = 0;
             processMessage(entry.getValue());
             iter.remove();
         }
+        delay_midievent = 0;
     }
 
     protected void processAudioBuffers() {
+
+        if(synth.weakstream != null && synth.weakstream.silent_samples != 0)
+        {
+            sample_pos += synth.weakstream.silent_samples;
+            synth.weakstream.silent_samples = 0;
+        }
+
         for (int i = 0; i < buffers.length; i++) {
-            buffers[i].clear();
+            if(i != CHANNEL_DELAY_LEFT &&
+                    i != CHANNEL_DELAY_RIGHT &&
+                    i != CHANNEL_DELAY_MONO &&
+                    i != CHANNEL_DELAY_EFFECT1 &&
+                    i != CHANNEL_DELAY_EFFECT2)
+                buffers[i].clear();
+        }
+
+        if(!buffers[CHANNEL_DELAY_LEFT].isSilent())
+        {
+            buffers[CHANNEL_LEFT].swap(buffers[CHANNEL_DELAY_LEFT]);
+        }
+        if(!buffers[CHANNEL_DELAY_RIGHT].isSilent())
+        {
+            buffers[CHANNEL_RIGHT].swap(buffers[CHANNEL_DELAY_RIGHT]);
+        }
+        if(!buffers[CHANNEL_DELAY_MONO].isSilent())
+        {
+            buffers[CHANNEL_MONO].swap(buffers[CHANNEL_DELAY_MONO]);
+        }
+        if(!buffers[CHANNEL_DELAY_EFFECT1].isSilent())
+        {
+            buffers[CHANNEL_EFFECT1].swap(buffers[CHANNEL_DELAY_EFFECT1]);
+        }
+        if(!buffers[CHANNEL_DELAY_EFFECT2].isSilent())
+        {
+            buffers[CHANNEL_EFFECT2].swap(buffers[CHANNEL_DELAY_EFFECT2]);
         }
 
         double volume_left;
         double volume_right;
 
-        ModelChannelMixer[] act_registeredMixers;
+        SoftChannelMixerContainer[] act_registeredMixers;
 
         // perform control logic
         synchronized (control_mutex) {
 
+            long msec_pos = (long)(sample_pos * (1000000.0 / samplerate));
+
             processMessages(msec_pos);
 
             if (active_sensing_on) {
@@ -450,7 +503,7 @@
             for (int i = 0; i < voicestatus.length; i++)
                 if (voicestatus[i].active)
                     voicestatus[i].processControlLogic();
-            msec_pos += msec_buffer_len;
+            sample_pos += buffer_len;
 
             double volume = co_master_volume[0];
             volume_left = volume;
@@ -469,7 +522,7 @@
             if (cur_registeredMixers == null) {
                 if (registeredMixers != null) {
                     cur_registeredMixers =
-                            new ModelChannelMixer[registeredMixers.size()];
+                            new SoftChannelMixerContainer[registeredMixers.size()];
                     registeredMixers.toArray(cur_registeredMixers);
                 }
             }
@@ -483,44 +536,61 @@
 
         if (act_registeredMixers != null) {
 
-            // Reroute default left,right output
-            // to channelmixer left,right input/output
+            // Make backup of left,right,mono channels
             SoftAudioBuffer leftbak = buffers[CHANNEL_LEFT];
             SoftAudioBuffer rightbak = buffers[CHANNEL_RIGHT];
             SoftAudioBuffer monobak = buffers[CHANNEL_MONO];
-            buffers[CHANNEL_LEFT] = buffers[CHANNEL_CHANNELMIXER_LEFT];
-            buffers[CHANNEL_RIGHT] = buffers[CHANNEL_CHANNELMIXER_RIGHT];
-            buffers[CHANNEL_MONO] = buffers[CHANNEL_CHANNELMIXER_MONO];
+            SoftAudioBuffer delayleftbak = buffers[CHANNEL_DELAY_LEFT];
+            SoftAudioBuffer delayrightbak = buffers[CHANNEL_DELAY_RIGHT];
+            SoftAudioBuffer delaymonobak = buffers[CHANNEL_DELAY_MONO];
 
             int bufferlen = buffers[CHANNEL_LEFT].getSize();
 
             float[][] cbuffer = new float[nrofchannels][];
-            cbuffer[0] = buffers[CHANNEL_LEFT].array();
-            if (nrofchannels != 1)
-                cbuffer[1] = buffers[CHANNEL_RIGHT].array();
-
             float[][] obuffer = new float[nrofchannels][];
             obuffer[0] = leftbak.array();
             if (nrofchannels != 1)
                 obuffer[1] = rightbak.array();
 
-            for (ModelChannelMixer cmixer : act_registeredMixers) {
-                for (int i = 0; i < cbuffer.length; i++)
-                    Arrays.fill(cbuffer[i], 0);
+            for (SoftChannelMixerContainer cmixer : act_registeredMixers) {
+
+                // Reroute default left,right output
+                // to channelmixer left,right input/output
+                buffers[CHANNEL_LEFT] =  cmixer.buffers[CHANNEL_LEFT];
+                buffers[CHANNEL_RIGHT] = cmixer.buffers[CHANNEL_RIGHT];
+                buffers[CHANNEL_MONO] = cmixer.buffers[CHANNEL_MONO];
+                buffers[CHANNEL_DELAY_LEFT] = cmixer.buffers[CHANNEL_DELAY_LEFT];
+                buffers[CHANNEL_DELAY_RIGHT] = cmixer.buffers[CHANNEL_DELAY_RIGHT];
+                buffers[CHANNEL_DELAY_MONO] = cmixer.buffers[CHANNEL_DELAY_MONO];
+
+                buffers[CHANNEL_LEFT].clear();
+                buffers[CHANNEL_RIGHT].clear();
                 buffers[CHANNEL_MONO].clear();
+
+                if(!buffers[CHANNEL_DELAY_LEFT].isSilent())
+                {
+                    buffers[CHANNEL_LEFT].swap(buffers[CHANNEL_DELAY_LEFT]);
+                }
+                if(!buffers[CHANNEL_DELAY_RIGHT].isSilent())
+                {
+                    buffers[CHANNEL_RIGHT].swap(buffers[CHANNEL_DELAY_RIGHT]);
+                }
+                if(!buffers[CHANNEL_DELAY_MONO].isSilent())
+                {
+                    buffers[CHANNEL_MONO].swap(buffers[CHANNEL_DELAY_MONO]);
+                }
+
+                cbuffer[0] = buffers[CHANNEL_LEFT].array();
+                if (nrofchannels != 1)
+                    cbuffer[1] = buffers[CHANNEL_RIGHT].array();
+
                 boolean hasactivevoices = false;
                 for (int i = 0; i < voicestatus.length; i++)
                     if (voicestatus[i].active)
-                        if (voicestatus[i].channelmixer == cmixer) {
+                        if (voicestatus[i].channelmixer == cmixer.mixer) {
                             voicestatus[i].processAudioLogic(buffers);
                             hasactivevoices = true;
                         }
-                if (!cmixer.process(cbuffer, 0, bufferlen)) {
-                    synchronized (control_mutex) {
-                        registeredMixers.remove(cmixer);
-                        cur_registeredMixers = null;
-                    }
-                }
 
                 if(!buffers[CHANNEL_MONO].isSilent())
                 {
@@ -542,6 +612,13 @@
                     }
                 }
 
+                if (!cmixer.mixer.process(cbuffer, 0, bufferlen)) {
+                    synchronized (control_mutex) {
+                        registeredMixers.remove(cmixer);
+                        cur_registeredMixers = null;
+                    }
+                }
+
                 for (int i = 0; i < cbuffer.length; i++) {
                     float[] cbuff = cbuffer[i];
                     float[] obuff = obuffer[i];
@@ -554,7 +631,7 @@
                         if (stoppedMixers != null) {
                             if (stoppedMixers.contains(cmixer)) {
                                 stoppedMixers.remove(cmixer);
-                                cmixer.stop();
+                                cmixer.mixer.stop();
                             }
                         }
                     }
@@ -565,6 +642,9 @@
             buffers[CHANNEL_LEFT] = leftbak;
             buffers[CHANNEL_RIGHT] = rightbak;
             buffers[CHANNEL_MONO] = monobak;
+            buffers[CHANNEL_DELAY_LEFT] = delayleftbak;
+            buffers[CHANNEL_DELAY_RIGHT] = delayrightbak;
+            buffers[CHANNEL_DELAY_MONO] = delaymonobak;
 
         }
 
@@ -650,14 +730,23 @@
         if(buffers[CHANNEL_LEFT].isSilent()
             && buffers[CHANNEL_RIGHT].isSilent())
         {
-            pusher_silent_count++;
-            if(pusher_silent_count > 5)
+
+            int midimessages_size;
+            synchronized (control_mutex) {
+                midimessages_size = midimessages.size();
+            }
+
+            if(midimessages_size == 0)
             {
-                pusher_silent_count = 0;
-                synchronized (control_mutex) {
-                    pusher_silent = true;
-                    if(synth.weakstream != null)
-                        synth.weakstream.setInputStream(null);
+                pusher_silent_count++;
+                if(pusher_silent_count > 5)
+                {
+                    pusher_silent_count = 0;
+                    synchronized (control_mutex) {
+                        pusher_silent = true;
+                        if(synth.weakstream != null)
+                            synth.weakstream.setInputStream(null);
+                    }
                 }
             }
         }
@@ -672,13 +761,18 @@
     // Must only we called within control_mutex synchronization
     public void activity()
     {
-        msec_last_activity = msec_pos;
+        long silent_samples = 0;
         if(pusher_silent)
         {
             pusher_silent = false;
             if(synth.weakstream != null)
+            {
                 synth.weakstream.setInputStream(ais);
+                silent_samples = synth.weakstream.silent_samples;
+            }
         }
+        msec_last_activity = (long)((sample_pos + silent_samples)
+                * (1000000.0 / samplerate));
     }
 
     public void stopMixer(ModelChannelMixer mixer) {
@@ -689,15 +783,22 @@
 
     public void registerMixer(ModelChannelMixer mixer) {
         if (registeredMixers == null)
-            registeredMixers = new HashSet<ModelChannelMixer>();
-        registeredMixers.add(mixer);
+            registeredMixers = new HashSet<SoftChannelMixerContainer>();
+        SoftChannelMixerContainer mixercontainer = new SoftChannelMixerContainer();
+        mixercontainer.buffers = new SoftAudioBuffer[6];
+        for (int i = 0; i < mixercontainer.buffers.length; i++) {
+            mixercontainer.buffers[i] =
+                new SoftAudioBuffer(buffer_len, synth.getFormat());
+        }
+        mixercontainer.mixer = mixer;
+        registeredMixers.add(mixercontainer);
         cur_registeredMixers = null;
     }
 
     public SoftMainMixer(SoftSynthesizer synth) {
         this.synth = synth;
 
-        msec_pos = 0;
+        sample_pos = 0;
 
         co_master_balance[0] = 0.5;
         co_master_volume[0] = 1;
@@ -705,14 +806,18 @@
         co_master_fine_tuning[0] = 0.5;
 
         msec_buffer_len = (long) (1000000.0 / synth.getControlRate());
-
+        samplerate = synth.getFormat().getSampleRate();
         nrofchannels = synth.getFormat().getChannels();
 
         int buffersize = (int) (synth.getFormat().getSampleRate()
                                 / synth.getControlRate());
 
+        buffer_len = buffersize;
+
+        max_delay_midievent = buffersize;
+
         control_mutex = synth.control_mutex;
-        buffers = new SoftAudioBuffer[17];
+        buffers = new SoftAudioBuffer[14];
         for (int i = 0; i < buffers.length; i++) {
             buffers[i] = new SoftAudioBuffer(buffersize, synth.getFormat());
         }
@@ -994,7 +1099,10 @@
 
         switch (cmd) {
         case ShortMessage.NOTE_ON:
-            softchannel.noteOn(data1, data2);
+            if(delay_midievent != 0)
+                softchannel.noteOn(data1, data2, delay_midievent);
+            else
+                softchannel.noteOn(data1, data2);
             break;
         case ShortMessage.NOTE_OFF:
             softchannel.noteOff(data1, data2);
@@ -1021,7 +1129,15 @@
     }
 
     public long getMicrosecondPosition() {
-        return msec_pos;
+        if(pusher_silent)
+        {
+            if(synth.weakstream != null)
+            {
+                return (long)((sample_pos  + synth.weakstream.silent_samples)
+                        * (1000000.0 / samplerate));
+            }
+        }
+        return (long)(sample_pos * (1000000.0 / samplerate));
     }
 
     public void close() {
--- a/jdk/src/share/classes/com/sun/media/sound/SoftReceiver.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftReceiver.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,8 @@
 
 import java.util.TreeMap;
 
+import javax.sound.midi.MidiDevice;
 import javax.sound.midi.MidiMessage;
-import javax.sound.midi.Receiver;
 import javax.sound.midi.ShortMessage;
 
 /**
@@ -35,7 +35,7 @@
  *
  * @author Karl Helgason
  */
-public class SoftReceiver implements Receiver {
+public class SoftReceiver implements MidiDeviceReceiver {
 
     protected boolean open = true;
     private Object control_mutex;
@@ -51,6 +51,10 @@
             this.midimessages = mainmixer.midimessages;
     }
 
+    public MidiDevice getMidiDevice() {
+        return synth;
+    }
+
     public void send(MidiMessage message, long timeStamp) {
 
         synchronized (control_mutex) {
@@ -60,6 +64,7 @@
 
         if (timeStamp != -1) {
             synchronized (control_mutex) {
+                mainmixer.activity();
                 while (midimessages.get(timeStamp) != null)
                     timeStamp++;
                 if (message instanceof ShortMessage
--- a/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -66,6 +66,8 @@
         public SoftAudioPusher pusher = null;
         public AudioInputStream jitter_stream = null;
         public SourceDataLine sourceDataLine = null;
+        public volatile long silent_samples = 0;
+        private int framesize = 0;
         private WeakReference<AudioInputStream> weak_stream_link;
         private AudioFloatConverter converter;
         private float[] silentbuffer = null;
@@ -101,6 +103,8 @@
                      silentbuffer = new float[flen];
                  converter.toByteArray(silentbuffer, flen, b, off);
 
+                 silent_samples += (long)((len / framesize));
+
                  if(pusher != null)
                  if(weak_stream_link.get() == null)
                  {
@@ -136,6 +140,7 @@
             weak_stream_link = new WeakReference<AudioInputStream>(stream);
             converter = AudioFloatConverter.getConverter(stream.getFormat());
             samplesize = stream.getFormat().getFrameSize() / stream.getFormat().getChannels();
+            framesize = stream.getFormat().getFrameSize();
         }
 
         public AudioInputStream getAudioInputStream()
--- a/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java	Wed Jul 05 17:04:26 2017 +0200
@@ -43,6 +43,7 @@
     private int noteOn_noteNumber = 0;
     private int noteOn_velocity = 0;
     private int noteOff_velocity = 0;
+    private int delay = 0;
     protected ModelChannelMixer channelmixer = null;
     protected double tunedKey = 0;
     protected SoftTuning tuning = null;
@@ -294,7 +295,7 @@
         tunedKey = tuning.getTuning(noteNumber) / 100.0;
     }
 
-    protected void noteOn(int noteNumber, int velocity) {
+    protected void noteOn(int noteNumber, int velocity, int delay) {
 
         sustain = false;
         sostenuto = false;
@@ -308,6 +309,7 @@
 
         noteOn_noteNumber = noteNumber;
         noteOn_velocity = velocity;
+        this.delay = delay;
 
         lastMuteValue = 0;
         lastSoloMuteValue = 0;
@@ -562,7 +564,7 @@
 
             if (stealer_channel != null) {
                 stealer_channel.initVoice(this, stealer_performer,
-                        stealer_voiceID, stealer_noteNumber, stealer_velocity,
+                        stealer_voiceID, stealer_noteNumber, stealer_velocity, 0,
                         stealer_extendedConnectionBlocks, stealer_channelmixer,
                         stealer_releaseTriggered);
                 stealer_releaseTriggered = false;
@@ -733,23 +735,55 @@
     }
 
     protected void mixAudioStream(SoftAudioBuffer in, SoftAudioBuffer out,
+            SoftAudioBuffer dout,
             float amp_from, float amp_to) {
         int bufferlen = in.getSize();
         if (amp_from < 0.000000001 && amp_to < 0.000000001)
             return;
-        if (amp_from == amp_to) {
-            float[] fout = out.array();
-            float[] fin = in.array();
-            for (int i = 0; i < bufferlen; i++)
-                fout[i] += fin[i] * amp_to;
-        } else {
-            float amp = amp_from;
-            float amp_delta = (amp_to - amp_from) / bufferlen;
-            float[] fout = out.array();
-            float[] fin = in.array();
-            for (int i = 0; i < bufferlen; i++) {
-                amp += amp_delta;
-                fout[i] += fin[i] * amp;
+        if(dout != null && delay != 0)
+        {
+            if (amp_from == amp_to) {
+                float[] fout = out.array();
+                float[] fin = in.array();
+                int j = 0;
+                for (int i = delay; i < bufferlen; i++)
+                    fout[i] += fin[j++] * amp_to;
+                fout = dout.array();
+                for (int i = 0; i < delay; i++)
+                    fout[i] += fin[j++] * amp_to;
+            } else {
+                float amp = amp_from;
+                float amp_delta = (amp_to - amp_from) / bufferlen;
+                float[] fout = out.array();
+                float[] fin = in.array();
+                int j = 0;
+                for (int i = delay; i < bufferlen; i++) {
+                    amp += amp_delta;
+                    fout[i] += fin[j++] * amp;
+                }
+                fout = dout.array();
+                for (int i = 0; i < delay; i++) {
+                    amp += amp_delta;
+                    fout[i] += fin[j++] * amp;
+                }
+            }
+        }
+        else
+        {
+            if (amp_from == amp_to) {
+                float[] fout = out.array();
+                float[] fin = in.array();
+                for (int i = 0; i < bufferlen; i++)
+                    fout[i] += fin[i] * amp_to;
+            } else {
+                float amp = amp_from;
+                float amp_delta = (amp_to - amp_from) / bufferlen;
+                float[] fout = out.array();
+                float[] fin = in.array();
+                for (int i = 0; i < bufferlen; i++) {
+                    amp += amp_delta;
+                    fout[i] += fin[i] * amp;
+                }
             }
         }
 
@@ -785,6 +819,13 @@
         SoftAudioBuffer mono = buffer[SoftMainMixer.CHANNEL_MONO];
         SoftAudioBuffer eff1 = buffer[SoftMainMixer.CHANNEL_EFFECT1];
         SoftAudioBuffer eff2 = buffer[SoftMainMixer.CHANNEL_EFFECT2];
+
+        SoftAudioBuffer dleft = buffer[SoftMainMixer.CHANNEL_DELAY_LEFT];
+        SoftAudioBuffer dright = buffer[SoftMainMixer.CHANNEL_DELAY_RIGHT];
+        SoftAudioBuffer dmono = buffer[SoftMainMixer.CHANNEL_DELAY_MONO];
+        SoftAudioBuffer deff1 = buffer[SoftMainMixer.CHANNEL_DELAY_EFFECT1];
+        SoftAudioBuffer deff2 = buffer[SoftMainMixer.CHANNEL_DELAY_EFFECT2];
+
         SoftAudioBuffer leftdry = buffer[SoftMainMixer.CHANNEL_LEFT_DRY];
         SoftAudioBuffer rightdry = buffer[SoftMainMixer.CHANNEL_RIGHT_DRY];
 
@@ -799,42 +840,42 @@
 
         if (nrofchannels == 1) {
             out_mixer_left = (out_mixer_left + out_mixer_right) / 2;
-            mixAudioStream(leftdry, left, last_out_mixer_left, out_mixer_left);
+            mixAudioStream(leftdry, left, dleft, last_out_mixer_left, out_mixer_left);
             if (rightdry != null)
-                mixAudioStream(rightdry, left, last_out_mixer_left,
+                mixAudioStream(rightdry, left, dleft, last_out_mixer_left,
                         out_mixer_left);
         } else {
             if(rightdry == null &&
                     last_out_mixer_left == last_out_mixer_right &&
                     out_mixer_left == out_mixer_right)
             {
-                mixAudioStream(leftdry, mono, last_out_mixer_left, out_mixer_left);
+                mixAudioStream(leftdry, mono, dmono, last_out_mixer_left, out_mixer_left);
             }
             else
             {
-                mixAudioStream(leftdry, left, last_out_mixer_left, out_mixer_left);
+                mixAudioStream(leftdry, left, dleft, last_out_mixer_left, out_mixer_left);
                 if (rightdry != null)
-                    mixAudioStream(rightdry, right, last_out_mixer_right,
+                    mixAudioStream(rightdry, right, dright, last_out_mixer_right,
                         out_mixer_right);
                 else
-                    mixAudioStream(leftdry, right, last_out_mixer_right,
+                    mixAudioStream(leftdry, right, dright, last_out_mixer_right,
                         out_mixer_right);
             }
         }
 
         if (rightdry == null) {
-            mixAudioStream(leftdry, eff1, last_out_mixer_effect1,
+            mixAudioStream(leftdry, eff1, deff1, last_out_mixer_effect1,
                     out_mixer_effect1);
-            mixAudioStream(leftdry, eff2, last_out_mixer_effect2,
+            mixAudioStream(leftdry, eff2, deff2, last_out_mixer_effect2,
                     out_mixer_effect2);
         } else {
-            mixAudioStream(leftdry, eff1, last_out_mixer_effect1 * 0.5f,
+            mixAudioStream(leftdry, eff1, deff1, last_out_mixer_effect1 * 0.5f,
                     out_mixer_effect1 * 0.5f);
-            mixAudioStream(leftdry, eff2, last_out_mixer_effect2 * 0.5f,
+            mixAudioStream(leftdry, eff2, deff2, last_out_mixer_effect2 * 0.5f,
                     out_mixer_effect2 * 0.5f);
-            mixAudioStream(rightdry, eff1, last_out_mixer_effect1 * 0.5f,
+            mixAudioStream(rightdry, eff1, deff1, last_out_mixer_effect1 * 0.5f,
                     out_mixer_effect1 * 0.5f);
-            mixAudioStream(rightdry, eff2, last_out_mixer_effect2 * 0.5f,
+            mixAudioStream(rightdry, eff2, deff2, last_out_mixer_effect2 * 0.5f,
                     out_mixer_effect2 * 0.5f);
         }
 
--- a/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/security/auth/PolicyFile.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,8 +34,6 @@
 
 import java.security.AccessController;
 import java.security.CodeSource;
-import java.security.Identity;
-import java.security.IdentityScope;
 import java.security.KeyStore;
 import java.security.KeyStoreException;
 import java.security.Permission;
@@ -267,7 +265,7 @@
     private boolean initialized = false;
 
     private boolean expandProperties = true;
-    private boolean ignoreIdentityScope = false;
+    private boolean ignoreIdentityScope = true;
 
     // for use with the reflection API
 
@@ -459,9 +457,6 @@
         }
     }
 
-    /** the scope to check */
-    private static IdentityScope scope = null;
-
     /**
      * Checks public key. If it is marked as trusted in
      * the identity database, add it to the policy
--- a/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/security/jgss/ExtendedGSSContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -99,4 +99,58 @@
      */
     public Object inquireSecContext(InquireType type)
             throws GSSException;
+
+    /**
+     * Requests that the delegation policy be respected. When a true value is
+     * requested, the underlying context would use the delegation policy
+     * defined by the environment as a hint to determine whether credentials
+     * delegation should be performed. This request can only be made on the
+     * context initiator's side and it has to be done prior to the first
+     * call to <code>initSecContext</code>.
+     * <p>
+     * When this flag is false, delegation will only be tried when the
+     * {@link GSSContext#requestCredDeleg(boolean) credentials delegation flag}
+     * is true.
+     * <p>
+     * When this flag is true but the
+     * {@link GSSContext#requestCredDeleg(boolean) credentials delegation flag}
+     * is false, delegation will be only tried if the delegation policy permits
+     * delegation.
+     * <p>
+     * When both this flag and the
+     * {@link GSSContext#requestCredDeleg(boolean) credentials delegation flag}
+     * are true, delegation will be always tried. However, if the delegation
+     * policy does not permit delegation, the value of
+     * {@link #getDelegPolicyState} will be false, even
+     * if delegation is performed successfully.
+     * <p>
+     * In any case, if the delegation is not successful, the value returned
+     * by {@link GSSContext#getCredDelegState()} is false, and the value
+     * returned by {@link #getDelegPolicyState()} is also false.
+     * <p>
+     * Not all mechanisms support delegation policy. Therefore, the
+     * application should check to see if the request was honored with the
+     * {@link #getDelegPolicyState() getDelegPolicyState} method. When
+     * delegation policy is not supported, <code>requestDelegPolicy</code>
+     * should return silently without throwing an exception.
+     * <p>
+     * Note: for the Kerberos 5 mechanism, the delegation policy is expressed
+     * through the OK-AS-DELEGATE flag in the service ticket. When it's true,
+     * the KDC permits delegation to the target server. In a cross-realm
+     * environment, in order for delegation be permitted, all cross-realm TGTs
+     * on the authentication path must also have the OK-AS-DELAGATE flags set.
+     * @param state true if the policy should be respected
+     * @throws GSSException containing the following
+     * major error codes:
+     *   {@link GSSException#FAILURE GSSException.FAILURE}
+     */
+    public void requestDelegPolicy(boolean state) throws GSSException;
+
+    /**
+     * Returns the delegation policy response. Called after a security context
+     * is established. This method can be only called on the initiator's side.
+     * See {@link ExtendedGSSContext#requestDelegPolicy}.
+     * @return the delegation policy response
+     */
+    public boolean getDelegPolicyState();
 }
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java	Wed Jul 05 17:04:26 2017 +0200
@@ -57,7 +57,10 @@
             id = ((JavaObjectRef)value).getId();
         }
         value = value.dereference(snapshot, field);
-        if (value.isHeapAllocated()) {
+        if (value.isHeapAllocated() &&
+            clazz.getLoader() == snapshot.getNullThing()) {
+            // static fields are only roots if they are in classes
+            //    loaded by the root classloader.
             JavaHeapObject ho = (JavaHeapObject) value;
             String s = "Static reference from " + clazz.getName()
                        + "." + field.getName();
--- a/jdk/src/share/classes/com/sun/tracing/ProviderFactory.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/com/sun/tracing/ProviderFactory.java	Wed Jul 05 17:04:26 2017 +0200
@@ -4,7 +4,10 @@
 import java.util.HashSet;
 import java.io.PrintStream;
 import java.lang.reflect.Field;
-import java.util.logging.Logger;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import sun.security.action.GetPropertyAction;
 
 import sun.tracing.NullProviderFactory;
 import sun.tracing.PrintStreamProviderFactory;
@@ -52,23 +55,17 @@
         HashSet<ProviderFactory> factories = new HashSet<ProviderFactory>();
 
         // Try to instantiate a DTraceProviderFactory
-        String prop = null;
-        try { prop = System.getProperty("com.sun.tracing.dtrace"); }
-        catch (java.security.AccessControlException e) {
-            Logger.getAnonymousLogger().fine(
-                "Cannot access property com.sun.tracing.dtrace");
-        }
+        String prop = AccessController.doPrivileged(
+            new GetPropertyAction("com.sun.tracing.dtrace"));
+
         if ( (prop == null || !prop.equals("disable")) &&
              DTraceProviderFactory.isSupported() ) {
             factories.add(new DTraceProviderFactory());
         }
 
         // Try to instantiate an output stream factory
-        try { prop = System.getProperty("sun.tracing.stream"); }
-        catch (java.security.AccessControlException e) {
-            Logger.getAnonymousLogger().fine(
-                "Cannot access property sun.tracing.stream");
-        }
+        prop = AccessController.doPrivileged(
+            new GetPropertyAction("sun.tracing.stream"));
         if (prop != null) {
             for (String spec : prop.split(",")) {
                 PrintStream ps = getPrintStreamFromSpec(spec);
@@ -89,22 +86,29 @@
         }
     }
 
-    private static PrintStream getPrintStreamFromSpec(String spec) {
+    private static PrintStream getPrintStreamFromSpec(final String spec) {
         try {
             // spec is in the form of <class>.<field>, where <class> is
             // a fully specified class name, and <field> is a static member
             // in that class.  The <field> must be a 'PrintStream' or subtype
             // in order to be used.
-            int fieldpos = spec.lastIndexOf('.');
-            Class<?> cls = Class.forName(spec.substring(0, fieldpos));
-            Field f = cls.getField(spec.substring(fieldpos + 1));
-            Class<?> fieldType = f.getType();
+            final int fieldpos = spec.lastIndexOf('.');
+            final Class<?> cls = Class.forName(spec.substring(0, fieldpos));
+
+            Field f = AccessController.doPrivileged(new PrivilegedExceptionAction<Field>() {
+                public Field run() throws NoSuchFieldException {
+                    return cls.getField(spec.substring(fieldpos + 1));
+                }
+            });
+
             return (PrintStream)f.get(null);
-        } catch (Exception e) {
-            Logger.getAnonymousLogger().warning(
-                "Could not parse sun.tracing.stream property: " + e);
+        } catch (ClassNotFoundException e) {
+            throw new AssertionError(e);
+        } catch (IllegalAccessException e) {
+            throw new AssertionError(e);
+        } catch (PrivilegedActionException e) {
+            throw new AssertionError(e);
         }
-        return null;
     }
 }
 
--- a/jdk/src/share/classes/java/awt/Component.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/awt/Component.java	Wed Jul 05 17:04:26 2017 +0200
@@ -871,7 +871,7 @@
                 return comp.canBeFocusOwner();
             }
 
-            public boolean isVisible_NoClientCode(Component comp) {
+            public boolean isVisible(Component comp) {
                 return comp.isVisible_NoClientCode();
             }
             public void setRequestFocusController
@@ -885,6 +885,71 @@
             public void setAppContext(Component comp, AppContext appContext) {
                  comp.appContext = appContext;
             }
+            public Container getParent(Component comp) {
+                return comp.getParent_NoClientCode();
+            }
+            public void setParent(Component comp, Container parent) {
+                comp.parent = parent;
+            }
+            public void setSize(Component comp, int width, int height) {
+                comp.width = width;
+                comp.height = height;
+            }
+            public Point getLocation(Component comp) {
+                return comp.location_NoClientCode();
+            }
+            public void setLocation(Component comp, int x, int y) {
+                comp.x = x;
+                comp.y = y;
+            }
+            public boolean isEnabled(Component comp) {
+                return comp.isEnabledImpl();
+            }
+            public boolean isDisplayable(Component comp) {
+                return comp.peer != null;
+            }
+            public Cursor getCursor(Component comp) {
+                return comp.getCursor_NoClientCode();
+            }
+            public ComponentPeer getPeer(Component comp) {
+                return comp.peer;
+            }
+            public void setPeer(Component comp, ComponentPeer peer) {
+                comp.peer = peer;
+            }
+            public boolean isLightweight(Component comp) {
+                return (comp.peer instanceof LightweightPeer);
+            }
+            public boolean getIgnoreRepaint(Component comp) {
+                return comp.ignoreRepaint;
+            }
+            public int getWidth(Component comp) {
+                return comp.width;
+            }
+            public int getHeight(Component comp) {
+                return comp.height;
+            }
+            public int getX(Component comp) {
+                return comp.x;
+            }
+            public int getY(Component comp) {
+                return comp.y;
+            }
+            public Color getForeground(Component comp) {
+                return comp.foreground;
+            }
+            public Color getBackground(Component comp) {
+                return comp.background;
+            }
+            public void setBackground(Component comp, Color background) {
+                comp.background = background;
+            }
+            public Font getFont(Component comp) {
+                return comp.getFont_NoClientCode();
+            }
+            public void processEvent(Component comp, AWTEvent e) {
+                comp.processEvent(e);
+            }
         });
     }
 
@@ -8021,7 +8086,7 @@
     Container getNativeContainer() {
         Container p = parent;
         while (p != null && p.peer instanceof LightweightPeer) {
-            p = p.getParent();
+            p = p.getParent_NoClientCode();
         }
         return p;
     }
--- a/jdk/src/share/classes/java/awt/EventDispatchThread.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/awt/EventDispatchThread.java	Wed Jul 05 17:04:26 2017 +0200
@@ -104,11 +104,8 @@
         } else {
             stopEvent.dispatch();
         }
-        synchronized (theQueue) {
-            if (theQueue.getDispatchThread() == this) {
-                theQueue.detachDispatchThread();
-            }
-        }
+
+        theQueue.detachDispatchThread(this, false);
     }
 
     public void stopDispatching() {
@@ -142,35 +139,7 @@
                 }
             });
         } finally {
-            /*
-             * This synchronized block is to secure that the event dispatch
-             * thread won't die in the middle of posting a new event to the
-             * associated event queue. It is important because we notify
-             * that the event dispatch thread is busy after posting a new event
-             * to its queue, so the EventQueue.dispatchThread reference must
-             * be valid at that point.
-             */
-            synchronized (theQueue) {
-                if (theQueue.getDispatchThread() == this) {
-                    theQueue.detachDispatchThread();
-                }
-                /*
-                 * Event dispatch thread dies in case of an uncaught exception.
-                 * A new event dispatch thread for this queue will be started
-                 * only if a new event is posted to it. In case if no more
-                 * events are posted after this thread died all events that
-                 * currently are in the queue will never be dispatched.
-                 */
-                /*
-                 * Fix for 4648733. Check both the associated java event
-                 * queue and the PostEventQueue.
-                 */
-                if (theQueue.peekEvent() != null ||
-                    !SunToolkit.isPostEventQueueEmpty()) {
-                    theQueue.initDispatchThread();
-                }
-                AWTAutoShutdown.getInstance().notifyThreadFree(this);
-            }
+            theQueue.detachDispatchThread(this, true);
         }
     }
 
--- a/jdk/src/share/classes/java/awt/EventQueue.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/awt/EventQueue.java	Wed Jul 05 17:04:26 2017 +0200
@@ -45,6 +45,9 @@
 import sun.awt.EventQueueItem;
 import sun.awt.AWTAccessor;
 
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+
 /**
  * <code>EventQueue</code> is a platform-independent class
  * that queues events, both from the underlying peer classes
@@ -127,6 +130,14 @@
      */
     private EventQueue previousQueue;
 
+    /*
+     * A single lock to synchronize the push()/pop() and related operations with
+     * all the EventQueues from the AppContext. Synchronization on any particular
+     * event queue(s) is not enough: we should lock the whole stack.
+     */
+    private final Lock pushPopLock;
+    private final Condition pushPopCond;
+
     private EventDispatchThread dispatchThread;
 
     private final ThreadGroup threadGroup =
@@ -158,11 +169,11 @@
     static {
         AWTAccessor.setEventQueueAccessor(
             new AWTAccessor.EventQueueAccessor() {
-                public EventQueue getNextQueue(EventQueue eventQueue) {
-                    return eventQueue.nextQueue;
+                public Thread getDispatchThread(EventQueue eventQueue) {
+                    return eventQueue.getDispatchThread();
                 }
-                public Thread getDispatchThread(EventQueue eventQueue) {
-                    return eventQueue.dispatchThread;
+                public boolean isDispatchThreadImpl(EventQueue eventQueue) {
+                    return eventQueue.isDispatchThreadImpl();
                 }
             });
     }
@@ -179,6 +190,9 @@
          * may call AppContext.getAppContext() before createNewAppContext()
          * completes thus causing mess in thread group to appcontext mapping.
          */
+
+        pushPopLock = (Lock)AppContext.getAppContext().get(AppContext.EVENT_QUEUE_LOCK_KEY);
+        pushPopCond = (Condition)AppContext.getAppContext().get(AppContext.EVENT_QUEUE_COND_KEY);
     }
 
     /**
@@ -207,7 +221,8 @@
      */
     final void postEventPrivate(AWTEvent theEvent) {
         theEvent.isPosted = true;
-        synchronized(this) {
+        pushPopLock.lock();
+        try {
             if (dispatchThread == null && nextQueue == null) {
                 if (theEvent.getSource() == AWTAutoShutdown.getInstance()) {
                     return;
@@ -221,6 +236,8 @@
                 return;
             }
             postEvent(theEvent, getPriority(theEvent));
+        } finally {
+            pushPopLock.unlock();
         }
     }
 
@@ -280,9 +297,9 @@
                 if (theEvent.getSource() != AWTAutoShutdown.getInstance()) {
                     AWTAutoShutdown.getInstance().notifyThreadBusy(dispatchThread);
                 }
-                notifyAll();
+                pushPopCond.signalAll();
             } else if (notifyID) {
-                notifyAll();
+                pushPopCond.signalAll();
             }
         } else {
             // The event was not coalesced or has non-Component source.
@@ -290,7 +307,7 @@
             queues[priority].tail.next = newItem;
             queues[priority].tail = newItem;
             if (notifyID) {
-                notifyAll();
+                pushPopCond.signalAll();
             }
         }
     }
@@ -482,7 +499,8 @@
              * event queues are nested with push()/pop().
              */
             SunToolkit.flushPendingEvents();
-            synchronized (this) {
+            pushPopLock.lock();
+            try {
                 for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
                     if (queues[i].head != null) {
                         EventQueueItem entry = queues[i].head;
@@ -495,7 +513,9 @@
                     }
                 }
                 AWTAutoShutdown.getInstance().notifyThreadFree(dispatchThread);
-                wait();
+                pushPopCond.await();
+            } finally {
+                pushPopLock.unlock();
             }
         } while(true);
     }
@@ -508,7 +528,8 @@
              * event queues are nested with push()/pop().
              */
             SunToolkit.flushPendingEvents();
-            synchronized (this) {
+            pushPopLock.lock();
+            try {
                 for (int i = 0; i < NUM_PRIORITIES; i++) {
                     for (EventQueueItem entry = queues[i].head, prev = null;
                          entry != null; prev = entry, entry = entry.next)
@@ -527,9 +548,11 @@
                         }
                     }
                 }
-                this.waitForID = id;
-                wait();
-                this.waitForID = 0;
+                waitForID = id;
+                pushPopCond.await();
+                waitForID = 0;
+            } finally {
+                pushPopLock.unlock();
             }
         } while(true);
     }
@@ -539,11 +562,16 @@
      * without removing it.
      * @return the first event
      */
-    public synchronized AWTEvent peekEvent() {
-        for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
-            if (queues[i].head != null) {
-                return queues[i].head.event;
+    public AWTEvent peekEvent() {
+        pushPopLock.lock();
+        try {
+            for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
+                if (queues[i].head != null) {
+                    return queues[i].head.event;
+                }
             }
+        } finally {
+            pushPopLock.unlock();
         }
 
         return null;
@@ -555,14 +583,19 @@
      * @return the first event of the specified id or <code>null</code>
      *    if there is no such event
      */
-    public synchronized AWTEvent peekEvent(int id) {
-        for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
-            EventQueueItem q = queues[i].head;
-            for (; q != null; q = q.next) {
-                if (q.event.getID() == id) {
-                    return q.event;
+    public AWTEvent peekEvent(int id) {
+        pushPopLock.lock();
+        try {
+            for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
+                EventQueueItem q = queues[i].head;
+                for (; q != null; q = q.next) {
+                    if (q.event.getID() == id) {
+                        return q.event;
+                    }
                 }
             }
+        } finally {
+            pushPopLock.unlock();
         }
 
         return null;
@@ -661,17 +694,27 @@
     public static long getMostRecentEventTime() {
         return Toolkit.getEventQueue().getMostRecentEventTimeImpl();
     }
-    private synchronized long getMostRecentEventTimeImpl() {
-        return (Thread.currentThread() == dispatchThread)
-            ? mostRecentEventTime
-            : System.currentTimeMillis();
+    private long getMostRecentEventTimeImpl() {
+        pushPopLock.lock();
+        try {
+            return (Thread.currentThread() == dispatchThread)
+                ? mostRecentEventTime
+                : System.currentTimeMillis();
+        } finally {
+            pushPopLock.unlock();
+        }
     }
 
     /**
      * @return most recent event time on all threads.
      */
-    synchronized long getMostRecentEventTimeEx() {
-        return mostRecentEventTime;
+    long getMostRecentEventTimeEx() {
+        pushPopLock.lock();
+        try {
+            return mostRecentEventTime;
+        } finally {
+            pushPopLock.unlock();
+        }
     }
 
     /**
@@ -689,10 +732,15 @@
     public static AWTEvent getCurrentEvent() {
         return Toolkit.getEventQueue().getCurrentEventImpl();
     }
-    private synchronized AWTEvent getCurrentEventImpl() {
-        return (Thread.currentThread() == dispatchThread)
-            ? ((AWTEvent)currentEvent.get())
-            : null;
+    private AWTEvent getCurrentEventImpl() {
+        pushPopLock.lock();
+        try {
+                return (Thread.currentThread() == dispatchThread)
+                ? ((AWTEvent)currentEvent.get())
+                : null;
+        } finally {
+            pushPopLock.unlock();
+        }
     }
 
     /**
@@ -706,21 +754,22 @@
      * @throws NullPointerException if <code>newEventQueue</code> is <code>null</code>
      * @since           1.2
      */
-    public synchronized void push(EventQueue newEventQueue) {
+    public void push(EventQueue newEventQueue) {
         if (eventLog.isLoggable(PlatformLogger.FINE)) {
             eventLog.fine("EventQueue.push(" + newEventQueue + ")");
         }
 
-        if (nextQueue != null) {
-            nextQueue.push(newEventQueue);
-            return;
-        }
+        pushPopLock.lock();
+        try {
+            EventQueue toPush = this;
+            while (toPush.nextQueue != null) {
+                toPush = toPush.nextQueue;
+            }
 
-        synchronized (newEventQueue) {
             // Transfer all events forward to new EventQueue.
-            while (peekEvent() != null) {
+            while (toPush.peekEvent() != null) {
                 try {
-                    newEventQueue.postEventPrivate(getNextEvent());
+                    newEventQueue.postEventPrivate(toPush.getNextEvent());
                 } catch (InterruptedException ie) {
                     if (eventLog.isLoggable(PlatformLogger.FINE)) {
                         eventLog.fine("Interrupted push", ie);
@@ -728,27 +777,30 @@
                 }
             }
 
-            newEventQueue.previousQueue = this;
-        }
-        /*
-         * Stop the event dispatch thread associated with the currently
-         * active event queue, so that after the new queue is pushed
-         * on the top this event dispatch thread won't prevent AWT from
-         * being automatically shut down.
-         * Use stopDispatchingLater() to avoid deadlock: stopDispatching()
-         * waits for the dispatch thread to exit, so if the dispatch
-         * thread attempts to synchronize on this EventQueue object
-         * it will never exit since we already hold this lock.
-         */
-        if (dispatchThread != null) {
-            dispatchThread.stopDispatchingLater();
-        }
+            newEventQueue.previousQueue = toPush;
 
-        nextQueue = newEventQueue;
+            /*
+             * Stop the event dispatch thread associated with the currently
+             * active event queue, so that after the new queue is pushed
+             * on the top this event dispatch thread won't prevent AWT from
+             * being automatically shut down.
+             * Use stopDispatchingLater() to avoid deadlock: stopDispatching()
+             * waits for the dispatch thread to exit, which in turn waits
+             * for the lock in EQ.detachDispatchThread(), which is hold by
+             * this method.
+             */
+            if (toPush.dispatchThread != null) {
+                toPush.dispatchThread.stopDispatchingLater();
+            }
 
-        AppContext appContext = AppContext.getAppContext();
-        if (appContext.get(AppContext.EVENT_QUEUE_KEY) == this) {
-            appContext.put(AppContext.EVENT_QUEUE_KEY, newEventQueue);
+            toPush.nextQueue = newEventQueue;
+
+            AppContext appContext = AppContext.getAppContext();
+            if (appContext.get(AppContext.EVENT_QUEUE_KEY) == toPush) {
+                appContext.put(AppContext.EVENT_QUEUE_KEY, newEventQueue);
+            }
+        } finally {
+            pushPopLock.unlock();
         }
     }
 
@@ -770,25 +822,24 @@
             eventLog.fine("EventQueue.pop(" + this + ")");
         }
 
-        // To prevent deadlock, we lock on the previous EventQueue before
-        // this one.  This uses the same locking order as everything else
-        // in EventQueue.java, so deadlock isn't possible.
-        EventQueue prev = previousQueue;
-        synchronized ((prev != null) ? prev : this) {
-          synchronized(this) {
-            if (nextQueue != null) {
-                nextQueue.pop();
-                return;
+        EventDispatchThread dt = null;
+        pushPopLock.lock();
+        try {
+            EventQueue toPop = this;
+            while (toPop.nextQueue != null) {
+                toPop = toPop.nextQueue;
             }
-            if (previousQueue == null) {
+            EventQueue prev = toPop.previousQueue;
+            if (prev == null) {
                 throw new EmptyStackException();
             }
+            toPop.previousQueue = null;
 
             // Transfer all events back to previous EventQueue.
-            previousQueue.nextQueue = null;
-            while (peekEvent() != null) {
+            prev.nextQueue = null;
+            while (toPop.peekEvent() != null) {
                 try {
-                    previousQueue.postEventPrivate(getNextEvent());
+                    prev.postEventPrivate(toPop.getNextEvent());
                 } catch (InterruptedException ie) {
                     if (eventLog.isLoggable(PlatformLogger.FINE)) {
                         eventLog.fine("Interrupted pop", ie);
@@ -797,14 +848,14 @@
             }
             AppContext appContext = AppContext.getAppContext();
             if (appContext.get(AppContext.EVENT_QUEUE_KEY) == this) {
-                appContext.put(AppContext.EVENT_QUEUE_KEY, previousQueue);
+                appContext.put(AppContext.EVENT_QUEUE_KEY, prev);
             }
 
-            previousQueue = null;
-          }
+            dt = toPop.dispatchThread;
+        } finally {
+            pushPopLock.unlock();
         }
 
-        EventDispatchThread dt = this.dispatchThread;
         if (dt != null) {
             dt.stopDispatching(); // Must be done outside synchronized
                                   // block to avoid possible deadlock
@@ -833,16 +884,27 @@
      */
     public static boolean isDispatchThread() {
         EventQueue eq = Toolkit.getEventQueue();
-        EventQueue next = eq.nextQueue;
-        while (next != null) {
-            eq = next;
-            next = eq.nextQueue;
+        return eq.isDispatchThreadImpl();
+    }
+
+    final boolean isDispatchThreadImpl() {
+        EventQueue eq = this;
+        pushPopLock.lock();
+        try {
+            EventQueue next = eq.nextQueue;
+            while (next != null) {
+                eq = next;
+                next = eq.nextQueue;
+            }
+            return (Thread.currentThread() == eq.dispatchThread);
+        } finally {
+            pushPopLock.unlock();
         }
-        return (Thread.currentThread() == eq.dispatchThread);
     }
 
     final void initDispatchThread() {
-        synchronized (this) {
+        pushPopLock.lock();
+        try {
             AppContext appContext = AppContext.getAppContext();
             if (dispatchThread == null && !threadGroup.isDestroyed() && !appContext.isDisposed()) {
                 dispatchThread = (EventDispatchThread)
@@ -861,11 +923,45 @@
                 AWTAutoShutdown.getInstance().notifyThreadBusy(dispatchThread);
                 dispatchThread.start();
             }
+        } finally {
+            pushPopLock.unlock();
         }
     }
 
-    final void detachDispatchThread() {
-        dispatchThread = null;
+    final void detachDispatchThread(EventDispatchThread edt, boolean restart) {
+        /*
+         * This synchronized block is to secure that the event dispatch
+         * thread won't die in the middle of posting a new event to the
+         * associated event queue. It is important because we notify
+         * that the event dispatch thread is busy after posting a new event
+         * to its queue, so the EventQueue.dispatchThread reference must
+         * be valid at that point.
+         */
+        pushPopLock.lock();
+        try {
+            EventDispatchThread oldDispatchThread = dispatchThread;
+            if (dispatchThread == edt) {
+                dispatchThread = null;
+            }
+            if (restart) {
+                /*
+                 * Event dispatch thread dies in case of an uncaught exception.
+                 * A new event dispatch thread for this queue will be started
+                 * only if a new event is posted to it. In case if no more
+                 * events are posted after this thread died all events that
+                 * currently are in the queue will never be dispatched.
+                 *
+                 * Fix for 4648733. Check both the associated java event
+                 * queue and the PostEventQueue.
+                 */
+                if ((peekEvent() != null) || !SunToolkit.isPostEventQueueEmpty()) {
+                    initDispatchThread();
+                }
+                AWTAutoShutdown.getInstance().notifyThreadFree(oldDispatchThread);
+            }
+        } finally {
+            pushPopLock.unlock();
+        }
     }
 
     /*
@@ -878,7 +974,12 @@
      * @see    java.awt.EventQueue#detachDispatchThread
      */
     final EventDispatchThread getDispatchThread() {
-        return dispatchThread;
+        pushPopLock.lock();
+        try {
+            return dispatchThread;
+        } finally {
+            pushPopLock.unlock();
+        }
     }
 
     /*
@@ -895,7 +996,8 @@
      */
     final void removeSourceEvents(Object source, boolean removeAllEvents) {
         SunToolkit.flushPendingEvents();
-        synchronized (this) {
+        pushPopLock.lock();
+        try {
             for (int i = 0; i < NUM_PRIORITIES; i++) {
                 EventQueueItem entry = queues[i].head;
                 EventQueueItem prev = null;
@@ -928,43 +1030,49 @@
                 }
                 queues[i].tail = prev;
             }
+        } finally {
+            pushPopLock.unlock();
         }
     }
 
     static void setCurrentEventAndMostRecentTime(AWTEvent e) {
         Toolkit.getEventQueue().setCurrentEventAndMostRecentTimeImpl(e);
     }
-    private synchronized void setCurrentEventAndMostRecentTimeImpl(AWTEvent e)
-    {
-        if (Thread.currentThread() != dispatchThread) {
-            return;
-        }
+    private void setCurrentEventAndMostRecentTimeImpl(AWTEvent e) {
+        pushPopLock.lock();
+        try {
+            if (Thread.currentThread() != dispatchThread) {
+                return;
+            }
 
-        currentEvent = new WeakReference(e);
+            currentEvent = new WeakReference(e);
 
-        // This series of 'instanceof' checks should be replaced with a
-        // polymorphic type (for example, an interface which declares a
-        // getWhen() method). However, this would require us to make such
-        // a type public, or to place it in sun.awt. Both of these approaches
-        // have been frowned upon. So for now, we hack.
-        //
-        // In tiger, we will probably give timestamps to all events, so this
-        // will no longer be an issue.
-        long mostRecentEventTime2 = Long.MIN_VALUE;
-        if (e instanceof InputEvent) {
-            InputEvent ie = (InputEvent)e;
-            mostRecentEventTime2 = ie.getWhen();
-        } else if (e instanceof InputMethodEvent) {
-            InputMethodEvent ime = (InputMethodEvent)e;
-            mostRecentEventTime2 = ime.getWhen();
-        } else if (e instanceof ActionEvent) {
-            ActionEvent ae = (ActionEvent)e;
-            mostRecentEventTime2 = ae.getWhen();
-        } else if (e instanceof InvocationEvent) {
-            InvocationEvent ie = (InvocationEvent)e;
-            mostRecentEventTime2 = ie.getWhen();
+            // This series of 'instanceof' checks should be replaced with a
+            // polymorphic type (for example, an interface which declares a
+            // getWhen() method). However, this would require us to make such
+            // a type public, or to place it in sun.awt. Both of these approaches
+            // have been frowned upon. So for now, we hack.
+            //
+            // In tiger, we will probably give timestamps to all events, so this
+            // will no longer be an issue.
+            long mostRecentEventTime2 = Long.MIN_VALUE;
+            if (e instanceof InputEvent) {
+                InputEvent ie = (InputEvent)e;
+                mostRecentEventTime2 = ie.getWhen();
+            } else if (e instanceof InputMethodEvent) {
+                InputMethodEvent ime = (InputMethodEvent)e;
+                mostRecentEventTime2 = ime.getWhen();
+            } else if (e instanceof ActionEvent) {
+                ActionEvent ae = (ActionEvent)e;
+                mostRecentEventTime2 = ae.getWhen();
+            } else if (e instanceof InvocationEvent) {
+                InvocationEvent ie = (InvocationEvent)e;
+                mostRecentEventTime2 = ie.getWhen();
+            }
+            mostRecentEventTime = Math.max(mostRecentEventTime, mostRecentEventTime2);
+        } finally {
+            pushPopLock.unlock();
         }
-        mostRecentEventTime = Math.max(mostRecentEventTime, mostRecentEventTime2);
     }
 
     /**
@@ -1045,15 +1153,18 @@
      * or starts a new one otherwise.
      */
     private void wakeup(boolean isShutdown) {
-        synchronized(this) {
+        pushPopLock.lock();
+        try {
             if (nextQueue != null) {
                 // Forward call to the top of EventQueue stack.
                 nextQueue.wakeup(isShutdown);
             } else if (dispatchThread != null) {
-                notifyAll();
+                pushPopCond.signalAll();
             } else if (!isShutdown) {
                 initDispatchThread();
             }
+        } finally {
+            pushPopLock.unlock();
         }
     }
 }
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Wed Jul 05 17:04:26 2017 +0200
@@ -53,8 +53,7 @@
 import java.util.StringTokenizer;
 import java.util.WeakHashMap;
 
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import sun.util.logging.PlatformLogger;
 
 import sun.awt.AppContext;
 import sun.awt.HeadlessToolkit;
@@ -111,7 +110,7 @@
 {
 
     // Shared focus engine logger
-    private static final Logger focusLog = Logger.getLogger("java.awt.focus.KeyboardFocusManager");
+    private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.KeyboardFocusManager");
 
     static {
         /* ensure that the necessary native libraries are loaded */
@@ -154,7 +153,7 @@
      */
     private static native void initIDs();
 
-    private static final Logger log = Logger.getLogger("java.awt.KeyboardFocusManager");
+    private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.KeyboardFocusManager");
 
     /**
      * The identifier for the Forward focus traversal keys.
@@ -504,8 +503,8 @@
             if (this == getCurrentKeyboardFocusManager()) {
                 return focusOwner;
             } else {
-                if (focusLog.isLoggable(Level.FINER)) {
-                    focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
+                if (focusLog.isLoggable(PlatformLogger.FINER)) {
+                    focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
                 }
                 throw new SecurityException(notPrivileged);
             }
@@ -609,9 +608,9 @@
     }
 
     void setNativeFocusOwner(Component comp) {
-        if (focusLog.isLoggable(Level.FINEST)) {
-            focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}",
-                         new Object[] {String.valueOf(peer), String.valueOf(comp)});
+        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
+            focusLog.finest("Calling peer {0} setCurrentFocusOwner for {1}",
+                            String.valueOf(peer), String.valueOf(comp));
         }
         peer.setCurrentFocusOwner(comp);
     }
@@ -673,8 +672,8 @@
             if (this == getCurrentKeyboardFocusManager()) {
                 return permanentFocusOwner;
             } else {
-                if (focusLog.isLoggable(Level.FINER)) {
-                    focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
+                if (focusLog.isLoggable(PlatformLogger.FINER)) {
+                    focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
                 }
                 throw new SecurityException(notPrivileged);
             }
@@ -781,8 +780,8 @@
             if (this == getCurrentKeyboardFocusManager()) {
                return focusedWindow;
             } else {
-                if (focusLog.isLoggable(Level.FINER)) {
-                    focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
+                if (focusLog.isLoggable(PlatformLogger.FINER)) {
+                    focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
                 }
                 throw new SecurityException(notPrivileged);
             }
@@ -885,8 +884,8 @@
             if (this == getCurrentKeyboardFocusManager()) {
                return activeWindow;
             } else {
-                if (focusLog.isLoggable(Level.FINER)) {
-                    focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
+                if (focusLog.isLoggable(PlatformLogger.FINER)) {
+                    focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
                 }
                 throw new SecurityException(notPrivileged);
             }
@@ -919,8 +918,8 @@
         Window oldActiveWindow;
         synchronized (KeyboardFocusManager.class) {
             oldActiveWindow = getActiveWindow();
-            if (focusLog.isLoggable(Level.FINER)) {
-                focusLog.log(Level.FINER, "Setting global active window to " + activeWindow + ", old active " + oldActiveWindow);
+            if (focusLog.isLoggable(PlatformLogger.FINER)) {
+                focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow);
             }
 
             try {
@@ -1215,8 +1214,8 @@
             if (this == getCurrentKeyboardFocusManager()) {
                 return currentFocusCycleRoot;
             } else {
-                if (focusLog.isLoggable(Level.FINER)) {
-                    focusLog.log(Level.FINER, "This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
+                if (focusLog.isLoggable(PlatformLogger.FINER)) {
+                    focusLog.finer("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
                 }
                 throw new SecurityException(notPrivileged);
             }
@@ -2149,9 +2148,9 @@
 
         HeavyweightFocusRequest(Component heavyweight, Component descendant,
                                 boolean temporary, CausedFocusEvent.Cause cause) {
-            if (log.isLoggable(Level.FINE)) {
+            if (log.isLoggable(PlatformLogger.FINE)) {
                 if (heavyweight == null) {
-                    log.log(Level.FINE, "Assertion (heavyweight != null) failed");
+                    log.fine("Assertion (heavyweight != null) failed");
                 }
             }
 
@@ -2161,12 +2160,12 @@
         }
         boolean addLightweightRequest(Component descendant,
                                       boolean temporary, CausedFocusEvent.Cause cause) {
-            if (log.isLoggable(Level.FINE)) {
+            if (log.isLoggable(PlatformLogger.FINE)) {
                 if (this == HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
-                    log.log(Level.FINE, "Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed");
+                    log.fine("Assertion (this != HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) failed");
                 }
                 if (descendant == null) {
-                    log.log(Level.FINE, "Assertion (descendant != null) failed");
+                    log.fine("Assertion (descendant != null) failed");
                 }
             }
 
@@ -2339,12 +2338,12 @@
         (Component heavyweight, Component descendant, boolean temporary,
          boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
     {
-        if (log.isLoggable(Level.FINE)) {
+        if (log.isLoggable(PlatformLogger.FINE)) {
             if (heavyweight == null) {
-                log.log(Level.FINE, "Assertion (heavyweight != null) failed");
+                log.fine("Assertion (heavyweight != null) failed");
             }
             if (time == 0) {
-                log.log(Level.FINE, "Assertion (time != 0) failed");
+                log.fine("Assertion (time != 0) failed");
             }
         }
 
@@ -2361,31 +2360,31 @@
         Component currentFocusOwner = thisManager.getGlobalFocusOwner();
         Component nativeFocusOwner = thisManager.getNativeFocusOwner();
         Window nativeFocusedWindow = thisManager.getNativeFocusedWindow();
-        if (focusLog.isLoggable(Level.FINER)) {
-            focusLog.log(Level.FINER, "SNFH for {0} in {1}",
-                         new Object[] {String.valueOf(descendant), String.valueOf(heavyweight)});
+        if (focusLog.isLoggable(PlatformLogger.FINER)) {
+            focusLog.finer("SNFH for {0} in {1}",
+                           String.valueOf(descendant), String.valueOf(heavyweight));
         }
-        if (focusLog.isLoggable(Level.FINEST)) {
-            focusLog.log(Level.FINEST, "0. Current focus owner {0}",
-                         String.valueOf(currentFocusOwner));
-            focusLog.log(Level.FINEST, "0. Native focus owner {0}",
-                         String.valueOf(nativeFocusOwner));
-            focusLog.log(Level.FINEST, "0. Native focused window {0}",
-                         String.valueOf(nativeFocusedWindow));
+        if (focusLog.isLoggable(PlatformLogger.FINEST)) {
+            focusLog.finest("0. Current focus owner {0}",
+                            String.valueOf(currentFocusOwner));
+            focusLog.finest("0. Native focus owner {0}",
+                            String.valueOf(nativeFocusOwner));
+            focusLog.finest("0. Native focused window {0}",
+                            String.valueOf(nativeFocusedWindow));
         }
         synchronized (heavyweightRequests) {
             HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
-            if (focusLog.isLoggable(Level.FINEST)) {
-                focusLog.log(Level.FINEST, "Request {0}", String.valueOf(hwFocusRequest));
+            if (focusLog.isLoggable(PlatformLogger.FINEST)) {
+                focusLog.finest("Request {0}", String.valueOf(hwFocusRequest));
             }
             if (hwFocusRequest == null &&
                 heavyweight == nativeFocusOwner)
             {
                 if (descendant == currentFocusOwner) {
                     // Redundant request.
-                    if (focusLog.isLoggable(Level.FINEST))
-                        focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}",
-                                     String.valueOf(descendant));
+                    if (focusLog.isLoggable(PlatformLogger.FINEST))
+                        focusLog.finest("1. SNFH_FAILURE for {0}",
+                                        String.valueOf(descendant));
                     return SNFH_FAILURE;
                 }
 
@@ -2417,8 +2416,8 @@
                 // SunToolkit.postPriorityEvent(newFocusOwnerEvent);
                 SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
 
-                if (focusLog.isLoggable(Level.FINEST))
-                    focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant));
+                if (focusLog.isLoggable(PlatformLogger.FINEST))
+                    focusLog.finest("2. SNFH_HANDLED for {0}", String.valueOf(descendant));
                 return SNFH_SUCCESS_HANDLED;
             } else if (hwFocusRequest != null &&
                        hwFocusRequest.heavyweight == heavyweight) {
@@ -2431,7 +2430,7 @@
                     manager.enqueueKeyEvents(time, descendant);
                 }
 
-                if (focusLog.isLoggable(Level.FINEST))
+                if (focusLog.isLoggable(PlatformLogger.FINEST))
                     focusLog.finest("3. SNFH_HANDLED for lightweight" +
                                     descendant + " in " + heavyweight);
                 return SNFH_SUCCESS_HANDLED;
@@ -2454,7 +2453,7 @@
                                              (hwFocusRequest != null)
                                              ? hwFocusRequest.heavyweight
                                              : nativeFocusedWindow)) {
-                        if (focusLog.isLoggable(Level.FINEST))
+                        if (focusLog.isLoggable(PlatformLogger.FINEST))
                             focusLog.finest("4. SNFH_FAILURE for " + descendant);
                         return SNFH_FAILURE;
                     }
@@ -2464,7 +2463,7 @@
                 heavyweightRequests.add
                     (new HeavyweightFocusRequest(heavyweight, descendant,
                                                  temporary, cause));
-                if (focusLog.isLoggable(Level.FINEST))
+                if (focusLog.isLoggable(PlatformLogger.FINEST))
                     focusLog.finest("5. SNFH_PROCEED for " + descendant);
                 return SNFH_SUCCESS_PROCEED;
             }
@@ -2855,14 +2854,14 @@
         }
 
         KeyboardFocusManager manager = getCurrentKeyboardFocusManager();
-        if (focusLog.isLoggable(Level.FINER)) {
+        if (focusLog.isLoggable(PlatformLogger.FINER)) {
             if (event instanceof FocusEvent || event instanceof WindowEvent) {
-                focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)});
+                focusLog.finer(">>> {0}", String.valueOf(event));
             }
-            if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) {
-                focusLog.log(Level.FINER, "    focus owner is {0}",
-                                          new Object[] {String.valueOf(manager.getGlobalFocusOwner())});
-                focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)});
+            if (focusLog.isLoggable(PlatformLogger.FINER) && event instanceof KeyEvent) {
+                focusLog.finer("    focus owner is {0}",
+                               String.valueOf(manager.getGlobalFocusOwner()));
+                focusLog.finer(">>> {0}", String.valueOf(event));
             }
         }
 
@@ -2946,9 +2945,9 @@
         }
     }
     static void removeLastFocusRequest(Component heavyweight) {
-        if (log.isLoggable(Level.FINE)) {
+        if (log.isLoggable(PlatformLogger.FINE)) {
             if (heavyweight == null) {
-                log.log(Level.FINE, "Assertion (heavyweight != null) failed");
+                log.fine("Assertion (heavyweight != null) failed");
             }
         }
 
--- a/jdk/src/share/classes/java/awt/Window.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/awt/Window.java	Wed Jul 05 17:04:26 2017 +0200
@@ -148,6 +148,51 @@
 public class Window extends Container implements Accessible {
 
     /**
+     * Enumeration of available <i>window types</i>.
+     *
+     * A window type defines the generic visual appearance and behavior of a
+     * top-level window. For example, the type may affect the kind of
+     * decorations of a decorated {@code Frame} or {@code Dialog} instance.
+     * <p>
+     * Some platforms may not fully support a certain window type. Depending on
+     * the level of support, some properties of the window type may be
+     * disobeyed.
+     *
+     * @see   #getType
+     * @see   #setType
+     * @since 1.7
+     */
+    public static enum Type {
+        /**
+         * Represents a <i>normal</i> window.
+         *
+         * This is the default type for objects of the {@code Window} class or
+         * its descendants. Use this type for regular top-level windows.
+         */
+        NORMAL,
+
+        /**
+         * Represents a <i>utility</i> window.
+         *
+         * A utility window is usually a small window such as a toolbar or a
+         * palette. The native system may render the window with smaller
+         * title-bar if the window is either a {@code Frame} or a {@code
+         * Dialog} object, and if it has its decorations enabled.
+         */
+        UTILITY,
+
+        /**
+         * Represents a <i>popup</i> window.
+         *
+         * A popup window is a temporary window such as a drop-down menu or a
+         * tooltip. On some platforms, windows of that type may be forcibly
+         * made undecorated even if they are instances of the {@code Frame} or
+         * {@code Dialog} class, and have decorations enabled.
+         */
+        POPUP
+    }
+
+    /**
      * This represents the warning message that is
      * to be displayed in a non secure window. ie :
      * a window that has a security manager installed for
@@ -2718,6 +2763,52 @@
     }
 
     /**
+     * Window type.
+     *
+     * Synchronization: ObjectLock
+     */
+    private Type type = Type.NORMAL;
+
+    /**
+     * Sets the type of the window.
+     *
+     * This method can only be called while the window is not displayable.
+     *
+     * @throws IllegalComponentStateException if the window
+     *         is displayable.
+     * @throws IllegalArgumentException if the type is {@code null}
+     * @see    Component#isDisplayable
+     * @see    #getType
+     * @since 1.7
+     */
+    public void setType(Type type) {
+        if (type == null) {
+            throw new IllegalArgumentException("type should not be null.");
+        }
+        synchronized (getTreeLock()) {
+            if (isDisplayable()) {
+                throw new IllegalComponentStateException(
+                        "The window is displayable.");
+            }
+            synchronized (getObjectLock()) {
+                this.type = type;
+            }
+        }
+    }
+
+    /**
+     * Returns the type of the window.
+     *
+     * @see   #setType
+     * @since 1.7
+     */
+    public Type getType() {
+        synchronized (getObjectLock()) {
+            return type;
+        }
+    }
+
+    /**
      * The window serialized data version.
      *
      * @serial
@@ -3873,6 +3964,18 @@
             public void setLWRequestStatus(Window changed, boolean status) {
                 changed.syncLWRequests = status;
             }
+
+            public boolean isAutoRequestFocus(Window w) {
+                return w.autoRequestFocus;
+            }
+
+            public boolean isTrayIconWindow(Window w) {
+                return w.isTrayIconWindow;
+            }
+
+            public void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
+                w.isTrayIconWindow = isTrayIconWindow;
+            }
         }); // WindowAccessor
     } // static
 
--- a/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Wed Jul 05 17:04:26 2017 +0200
@@ -313,11 +313,14 @@
     }
 
     /**
-     * Gets the <code>Class</code> object of the indexed properties' type.
-     * The returned <code>Class</code> may describe a primitive type such as <code>int</code>.
+     * Returns the Java type info for the indexed property.
+     * Note that the {@code Class} object may describe
+     * primitive Java types such as {@code int}.
+     * This type is returned by the indexed read method
+     * or is used as the parameter type of the indexed write method.
      *
-     * @return The <code>Class</code> for the indexed properties' type; may return <code>null</code>
-     *         if the type cannot be determined.
+     * @return the {@code Class} object that represents the Java type info,
+     *         or {@code null} if the type cannot be determined
      */
     public synchronized Class<?> getIndexedPropertyType() {
         Class type = getIndexedPropertyType0();
--- a/jdk/src/share/classes/java/beans/Introspector.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/beans/Introspector.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,26 +25,19 @@
 
 package java.beans;
 
+import com.sun.beans.WeakCache;
 import com.sun.beans.finder.BeanInfoFinder;
 import com.sun.beans.finder.ClassFinder;
 
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
-
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import java.util.Collections;
 import java.util.Map;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.EventListener;
 import java.util.List;
-import java.util.WeakHashMap;
 import java.util.TreeMap;
 
 import sun.awt.AppContext;
@@ -85,20 +78,7 @@
  * patterns to identify property accessors, event sources, or public
  * methods.  We then proceed to analyze the class's superclass and add
  * in the information from it (and possibly on up the superclass chain).
- *
  * <p>
- * Because the Introspector caches BeanInfo classes for better performance,
- * take care if you use it in an application that uses
- * multiple class loaders.
- * In general, when you destroy a <code>ClassLoader</code>
- * that has been used to introspect classes,
- * you should use the
- * {@link #flushCaches <code>Introspector.flushCaches</code>}
- * or
- * {@link #flushFromCaches <code>Introspector.flushFromCaches</code>} method
- * to flush all of the introspected classes out of the cache.
- *
- * <P>
  * For more information about introspection and design patterns, please
  * consult the
  *  <a href="http://java.sun.com/products/javabeans/docs/index.html">JavaBeans specification</a>.
@@ -112,8 +92,8 @@
     public final static int IGNORE_ALL_BEANINFO        = 3;
 
     // Static Caches to speed up introspection.
-    private static Map declaredMethodCache =
-        Collections.synchronizedMap(new WeakHashMap());
+    private static WeakCache<Class<?>, Method[]> declaredMethodCache =
+            new WeakCache<Class<?>, Method[]>();
 
     private static final Object BEANINFO_CACHE = new Object();
 
@@ -174,20 +154,21 @@
         if (!ReflectUtil.isPackageAccessible(beanClass)) {
             return (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
         }
-        Map<Class<?>, BeanInfo> map;
         synchronized (BEANINFO_CACHE) {
-            map = (Map<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
-            if (map == null) {
-                map = Collections.synchronizedMap(new WeakHashMap<Class<?>, BeanInfo>());
-                AppContext.getAppContext().put(BEANINFO_CACHE, map);
+            WeakCache<Class<?>, BeanInfo> beanInfoCache =
+                    (WeakCache<Class<?>, BeanInfo>) AppContext.getAppContext().get(BEANINFO_CACHE);
+
+            if (beanInfoCache == null) {
+                beanInfoCache = new WeakCache<Class<?>, BeanInfo>();
+                AppContext.getAppContext().put(BEANINFO_CACHE, beanInfoCache);
             }
+            BeanInfo beanInfo = beanInfoCache.get(beanClass);
+            if (beanInfo == null) {
+                beanInfo = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
+                beanInfoCache.put(beanClass, beanInfo);
+            }
+            return beanInfo;
         }
-        BeanInfo bi = map.get(beanClass);
-        if (bi == null) {
-            bi = (new Introspector(beanClass, null, USE_ALL_BEANINFO)).getBeanInfo();
-            map.put(beanClass, bi);
-        }
-        return bi;
     }
 
     /**
@@ -359,11 +340,13 @@
      */
 
     public static void flushCaches() {
-        Map map = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
-        if (map != null) {
-            map.clear();
+        synchronized (BEANINFO_CACHE) {
+            WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
+            if (beanInfoCache != null) {
+                beanInfoCache.clear();
+            }
+            declaredMethodCache.clear();
         }
-        declaredMethodCache.clear();
     }
 
     /**
@@ -385,11 +368,13 @@
         if (clz == null) {
             throw new NullPointerException();
         }
-        Map map = (Map) AppContext.getAppContext().get(BEANINFO_CACHE);
-        if (map != null) {
-            map.remove(clz);
+        synchronized (BEANINFO_CACHE) {
+            WeakCache beanInfoCache = (WeakCache) AppContext.getAppContext().get(BEANINFO_CACHE);
+            if (beanInfoCache != null) {
+                beanInfoCache.put(clz, null);
+            }
+            declaredMethodCache.put(clz, null);
         }
-        declaredMethodCache.remove(clz);
     }
 
     //======================================================================
@@ -1272,41 +1257,26 @@
     /*
      * Internal method to return *public* methods within a class.
      */
-    private static synchronized Method[] getPublicDeclaredMethods(Class clz) {
+    private static Method[] getPublicDeclaredMethods(Class clz) {
         // Looking up Class.getDeclaredMethods is relatively expensive,
         // so we cache the results.
-        Method[] result = null;
         if (!ReflectUtil.isPackageAccessible(clz)) {
             return new Method[0];
         }
-        final Class fclz = clz;
-        Reference ref = (Reference)declaredMethodCache.get(fclz);
-        if (ref != null) {
-            result = (Method[])ref.get();
-            if (result != null) {
-                return result;
-            }
-        }
-
-        // We have to raise privilege for getDeclaredMethods
-        result = (Method[]) AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
-                    return fclz.getDeclaredMethods();
+        synchronized (BEANINFO_CACHE) {
+            Method[] result = declaredMethodCache.get(clz);
+            if (result == null) {
+                result = clz.getMethods();
+                for (int i = 0; i < result.length; i++) {
+                    Method method = result[i];
+                    if (!method.getDeclaringClass().equals(clz)) {
+                        result[i] = null;
+                    }
                 }
-            });
-
-
-        // Null out any non-public methods.
-        for (int i = 0; i < result.length; i++) {
-            Method method = result[i];
-            int mods = method.getModifiers();
-            if (!Modifier.isPublic(mods)) {
-                result[i] = null;
+                declaredMethodCache.put(clz, result);
             }
+            return result;
         }
-        // Add it to the cache.
-        declaredMethodCache.put(fclz, new SoftReference(result));
-        return result;
     }
 
     //======================================================================
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java	Wed Jul 05 17:04:26 2017 +0200
@@ -164,14 +164,16 @@
     }
 
     /**
-     * Gets the Class object for the property.
+     * Returns the Java type info for the property.
+     * Note that the {@code Class} object may describe
+     * primitive Java types such as {@code int}.
+     * This type is returned by the read method
+     * or is used as the parameter type of the write method.
+     * Returns {@code null} if the type is an indexed property
+     * that does not support non-indexed access.
      *
-     * @return The Java type info for the property.  Note that
-     * the "Class" object may describe a built-in Java type such as "int".
-     * The result may be "null" if this is an indexed property that
-     * does not support non-indexed access.
-     * <p>
-     * This is the type that will be returned by the ReadMethod.
+     * @return the {@code Class} object that represents the Java type info,
+     *         or {@code null} if the type cannot be determined
      */
     public synchronized Class<?> getPropertyType() {
         Class type = getPropertyType0();
--- a/jdk/src/share/classes/java/lang/ClassLoader.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/lang/ClassLoader.java	Wed Jul 05 17:04:26 2017 +0200
@@ -175,15 +175,8 @@
 public abstract class ClassLoader {
 
     private static native void registerNatives();
-
-    // Set of classes which are registered as parallel capable class loaders
-    private static final Set<Class<? extends ClassLoader>> parallelLoaders
-        = Collections.newSetFromMap(Collections.synchronizedMap
-              (new WeakHashMap<Class<? extends ClassLoader>, Boolean>()));
-
     static {
         registerNatives();
-        parallelLoaders.add(ClassLoader.class);
     }
 
     // The parent class loader for delegation
@@ -191,6 +184,52 @@
     // must be added *after* it.
     private final ClassLoader parent;
 
+    /**
+     * Encapsulates the set of parallel capable loader types.
+     */
+    private static class ParallelLoaders {
+        private ParallelLoaders() {}
+
+        // the set of parallel capable loader types
+        private static final Set<Class<? extends ClassLoader>> loaderTypes =
+            Collections.newSetFromMap(
+                new WeakHashMap<Class<? extends ClassLoader>, Boolean>());
+        static {
+            synchronized (loaderTypes) { loaderTypes.add(ClassLoader.class); }
+        }
+
+        /**
+         * Registers the given class loader type as parallel capabale.
+         * Returns {@code true} is successfully registered; {@code false} if
+         * loader's super class is not registered.
+         */
+        static boolean register(Class<? extends ClassLoader> c) {
+            synchronized (loaderTypes) {
+                if (loaderTypes.contains(c.getSuperclass())) {
+                    // register the class loader as parallel capable
+                    // if and only if all of its super classes are.
+                    // Note: given current classloading sequence, if
+                    // the immediate super class is parallel capable,
+                    // all the super classes higher up must be too.
+                    loaderTypes.add(c);
+                    return true;
+                } else {
+                    return false;
+                }
+            }
+        }
+
+        /**
+         * Returns {@code true} if the given class loader type is
+         * registered as parallel capable.
+         */
+        static boolean isRegistered(Class<? extends ClassLoader> c) {
+            synchronized (loaderTypes) {
+                return loaderTypes.contains(c);
+            }
+        }
+    }
+
     // Maps class name to the corresponding lock object when the current
     // class loader is parallel capable.
     // Note: VM also uses this field to decide if the current class loader
@@ -237,7 +276,7 @@
 
     private ClassLoader(Void unused, ClassLoader parent) {
         this.parent = parent;
-        if (parallelLoaders.contains(this.getClass())) {
+        if (ParallelLoaders.isRegistered(this.getClass())) {
             parallelLockMap = new ConcurrentHashMap<String, Object>();
             package2certs = new ConcurrentHashMap<String, Certificate[]>();
             domains =
@@ -1194,24 +1233,7 @@
      * @since   1.7
      */
     protected static boolean registerAsParallelCapable() {
-        Class<? extends ClassLoader> caller = getCaller(1);
-        Class superCls = caller.getSuperclass();
-        boolean result = false;
-        // Explicit synchronization needed for composite action
-        synchronized (parallelLoaders) {
-            if (!parallelLoaders.contains(caller)) {
-                if (parallelLoaders.contains(superCls)) {
-                    // register the immediate caller as parallel capable
-                    // if and only if all of its super classes are.
-                    // Note: given current classloading sequence, if
-                    // the immediate super class is parallel capable,
-                    // all the super classes higher up must be too.
-                    result = true;
-                    parallelLoaders.add(caller);
-                }
-            } else result = true;
-        }
-        return result;
+        return ParallelLoaders.register(getCaller(1));
     }
 
     /**
@@ -2174,4 +2196,3 @@
         return sys;
     }
 }
-
--- a/jdk/src/share/classes/java/lang/System.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/lang/System.java	Wed Jul 05 17:04:26 2017 +0200
@@ -620,6 +620,20 @@
     }
 
     /**
+     * Returns the system-dependent line separator string.  It always
+     * returns the same value - the initial value of the {@linkplain
+     * #getProperty(String) system property} {@code line.separator}.
+     *
+     * <p>On UNIX systems, it returns {@code "\n"}; on Microsoft
+     * Windows systems it returns {@code "\r\n"}.
+     */
+    public static String lineSeparator() {
+        return lineSeparator;
+    }
+
+    private static String lineSeparator;
+
+    /**
      * Sets the system properties to the <code>Properties</code>
      * argument.
      * <p>
@@ -1104,6 +1118,7 @@
     private static void initializeSystemClass() {
         props = new Properties();
         initProperties(props);
+        lineSeparator = props.getProperty("line.separator");
         sun.misc.Version.init();
 
         // Workaround until DownloadManager initialization is revisited.
@@ -1192,7 +1207,7 @@
     }
 
     /* returns the class of the caller. */
-    static Class getCallerClass() {
+    static Class<?> getCallerClass() {
         // NOTE use of more generic Reflection.getCallerClass()
         return Reflection.getCallerClass(3);
     }
--- a/jdk/src/share/classes/java/net/CookieManager.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/net/CookieManager.java	Wed Jul 05 17:04:26 2017 +0200
@@ -30,6 +30,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.io.IOException;
+import sun.util.logging.PlatformLogger;
 
 /**
  * CookieManager provides a concrete implementation of {@link CookieHandler},
@@ -263,6 +264,7 @@
         if (cookieJar == null)
             return;
 
+    PlatformLogger logger = PlatformLogger.getLogger("java.net.CookieManager");
         for (String headerKey : responseHeaders.keySet()) {
             // RFC 2965 3.2.2, key must be 'Set-Cookie2'
             // we also accept 'Set-Cookie' here for backward compatibility
@@ -277,7 +279,16 @@
 
             for (String headerValue : responseHeaders.get(headerKey)) {
                 try {
-                    List<HttpCookie> cookies = HttpCookie.parse(headerValue);
+                    List<HttpCookie> cookies;
+                    try {
+                        cookies = HttpCookie.parse(headerValue);
+                    } catch (IllegalArgumentException e) {
+                        // Bogus header, make an empty list and log the error
+                        cookies = java.util.Collections.EMPTY_LIST;
+                        if (logger.isLoggable(PlatformLogger.SEVERE)) {
+                            logger.severe("Invalid cookie for " + uri + ": " + headerValue);
+                        }
+                    }
                     for (HttpCookie cookie : cookies) {
                         if (cookie.getPath() == null) {
                             // If no path is specified, then by default
--- a/jdk/src/share/classes/java/net/HttpCookie.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/net/HttpCookie.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1036,7 +1036,7 @@
                         int version = Integer.parseInt(attrValue);
                         cookie.setVersion(version);
                     } catch (NumberFormatException ignored) {
-                        throw new IllegalArgumentException("Illegal cookie version attribute");
+                        // Just ignore bogus version, it will default to 0 or 1
                     }
                 }
             });
@@ -1147,12 +1147,15 @@
     }
 
     private static String stripOffSurroundingQuote(String str) {
-        if (str != null && str.length() > 0 &&
+        if (str != null && str.length() > 2 &&
             str.charAt(0) == '"' && str.charAt(str.length() - 1) == '"') {
             return str.substring(1, str.length() - 1);
-        } else {
-            return str;
         }
+        if (str != null && str.length() > 2 &&
+            str.charAt(0) == '\'' && str.charAt(str.length() - 1) == '\'') {
+            return str.substring(1, str.length() - 1);
+        }
+        return str;
     }
 
     private static boolean equalsIgnoreCase(String s, String t) {
--- a/jdk/src/share/classes/java/nio/channels/Selector.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/nio/channels/Selector.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,6 +25,7 @@
 
 package java.nio.channels;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.nio.channels.spi.SelectorProvider;
 import java.util.Set;
@@ -202,7 +203,7 @@
  * @see SelectionKey
  */
 
-public abstract class Selector {
+public abstract class Selector implements Closeable {
 
     /**
      * Initializes a new instance of this class.
--- a/jdk/src/share/classes/java/util/DualPivotQuicksort.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/util/DualPivotQuicksort.java	Wed Jul 05 17:04:26 2017 +0200
@@ -36,12 +36,12 @@
  * @author Jon Bentley
  * @author Josh Bloch
  *
- * @version 2009.11.16 m765.827.v12a
+ * @version 2009.11.29 m765.827.12i
  */
 final class DualPivotQuicksort {
 
     /**
-     * Suppresses default constructor.
+     * Prevents instantiation.
      */
     private DualPivotQuicksort() {}
 
@@ -84,7 +84,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty.
+     * the range to be sorted is empty (and the call is a no-op).
      *
      * @param a the array to be sorted
      * @param fromIndex the index of the first element, inclusive, to be sorted
@@ -101,8 +101,8 @@
     /**
      * Sorts the specified range of the array into ascending order. This
      * method differs from the public {@code sort} method in that the
-     * {@code right} index is inclusive, and it does no range checking on
-     * {@code left} or {@code right}.
+     * {@code right} index is inclusive, and it does no range checking
+     * on {@code left} or {@code right}.
      *
      * @param a the array to be sorted
      * @param left the index of the first element, inclusive, to be sorted
@@ -111,13 +111,13 @@
     private static void doSort(int[] a, int left, int right) {
         // Use insertion sort on tiny arrays
         if (right - left + 1 < INSERTION_SORT_THRESHOLD) {
-            for (int k = left + 1; k <= right; k++) {
-                int ak = a[k];
+            for (int i = left + 1; i <= right; i++) {
+                int ai = a[i];
                 int j;
-                for (j = k - 1; j >= left && ak < a[j]; j--) {
+                for (j = i - 1; j >= left && ai < a[j]; j--) {
                     a[j + 1] = a[j];
                 }
-                a[j + 1] = ak;
+                a[j + 1] = ai;
             }
         } else { // Use Dual-Pivot Quicksort on large arrays
             dualPivotQuicksort(a, left, right);
@@ -162,7 +162,7 @@
          * second terciles of the array. Note that pivot1 <= pivot2.
          *
          * The pivots are stored in local variables, and the first and
-         * the last of the sorted elements are moved to the locations
+         * the last of the elements to be sorted are moved to the locations
          * formerly occupied by the pivots. When partitioning is complete,
          * the pivots are swapped back into their final positions, and
          * excluded from subsequent sorting.
@@ -170,27 +170,26 @@
         int pivot1 = ae2; a[e2] = a[left];
         int pivot2 = ae4; a[e4] = a[right];
 
-        /*
-         * Partitioning
-         *
-         *   left part         center part                  right part
-         * ------------------------------------------------------------
-         * [ < pivot1  |  pivot1 <= && <= pivot2  |   ?   |  > pivot2 ]
-         * ------------------------------------------------------------
-         *              ^                          ^     ^
-         *              |                          |     |
-         *             less                        k   great
-         */
-
         // Pointers
         int less  = left  + 1; // The index of first element of center part
         int great = right - 1; // The index before first element of right part
 
-        boolean pivotsDiffer = pivot1 != pivot2;
+        boolean pivotsDiffer = (pivot1 != pivot2);
 
         if (pivotsDiffer) {
             /*
+             * Partitioning:
+             *
+             *   left part         center part                    right part
+             * +------------------------------------------------------------+
+             * | < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2 |
+             * +------------------------------------------------------------+
+             *              ^                          ^       ^
+             *              |                          |       |
+             *             less                        k     great
+             *
              * Invariants:
+             *
              *              all in (left, less)   < pivot1
              *    pivot1 <= all in [less, k)     <= pivot2
              *              all in (great, right) > pivot2
@@ -200,37 +199,37 @@
             outer:
             for (int k = less; k <= great; k++) {
                 int ak = a[k];
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else if (ak > pivot2) {
+                } else if (ak > pivot2) { // Move a[k] to right part
                     while (a[great] > pivot2) {
-                        if (k == great--) {
+                        if (great-- == k) {
                             break outer;
                         }
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) < pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                        a[great--] = ak;
                     }
                 }
             }
         } else { // Pivots are equal
             /*
-             * Partition degenerates to the traditional 3-way
-             * (or "Dutch National Flag") partition:
+             * Partition degenerates to the traditional 3-way,
+             * or "Dutch National Flag", partition:
              *
              *   left part   center part            right part
-             * -------------------------------------------------
-             * [  < pivot  |  == pivot  |    ?    |  > pivot   ]
-             * -------------------------------------------------
-             *
+             * +----------------------------------------------+
+             * |  < pivot  |  == pivot  |    ?    |  > pivot  |
+             * +----------------------------------------------+
              *              ^            ^       ^
              *              |            |       |
              *             less          k     great
@@ -243,30 +242,34 @@
              *
              * Pointer k is the first index of ?-part
              */
-            outer:
             for (int k = less; k <= great; k++) {
                 int ak = a[k];
                 if (ak == pivot1) {
                     continue;
                 }
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else { // a[k] > pivot
+                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                    /*
+                     * We know that pivot1 == a[e3] == pivot2. Thus, we know
+                     * that great will still be >= k when the following loop
+                     * terminates, even though we don't test for it explicitly.
+                     * In other words, a[e3] acts as a sentinel for great.
+                     */
                     while (a[great] > pivot1) {
-                        if (k == great--) {
-                            break outer;
-                        }
+                        great--;
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // a[great] == pivot1
+                        a[k] = pivot1;
+                        a[great--] = ak;
                     }
                 }
             }
@@ -289,26 +292,55 @@
         }
 
         /*
-         * If center part is too large (comprises > 5/6 of
-         * the array), swap internal pivot values to ends
+         * If center part is too large (comprises > 2/3 of the array),
+         * swap internal pivot values to ends
          */
-        if (less < e1 && e5 < great) {
+        if (less < e1 && great > e5) {
             while (a[less] == pivot1) {
                 less++;
             }
             while (a[great] == pivot2) {
                 great--;
             }
-            for (int k = less + 1; k <= great; ) {
+
+            /*
+             * Partitioning:
+             *
+             *   left part       center part                   right part
+             * +----------------------------------------------------------+
+             * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+             * +----------------------------------------------------------+
+             *              ^                        ^       ^
+             *              |                        |       |
+             *             less                      k     great
+             *
+             * Invariants:
+             *
+             *              all in (*, less)  == pivot1
+             *     pivot1 < all in [less, k)   < pivot2
+             *              all in (great, *) == pivot2
+             *
+             * Pointer k is the first index of ?-part
+             */
+            outer:
+            for (int k = less; k <= great; k++) {
                 int ak = a[k];
-                if (ak == pivot1) {
-                    a[k++] = a[less];
+                if (ak == pivot2) { // Move a[k] to right part
+                    while (a[great] == pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] == pivot1) {
+                        a[k] = a[less];
+                        a[less++] = pivot1;
+                    } else { // pivot1 < a[great] < pivot2
+                        a[k] = a[great];
+                    }
+                    a[great--] = pivot2;
+                } else if (ak == pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
                     a[less++] = pivot1;
-                } else if (ak == pivot2) {
-                    a[k] = a[great];
-                    a[great--] = pivot2;
-                } else {
-                    k++;
                 }
             }
         }
@@ -330,7 +362,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty.
+     * the range to be sorted is empty (and the call is a no-op).
      *
      * @param a the array to be sorted
      * @param fromIndex the index of the first element, inclusive, to be sorted
@@ -357,13 +389,13 @@
     private static void doSort(long[] a, int left, int right) {
         // Use insertion sort on tiny arrays
         if (right - left + 1 < INSERTION_SORT_THRESHOLD) {
-            for (int k = left + 1; k <= right; k++) {
-                long ak = a[k];
+            for (int i = left + 1; i <= right; i++) {
+                long ai = a[i];
                 int j;
-                for (j = k - 1; j >= left && ak < a[j]; j--) {
+                for (j = i - 1; j >= left && ai < a[j]; j--) {
                     a[j + 1] = a[j];
                 }
-                a[j + 1] = ak;
+                a[j + 1] = ai;
             }
         } else { // Use Dual-Pivot Quicksort on large arrays
             dualPivotQuicksort(a, left, right);
@@ -408,7 +440,7 @@
          * second terciles of the array. Note that pivot1 <= pivot2.
          *
          * The pivots are stored in local variables, and the first and
-         * the last of the sorted elements are moved to the locations
+         * the last of the elements to be sorted are moved to the locations
          * formerly occupied by the pivots. When partitioning is complete,
          * the pivots are swapped back into their final positions, and
          * excluded from subsequent sorting.
@@ -416,27 +448,26 @@
         long pivot1 = ae2; a[e2] = a[left];
         long pivot2 = ae4; a[e4] = a[right];
 
-        /*
-         * Partitioning
-         *
-         *   left part         center part                  right part
-         * ------------------------------------------------------------
-         * [ < pivot1  |  pivot1 <= && <= pivot2  |   ?   |  > pivot2 ]
-         * ------------------------------------------------------------
-         *              ^                          ^     ^
-         *              |                          |     |
-         *             less                        k   great
-         */
-
         // Pointers
         int less  = left  + 1; // The index of first element of center part
         int great = right - 1; // The index before first element of right part
 
-        boolean pivotsDiffer = pivot1 != pivot2;
+        boolean pivotsDiffer = (pivot1 != pivot2);
 
         if (pivotsDiffer) {
             /*
+             * Partitioning:
+             *
+             *   left part         center part                    right part
+             * +------------------------------------------------------------+
+             * | < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2 |
+             * +------------------------------------------------------------+
+             *              ^                          ^       ^
+             *              |                          |       |
+             *             less                        k     great
+             *
              * Invariants:
+             *
              *              all in (left, less)   < pivot1
              *    pivot1 <= all in [less, k)     <= pivot2
              *              all in (great, right) > pivot2
@@ -446,37 +477,37 @@
             outer:
             for (int k = less; k <= great; k++) {
                 long ak = a[k];
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else if (ak > pivot2) {
+                } else if (ak > pivot2) { // Move a[k] to right part
                     while (a[great] > pivot2) {
-                        if (k == great--) {
+                        if (great-- == k) {
                             break outer;
                         }
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                        a[great--] = ak;
                     }
                 }
             }
         } else { // Pivots are equal
             /*
-             * Partition degenerates to the traditional 3-way
-             * (or "Dutch National Flag") partition:
+             * Partition degenerates to the traditional 3-way,
+             * or "Dutch National Flag", partition:
              *
              *   left part   center part            right part
-             * -------------------------------------------------
-             * [  < pivot  |  == pivot  |    ?    |  > pivot   ]
-             * -------------------------------------------------
-             *
+             * +----------------------------------------------+
+             * |  < pivot  |  == pivot  |    ?    |  > pivot  |
+             * +----------------------------------------------+
              *              ^            ^       ^
              *              |            |       |
              *             less          k     great
@@ -489,30 +520,34 @@
              *
              * Pointer k is the first index of ?-part
              */
-            outer:
             for (int k = less; k <= great; k++) {
                 long ak = a[k];
                 if (ak == pivot1) {
                     continue;
                 }
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else { // a[k] > pivot
+                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                    /*
+                     * We know that pivot1 == a[e3] == pivot2. Thus, we know
+                     * that great will still be >= k when the following loop
+                     * terminates, even though we don't test for it explicitly.
+                     * In other words, a[e3] acts as a sentinel for great.
+                     */
                     while (a[great] > pivot1) {
-                        if (k == great--) {
-                            break outer;
-                        }
+                        great--;
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // a[great] == pivot1
+                        a[k] = pivot1;
+                        a[great--] = ak;
                     }
                 }
             }
@@ -535,26 +570,55 @@
         }
 
         /*
-         * If center part is too large (comprises > 5/6 of
-         * the array), swap internal pivot values to ends
+         * If center part is too large (comprises > 2/3 of the array),
+         * swap internal pivot values to ends
          */
-        if (less < e1 && e5 < great) {
+        if (less < e1 && great > e5) {
             while (a[less] == pivot1) {
                 less++;
             }
             while (a[great] == pivot2) {
                 great--;
             }
-            for (int k = less + 1; k <= great; ) {
+
+            /*
+             * Partitioning:
+             *
+             *   left part       center part                   right part
+             * +----------------------------------------------------------+
+             * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+             * +----------------------------------------------------------+
+             *              ^                        ^       ^
+             *              |                        |       |
+             *             less                      k     great
+             *
+             * Invariants:
+             *
+             *              all in (*, less)  == pivot1
+             *     pivot1 < all in [less, k)   < pivot2
+             *              all in (great, *) == pivot2
+             *
+             * Pointer k is the first index of ?-part
+             */
+            outer:
+            for (int k = less; k <= great; k++) {
                 long ak = a[k];
-                if (ak == pivot1) {
-                    a[k++] = a[less];
+                if (ak == pivot2) { // Move a[k] to right part
+                    while (a[great] == pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] == pivot1) {
+                        a[k] = a[less];
+                        a[less++] = pivot1;
+                    } else { // pivot1 < a[great] < pivot2
+                        a[k] = a[great];
+                    }
+                    a[great--] = pivot2;
+                } else if (ak == pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
                     a[less++] = pivot1;
-                } else if (ak == pivot2) {
-                    a[k] = a[great];
-                    a[great--] = pivot2;
-                } else {
-                    k++;
                 }
             }
         }
@@ -576,7 +640,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty.
+     * the range to be sorted is empty (and the call is a no-op).
      *
      * @param a the array to be sorted
      * @param fromIndex the index of the first element, inclusive, to be sorted
@@ -606,13 +670,13 @@
     private static void doSort(short[] a, int left, int right) {
         // Use insertion sort on tiny arrays
         if (right - left + 1 < INSERTION_SORT_THRESHOLD) {
-            for (int k = left + 1; k <= right; k++) {
-                short ak = a[k];
+            for (int i = left + 1; i <= right; i++) {
+                short ai = a[i];
                 int j;
-                for (j = k - 1; j >= left && ak < a[j]; j--) {
+                for (j = i - 1; j >= left && ai < a[j]; j--) {
                     a[j + 1] = a[j];
                 }
-                a[j + 1] = ak;
+                a[j + 1] = ai;
             }
         } else if (right-left+1 > COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR) {
             // Use counting sort on huge arrays
@@ -671,7 +735,7 @@
          * second terciles of the array. Note that pivot1 <= pivot2.
          *
          * The pivots are stored in local variables, and the first and
-         * the last of the sorted elements are moved to the locations
+         * the last of the elements to be sorted are moved to the locations
          * formerly occupied by the pivots. When partitioning is complete,
          * the pivots are swapped back into their final positions, and
          * excluded from subsequent sorting.
@@ -679,27 +743,26 @@
         short pivot1 = ae2; a[e2] = a[left];
         short pivot2 = ae4; a[e4] = a[right];
 
-        /*
-         * Partitioning
-         *
-         *   left part         center part                  right part
-         * ------------------------------------------------------------
-         * [ < pivot1  |  pivot1 <= && <= pivot2  |   ?   |  > pivot2 ]
-         * ------------------------------------------------------------
-         *              ^                          ^     ^
-         *              |                          |     |
-         *             less                        k   great
-         */
-
         // Pointers
         int less  = left  + 1; // The index of first element of center part
         int great = right - 1; // The index before first element of right part
 
-        boolean pivotsDiffer = pivot1 != pivot2;
+        boolean pivotsDiffer = (pivot1 != pivot2);
 
         if (pivotsDiffer) {
             /*
+             * Partitioning:
+             *
+             *   left part         center part                    right part
+             * +------------------------------------------------------------+
+             * | < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2 |
+             * +------------------------------------------------------------+
+             *              ^                          ^       ^
+             *              |                          |       |
+             *             less                        k     great
+             *
              * Invariants:
+             *
              *              all in (left, less)   < pivot1
              *    pivot1 <= all in [less, k)     <= pivot2
              *              all in (great, right) > pivot2
@@ -709,37 +772,37 @@
             outer:
             for (int k = less; k <= great; k++) {
                 short ak = a[k];
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else if (ak > pivot2) {
+                } else if (ak > pivot2) { // Move a[k] to right part
                     while (a[great] > pivot2) {
-                        if (k == great--) {
+                        if (great-- == k) {
                             break outer;
                         }
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                        a[great--] = ak;
                     }
                 }
             }
         } else { // Pivots are equal
             /*
-             * Partition degenerates to the traditional 3-way
-             * (or "Dutch National Flag") partition:
+             * Partition degenerates to the traditional 3-way,
+             * or "Dutch National Flag", partition:
              *
              *   left part   center part            right part
-             * -------------------------------------------------
-             * [  < pivot  |  == pivot  |    ?    |  > pivot   ]
-             * -------------------------------------------------
-             *
+             * +----------------------------------------------+
+             * |  < pivot  |  == pivot  |    ?    |  > pivot  |
+             * +----------------------------------------------+
              *              ^            ^       ^
              *              |            |       |
              *             less          k     great
@@ -752,30 +815,34 @@
              *
              * Pointer k is the first index of ?-part
              */
-            outer:
             for (int k = less; k <= great; k++) {
                 short ak = a[k];
                 if (ak == pivot1) {
                     continue;
                 }
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else { // a[k] > pivot
+                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                    /*
+                     * We know that pivot1 == a[e3] == pivot2. Thus, we know
+                     * that great will still be >= k when the following loop
+                     * terminates, even though we don't test for it explicitly.
+                     * In other words, a[e3] acts as a sentinel for great.
+                     */
                     while (a[great] > pivot1) {
-                        if (k == great--) {
-                            break outer;
-                        }
+                        great--;
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // a[great] == pivot1
+                        a[k] = pivot1;
+                        a[great--] = ak;
                     }
                 }
             }
@@ -798,26 +865,55 @@
         }
 
         /*
-         * If center part is too large (comprises > 5/6 of
-         * the array), swap internal pivot values to ends
+         * If center part is too large (comprises > 2/3 of the array),
+         * swap internal pivot values to ends
          */
-        if (less < e1 && e5 < great) {
+        if (less < e1 && great > e5) {
             while (a[less] == pivot1) {
                 less++;
             }
             while (a[great] == pivot2) {
                 great--;
             }
-            for (int k = less + 1; k <= great; ) {
+
+            /*
+             * Partitioning:
+             *
+             *   left part       center part                   right part
+             * +----------------------------------------------------------+
+             * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+             * +----------------------------------------------------------+
+             *              ^                        ^       ^
+             *              |                        |       |
+             *             less                      k     great
+             *
+             * Invariants:
+             *
+             *              all in (*, less)  == pivot1
+             *     pivot1 < all in [less, k)   < pivot2
+             *              all in (great, *) == pivot2
+             *
+             * Pointer k is the first index of ?-part
+             */
+            outer:
+            for (int k = less; k <= great; k++) {
                 short ak = a[k];
-                if (ak == pivot1) {
-                    a[k++] = a[less];
+                if (ak == pivot2) { // Move a[k] to right part
+                    while (a[great] == pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] == pivot1) {
+                        a[k] = a[less];
+                        a[less++] = pivot1;
+                    } else { // pivot1 < a[great] < pivot2
+                        a[k] = a[great];
+                    }
+                    a[great--] = pivot2;
+                } else if (ak == pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
                     a[less++] = pivot1;
-                } else if (ak == pivot2) {
-                    a[k] = a[great];
-                    a[great--] = pivot2;
-                } else {
-                    k++;
                 }
             }
         }
@@ -839,7 +935,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty.
+     * the range to be sorted is empty (and the call is a no-op).
      *
      * @param a the array to be sorted
      * @param fromIndex the index of the first element, inclusive, to be sorted
@@ -869,13 +965,13 @@
     private static void doSort(char[] a, int left, int right) {
         // Use insertion sort on tiny arrays
         if (right - left + 1 < INSERTION_SORT_THRESHOLD) {
-            for (int k = left + 1; k <= right; k++) {
-                char ak = a[k];
+            for (int i = left + 1; i <= right; i++) {
+                char ai = a[i];
                 int j;
-                for (j = k - 1; j >= left && ak < a[j]; j--) {
+                for (j = i - 1; j >= left && ai < a[j]; j--) {
                     a[j + 1] = a[j];
                 }
-                a[j + 1] = ak;
+                a[j + 1] = ai;
             }
         } else if (right-left+1 > COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR) {
             // Use counting sort on huge arrays
@@ -932,7 +1028,7 @@
          * second terciles of the array. Note that pivot1 <= pivot2.
          *
          * The pivots are stored in local variables, and the first and
-         * the last of the sorted elements are moved to the locations
+         * the last of the elements to be sorted are moved to the locations
          * formerly occupied by the pivots. When partitioning is complete,
          * the pivots are swapped back into their final positions, and
          * excluded from subsequent sorting.
@@ -940,27 +1036,26 @@
         char pivot1 = ae2; a[e2] = a[left];
         char pivot2 = ae4; a[e4] = a[right];
 
-        /*
-         * Partitioning
-         *
-         *   left part         center part                  right part
-         * ------------------------------------------------------------
-         * [ < pivot1  |  pivot1 <= && <= pivot2  |   ?   |  > pivot2 ]
-         * ------------------------------------------------------------
-         *              ^                          ^     ^
-         *              |                          |     |
-         *             less                        k   great
-         */
-
         // Pointers
         int less  = left  + 1; // The index of first element of center part
         int great = right - 1; // The index before first element of right part
 
-        boolean pivotsDiffer = pivot1 != pivot2;
+        boolean pivotsDiffer = (pivot1 != pivot2);
 
         if (pivotsDiffer) {
             /*
+             * Partitioning:
+             *
+             *   left part         center part                    right part
+             * +------------------------------------------------------------+
+             * | < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2 |
+             * +------------------------------------------------------------+
+             *              ^                          ^       ^
+             *              |                          |       |
+             *             less                        k     great
+             *
              * Invariants:
+             *
              *              all in (left, less)   < pivot1
              *    pivot1 <= all in [less, k)     <= pivot2
              *              all in (great, right) > pivot2
@@ -970,37 +1065,37 @@
             outer:
             for (int k = less; k <= great; k++) {
                 char ak = a[k];
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else if (ak > pivot2) {
+                } else if (ak > pivot2) { // Move a[k] to right part
                     while (a[great] > pivot2) {
-                        if (k == great--) {
+                        if (great-- == k) {
                             break outer;
                         }
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                        a[great--] = ak;
                     }
                 }
             }
         } else { // Pivots are equal
             /*
-             * Partition degenerates to the traditional 3-way
-             * (or "Dutch National Flag") partition:
+             * Partition degenerates to the traditional 3-way,
+             * or "Dutch National Flag", partition:
              *
              *   left part   center part            right part
-             * -------------------------------------------------
-             * [  < pivot  |  == pivot  |    ?    |  > pivot   ]
-             * -------------------------------------------------
-             *
+             * +----------------------------------------------+
+             * |  < pivot  |  == pivot  |    ?    |  > pivot  |
+             * +----------------------------------------------+
              *              ^            ^       ^
              *              |            |       |
              *             less          k     great
@@ -1013,30 +1108,34 @@
              *
              * Pointer k is the first index of ?-part
              */
-            outer:
             for (int k = less; k <= great; k++) {
                 char ak = a[k];
                 if (ak == pivot1) {
                     continue;
                 }
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else { // a[k] > pivot
+                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                    /*
+                     * We know that pivot1 == a[e3] == pivot2. Thus, we know
+                     * that great will still be >= k when the following loop
+                     * terminates, even though we don't test for it explicitly.
+                     * In other words, a[e3] acts as a sentinel for great.
+                     */
                     while (a[great] > pivot1) {
-                        if (k == great--) {
-                            break outer;
-                        }
+                        great--;
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // a[great] == pivot1
+                        a[k] = pivot1;
+                        a[great--] = ak;
                     }
                 }
             }
@@ -1059,26 +1158,55 @@
         }
 
         /*
-         * If center part is too large (comprises > 5/6 of
-         * the array), swap internal pivot values to ends
+         * If center part is too large (comprises > 2/3 of the array),
+         * swap internal pivot values to ends
          */
-        if (less < e1 && e5 < great) {
+        if (less < e1 && great > e5) {
             while (a[less] == pivot1) {
                 less++;
             }
             while (a[great] == pivot2) {
                 great--;
             }
-            for (int k = less + 1; k <= great; ) {
+
+            /*
+             * Partitioning:
+             *
+             *   left part       center part                   right part
+             * +----------------------------------------------------------+
+             * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+             * +----------------------------------------------------------+
+             *              ^                        ^       ^
+             *              |                        |       |
+             *             less                      k     great
+             *
+             * Invariants:
+             *
+             *              all in (*, less)  == pivot1
+             *     pivot1 < all in [less, k)   < pivot2
+             *              all in (great, *) == pivot2
+             *
+             * Pointer k is the first index of ?-part
+             */
+            outer:
+            for (int k = less; k <= great; k++) {
                 char ak = a[k];
-                if (ak == pivot1) {
-                    a[k++] = a[less];
+                if (ak == pivot2) { // Move a[k] to right part
+                    while (a[great] == pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] == pivot1) {
+                        a[k] = a[less];
+                        a[less++] = pivot1;
+                    } else { // pivot1 < a[great] < pivot2
+                        a[k] = a[great];
+                    }
+                    a[great--] = pivot2;
+                } else if (ak == pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
                     a[less++] = pivot1;
-                } else if (ak == pivot2) {
-                    a[k] = a[great];
-                    a[great--] = pivot2;
-                } else {
-                    k++;
                 }
             }
         }
@@ -1100,7 +1228,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty.
+     * the range to be sorted is empty (and the call is a no-op).
      *
      * @param a the array to be sorted
      * @param fromIndex the index of the first element, inclusive, to be sorted
@@ -1130,13 +1258,13 @@
     private static void doSort(byte[] a, int left, int right) {
         // Use insertion sort on tiny arrays
         if (right - left + 1 < INSERTION_SORT_THRESHOLD) {
-            for (int k = left + 1; k <= right; k++) {
-                byte ak = a[k];
+            for (int i = left + 1; i <= right; i++) {
+                byte ai = a[i];
                 int j;
-                for (j = k - 1; j >= left && ak < a[j]; j--) {
+                for (j = i - 1; j >= left && ai < a[j]; j--) {
                     a[j + 1] = a[j];
                 }
-                a[j + 1] = ak;
+                a[j + 1] = ai;
             }
         } else if (right - left + 1 > COUNTING_SORT_THRESHOLD_FOR_BYTE) {
             // Use counting sort on huge arrays
@@ -1195,7 +1323,7 @@
          * second terciles of the array. Note that pivot1 <= pivot2.
          *
          * The pivots are stored in local variables, and the first and
-         * the last of the sorted elements are moved to the locations
+         * the last of the elements to be sorted are moved to the locations
          * formerly occupied by the pivots. When partitioning is complete,
          * the pivots are swapped back into their final positions, and
          * excluded from subsequent sorting.
@@ -1203,27 +1331,26 @@
         byte pivot1 = ae2; a[e2] = a[left];
         byte pivot2 = ae4; a[e4] = a[right];
 
-        /*
-         * Partitioning
-         *
-         *   left part         center part                  right part
-         * ------------------------------------------------------------
-         * [ < pivot1  |  pivot1 <= && <= pivot2  |   ?   |  > pivot2 ]
-         * ------------------------------------------------------------
-         *              ^                          ^     ^
-         *              |                          |     |
-         *             less                        k   great
-         */
-
         // Pointers
         int less  = left  + 1; // The index of first element of center part
         int great = right - 1; // The index before first element of right part
 
-        boolean pivotsDiffer = pivot1 != pivot2;
+        boolean pivotsDiffer = (pivot1 != pivot2);
 
         if (pivotsDiffer) {
             /*
+             * Partitioning:
+             *
+             *   left part         center part                    right part
+             * +------------------------------------------------------------+
+             * | < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2 |
+             * +------------------------------------------------------------+
+             *              ^                          ^       ^
+             *              |                          |       |
+             *             less                        k     great
+             *
              * Invariants:
+             *
              *              all in (left, less)   < pivot1
              *    pivot1 <= all in [less, k)     <= pivot2
              *              all in (great, right) > pivot2
@@ -1233,37 +1360,37 @@
             outer:
             for (int k = less; k <= great; k++) {
                 byte ak = a[k];
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else if (ak > pivot2) {
+                } else if (ak > pivot2) { // Move a[k] to right part
                     while (a[great] > pivot2) {
-                        if (k == great--) {
+                        if (great-- == k) {
                             break outer;
                         }
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                        a[great--] = ak;
                     }
                 }
             }
         } else { // Pivots are equal
             /*
-             * Partition degenerates to the traditional 3-way
-             * (or "Dutch National Flag") partition:
+             * Partition degenerates to the traditional 3-way,
+             * or "Dutch National Flag", partition:
              *
              *   left part   center part            right part
-             * -------------------------------------------------
-             * [  < pivot  |  == pivot  |    ?    |  > pivot   ]
-             * -------------------------------------------------
-             *
+             * +----------------------------------------------+
+             * |  < pivot  |  == pivot  |    ?    |  > pivot  |
+             * +----------------------------------------------+
              *              ^            ^       ^
              *              |            |       |
              *             less          k     great
@@ -1276,30 +1403,34 @@
              *
              * Pointer k is the first index of ?-part
              */
-            outer:
             for (int k = less; k <= great; k++) {
                 byte ak = a[k];
                 if (ak == pivot1) {
                     continue;
                 }
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else { // a[k] > pivot
+                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                    /*
+                     * We know that pivot1 == a[e3] == pivot2. Thus, we know
+                     * that great will still be >= k when the following loop
+                     * terminates, even though we don't test for it explicitly.
+                     * In other words, a[e3] acts as a sentinel for great.
+                     */
                     while (a[great] > pivot1) {
-                        if (k == great--) {
-                            break outer;
-                        }
+                        great--;
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // a[great] == pivot1
+                        a[k] = pivot1;
+                        a[great--] = ak;
                     }
                 }
             }
@@ -1322,26 +1453,55 @@
         }
 
         /*
-         * If center part is too large (comprises > 5/6 of
-         * the array), swap internal pivot values to ends
+         * If center part is too large (comprises > 2/3 of the array),
+         * swap internal pivot values to ends
          */
-        if (less < e1 && e5 < great) {
+        if (less < e1 && great > e5) {
             while (a[less] == pivot1) {
                 less++;
             }
             while (a[great] == pivot2) {
                 great--;
             }
-            for (int k = less + 1; k <= great; ) {
+
+            /*
+             * Partitioning:
+             *
+             *   left part       center part                   right part
+             * +----------------------------------------------------------+
+             * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+             * +----------------------------------------------------------+
+             *              ^                        ^       ^
+             *              |                        |       |
+             *             less                      k     great
+             *
+             * Invariants:
+             *
+             *              all in (*, less)  == pivot1
+             *     pivot1 < all in [less, k)   < pivot2
+             *              all in (great, *) == pivot2
+             *
+             * Pointer k is the first index of ?-part
+             */
+            outer:
+            for (int k = less; k <= great; k++) {
                 byte ak = a[k];
-                if (ak == pivot1) {
-                    a[k++] = a[less];
+                if (ak == pivot2) { // Move a[k] to right part
+                    while (a[great] == pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] == pivot1) {
+                        a[k] = a[less];
+                        a[less++] = pivot1;
+                    } else { // pivot1 < a[great] < pivot2
+                        a[k] = a[great];
+                    }
+                    a[great--] = pivot2;
+                } else if (ak == pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
                     a[less++] = pivot1;
-                } else if (ak == pivot2) {
-                    a[k] = a[great];
-                    a[great--] = pivot2;
-                } else {
-                    k++;
                 }
             }
         }
@@ -1371,7 +1531,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty.
+     * the range to be sorted is empty  and the call is a no-op).
      *
      * <p>The {@code <} relation does not provide a total order on all float
      * values: {@code -0.0f == 0.0f} is {@code true} and a {@code Float.NaN}
@@ -1485,13 +1645,13 @@
     private static void doSort(float[] a, int left, int right) {
         // Use insertion sort on tiny arrays
         if (right - left + 1 < INSERTION_SORT_THRESHOLD) {
-            for (int k = left + 1; k <= right; k++) {
-                float ak = a[k];
+            for (int i = left + 1; i <= right; i++) {
+                float ai = a[i];
                 int j;
-                for (j = k - 1; j >= left && ak < a[j]; j--) {
+                for (j = i - 1; j >= left && ai < a[j]; j--) {
                     a[j + 1] = a[j];
                 }
-                a[j + 1] = ak;
+                a[j + 1] = ai;
             }
         } else { // Use Dual-Pivot Quicksort on large arrays
             dualPivotQuicksort(a, left, right);
@@ -1536,7 +1696,7 @@
          * second terciles of the array. Note that pivot1 <= pivot2.
          *
          * The pivots are stored in local variables, and the first and
-         * the last of the sorted elements are moved to the locations
+         * the last of the elements to be sorted are moved to the locations
          * formerly occupied by the pivots. When partitioning is complete,
          * the pivots are swapped back into their final positions, and
          * excluded from subsequent sorting.
@@ -1544,27 +1704,26 @@
         float pivot1 = ae2; a[e2] = a[left];
         float pivot2 = ae4; a[e4] = a[right];
 
-        /*
-         * Partitioning
-         *
-         *   left part         center part                  right part
-         * ------------------------------------------------------------
-         * [ < pivot1  |  pivot1 <= && <= pivot2  |   ?   |  > pivot2 ]
-         * ------------------------------------------------------------
-         *              ^                          ^     ^
-         *              |                          |     |
-         *             less                        k   great
-         */
-
         // Pointers
         int less  = left  + 1; // The index of first element of center part
         int great = right - 1; // The index before first element of right part
 
-        boolean pivotsDiffer = pivot1 != pivot2;
+        boolean pivotsDiffer = (pivot1 != pivot2);
 
         if (pivotsDiffer) {
             /*
+             * Partitioning:
+             *
+             *   left part         center part                    right part
+             * +------------------------------------------------------------+
+             * | < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2 |
+             * +------------------------------------------------------------+
+             *              ^                          ^       ^
+             *              |                          |       |
+             *             less                        k     great
+             *
              * Invariants:
+             *
              *              all in (left, less)   < pivot1
              *    pivot1 <= all in [less, k)     <= pivot2
              *              all in (great, right) > pivot2
@@ -1574,37 +1733,37 @@
             outer:
             for (int k = less; k <= great; k++) {
                 float ak = a[k];
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else if (ak > pivot2) {
+                } else if (ak > pivot2) { // Move a[k] to right part
                     while (a[great] > pivot2) {
-                        if (k == great--) {
+                        if (great-- == k) {
                             break outer;
                         }
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                        a[great--] = ak;
                     }
                 }
             }
         } else { // Pivots are equal
             /*
-             * Partition degenerates to the traditional 3-way
-             * (or "Dutch National Flag") partition:
+             * Partition degenerates to the traditional 3-way,
+             * or "Dutch National Flag", partition:
              *
              *   left part   center part            right part
-             * -------------------------------------------------
-             * [  < pivot  |  == pivot  |    ?    |  > pivot   ]
-             * -------------------------------------------------
-             *
+             * +----------------------------------------------+
+             * |  < pivot  |  == pivot  |    ?    |  > pivot  |
+             * +----------------------------------------------+
              *              ^            ^       ^
              *              |            |       |
              *             less          k     great
@@ -1617,30 +1776,34 @@
              *
              * Pointer k is the first index of ?-part
              */
-            outer:
             for (int k = less; k <= great; k++) {
                 float ak = a[k];
                 if (ak == pivot1) {
                     continue;
                 }
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else { // a[k] > pivot
+                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                    /*
+                     * We know that pivot1 == a[e3] == pivot2. Thus, we know
+                     * that great will still be >= k when the following loop
+                     * terminates, even though we don't test for it explicitly.
+                     * In other words, a[e3] acts as a sentinel for great.
+                     */
                     while (a[great] > pivot1) {
-                        if (k == great--) {
-                            break outer;
-                        }
+                        great--;
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // a[great] == pivot1
+                        a[k] = pivot1;
+                        a[great--] = ak;
                     }
                 }
             }
@@ -1663,26 +1826,55 @@
         }
 
         /*
-         * If center part is too large (comprises > 5/6 of
-         * the array), swap internal pivot values to ends
+         * If center part is too large (comprises > 2/3 of the array),
+         * swap internal pivot values to ends
          */
-        if (less < e1 && e5 < great) {
+        if (less < e1 && great > e5) {
             while (a[less] == pivot1) {
                 less++;
             }
             while (a[great] == pivot2) {
                 great--;
             }
-            for (int k = less + 1; k <= great; ) {
+
+            /*
+             * Partitioning:
+             *
+             *   left part       center part                   right part
+             * +----------------------------------------------------------+
+             * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+             * +----------------------------------------------------------+
+             *              ^                        ^       ^
+             *              |                        |       |
+             *             less                      k     great
+             *
+             * Invariants:
+             *
+             *              all in (*, less)  == pivot1
+             *     pivot1 < all in [less, k)   < pivot2
+             *              all in (great, *) == pivot2
+             *
+             * Pointer k is the first index of ?-part
+             */
+            outer:
+            for (int k = less; k <= great; k++) {
                 float ak = a[k];
-                if (ak == pivot1) {
-                    a[k++] = a[less];
+                if (ak == pivot2) { // Move a[k] to right part
+                    while (a[great] == pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] == pivot1) {
+                        a[k] = a[less];
+                        a[less++] = pivot1;
+                    } else { // pivot1 < a[great] < pivot2
+                        a[k] = a[great];
+                    }
+                    a[great--] = pivot2;
+                } else if (ak == pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
                     a[less++] = pivot1;
-                } else if (ak == pivot2) {
-                    a[k] = a[great];
-                    a[great--] = pivot2;
-                } else {
-                    k++;
                 }
             }
         }
@@ -1712,7 +1904,7 @@
      * Sorts the specified range of the array into ascending order. The range
      * to be sorted extends from the index {@code fromIndex}, inclusive, to
      * the index {@code toIndex}, exclusive. If {@code fromIndex == toIndex},
-     * the range to be sorted is empty.
+     * the range to be sorted is empty (and the call is a no-op).
      *
      * <p>The {@code <} relation does not provide a total order on all double
      * values: {@code -0.0d == 0.0d} is {@code true} and a {@code Double.NaN}
@@ -1826,13 +2018,13 @@
     private static void doSort(double[] a, int left, int right) {
         // Use insertion sort on tiny arrays
         if (right - left + 1 < INSERTION_SORT_THRESHOLD) {
-            for (int k = left + 1; k <= right; k++) {
-                double ak = a[k];
+            for (int i = left + 1; i <= right; i++) {
+                double ai = a[i];
                 int j;
-                for (j = k - 1; j >= left && ak < a[j]; j--) {
+                for (j = i - 1; j >= left && ai < a[j]; j--) {
                     a[j + 1] = a[j];
                 }
-                a[j + 1] = ak;
+                a[j + 1] = ai;
             }
         } else { // Use Dual-Pivot Quicksort on large arrays
             dualPivotQuicksort(a, left, right);
@@ -1877,7 +2069,7 @@
          * second terciles of the array. Note that pivot1 <= pivot2.
          *
          * The pivots are stored in local variables, and the first and
-         * the last of the sorted elements are moved to the locations
+         * the last of the elements to be sorted are moved to the locations
          * formerly occupied by the pivots. When partitioning is complete,
          * the pivots are swapped back into their final positions, and
          * excluded from subsequent sorting.
@@ -1885,27 +2077,26 @@
         double pivot1 = ae2; a[e2] = a[left];
         double pivot2 = ae4; a[e4] = a[right];
 
-        /*
-         * Partitioning
-         *
-         *   left part         center part                  right part
-         * ------------------------------------------------------------
-         * [ < pivot1  |  pivot1 <= && <= pivot2  |   ?   |  > pivot2 ]
-         * ------------------------------------------------------------
-         *              ^                          ^     ^
-         *              |                          |     |
-         *             less                        k   great
-         */
-
         // Pointers
         int less  = left  + 1; // The index of first element of center part
         int great = right - 1; // The index before first element of right part
 
-        boolean pivotsDiffer = pivot1 != pivot2;
+        boolean pivotsDiffer = (pivot1 != pivot2);
 
         if (pivotsDiffer) {
             /*
+             * Partitioning:
+             *
+             *   left part         center part                    right part
+             * +------------------------------------------------------------+
+             * | < pivot1  |  pivot1 <= && <= pivot2  |    ?    |  > pivot2 |
+             * +------------------------------------------------------------+
+             *              ^                          ^       ^
+             *              |                          |       |
+             *             less                        k     great
+             *
              * Invariants:
+             *
              *              all in (left, less)   < pivot1
              *    pivot1 <= all in [less, k)     <= pivot2
              *              all in (great, right) > pivot2
@@ -1915,37 +2106,37 @@
             outer:
             for (int k = less; k <= great; k++) {
                 double ak = a[k];
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else if (ak > pivot2) {
+                } else if (ak > pivot2) { // Move a[k] to right part
                     while (a[great] > pivot2) {
-                        if (k == great--) {
+                        if (great-- == k) {
                             break outer;
                         }
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // pivot1 <= a[great] <= pivot2
+                        a[k] = a[great];
+                        a[great--] = ak;
                     }
                 }
             }
         } else { // Pivots are equal
             /*
-             * Partition degenerates to the traditional 3-way
-             * (or "Dutch National Flag") partition:
+             * Partition degenerates to the traditional 3-way,
+             * or "Dutch National Flag", partition:
              *
              *   left part   center part            right part
-             * -------------------------------------------------
-             * [  < pivot  |  == pivot  |    ?    |  > pivot   ]
-             * -------------------------------------------------
-             *
+             * +----------------------------------------------+
+             * |  < pivot  |  == pivot  |    ?    |  > pivot  |
+             * +----------------------------------------------+
              *              ^            ^       ^
              *              |            |       |
              *             less          k     great
@@ -1958,30 +2149,34 @@
              *
              * Pointer k is the first index of ?-part
              */
-            outer:
             for (int k = less; k <= great; k++) {
                 double ak = a[k];
                 if (ak == pivot1) {
                     continue;
                 }
-                if (ak < pivot1) {
-                    if (k > less) {
+                if (ak < pivot1) { // Move a[k] to left part
+                    if (k != less) {
                         a[k] = a[less];
                         a[less] = ak;
                     }
                     less++;
-                } else { // a[k] > pivot
+                } else { // (a[k] > pivot1) -  Move a[k] to right part
+                    /*
+                     * We know that pivot1 == a[e3] == pivot2. Thus, we know
+                     * that great will still be >= k when the following loop
+                     * terminates, even though we don't test for it explicitly.
+                     * In other words, a[e3] acts as a sentinel for great.
+                     */
                     while (a[great] > pivot1) {
-                        if (k == great--) {
-                            break outer;
-                        }
+                        great--;
                     }
-                    a[k] = a[great];
-                    a[great--] = ak;
-
-                    if ((ak = a[k]) <  pivot1) {
+                    if (a[great] < pivot1) {
                         a[k] = a[less];
-                        a[less++] = ak;
+                        a[less++] = a[great];
+                        a[great--] = ak;
+                    } else { // a[great] == pivot1
+                        a[k] = pivot1;
+                        a[great--] = ak;
                     }
                 }
             }
@@ -2004,26 +2199,55 @@
         }
 
         /*
-         * If center part is too large (comprises > 5/6 of
-         * the array), swap internal pivot values to ends
+         * If center part is too large (comprises > 2/3 of the array),
+         * swap internal pivot values to ends
          */
-        if (less < e1 && e5 < great) {
+        if (less < e1 && great > e5) {
             while (a[less] == pivot1) {
                 less++;
             }
             while (a[great] == pivot2) {
                 great--;
             }
-            for (int k = less + 1; k <= great; ) {
+
+            /*
+             * Partitioning:
+             *
+             *   left part       center part                   right part
+             * +----------------------------------------------------------+
+             * | == pivot1 |  pivot1 < && < pivot2  |    ?    | == pivot2 |
+             * +----------------------------------------------------------+
+             *              ^                        ^       ^
+             *              |                        |       |
+             *             less                      k     great
+             *
+             * Invariants:
+             *
+             *              all in (*, less)  == pivot1
+             *     pivot1 < all in [less, k)   < pivot2
+             *              all in (great, *) == pivot2
+             *
+             * Pointer k is the first index of ?-part
+             */
+            outer:
+            for (int k = less; k <= great; k++) {
                 double ak = a[k];
-                if (ak == pivot1) {
-                    a[k++] = a[less];
+                if (ak == pivot2) { // Move a[k] to right part
+                    while (a[great] == pivot2) {
+                        if (great-- == k) {
+                            break outer;
+                        }
+                    }
+                    if (a[great] == pivot1) {
+                        a[k] = a[less];
+                        a[less++] = pivot1;
+                    } else { // pivot1 < a[great] < pivot2
+                        a[k] = a[great];
+                    }
+                    a[great--] = pivot2;
+                } else if (ak == pivot1) { // Move a[k] to left part
+                    a[k] = a[less];
                     a[less++] = pivot1;
-                } else if (ak == pivot2) {
-                    a[k] = a[great];
-                    a[great--] = pivot2;
-                } else {
-                    k++;
                 }
             }
         }
--- a/jdk/src/share/classes/java/util/Formatter.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/util/Formatter.java	Wed Jul 05 17:04:26 2017 +0200
@@ -2552,9 +2552,6 @@
         private boolean dt = false;
         private char c;
 
-        // cache the line separator
-        private String ls;
-
         private int index(String s) {
             if (s != null) {
                 try {
@@ -2702,9 +2699,7 @@
                 printHashCode(arg);
                 break;
             case Conversion.LINE_SEPARATOR:
-                if (ls == null)
-                    ls = System.getProperty("line.separator");
-                a.append(ls);
+                a.append(System.lineSeparator());
                 break;
             case Conversion.PERCENT_SIGN:
                 a.append('%');
--- a/jdk/src/share/classes/java/util/zip/Deflater.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/util/zip/Deflater.java	Wed Jul 05 17:04:26 2017 +0200
@@ -318,7 +318,7 @@
     /**
      * Compresses the input data and fills specified buffer with compressed
      * data. Returns actual number of bytes of compressed data. A return value
-     * of 0 indicates that {@link needsInput() needsInput} should be called
+     * of 0 indicates that {@link #needsInput() needsInput} should be called
      * in order to determine if more input data is required.
      *
      * <p>This method uses {@link #NO_FLUSH} as its compression flush mode.
@@ -339,7 +339,7 @@
     /**
      * Compresses the input data and fills specified buffer with compressed
      * data. Returns actual number of bytes of compressed data. A return value
-     * of 0 indicates that {@link needsInput() needsInput} should be called
+     * of 0 indicates that {@link #needsInput() needsInput} should be called
      * in order to determine if more input data is required.
      *
      * <p>This method uses {@link #NO_FLUSH} as its compression flush mode.
--- a/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/java/util/zip/DeflaterOutputStream.java	Wed Jul 05 17:04:26 2017 +0200
@@ -66,7 +66,7 @@
      * @param def the compressor ("deflater")
      * @param size the output buffer size
      * @param syncFlush
-     *        if {@code true} the {@link flush()} method of this
+     *        if {@code true} the {@link #flush()} method of this
      *        instance flushes the compressor with flush mode
      *        {@link Deflater#SYNC_FLUSH} before flushing the output
      *        stream, otherwise only flushes the output stream
@@ -114,7 +114,7 @@
      * @param out the output stream
      * @param def the compressor ("deflater")
      * @param syncFlush
-     *        if {@code true} the {@link flush()} method of this
+     *        if {@code true} the {@link #flush()} method of this
      *        instance flushes the compressor with flush mode
      *        {@link Deflater#SYNC_FLUSH} before flushing the output
      *        stream, otherwise only flushes the output stream
@@ -151,7 +151,7 @@
      *
      * @param out the output stream
      * @param syncFlush
-     *        if {@code true} the {@link flush()} method of this
+     *        if {@code true} the {@link #flush()} method of this
      *        instance flushes the compressor with flush mode
      *        {@link Deflater#SYNC_FLUSH} before flushing the output
      *        stream, otherwise only flushes the output stream
@@ -262,10 +262,10 @@
     /**
      * Flushes the compressed output stream.
      *
-     * If {@link DeflaterOutputStream(OutputStream, Deflater, int, boolean)
+     * If {@link #DeflaterOutputStream(OutputStream, Deflater, int, boolean)
      * syncFlush} is {@code true} when this compressed output stream is
-     * constructed this method flushes the underlying {@code compressor}
-     * first with the flush mode {@link Deflater#SYNC_FLUSH} to force
+     * constructed, this method first flushes the underlying {@code compressor}
+     * with the flush mode {@link Deflater#SYNC_FLUSH} to force
      * all pending data to be flushed out to the output stream and then
      * flushes the output stream. Otherwise this method only flushes the
      * output stream without flushing the {@code compressor}.
--- a/jdk/src/share/classes/javax/naming/InitialContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/naming/InitialContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -198,6 +198,8 @@
      *
      * <p> This constructor will not modify <tt>environment</tt>
      * or save a reference to it, but may save a clone.
+     * Caller should not modify mutable keys and values in
+     * <tt>environment</tt> after it has been passed to the constructor.
      *
      * @param environment
      *          environment used to create the initial context.
--- a/jdk/src/share/classes/javax/naming/directory/InitialDirContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/naming/directory/InitialDirContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,6 +86,8 @@
      *
      * <p> This constructor will not modify <tt>environment</tt>
      * or save a reference to it, but may save a clone.
+     * Caller should not modify mutable keys and values in
+     * <tt>environment</tt> after it has been passed to the constructor.
      *
      * @param environment
      *          environment used to create the initial DirContext.
--- a/jdk/src/share/classes/javax/naming/ldap/InitialLdapContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/naming/ldap/InitialLdapContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,8 @@
      *
      * <p> This constructor will not modify its parameters or
      * save references to them, but may save a clone or copy.
+     * Caller should not modify mutable keys and values in
+     * <tt>environment</tt> after it has been passed to the constructor.
      *
      * <p> <tt>connCtls</tt> is used as the underlying context instance's
      * connection request controls.  See the class description
--- a/jdk/src/share/classes/javax/security/auth/Subject.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/security/auth/Subject.java	Wed Jul 05 17:04:26 2017 +0200
@@ -40,7 +40,6 @@
 import java.security.PrivilegedActionException;
 import java.security.ProtectionDomain;
 import sun.security.util.ResourcesMgr;
-import sun.security.util.SecurityConstants;
 
 /**
  * <p> A <code>Subject</code> represents a grouping of related information
@@ -239,7 +238,7 @@
     public void setReadOnly() {
         java.lang.SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            sm.checkPermission(new AuthPermission("setReadOnly"));
+            sm.checkPermission(AuthPermissionHolder.SET_READ_ONLY_PERMISSION);
         }
 
         this.readOnly = true;
@@ -285,7 +284,7 @@
 
         java.lang.SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            sm.checkPermission(new AuthPermission("getSubject"));
+            sm.checkPermission(AuthPermissionHolder.GET_SUBJECT_PERMISSION);
         }
 
         if (acc == null) {
@@ -343,7 +342,7 @@
 
         java.lang.SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            sm.checkPermission(SecurityConstants.DO_AS_PERMISSION);
+            sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
         }
         if (action == null)
             throw new NullPointerException
@@ -402,7 +401,7 @@
 
         java.lang.SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            sm.checkPermission(SecurityConstants.DO_AS_PERMISSION);
+            sm.checkPermission(AuthPermissionHolder.DO_AS_PERMISSION);
         }
 
         if (action == null)
@@ -456,7 +455,7 @@
 
         java.lang.SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION);
+            sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
         }
 
         if (action == null)
@@ -520,7 +519,7 @@
 
         java.lang.SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            sm.checkPermission(SecurityConstants.DO_AS_PRIVILEGED_PERMISSION);
+            sm.checkPermission(AuthPermissionHolder.DO_AS_PRIVILEGED_PERMISSION);
         }
 
         if (action == null)
@@ -1044,16 +1043,13 @@
                     if (sm != null) {
                         switch (which) {
                         case Subject.PRINCIPAL_SET:
-                            sm.checkPermission(new AuthPermission
-                                        ("modifyPrincipals"));
+                            sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION);
                             break;
                         case Subject.PUB_CREDENTIAL_SET:
-                            sm.checkPermission(new AuthPermission
-                                        ("modifyPublicCredentials"));
+                            sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION);
                             break;
                         default:
-                            sm.checkPermission(new AuthPermission
-                                        ("modifyPrivateCredentials"));
+                            sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION);
                             break;
                         }
                     }
@@ -1073,16 +1069,13 @@
             if (sm != null) {
                 switch (which) {
                 case Subject.PRINCIPAL_SET:
-                    sm.checkPermission
-                        (new AuthPermission("modifyPrincipals"));
+                    sm.checkPermission(AuthPermissionHolder.MODIFY_PRINCIPALS_PERMISSION);
                     break;
                 case Subject.PUB_CREDENTIAL_SET:
-                    sm.checkPermission
-                        (new AuthPermission("modifyPublicCredentials"));
+                    sm.checkPermission(AuthPermissionHolder.MODIFY_PUBLIC_CREDENTIALS_PERMISSION);
                     break;
                 default:
-                    sm.checkPermission
-                        (new AuthPermission("modifyPrivateCredentials"));
+                    sm.checkPermission(AuthPermissionHolder.MODIFY_PRIVATE_CREDENTIALS_PERMISSION);
                     break;
                 }
             }
@@ -1405,4 +1398,27 @@
             return set.add(o);
         }
     }
+
+    static class AuthPermissionHolder {
+        static final AuthPermission DO_AS_PERMISSION =
+            new AuthPermission("doAs");
+
+        static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
+            new AuthPermission("doAsPrivileged");
+
+        static final AuthPermission SET_READ_ONLY_PERMISSION =
+            new AuthPermission("setReadOnly");
+
+        static final AuthPermission GET_SUBJECT_PERMISSION =
+            new AuthPermission("getSubject");
+
+        static final AuthPermission MODIFY_PRINCIPALS_PERMISSION =
+            new AuthPermission("modifyPrincipals");
+
+        static final AuthPermission MODIFY_PUBLIC_CREDENTIALS_PERMISSION =
+            new AuthPermission("modifyPublicCredentials");
+
+        static final AuthPermission MODIFY_PRIVATE_CREDENTIALS_PERMISSION =
+            new AuthPermission("modifyPrivateCredentials");
+    }
 }
--- a/jdk/src/share/classes/javax/swing/AbstractListModel.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/AbstractListModel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -42,9 +42,11 @@
  * has been added to the <code>java.beans</code> package.
  * Please see {@link java.beans.XMLEncoder}.
  *
+ * @param <E> the type of the elements of this model
+ *
  * @author Hans Muller
  */
-public abstract class AbstractListModel implements ListModel, Serializable
+public abstract class AbstractListModel<E> implements ListModel<E>, Serializable
 {
     protected EventListenerList listenerList = new EventListenerList();
 
--- a/jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/DefaultListCellRenderer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -71,7 +71,7 @@
  * @author Hans Muller
  */
 public class DefaultListCellRenderer extends JLabel
-    implements ListCellRenderer, Serializable
+    implements ListCellRenderer<Object>, Serializable
 {
 
    /**
@@ -111,7 +111,7 @@
     }
 
     public Component getListCellRendererComponent(
-        JList list,
+        JList<?> list,
         Object value,
         int index,
         boolean isSelected,
--- a/jdk/src/share/classes/javax/swing/DefaultListModel.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/DefaultListModel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -48,11 +48,13 @@
  * has been added to the <code>java.beans</code> package.
  * Please see {@link java.beans.XMLEncoder}.
  *
+ * @param <E> the type of the elements of this model
+ *
  * @author Hans Muller
  */
-public class DefaultListModel extends AbstractListModel
+public class DefaultListModel<E> extends AbstractListModel<E>
 {
-    private Vector delegate = new Vector();
+    private Vector<E> delegate = new Vector<E>();
 
     /**
      * Returns the number of components in this list.
@@ -83,7 +85,7 @@
      *             list
      * @see #get(int)
      */
-    public Object getElementAt(int index) {
+    public E getElementAt(int index) {
         return delegate.elementAt(index);
     }
 
@@ -175,7 +177,7 @@
      * @return  an enumeration of the components of this list
      * @see Vector#elements()
      */
-    public Enumeration<?> elements() {
+    public Enumeration<E> elements() {
         return delegate.elements();
     }
 
@@ -260,7 +262,7 @@
      * @see #get(int)
      * @see Vector#elementAt(int)
      */
-    public Object elementAt(int index) {
+    public E elementAt(int index) {
         return delegate.elementAt(index);
     }
 
@@ -271,7 +273,7 @@
      * @return     the first component of this list
      * @see Vector#firstElement()
      */
-    public Object firstElement() {
+    public E firstElement() {
         return delegate.firstElement();
     }
 
@@ -283,13 +285,13 @@
      * @return  the last component of the list
      * @see Vector#lastElement()
      */
-    public Object lastElement() {
+    public E lastElement() {
         return delegate.lastElement();
     }
 
     /**
      * Sets the component at the specified <code>index</code> of this
-     * list to be the specified object. The previous component at that
+     * list to be the specified element. The previous component at that
      * position is discarded.
      * <p>
      * Throws an <code>ArrayIndexOutOfBoundsException</code> if the index
@@ -300,13 +302,13 @@
      *    <code>List</code> interface defined in the 1.2 Collections framework.
      * </blockquote>
      *
-     * @param      obj     what the component is to be set to
+     * @param      element what the component is to be set to
      * @param      index   the specified index
      * @see #set(int,Object)
      * @see Vector#setElementAt(Object,int)
      */
-    public void setElementAt(Object obj, int index) {
-        delegate.setElementAt(obj, index);
+    public void setElementAt(E element, int index) {
+        delegate.setElementAt(element, index);
         fireContentsChanged(this, index, index);
     }
 
@@ -331,7 +333,7 @@
     }
 
     /**
-     * Inserts the specified object as a component in this list at the
+     * Inserts the specified element as a component in this list at the
      * specified <code>index</code>.
      * <p>
      * Throws an <code>ArrayIndexOutOfBoundsException</code> if the index
@@ -342,26 +344,26 @@
      *    <code>List</code> interface defined in the 1.2 Collections framework.
      * </blockquote>
      *
-     * @param      obj     the component to insert
+     * @param      element the component to insert
      * @param      index   where to insert the new component
      * @exception  ArrayIndexOutOfBoundsException  if the index was invalid
      * @see #add(int,Object)
      * @see Vector#insertElementAt(Object,int)
      */
-    public void insertElementAt(Object obj, int index) {
-        delegate.insertElementAt(obj, index);
+    public void insertElementAt(E element, int index) {
+        delegate.insertElementAt(element, index);
         fireIntervalAdded(this, index, index);
     }
 
     /**
      * Adds the specified component to the end of this list.
      *
-     * @param   obj   the component to be added
+     * @param   element   the component to be added
      * @see Vector#addElement(Object)
      */
-    public void addElement(Object obj) {
+    public void addElement(E element) {
         int index = delegate.size();
-        delegate.addElement(obj);
+        delegate.addElement(element);
         fireIntervalAdded(this, index, index);
     }
 
@@ -441,7 +443,7 @@
      *
      * @param index index of element to return
      */
-    public Object get(int index) {
+    public E get(int index) {
         return delegate.elementAt(index);
     }
 
@@ -457,8 +459,8 @@
      * @param element element to be stored at the specified position
      * @return the element previously at the specified position
      */
-    public Object set(int index, Object element) {
-        Object rv = delegate.elementAt(index);
+    public E set(int index, E element) {
+        E rv = delegate.elementAt(index);
         delegate.setElementAt(element, index);
         fireContentsChanged(this, index, index);
         return rv;
@@ -474,7 +476,7 @@
      * @param index index at which the specified element is to be inserted
      * @param element element to be inserted
      */
-    public void add(int index, Object element) {
+    public void add(int index, E element) {
         delegate.insertElementAt(element, index);
         fireIntervalAdded(this, index, index);
     }
@@ -488,9 +490,10 @@
      * (<code>index &lt; 0 || index &gt;= size()</code>).
      *
      * @param index the index of the element to removed
+     * @return the element previously at the specified position
      */
-    public Object remove(int index) {
-        Object rv = delegate.elementAt(index);
+    public E remove(int index) {
+        E rv = delegate.elementAt(index);
         delegate.removeElementAt(index);
         fireIntervalRemoved(this, index, index);
         return rv;
--- a/jdk/src/share/classes/javax/swing/JList.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/JList.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,11 +25,24 @@
 
 package javax.swing;
 
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.GraphicsEnvironment;
+import java.awt.HeadlessException;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
 import java.awt.event.*;
-import java.awt.*;
 
 import java.util.Vector;
 import java.util.Locale;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
@@ -59,28 +72,30 @@
  * constructor that automatically builds a read-only {@code ListModel} instance
  * for you:
  * <pre>
+ * {@code
  * // Create a JList that displays strings from an array
  *
  * String[] data = {"one", "two", "three", "four"};
- * JList myList = new JList(data);
+ * JList<String> myList = new JList<String>(data);
  *
  * // Create a JList that displays the superclasses of JList.class, by
  * // creating it with a Vector populated with this data
  *
- * Vector superClasses = new Vector();
- * Class rootClass = javax.swing.JList.class;
- * for(Class cls = rootClass; cls != null; cls = cls.getSuperclass()) {
+ * Vector<Class<?>> superClasses = new Vector<Class<?>>();
+ * Class<JList> rootClass = javax.swing.JList.class;
+ * for(Class<?> cls = rootClass; cls != null; cls = cls.getSuperclass()) {
  *     superClasses.addElement(cls);
  * }
- * JList myList = new JList(superClasses);
+ * JList<Class<?>> myList = new JList<Class<?>>(superClasses);
  *
  * // The automatically created model is stored in JList's "model"
  * // property, which you can retrieve
  *
- * ListModel model = myList.getModel();
+ * ListModel<Class<?>> model = myList.getModel();
  * for(int i = 0; i < model.getSize(); i++) {
  *     System.out.println(model.getElementAt(i));
  * }
+ * }
  * </pre>
  * <p>
  * A {@code ListModel} can be supplied directly to a {@code JList} by way of a
@@ -103,12 +118,14 @@
  * notifying listeners. For example, a read-only implementation of
  * {@code AbstractListModel}:
  * <pre>
+ * {@code
  * // This list model has about 2^16 elements.  Enjoy scrolling.
  *
- * ListModel bigData = new AbstractListModel() {
+ * ListModel<String> bigData = new AbstractListModel<String>() {
  *     public int getSize() { return Short.MAX_VALUE; }
- *     public Object getElementAt(int index) { return "Index " + index; }
+ *     public String getElementAt(int index) { return "Index " + index; }
  * };
+ * }
  * </pre>
  * <p>
  * The selection state of a {@code JList} is managed by another separate
@@ -150,9 +167,10 @@
  * component to render, is installed by the lists's {@code ListUI}. You can
  * substitute your own renderer using code like this:
  * <pre>
+ * {@code
  *  // Display an icon and a string for each object in the list.
  *
- * class MyCellRenderer extends JLabel implements ListCellRenderer {
+ * class MyCellRenderer extends JLabel implements ListCellRenderer<Object> {
  *     final static ImageIcon longIcon = new ImageIcon("long.gif");
  *     final static ImageIcon shortIcon = new ImageIcon("short.gif");
  *
@@ -160,7 +178,7 @@
  *     // We just reconfigure the JLabel each time we're called.
  *
  *     public Component getListCellRendererComponent(
- *       JList list,              // the list
+ *       JList<?> list,           // the list
  *       Object value,            // value to display
  *       int index,               // cell index
  *       boolean isSelected,      // is the cell selected
@@ -184,6 +202,7 @@
  * }
  *
  * myList.setCellRenderer(new MyCellRenderer());
+ * }
  * </pre>
  * <p>
  * Another job for the cell renderer is in helping to determine sizing
@@ -195,7 +214,8 @@
  * automatically based on a single prototype value:
  * <a name="prototype_example">
  * <pre>
- * JList bigDataList = new JList(bigData);
+ * {@code
+ * JList<String> bigDataList = new JList<String>(bigData);
  *
  * // We don't want the JList implementation to compute the width
  * // or height of all of the list cells, so we give it a string
@@ -204,6 +224,7 @@
  * // properties.
  *
  * bigDataList.setPrototypeCellValue("Index 1234567890");
+ * }
  * </pre>
  * <p>
  * {@code JList} doesn't implement scrolling directly. To create a list that
@@ -260,13 +281,15 @@
  * @see ListCellRenderer
  * @see DefaultListCellRenderer
  *
+ * @param <E> the type of the elements of this list
+ *
  * @beaninfo
  *   attribute: isContainer false
  * description: A component which allows for the selection of one or more objects from a list.
  *
  * @author Hans Muller
  */
-public class JList extends JComponent implements Scrollable, Accessible
+public class JList<E> extends JComponent implements Scrollable, Accessible
 {
     /**
      * @see #getUIClassID
@@ -301,15 +324,15 @@
     private int fixedCellWidth = -1;
     private int fixedCellHeight = -1;
     private int horizontalScrollIncrement = -1;
-    private Object prototypeCellValue;
+    private E prototypeCellValue;
     private int visibleRowCount = 8;
     private Color selectionForeground;
     private Color selectionBackground;
     private boolean dragEnabled;
 
     private ListSelectionModel selectionModel;
-    private ListModel dataModel;
-    private ListCellRenderer cellRenderer;
+    private ListModel<E> dataModel;
+    private ListCellRenderer<? super E> cellRenderer;
     private ListSelectionListener selectionListener;
 
     /**
@@ -402,7 +425,7 @@
      * @param dataModel the model for the list
      * @exception IllegalArgumentException if the model is {@code null}
      */
-    public JList(ListModel dataModel)
+    public JList(ListModel<E> dataModel)
     {
         if (dataModel == null) {
             throw new IllegalArgumentException("dataModel must be non null");
@@ -437,12 +460,12 @@
      * @param  listData  the array of Objects to be loaded into the data model,
      *                   {@code non-null}
      */
-    public JList(final Object[] listData)
+    public JList(final E[] listData)
     {
         this (
-            new AbstractListModel() {
+            new AbstractListModel<E>() {
                 public int getSize() { return listData.length; }
-                public Object getElementAt(int i) { return listData[i]; }
+                public E getElementAt(int i) { return listData[i]; }
             }
         );
     }
@@ -462,11 +485,11 @@
      * @param  listData  the <code>Vector</code> to be loaded into the
      *                   data model, {@code non-null}
      */
-    public JList(final Vector<?> listData) {
+    public JList(final Vector<? extends E> listData) {
         this (
-            new AbstractListModel() {
+            new AbstractListModel<E>() {
                 public int getSize() { return listData.size(); }
-                public Object getElementAt(int i) { return listData.elementAt(i); }
+                public E getElementAt(int i) { return listData.elementAt(i); }
             }
         );
     }
@@ -477,9 +500,9 @@
      */
     public JList() {
         this (
-            new AbstractListModel() {
+            new AbstractListModel<E>() {
               public int getSize() { return 0; }
-              public Object getElementAt(int i) { return "No Data Model"; }
+              public E getElementAt(int i) { throw new IndexOutOfBoundsException("No Data Model"); }
             }
         );
     }
@@ -526,7 +549,7 @@
     public void updateUI() {
         setUI((ListUI)UIManager.getUI(this));
 
-        ListCellRenderer renderer = getCellRenderer();
+        ListCellRenderer<? super E> renderer = getCellRenderer();
         if (renderer instanceof Component) {
             SwingUtilities.updateComponentTreeUI((Component)renderer);
         }
@@ -560,8 +583,8 @@
      */
     private void updateFixedCellSize()
     {
-        ListCellRenderer cr = getCellRenderer();
-        Object value = getPrototypeCellValue();
+        ListCellRenderer<? super E> cr = getCellRenderer();
+        E value = getPrototypeCellValue();
 
         if ((cr != null) && (value != null)) {
             Component c = cr.getListCellRendererComponent(this, value, 0, false, false);
@@ -592,7 +615,7 @@
      * @return the value of the {@code prototypeCellValue} property
      * @see #setPrototypeCellValue
      */
-    public Object getPrototypeCellValue() {
+    public E getPrototypeCellValue() {
         return prototypeCellValue;
     }
 
@@ -632,8 +655,8 @@
      *   attribute: visualUpdate true
      * description: The cell prototype value, used to compute cell width and height.
      */
-    public void setPrototypeCellValue(Object prototypeCellValue) {
-        Object oldValue = this.prototypeCellValue;
+    public void setPrototypeCellValue(E prototypeCellValue) {
+        E oldValue = this.prototypeCellValue;
         this.prototypeCellValue = prototypeCellValue;
 
         /* If the prototypeCellValue has changed and is non-null,
@@ -727,7 +750,7 @@
      * @see #setCellRenderer
      */
     @Transient
-    public ListCellRenderer getCellRenderer() {
+    public ListCellRenderer<? super E> getCellRenderer() {
         return cellRenderer;
     }
 
@@ -755,8 +778,8 @@
      *   attribute: visualUpdate true
      * description: The component used to draw the cells.
      */
-    public void setCellRenderer(ListCellRenderer cellRenderer) {
-        ListCellRenderer oldValue = this.cellRenderer;
+    public void setCellRenderer(ListCellRenderer<? super E> cellRenderer) {
+        ListCellRenderer<? super E> oldValue = this.cellRenderer;
         this.cellRenderer = cellRenderer;
 
         /* If the cellRenderer has changed and prototypeCellValue
@@ -1455,7 +1478,7 @@
      * @since 1.4
      */
     public int getNextMatch(String prefix, int startIndex, Position.Bias bias) {
-        ListModel model = getModel();
+        ListModel<E> model = getModel();
         int max = model.getSize();
         if (prefix == null) {
             throw new IllegalArgumentException();
@@ -1469,16 +1492,16 @@
         int increment = (bias == Position.Bias.Forward) ? 1 : -1;
         int index = startIndex;
         do {
-            Object o = model.getElementAt(index);
-
-            if (o != null) {
+            E element = model.getElementAt(index);
+
+            if (element != null) {
                 String string;
 
-                if (o instanceof String) {
-                    string = ((String)o).toUpperCase();
+                if (element instanceof String) {
+                    string = ((String)element).toUpperCase();
                 }
                 else {
-                    string = o.toString();
+                    string = element.toString();
                     if (string != null) {
                         string = string.toUpperCase();
                     }
@@ -1516,7 +1539,7 @@
         if(event != null) {
             Point p = event.getPoint();
             int index = locationToIndex(p);
-            ListCellRenderer r = getCellRenderer();
+            ListCellRenderer<? super E> r = getCellRenderer();
             Rectangle cellBounds;
 
             if (index != -1 && r != null && (cellBounds =
@@ -1634,7 +1657,7 @@
      *                          list of items
      * @see #setModel
      */
-    public ListModel getModel() {
+    public ListModel<E> getModel() {
         return dataModel;
     }
 
@@ -1656,11 +1679,11 @@
      *   attribute: visualUpdate true
      * description: The object that contains the data to be drawn by this JList.
      */
-    public void setModel(ListModel model) {
+    public void setModel(ListModel<E> model) {
         if (model == null) {
             throw new IllegalArgumentException("model must be non null");
         }
-        ListModel oldValue = dataModel;
+        ListModel<E> oldValue = dataModel;
         dataModel = model;
         firePropertyChange("model", oldValue, dataModel);
         clearSelection();
@@ -1668,7 +1691,7 @@
 
 
     /**
-     * Constructs a read-only <code>ListModel</code> from an array of objects,
+     * Constructs a read-only <code>ListModel</code> from an array of items,
      * and calls {@code setModel} with this model.
      * <p>
      * Attempts to pass a {@code null} value to this method results in
@@ -1676,15 +1699,15 @@
      * references the given array directly. Attempts to modify the array
      * after invoking this method results in undefined behavior.
      *
-     * @param listData an array of {@code Objects} containing the items to
+     * @param listData an array of {@code E} containing the items to
      *        display in the list
      * @see #setModel
      */
-    public void setListData(final Object[] listData) {
+    public void setListData(final E[] listData) {
         setModel (
-            new AbstractListModel() {
+            new AbstractListModel<E>() {
                 public int getSize() { return listData.length; }
-                public Object getElementAt(int i) { return listData[i]; }
+                public E getElementAt(int i) { return listData[i]; }
             }
         );
     }
@@ -1703,11 +1726,11 @@
      *                                          display in the list
      * @see #setModel
      */
-    public void setListData(final Vector<?> listData) {
+    public void setListData(final Vector<? extends E> listData) {
         setModel (
-            new AbstractListModel() {
+            new AbstractListModel<E>() {
                 public int getSize() { return listData.size(); }
-                public Object getElementAt(int i) { return listData.elementAt(i); }
+                public E getElementAt(int i) { return listData.elementAt(i); }
             }
         );
     }
@@ -2235,10 +2258,13 @@
      * @see #isSelectedIndex
      * @see #getModel
      * @see #addListSelectionListener
+     *
+     * @deprecated As of JDK 1.7, replaced by {@link #getSelectedValuesList()}
      */
+    @Deprecated
     public Object[] getSelectedValues() {
         ListSelectionModel sm = getSelectionModel();
-        ListModel dm = getModel();
+        ListModel<E> dm = getModel();
 
         int iMin = sm.getMinSelectionIndex();
         int iMax = sm.getMaxSelectionIndex();
@@ -2259,6 +2285,37 @@
         return rv;
     }
 
+    /**
+     * Returns a list of all the selected items, in increasing order based
+     * on their indices in the list.
+     *
+     * @return the selected items, or an empty list if nothing is selected
+     * @see #isSelectedIndex
+     * @see #getModel
+     * @see #addListSelectionListener
+     *
+     * @since 1.7
+     */
+    public List<E> getSelectedValuesList() {
+        ListSelectionModel sm = getSelectionModel();
+        ListModel<E> dm = getModel();
+
+        int iMin = sm.getMinSelectionIndex();
+        int iMax = sm.getMaxSelectionIndex();
+
+        if ((iMin < 0) || (iMax < 0)) {
+            return Collections.emptyList();
+        }
+
+        List<E> selectedItems = new ArrayList<E>();
+        for(int i = iMin; i <= iMax; i++) {
+            if (sm.isSelectedIndex(i)) {
+                selectedItems.add(dm.getElementAt(i));
+            }
+        }
+        return selectedItems;
+    }
+
 
     /**
      * Returns the smallest selected cell index; <i>the selection</i> when only
@@ -2291,7 +2348,7 @@
      * @see #getModel
      * @see #addListSelectionListener
      */
-    public Object getSelectedValue() {
+    public E getSelectedValue() {
         int i = getMinSelectionIndex();
         return (i == -1) ? null : getModel().getElementAt(i);
     }
@@ -2309,7 +2366,7 @@
             setSelectedIndex(-1);
         else if(!anObject.equals(getSelectedValue())) {
             int i,c;
-            ListModel dm = getModel();
+            ListModel<E> dm = getModel();
             for(i=0,c=dm.getSize();i<c;i++)
                 if(anObject.equals(dm.getElementAt(i))){
                     setSelectedIndex(i);
@@ -3138,14 +3195,14 @@
            */
         protected class AccessibleJListChild extends AccessibleContext
                 implements Accessible, AccessibleComponent {
-            private JList     parent = null;
+            private JList<E>     parent = null;
             private int       indexInParent;
             private Component component = null;
             private AccessibleContext accessibleContext = null;
-            private ListModel listModel;
-            private ListCellRenderer cellRenderer = null;
-
-            public AccessibleJListChild(JList parent, int indexInParent) {
+            private ListModel<E> listModel;
+            private ListCellRenderer<? super E> cellRenderer = null;
+
+            public AccessibleJListChild(JList<E> parent, int indexInParent) {
                 this.parent = parent;
                 this.setAccessibleParent(parent);
                 this.indexInParent = indexInParent;
@@ -3175,7 +3232,7 @@
                 if ((parent != null)
                         && (listModel != null)
                         && cellRenderer != null) {
-                    Object value = listModel.getElementAt(index);
+                    E value = listModel.getElementAt(index);
                     boolean isSelected = parent.isSelectedIndex(index);
                     boolean isFocussed = parent.isFocusOwner()
                             && (index == parent.getLeadSelectionIndex());
--- a/jdk/src/share/classes/javax/swing/JTable.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/JTable.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1337,7 +1337,11 @@
                 return (TableCellRenderer)renderer;
             }
             else {
-                return getDefaultRenderer(columnClass.getSuperclass());
+                Class c = columnClass.getSuperclass();
+                if (c == null && columnClass != Object.class) {
+                    c = Object.class;
+                }
+                return getDefaultRenderer(c);
             }
         }
     }
--- a/jdk/src/share/classes/javax/swing/ListCellRenderer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/ListCellRenderer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -33,12 +33,13 @@
  * the cells in a JList.  For example, to use a JLabel as a
  * ListCellRenderer, you would write something like this:
  * <pre>
- * class MyCellRenderer extends JLabel implements ListCellRenderer {
+ * {@code
+ * class MyCellRenderer extends JLabel implements ListCellRenderer<Object> {
  *     public MyCellRenderer() {
  *         setOpaque(true);
  *     }
  *
- *     public Component getListCellRendererComponent(JList list,
+ *     public Component getListCellRendererComponent(JList<?> list,
  *                                                   Object value,
  *                                                   int index,
  *                                                   boolean isSelected,
@@ -75,14 +76,17 @@
  *         return this;
  *     }
  * }
+ * }
  * </pre>
  *
+ * @param <E> the type of values this renderer can be used for
+ *
  * @see JList
  * @see DefaultListCellRenderer
  *
  * @author Hans Muller
  */
-public interface ListCellRenderer
+public interface ListCellRenderer<E>
 {
     /**
      * Return a component that has been configured to display the specified
@@ -104,8 +108,8 @@
      * @see ListModel
      */
     Component getListCellRendererComponent(
-        JList list,
-        Object value,
+        JList<? extends E> list,
+        E value,
         int index,
         boolean isSelected,
         boolean cellHasFocus);
--- a/jdk/src/share/classes/javax/swing/ListModel.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/ListModel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -35,10 +35,12 @@
  * length of the data model must be reported to all of the
  * ListDataListeners.
  *
+ * @param <E> the type of the elements of this model
+ *
  * @author Hans Muller
  * @see JList
  */
-public interface ListModel
+public interface ListModel<E>
 {
   /**
    * Returns the length of the list.
@@ -51,7 +53,7 @@
    * @param index the requested index
    * @return the value at <code>index</code>
    */
-  Object getElementAt(int index);
+  E getElementAt(int index);
 
   /**
    * Adds a listener to the list that's notified each time a change
--- a/jdk/src/share/classes/javax/swing/Popup.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/Popup.java	Wed Jul 05 17:04:26 2017 +0200
@@ -227,12 +227,8 @@
         HeavyWeightWindow(Window parent) {
             super(parent);
             setFocusableWindowState(false);
-            Toolkit tk = Toolkit.getDefaultToolkit();
-            if (tk instanceof SunToolkit) {
-                // all the short-lived windows like Popups should be
-                // OverrideRedirect on X11 platforms
-                ((SunToolkit)tk).setOverrideRedirect(this);
-            }
+            setType(Window.Type.POPUP);
+
             // Popups are typically transient and most likely won't benefit
             // from true double buffering.  Turn it off here.
             getRootPane().setUseTrueDoubleBuffering(false);
--- a/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/ComponentUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -60,13 +60,13 @@
     }
 
     /**
-     * Configures the specified component appropriate for the look and feel.
+     * Configures the specified component appropriately for the look and feel.
      * This method is invoked when the <code>ComponentUI</code> instance is being installed
      * as the UI delegate on the specified component.  This method should
      * completely configure the component for the look and feel,
      * including the following:
      * <ol>
-     * <li>Install any default property values for color, fonts, borders,
+     * <li>Install default property values for color, fonts, borders,
      *     icons, opacity, etc. on the component.  Whenever possible,
      *     property values initialized by the client program should <i>not</i>
      *     be overridden.
@@ -116,7 +116,7 @@
     }
 
     /**
-     * Paints the specified component appropriate for the look and feel.
+     * Paints the specified component appropriately for the look and feel.
      * This method is invoked from the <code>ComponentUI.update</code> method when
      * the specified component is being painted.  Subclasses should override
      * this method and use the specified <code>Graphics</code> object to
@@ -134,15 +134,15 @@
     }
 
     /**
-     * Notifies this UI delegate that it's time to paint the specified
+     * Notifies this UI delegate that it is time to paint the specified
      * component.  This method is invoked by <code>JComponent</code>
      * when the specified component is being painted.
-     * By default this method will fill the specified component with
-     * its background color (if its <code>opaque</code> property is
-     * <code>true</code>) and then immediately call <code>paint</code>.
-     * In general this method need not be overridden by subclasses;
-     * all look-and-feel rendering code should reside in the <code>paint</code>
-     * method.
+     *
+     * <p>By default this method fills the specified component with
+     * its background color if its {@code opaque} property is {@code true},
+     * and then immediately calls {@code paint}. In general this method need
+     * not be overridden by subclasses; all look-and-feel rendering code should
+     * reside in the {@code paint} method.
      *
      * @param g the <code>Graphics</code> context in which to paint
      * @param c the component being painted;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,14 +24,10 @@
  */
 package javax.swing.plaf.basic;
 
-import javax.swing.*;
+import javax.swing.ComboBoxEditor;
+import javax.swing.JTextField;
 import javax.swing.border.Border;
-
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.PlainDocument;
-
-import java.awt.*;
+import java.awt.Component;
 import java.awt.event.*;
 
 import java.lang.reflect.Method;
@@ -73,12 +69,17 @@
      * @param anObject the displayed value of the editor
      */
     public void setItem(Object anObject) {
+        String text;
+
         if ( anObject != null )  {
-            editor.setText(anObject.toString());
-
+            text = anObject.toString();
             oldValue = anObject;
         } else {
-            editor.setText("");
+            text = "";
+        }
+        // workaround for 4530952
+        if (! text.equals(editor.getText())) {
+            editor.setText(text);
         }
     }
 
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -30,7 +30,6 @@
 import javax.swing.*;
 import javax.accessibility.*;
 import javax.swing.plaf.*;
-import javax.swing.border.*;
 import javax.swing.text.*;
 import javax.swing.event.*;
 import java.beans.PropertyChangeListener;
@@ -189,19 +188,20 @@
     /**
      * Indicates whether or not the combo box button should be square.
      * If square, then the width and height are equal, and are both set to
-     * the height of the combo (minus appropriate insets).
+     * the height of the combo minus appropriate insets.
+     *
+     * @since 1.7
      */
-    private boolean squareButton = true;
+    protected boolean squareButton = true;
 
     /**
-     * Optional: if specified, these insets act as padding around the cell
-     * renderer when laying out and painting the "selected" item in the
-     * combo box. BasicComboBoxUI uses a single combo box renderer for rendering
-     * both the main combo box item and also all the items in the dropdown
-     * for the combo box. padding allows you to specify addition insets in
-     * addition to those specified by the cell renderer.
+     * If specified, these insets act as padding around the cell renderer when
+     * laying out and painting the "selected" item in the combo box. These
+     * insets add to those specified by the cell renderer.
+     *
+     * @since 1.7
      */
-    private Insets padding;
+    protected Insets padding;
 
     // Used for calculating the default size.
     private static ListCellRenderer getDefaultListCellRenderer() {
@@ -345,7 +345,7 @@
     }
 
     /**
-     * Create and install the listeners for the combo box and its model.
+     * Creates and installs listeners for the combo box and its model.
      * This method is called when the UI is installed.
      */
     protected void installListeners() {
@@ -379,8 +379,8 @@
     }
 
     /**
-     * Uninstalls the default colors, default font, default renderer, and default
-     * editor into the JComboBox.
+     * Uninstalls the default colors, default font, default renderer,
+     * and default editor from the combo box.
      */
     protected void uninstallDefaults() {
         LookAndFeel.installColorsAndFont( comboBox,
@@ -391,7 +391,7 @@
     }
 
     /**
-     * Remove the installed listeners from the combo box and its model.
+     * Removes the installed listeners from the combo box and its model.
      * The number and types of listeners removed and in this method should be
      * the same that was added in <code>installListeners</code>
      */
@@ -839,7 +839,7 @@
     }
 
     /**
-     * Creates an button which will be used as the control to show or hide
+     * Creates a button which will be used as the control to show or hide
      * the popup portion of the combo box.
      *
      * @return a button which represents the popup control
@@ -1392,12 +1392,17 @@
     }
 
     /**
-     * This has been refactored out in hopes that it may be investigated and
-     * simplified for the next major release. adding/removing
-     * the component to the currentValuePane and changing the font may be
-     * redundant operations.
+     * Returns the size a component would have if used as a cell renderer.
+     *
+     * @param comp a {@code Component} to check
+     * @return size of the component
+     * @since 1.7
      */
-    private Dimension getSizeForComponent(Component comp) {
+    protected Dimension getSizeForComponent(Component comp) {
+        // This has been refactored out in hopes that it may be investigated and
+        // simplified for the next major release. adding/removing
+        // the component to the currentValuePane and changing the font may be
+        // redundant operations.
         currentValuePane.add(comp);
         comp.setFont(comboBox.getFont());
         Dimension d = comp.getPreferredSize();
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -141,11 +141,10 @@
     }
 
     /**
-     * Paint the label text in the foreground color, if the label
-     * is opaque then paint the entire background with the background
-     * color.  The Label text is drawn by paintEnabledText() or
-     * paintDisabledText().  The locations of the label parts are computed
-     * by layoutCL.
+     * Paints the label text with the foreground color, if the label is opaque
+     * then paints the entire background with the background color. The Label
+     * text is drawn by {@link #paintEnabledText} or {@link #paintDisabledText}.
+     * The locations of the label parts are computed by {@link #layoutCL}.
      *
      * @see #paintEnabledText
      * @see #paintDisabledText
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicListUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -685,7 +685,7 @@
 
 
     /**
-     * Create and install the listeners for the JList, its model, and its
+     * Creates and installs the listeners for the JList, its model, and its
      * selectionModel.  This method is called at installUI() time.
      *
      * @see #installUI
@@ -728,7 +728,7 @@
 
 
     /**
-     * Remove the listeners for the JList, its model, and its
+     * Removes the listeners from the JList, its model, and its
      * selectionModel.  All of the listener fields, are reset to
      * null here.  This method is called at uninstallUI() time,
      * it should be kept in sync with installListeners.
@@ -764,8 +764,8 @@
 
 
     /**
-     * Initialize JList properties, e.g. font, foreground, and background,
-     * and add the CellRendererPane.  The font, foreground, and background
+     * Initializes list properties such as font, foreground, and background,
+     * and adds the CellRendererPane. The font, foreground, and background
      * properties are only set if their current value is either null
      * or a UIResource, other properties are set if the current
      * value is null.
@@ -820,9 +820,9 @@
 
 
     /**
-     * Set the JList properties that haven't been explicitly overridden to
-     * null.  A property is considered overridden if its current value
-     * is not a UIResource.
+     * Sets the list properties that have not been explicitly overridden to
+     * {@code null}. A property is considered overridden if its current value
+     * is not a {@code UIResource}.
      *
      * @see #installDefaults
      * @see #uninstallUI
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -32,7 +32,6 @@
 
 import javax.swing.*;
 import javax.swing.event.*;
-import javax.swing.border.*;
 import javax.swing.plaf.*;
 import javax.swing.text.View;
 
@@ -54,7 +53,12 @@
     protected Color disabledForeground;
     protected Color acceleratorForeground;
     protected Color acceleratorSelectionForeground;
-    private   String acceleratorDelimiter;
+
+    /**
+     * Accelerator delimiter string, such as {@code '+'} in {@code 'Ctrl+C'}.
+     * @since 1.7
+     */
+    protected String acceleratorDelimiter;
 
     protected int defaultTextIconGap;
     protected Font acceleratorFont;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -93,10 +93,13 @@
      * scrollbar. */
     private boolean supportsAbsolutePositioning;
 
-    /** Hint as to what width (when vertical) or height (when horizontal)
+    /**
+     * Hint as to what width (when vertical) or height (when horizontal)
      * should be.
+     *
+     * @since 1.7
      */
-    private int scrollBarWidth;
+    protected int scrollBarWidth;
 
     private Handler handler;
 
@@ -117,18 +120,18 @@
      * number. If negative, then an overlap between the button and track will occur,
      * which is useful for shaped buttons.
      *
-     * TODO This should be made protected in a feature release
+     * @since 1.7
      */
-    private int incrGap;
+    protected int incrGap;
 
     /**
      * Distance between the decrement button and the track. This may be a negative
      * number. If negative, then an overlap between the button and track will occur,
      * which is useful for shaped buttons.
      *
-     * TODO This should be made protected in a feature release
+     * @since 1.7
      */
-    private int decrGap;
+    protected int decrGap;
 
     static void loadActionMap(LazyActionMap map) {
         map.put(new Actions(Actions.POSITIVE_UNIT_INCREMENT));
@@ -586,7 +589,7 @@
 
 
     /**
-     * Return the smallest acceptable size for the thumb.  If the scrollbar
+     * Returns the smallest acceptable size for the thumb.  If the scrollbar
      * becomes so small that this size isn't available, the thumb will be
      * hidden.
      * <p>
@@ -601,7 +604,7 @@
     }
 
     /**
-     * Return the largest acceptable size for the thumb.  To create a fixed
+     * Returns the largest acceptable size for the thumb.  To create a fixed
      * size thumb one make this method and <code>getMinimumThumbSize</code>
      * return the same value.
      * <p>
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1409,9 +1409,10 @@
     }
 
     /**
-     * Returns a value give a y position.  If yPos is past the track at the top or the
-     * bottom it will set the value to the min or max of the slider, depending if the
-     * slider is inverted or not.
+     * Returns the value at the y position. If {@code yPos} is beyond the
+     * track at the the bottom or the top, this method sets the value to either
+     * the minimum or maximum value of the slider, depending on if the slider
+     * is inverted or not.
      */
     public int valueForYPosition( int yPos ) {
         int value;
@@ -1440,9 +1441,10 @@
     }
 
     /**
-     * Returns a value give an x position.  If xPos is past the track at the left or the
-     * right it will set the value to the min or max of the slider, depending if the
-     * slider is inverted or not.
+     * Returns the value at the x position.  If {@code xPos} is beyond the
+     * track at the left or the right, this method sets the value to either the
+     * minimum or maximum value of the slider, depending on if the slider is
+     * inverted or not.
      */
     public int valueForXPosition( int xPos ) {
         int value;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSpinnerUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -268,7 +268,7 @@
     }
 
     /**
-     * Create a <code>LayoutManager</code> that manages the <code>editor</code>,
+     * Creates a <code>LayoutManager</code> that manages the <code>editor</code>,
      * <code>nextButton</code>, and <code>previousButton</code>
      * children of the JSpinner.  These three children must be
      * added with a constraint that identifies their role:
@@ -286,7 +286,7 @@
 
 
     /**
-     * Create a <code>PropertyChangeListener</code> that can be
+     * Creates a <code>PropertyChangeListener</code> that can be
      * added to the JSpinner itself.  Typically, this listener
      * will call replaceEditor when the "editor" property changes,
      * since it's the <code>SpinnerUI's</code> responsibility to
@@ -302,16 +302,13 @@
 
 
     /**
-     * Create a component that will replace the spinner models value
-     * with the object returned by <code>spinner.getPreviousValue</code>.
-     * By default the <code>previousButton</code> is a JButton. This
-     * method invokes <code>installPreviousButtonListeners</code> to
-     * install the necessary listeners to update the <code>JSpinner</code>'s
-     * model in response to a user gesture. If a previousButton isn't needed
-     * (in a subclass) then override this method to return null.
+     * Creates a decrement button, i.e. component that replaces the spinner
+     * value with the object returned by <code>spinner.getPreviousValue</code>.
+     * By default the <code>previousButton</code> is a {@code JButton}. If the
+     * decrement button is not needed this method should return {@code null}.
      *
-     * @return a component that will replace the spinners model with the
-     *     next value in the sequence, or null
+     * @return a component that will replace the spinner's value with the
+     *     previous value in the sequence, or {@code null}
      * @see #installUI
      * @see #createNextButton
      * @see #installPreviousButtonListeners
@@ -325,15 +322,13 @@
 
 
     /**
-     * Create a component that will replace the spinner models value
-     * with the object returned by <code>spinner.getNextValue</code>.
-     * By default the <code>nextButton</code> is a JButton
-     * who's <code>ActionListener</code> updates it's <code>JSpinner</code>
-     * ancestors model.  If a nextButton isn't needed (in a subclass)
-     * then override this method to return null.
+     * Creates an increment button, i.e. component that replaces the spinner
+     * value with the object returned by <code>spinner.getNextValue</code>.
+     * By default the <code>nextButton</code> is a {@code JButton}. If the
+     * increment button is not needed this method should return {@code null}.
      *
-     * @return a component that will replace the spinners model with the
-     *     next value in the sequence, or null
+     * @return a component that will replace the spinner's value with the
+     *     next value in the sequence, or {@code null}
      * @see #installUI
      * @see #createPreviousButton
      * @see #installNextButtonListeners
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSplitPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -829,7 +829,7 @@
 
     /**
      * Returns the default non continuous layout divider, which is an
-     * instanceof Canvas that fills the background in dark gray.
+     * instance of {@code Canvas} that fills in the background with dark gray.
      */
     protected Component createDefaultNonContinuousLayoutDivider() {
         return new Canvas() {
@@ -1041,11 +1041,11 @@
 
 
     /**
-     * Messaged after the JSplitPane the receiver is providing the look
-     * and feel for paints its children.
+     * Called when the specified split pane has finished painting
+     * its children.
      */
-    public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
-        if(jc == splitPane && getLastDragLocation() != -1 &&
+    public void finishedPaintingChildren(JSplitPane sp, Graphics g) {
+        if(sp == splitPane && getLastDragLocation() != -1 &&
            !isContinuousLayout() && !draggingHW) {
             Dimension      size = splitPane.getSize();
 
@@ -1062,7 +1062,7 @@
 
 
     /**
-     * Messaged to paint the look and feel.
+     * @inheritDoc
      */
     public void paint(Graphics g, JComponent jc) {
         if (!painted && splitPane.getDividerLocation()<0) {
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTableHeaderUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -306,7 +306,7 @@
     }
 
     /**
-     * Initialize JTableHeader properties, e.g. font, foreground, and background.
+     * Initializes JTableHeader properties such as font, foreground, and background.
      * The font, foreground, and background properties are only set if their
      * current value is either null or a UIResource, other properties are set
      * if the current value is null.
@@ -403,9 +403,9 @@
     }
 
     /**
-     * This method gets called every time the rollover column in the table
-     * header is updated. Every look and feel supporting rollover effect
-     * in table header should override this method and repaint the header.
+     * This method gets called every time when a rollover column in the table
+     * header is updated. Every look and feel that supports a rollover effect
+     * in a table header should override this method and repaint the header.
      *
      * @param oldColumn the index of the previous rollover column or -1 if the
      * mouse was not over a column
@@ -736,7 +736,6 @@
     }
 
     private Dimension createHeaderSize(long width) {
-        TableColumnModel columnModel = header.getColumnModel();
         // None of the callers include the intercell spacing, do it here.
         if (width > Integer.MAX_VALUE) {
             width = Integer.MAX_VALUE;
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTextUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -37,6 +37,7 @@
 import javax.swing.event.*;
 import javax.swing.border.Border;
 import javax.swing.plaf.UIResource;
+import javax.swing.plaf.synth.SynthUI;
 import sun.swing.DefaultLookup;
 import sun.awt.AppContext;
 import javax.swing.plaf.basic.DragRecognitionSupport.BeforeDrag;
@@ -221,8 +222,7 @@
         // is ==, which is the case for the windows look and feel.
         // Until an appropriate solution is found, the code is being
         // reverted to what it was before the original fix.
-        if (this instanceof sun.swing.plaf.synth.SynthUI ||
-                (c instanceof JTextArea)) {
+        if (this instanceof SynthUI || (c instanceof JTextArea)) {
             return;
         }
         Color background = c.getBackground();
@@ -289,7 +289,7 @@
     protected abstract String getPropertyPrefix();
 
     /**
-     * Initializes component properties, e.g. font, foreground,
+     * Initializes component properties, such as font, foreground,
      * background, caret color, selection color, selected text color,
      * disabled text color, and border color.  The font, foreground, and
      * background properties are only set if their current value is either null
@@ -377,9 +377,9 @@
     }
 
     /**
-     * Sets the component properties that haven't been explicitly overridden to
-     * null.  A property is considered overridden if its current value
-     * is not a UIResource.
+     * Sets the component properties that have not been explicitly overridden
+     * to {@code null}.  A property is considered overridden if its current
+     * value is not a {@code UIResource}.
      *
      * @see #installDefaults
      * @see #uninstallUI
@@ -756,18 +756,18 @@
      * things.
      * <ol>
      * <li>
-     * Set the associated component to opaque (can be changed
+     * Sets the associated component to opaque (can be changed
      * easily by a subclass or on JTextComponent directly),
      * which is the most common case.  This will cause the
      * component's background color to be painted.
      * <li>
-     * Install the default caret and highlighter into the
+     * Installs the default caret and highlighter into the
      * associated component.
      * <li>
-     * Attach to the editor and model.  If there is no
+     * Attaches to the editor and model.  If there is no
      * model, a default one is created.
      * <li>
-     * create the view factory and the view hierarchy used
+     * Creates the view factory and the view hierarchy used
      * to represent the model.
      * </ol>
      *
@@ -784,7 +784,7 @@
 
             // This is a workaround as these should not override what synth has
             // set them to
-            if (!(this instanceof sun.swing.plaf.synth.SynthUI)){
+            if (! (this instanceof SynthUI)) {
                 // common case is background painted... this can
                 // easily be changed by subclasses or from outside
                 // of the component.
@@ -857,9 +857,9 @@
      * To prevent this from happening twice, this method is
      * reimplemented to simply paint.
      * <p>
-     * <em>NOTE:</em> Superclass is also not thread-safe in
-     * it's rendering of the background, although that's not
-     * an issue with the default rendering.
+     * <em>NOTE:</em> NOTE: Superclass is also not thread-safe in its
+     * rendering of the background, although that is not an issue with the
+     * default rendering.
      */
     public void update(Graphics g, JComponent c) {
         paint(g, c);
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicToolBarUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -669,7 +669,7 @@
 
     /**
      * Sets the border of the component to have a rollover border which
-     * was created by <code>createRolloverBorder</code>.
+     * was created by the {@link #createRolloverBorder} method.
      *
      * @param c component which will have a rollover border installed
      * @see #createRolloverBorder
@@ -709,7 +709,7 @@
 
     /**
      * Sets the border of the component to have a non-rollover border which
-     * was created by <code>createNonRolloverBorder</code>.
+     * was created by the {@link #createNonRolloverBorder} method.
      *
      * @param c component which will have a non-rollover border installed
      * @see #createNonRolloverBorder
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -30,16 +30,12 @@
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.datatransfer.*;
-import java.awt.dnd.*;
 import java.beans.*;
-import java.io.*;
 import java.util.Enumeration;
 import java.util.Hashtable;
-import java.util.TooManyListenersException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
-import javax.swing.plaf.ActionMapUIResource;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.UIResource;
 import javax.swing.plaf.TreeUI;
@@ -1244,11 +1240,26 @@
         drawingCache.clear();
     }
 
-    private boolean isDropLine(JTree.DropLocation loc) {
+    /**
+     * Tells if a {@code DropLocation} should be indicated by a line between
+     * nodes. This is meant for {@code javax.swing.DropMode.INSERT} and
+     * {@code javax.swing.DropMode.ON_OR_INSERT} drop modes.
+     *
+     * @param loc a {@code DropLocation}
+     * @return {@code true} if the drop location should be shown as a line
+     * @since 1.7
+     */
+    protected boolean isDropLine(JTree.DropLocation loc) {
         return loc != null && loc.getPath() != null && loc.getChildIndex() != -1;
     }
 
-    private void paintDropLine(Graphics g) {
+    /**
+     * Paints the drop line.
+     *
+     * @param g {@code Graphics} object to draw on
+     * @since 1.7
+     */
+    protected void paintDropLine(Graphics g) {
         JTree.DropLocation loc = tree.getDropLocation();
         if (!isDropLine(loc)) {
             return;
@@ -1262,7 +1273,14 @@
         }
     }
 
-    private Rectangle getDropLineRect(JTree.DropLocation loc) {
+    /**
+     * Returns a ubounding box for the drop line.
+     *
+     * @param loc a {@code DropLocation}
+     * @return bounding box for the drop line
+     * @since 1.7
+     */
+    protected Rectangle getDropLineRect(JTree.DropLocation loc) {
         Rectangle rect;
         TreePath path = loc.getPath();
         int index = loc.getChildIndex();
@@ -1684,7 +1702,7 @@
                     treeState.setExpandedState(path, true);
                 }
             }
-            updateLeadRow();
+            updateLeadSelectionRow();
             updateSize();
         }
     }
@@ -2425,11 +2443,21 @@
         return tree.getLeadSelectionPath();
     }
 
-    private void updateLeadRow() {
+    /**
+     * Updates the lead row of the selection.
+     * @since 1.7
+     */
+    protected void updateLeadSelectionRow() {
         leadRow = getRowForPath(tree, getLeadSelectionPath());
     }
 
-    private int getLeadSelectionRow() {
+    /**
+     * Returns the lead row of the selection.
+     *
+     * @return selection lead row
+     * @since 1.7
+     */
+    protected int getLeadSelectionRow() {
         return leadRow;
     }
 
@@ -3345,7 +3373,7 @@
 
                 if (changeName == JTree.LEAD_SELECTION_PATH_PROPERTY) {
                     if (!ignoreLAChange) {
-                        updateLeadRow();
+                        updateLeadSelectionRow();
                         repaintPath((TreePath)event.getOldValue());
                         repaintPath((TreePath)event.getNewValue());
                     }
@@ -3763,7 +3791,7 @@
                 completeEditing();
                 if(path != null && tree.isVisible(path)) {
                     treeState.setExpandedState(path, false);
-                    updateLeadRow();
+                    updateLeadSelectionRow();
                     updateSize();
                 }
             }
@@ -3823,7 +3851,7 @@
             if(treeState != null && e != null) {
                 treeState.treeNodesInserted(e);
 
-                updateLeadRow();
+                updateLeadSelectionRow();
 
                 TreePath       path = e.getTreePath();
 
@@ -3848,7 +3876,7 @@
             if(treeState != null && e != null) {
                 treeState.treeNodesRemoved(e);
 
-                updateLeadRow();
+                updateLeadSelectionRow();
 
                 TreePath       path = e.getTreePath();
 
@@ -3862,7 +3890,7 @@
             if(treeState != null && e != null) {
                 treeState.treeStructureChanged(e);
 
-                updateLeadRow();
+                updateLeadSelectionRow();
 
                 TreePath       pPath = e.getTreePath();
 
--- a/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/DefaultMenuLayout.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /**
  * The default layout manager for Popup menus and menubars.  This
  * class is an extension of BoxLayout which adds the UIResource tag
- * so that plauggable L&Fs can distinguish it from user-installed
+ * so that pluggable L&Fs can distinguish it from user-installed
  * layout managers on menus.
  *
  * @author Georges Saab
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/NimbusLookAndFeel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -257,13 +257,41 @@
 
     /**
      * @inheritDoc
-     * @return true
+     * @return {@code true}
      */
     @Override public boolean shouldUpdateStyleOnAncestorChanged() {
         return true;
     }
 
     /**
+     * @inheritDoc
+     *
+     * <p>Overridden to return {@code true} when one of the following
+     * properties change:
+     * <ul>
+     *   <li>{@code "Nimbus.Overrides"}
+     *   <li>{@code "Nimbus.Overrides.InheritDefaults"}
+     *   <li>{@code "JComponent.sizeVariant"}
+     * </ul>
+     *
+     * @since 1.7
+     */
+    @Override
+    protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) {
+        String eName = ev.getPropertyName();
+
+        // Always update when overrides or size variant change
+        if ("Nimbus.Overrides" == eName ||
+            "Nimbus.Overrides.InheritDefaults" == eName ||
+            "JComponent.sizeVariant" == eName) {
+
+            return true;
+        }
+
+        return super.shouldUpdateStyleOnEvent(ev);
+    }
+
+    /**
      * <p>Registers a third party component with the NimbusLookAndFeel.</p>
      *
      * <p>Regions represent Components and areas within Components that act as
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/package.html	Wed Jul 05 17:04:26 2017 +0200
@@ -88,12 +88,11 @@
 <p><strong>Note:</strong>
 Most of the Swing API is <em>not</em> thread safe.
 For details, see
-<a
-href="http://java.sun.com/docs/books/tutorial/uiswing/overview/threads.html"
-target="_top">Threads and Swing</a>,
+<a href="http://java.sun.com/docs/books/tutorial/uiswing/concurrency/index.html"
+   target="_top">Concurrency in Swing</a>,
 a section in
 <em><a href="http://java.sun.com/docs/books/tutorial/"
-target="_top">The Java Tutorial</a></em>.
+       target="_top">The Java Tutorial</a></em>.
 
 @since 1.7
 @serial exclude
--- a/jdk/src/share/classes/javax/swing/plaf/synth/DefaultMenuLayout.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package javax.swing.plaf.synth;
-
-import javax.swing.*;
-import javax.swing.plaf.UIResource;
-
-import java.awt.Container;
-import java.awt.Dimension;
-
-/**
- * The default layout manager for Popup menus and menubars.  This
- * class is an extension of BoxLayout which adds the UIResource tag
- * so that plauggable L&Fs can distinguish it from user-installed
- * layout managers on menus.
- *
- * Derived from javax.swing.plaf.basic.DefaultMenuLayout
- *
- * @author Georges Saab
- */
-
-class DefaultMenuLayout extends BoxLayout implements UIResource {
-    public DefaultMenuLayout(Container target, int axis) {
-        super(target, axis);
-    }
-
-    public Dimension preferredLayoutSize(Container target) {
-        if (target instanceof JPopupMenu) {
-            JPopupMenu popupMenu = (JPopupMenu) target;
-
-            popupMenu.putClientProperty(
-                    SynthMenuItemLayoutHelper.MAX_ACC_OR_ARROW_WIDTH, null);
-            sun.swing.MenuItemLayoutHelper.clearUsedClientProperties(popupMenu);
-
-            if (popupMenu.getComponentCount() == 0) {
-                return new Dimension(0, 0);
-            }
-        }
-
-        // Make BoxLayout recalculate cached preferred sizes
-        super.invalidateLayout(target);
-
-        return super.preferredLayoutSize(target);
-    }
-}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthBorder.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthBorder.java	Wed Jul 05 17:04:26 2017 +0200
@@ -29,7 +29,6 @@
 import javax.swing.text.JTextComponent;
 import javax.swing.border.*;
 import javax.swing.plaf.UIResource;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
  * SynthBorder is a border that delegates to a Painter. The Insets
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,40 +25,49 @@
 
 package javax.swing.plaf.synth;
 
+import javax.swing.*;
 import java.awt.*;
-import java.awt.event.*;
-import java.io.Serializable;
-import javax.swing.*;
-import javax.swing.border.*;
-import java.awt.*;
-import java.awt.event.*;
 import java.beans.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicButtonUI;
 import javax.swing.plaf.basic.BasicHTML;
 import javax.swing.text.View;
-import sun.swing.plaf.synth.SynthUI;
-import sun.swing.plaf.synth.DefaultSynthStyle;
 
 /**
- * Synth's ButtonUI implementation.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JButton}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthButtonUI extends BasicButtonUI implements
+public class SynthButtonUI extends BasicButtonUI implements
                                  PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthButtonUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults(AbstractButton b) {
         updateStyle(b);
 
         LookAndFeel.installProperty(b, "rolloverEnabled", Boolean.TRUE);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners(AbstractButton b) {
         super.installListeners(b);
         b.addPropertyChangeListener(this);
@@ -99,11 +108,19 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners(AbstractButton b) {
         super.uninstallListeners(b);
         b.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults(AbstractButton b) {
         SynthContext context = getContext(b, ENABLED);
 
@@ -112,20 +129,20 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
 
     SynthContext getContext(JComponent c, int state) {
-        Region region = getRegion(c);
+        Region region = SynthLookAndFeel.getRegion(c);
         return SynthContext.getContext(SynthContext.class, c, region,
                                        style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     /**
      * Returns the current state of the passed in <code>AbstractButton</code>.
      */
@@ -164,6 +181,10 @@
         return state;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public int getBaseline(JComponent c, int width, int height) {
         if (c == null) {
             throw new NullPointerException("Component must be non-null");
@@ -215,6 +236,10 @@
     //          Paint Methods
     // ********************************
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -224,6 +249,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -231,6 +260,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         AbstractButton b = (AbstractButton)context.getComponent();
 
@@ -253,19 +288,22 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintButtonBorder(context, g, x, y, w, h);
     }
 
     /**
-     * Returns the default icon. This should NOT callback
+     * Returns the default icon. This should not callback
      * to the JComponent.
      *
-     * @param b AbstractButton the icon is associated with
+     * @param b button the icon is associated with
      * @return default icon
      */
-
     protected Icon getDefaultIcon(AbstractButton b) {
         SynthContext context = getContext(b);
         Icon icon = context.getStyle().getIcon(context, getPropertyPrefix() + "icon");
@@ -274,7 +312,11 @@
     }
 
     /**
-     * Returns the Icon to use in painting the button.
+     * Returns the Icon to use for painting the button. The icon is chosen with
+     * respect to the current state of the button.
+     *
+     * @param b button the icon is associated with
+     * @return an icon
      */
     protected Icon getIcon(AbstractButton b) {
         Icon icon = b.getIcon();
@@ -374,7 +416,7 @@
     /**
      * Returns the amount to shift the text/icon when painting.
      */
-    protected int getTextShiftOffset(SynthContext state) {
+    private int getTextShiftOffset(SynthContext state) {
         AbstractButton button = (AbstractButton)state.getComponent();
         ButtonModel model = button.getModel();
 
@@ -389,6 +431,11 @@
     // ********************************
     //          Layout Methods
     // ********************************
+
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getMinimumSize(JComponent c) {
         if (c.getComponentCount() > 0 && c.getLayout() != null) {
             return null;
@@ -406,6 +453,10 @@
         return size;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         if (c.getComponentCount() > 0 && c.getLayout() != null) {
             return null;
@@ -423,6 +474,10 @@
         return size;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getMaximumSize(JComponent c) {
         if (c.getComponentCount() > 0 && c.getLayout() != null) {
             return null;
@@ -442,7 +497,8 @@
     }
 
     /**
-     * Returns the Icon used in calculating the pref/min/max size.
+     * Returns the Icon used in calculating the
+     * preferred/minimum/maximum size.
      */
     protected Icon getSizingIcon(AbstractButton b) {
         Icon icon = getEnabledIcon(b, b.getIcon());
@@ -452,6 +508,10 @@
         return icon;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((AbstractButton)e.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxMenuItemUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,56 +27,50 @@
 
 
 import java.awt.*;
-import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.plaf.*;
-import javax.swing.border.*;
-import java.io.Serializable;
 
 
 /**
- * Synth's CheckBoxMenuItemUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JCheckBoxMenuItem}.
  *
  * @author Leif Samuelsson
  * @author Georges Saab
  * @author David Karlton
  * @author Arnaud Weber
+ * @since 1.7
  */
-class SynthCheckBoxMenuItemUI extends SynthMenuItemUI {
+public class SynthCheckBoxMenuItemUI extends SynthMenuItemUI {
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthCheckBoxMenuItemUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected String getPropertyPrefix() {
         return "CheckBoxMenuItem";
     }
 
-    public void processMouseEvent(JMenuItem item, MouseEvent e,
-                                  MenuElement path[], MenuSelectionManager manager) {
-        Point p = e.getPoint();
-        if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) {
-            if (e.getID() == MouseEvent.MOUSE_RELEASED) {
-                manager.clearSelectedPath();
-                item.doClick(0);
-            } else {
-                manager.setSelectedPath(path);
-            }
-        } else if (item.getModel().isArmed()) {
-            int c = path.length - 1;
-            MenuElement newPath[] = new MenuElement[c];
-            for (int i = 0; i < c; i++) {
-                newPath[i] = path[i];
-            }
-            manager.setSelectedPath(newPath);
-        }
-    }
-
+    @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
         context.getPainter().paintCheckBoxMenuItemBackground(context, g, 0, 0,
                                                   c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintCheckBoxMenuItemBorder(context, g, x, y, w, h);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthCheckBoxUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,36 +25,51 @@
 
 package javax.swing.plaf.synth;
 
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.plaf.*;
-import java.io.Serializable;
+import javax.swing.JComponent;
+import java.awt.Graphics;
+import javax.swing.plaf.ComponentUI;
 
 
 /**
- * Synth's CheckBoxUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JCheckBox}.
  *
  * @author Jeff Dinkins
+ * @since 1.7
  */
-class SynthCheckBoxUI extends SynthRadioButtonUI {
+public class SynthCheckBoxUI extends SynthRadioButtonUI {
 
     // ********************************
     //            Create PLAF
     // ********************************
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param b component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent b) {
         return new SynthCheckBoxUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected String getPropertyPrefix() {
         return "CheckBox.";
     }
 
+    @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
         context.getPainter().paintCheckBoxBackground(context, g, 0, 0,
                                                   c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintCheckBoxBorder(context, g, x, y, w, h);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,34 +28,39 @@
 
 import javax.swing.*;
 import javax.swing.colorchooser.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicColorChooserUI;
-import java.util.*;
 import java.awt.*;
-import java.awt.image.*;
-import java.awt.event.*;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-import java.io.Serializable;
-import sun.swing.plaf.synth.SynthUI;
 
 
 /**
- * Synth's ColorChooserUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JColorChooser}.
  *
  * @author Tom Santos
  * @author Steve Wilson
+ * @since 1.7
  */
-class SynthColorChooserUI extends BasicColorChooserUI implements
+public class SynthColorChooserUI extends BasicColorChooserUI implements
         PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthColorChooserUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected AbstractColorChooserPanel[] createDefaultChoosers() {
         SynthContext context = getContext(chooser, ENABLED);
         AbstractColorChooserPanel[] panels = (AbstractColorChooserPanel[])
@@ -68,6 +73,10 @@
         return panels;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         super.installDefaults();
         updateStyle(chooser);
@@ -79,6 +88,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(chooser, ENABLED);
 
@@ -88,16 +101,28 @@
         super.uninstallDefaults();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         chooser.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         chooser.removePropertyChangeListener(this);
         super.uninstallListeners();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -107,14 +132,14 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -125,6 +150,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -132,14 +161,29 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     * This implementation does not perform any actions.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintColorChooserBorder(context, g, x, y,w,h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JColorChooser)e.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,21 +27,21 @@
 
 import java.awt.*;
 import java.awt.event.*;
-import java.lang.reflect.*;
 import javax.swing.*;
 import javax.swing.plaf.*;
 import javax.swing.event.*;
 import javax.swing.plaf.basic.*;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's ComboBoxUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JComboBox}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthComboBoxUI extends BasicComboBoxUI implements
+public class SynthComboBoxUI extends BasicComboBoxUI implements
                               PropertyChangeListener, SynthUI {
     private SynthStyle style;
     private boolean useListColors;
@@ -93,12 +93,11 @@
     private boolean forceOpaque = false;
 
     /**
-     * NOTE: This serves the same purpose as the same field in BasicComboBoxUI.
-     * It is here because I could not give the padding field in
-     * BasicComboBoxUI protected access in an update release.
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
      */
-    private Insets padding;
-
     public static ComponentUI createUI(JComponent c) {
         return new SynthComboBoxUI();
     }
@@ -118,21 +117,6 @@
 
     @Override
     protected void installDefaults() {
-        //NOTE: This next line of code was added because, since squareButton in
-        //BasicComboBoxUI is private, I need to have some way of reading it from UIManager.
-        //This is an incomplete solution (since it implies that squareButons,
-        //once set, cannot be reset per state. Probably ok, but not always ok).
-        //This line of code should be removed at the same time that squareButton
-        //is made protected in the super class.
-        super.installDefaults();
-
-        //This is here instead of in updateStyle because the value for padding
-        //needs to remain consistent with the value for padding in
-        //BasicComboBoxUI. I wouldn't have this value here at all if not
-        //for the fact that I cannot make "padding" protected in any way
-        //for an update release. This *should* be fixed in Java 7
-        padding = UIManager.getInsets("ComboBox.padding");
-
         updateStyle(comboBox);
     }
 
@@ -142,6 +126,7 @@
 
         style = SynthLookAndFeel.updateStyle(context, this);
         if (style != oldStyle) {
+            padding = (Insets) style.get(context, "ComboBox.padding");
             popupInsets = (Insets)style.get(context, "ComboBox.popupInsets");
             useListColors = style.getBoolean(context,
                     "ComboBox.rendererUseListColors", true);
@@ -149,6 +134,8 @@
                     "ComboBox.buttonWhenNotEditable", false);
             pressedWhenPopupVisible = style.getBoolean(context,
                     "ComboBox.pressedWhenPopupVisible", false);
+            squareButton = style.getBoolean(context,
+                    "ComboBox.squareButton", true);
 
             if (oldStyle != null) {
                 uninstallKeyboardActions();
@@ -164,6 +151,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installListeners() {
         comboBox.addPropertyChangeListener(this);
@@ -172,6 +162,9 @@
         super.installListeners();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void uninstallUI(JComponent c) {
         if (popup instanceof SynthComboPopup) {
@@ -181,6 +174,9 @@
         buttonHandler = null;
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(comboBox, ENABLED);
@@ -190,6 +186,9 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallListeners() {
         editorFocusHandler.unregister();
@@ -200,6 +199,9 @@
         super.uninstallListeners();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
@@ -210,10 +212,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         // currently we have a broken situation where if a developer
         // takes the border from a JComboBox and sets it on a JTextField
@@ -252,6 +250,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected ComboPopup createPopup() {
         SynthComboPopup p = new SynthComboPopup(comboBox);
@@ -259,11 +260,17 @@
         return p;
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected ListCellRenderer createRenderer() {
         return new SynthComboBoxRenderer();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected ComboBoxEditor createEditor() {
         return new SynthComboBoxEditor();
@@ -273,6 +280,9 @@
     // end UI Initialization
     //======================
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
@@ -280,6 +290,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected JButton createArrowButton() {
         SynthArrowButton button = new SynthArrowButton(SwingConstants.SOUTH);
@@ -291,6 +304,9 @@
     //=================================
     // begin ComponentUI Implementation
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -302,6 +318,9 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -310,6 +329,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         hasFocus = comboBox.hasFocus();
         if ( !comboBox.isEditable() ) {
@@ -318,6 +343,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
@@ -375,7 +403,7 @@
     }
 
     /**
-     * Return the default size of an empty display area of the combo box using
+     * Returns the default size of an empty display area of the combo box using
      * the current renderer and font.
      *
      * This method was overridden to use SynthComboBoxRenderer instead of
@@ -394,23 +422,6 @@
     }
 
     /**
-     * This has been refactored out in hopes that it may be investigated and
-     * simplified for the next major release. adding/removing
-     * the component to the currentValuePane and changing the font may be
-     * redundant operations.
-     *
-     * NOTE: This method was copied in its entirety from BasicComboBoxUI. Might
-     * want to make it protected in BasicComboBoxUI in Java 7
-     */
-    private Dimension getSizeForComponent(Component comp) {
-        currentValuePane.add(comp);
-        comp.setFont(comboBox.getFont());
-        Dimension d = comp.getPreferredSize();
-        currentValuePane.remove(comp);
-        return d;
-    }
-
-    /**
      * From BasicComboBoxRenderer v 1.18.
      *
      * Be aware that SynthFileChooserUIImpl relies on the fact that the default
@@ -478,85 +489,17 @@
     }
 
 
-    /**
-     * From BasicCombBoxEditor v 1.24.
-     */
-    private static class SynthComboBoxEditor implements
-                              ComboBoxEditor, UIResource {
-        protected JTextField editor;
-        private Object oldValue;
-
-        public SynthComboBoxEditor() {
-            editor = new JTextField("",9);
-            editor.setName("ComboBox.textField");
-        }
-
-        @Override
-        public Component getEditorComponent() {
-            return editor;
-        }
-
-        /**
-         * Sets the item that should be edited.
-         *
-         * @param anObject the displayed value of the editor
-         */
-        @Override
-        public void setItem(Object anObject) {
-            String text;
+    private static class SynthComboBoxEditor
+            extends BasicComboBoxEditor.UIResource {
 
-            if ( anObject != null )  {
-                text = anObject.toString();
-                oldValue = anObject;
-            } else {
-                text = "";
-            }
-            // workaround for 4530952
-            if (!text.equals(editor.getText())) {
-                editor.setText(text);
-            }
-        }
-
-        @Override
-        public Object getItem() {
-            Object newValue = editor.getText();
-
-            if (oldValue != null && !(oldValue instanceof String))  {
-                // The original value is not a string. Should return the value in it's
-                // original type.
-                if (newValue.equals(oldValue.toString())) {
-                    return oldValue;
-                } else {
-                    // Must take the value from the editor and get the value and cast it to the new type.
-                    Class<?> cls = oldValue.getClass();
-                    try {
-                        Method method = cls.getMethod("valueOf", new Class[]{String.class});
-                        newValue = method.invoke(oldValue, new Object[] { editor.getText()});
-                    } catch (Exception ex) {
-                        // Fail silently and return the newValue (a String object)
-                    }
-                }
-            }
-            return newValue;
-        }
-
-        @Override
-        public void selectAll() {
-            editor.selectAll();
-            editor.requestFocus();
-        }
-
-        @Override
-        public void addActionListener(ActionListener l) {
-            editor.addActionListener(l);
-        }
-
-        @Override
-        public void removeActionListener(ActionListener l) {
-            editor.removeActionListener(l);
+        @Override public JTextField createEditorComponent() {
+            JTextField f = new JTextField("", 9);
+            f.setName("ComboBox.textField");
+            return f;
         }
     }
 
+
     /**
      * Handles all the logic for treating the combo as a button when it is
      * not editable, and when shouldActLikeButton() is true. This class is a
@@ -620,7 +563,7 @@
         //------------------------------------------------------------------
 
         /**
-         * {@inheritDoc}
+         * @inheritDoc
          *
          * Ensures that isPressed() will return true if the combo is pressed,
          * or the arrowButton is pressed, <em>or</em> if the combo popup is
@@ -634,7 +577,7 @@
         }
 
         /**
-         * {@inheritDoc}
+         * @inheritDoc
          *
          * Ensures that the armed state is in sync with the pressed state
          * if shouldActLikeButton is true. Without this method, the arrow
@@ -649,7 +592,7 @@
         }
 
         /**
-         * {@inheritDoc}
+         * @inheritDoc
          *
          * Ensures that isRollover() will return true if the combo is
          * rolled over, or the arrowButton is rolled over.
@@ -660,7 +603,7 @@
         }
 
         /**
-         * {@inheritDoc}
+         * @inheritDoc
          *
          * Forwards pressed states to the internal "pressed" field
          */
@@ -671,7 +614,7 @@
         }
 
         /**
-         * {@inheritDoc}
+         * @inheritDoc
          *
          * Forwards rollover states to the internal "over" field
          */
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDefaultLookup.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDefaultLookup.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,6 @@
 import sun.swing.DefaultLookup;
 import javax.swing.JComponent;
 import javax.swing.plaf.ComponentUI;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
  * SynthDefaultLookup redirects all lookup calls to the SynthContext.
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,36 +28,44 @@
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicDesktopIconUI;
 import java.beans.*;
-import java.io.Serializable;
-import sun.swing.plaf.synth.SynthUI;
 
 
 /**
- * Synth L&F for a minimized window on a desktop.
+ * Provides the Synth L&F UI delegate for a minimized internal frame on a desktop.
  *
  * @author Joshua Outwater
+ * @since 1.7
  */
-class SynthDesktopIconUI extends BasicDesktopIconUI implements SynthUI,
-                                        ActionListener, PropertyChangeListener {
+public class SynthDesktopIconUI extends BasicDesktopIconUI
+                                implements SynthUI, PropertyChangeListener {
     private SynthStyle style;
+    private Handler handler = new Handler();
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c)    {
         return new SynthDesktopIconUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installComponents() {
         if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
             iconPane = new JToggleButton(frame.getTitle(), frame.getFrameIcon()) {
-                public String getToolTipText() {
+                @Override public String getToolTipText() {
                     return getText();
                 }
 
-                public JPopupMenu getComponentPopupMenu() {
+                @Override public JPopupMenu getComponentPopupMenu() {
                     return frame.getComponentPopupMenu();
                 }
             };
@@ -73,24 +81,37 @@
         desktopIcon.add(iconPane, BorderLayout.CENTER);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         desktopIcon.addPropertyChangeListener(this);
 
         if (iconPane instanceof JToggleButton) {
             frame.addPropertyChangeListener(this);
-            ((JToggleButton)iconPane).addActionListener(this);
+            ((JToggleButton)iconPane).addActionListener(handler);
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         if (iconPane instanceof JToggleButton) {
+            ((JToggleButton)iconPane).removeActionListener(handler);
             frame.removePropertyChangeListener(this);
         }
         desktopIcon.removePropertyChangeListener(this);
         super.uninstallListeners();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         updateStyle(desktopIcon);
     }
@@ -101,6 +122,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(desktopIcon, ENABLED);
         style.uninstallDefaults(context);
@@ -108,12 +133,16 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
-        Region region = getRegion(c);
+        Region region = SynthLookAndFeel.getRegion(c);
         return SynthContext.getContext(SynthContext.class, c, region,
                                        style, state);
     }
@@ -122,10 +151,10 @@
         return SynthLookAndFeel.getComponentState(c);
     }
 
-    Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -136,6 +165,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -143,33 +176,24 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintDesktopIconBorder(context, g, x, y, w, h);
     }
 
-    public void actionPerformed(ActionEvent evt) {
-        if (evt.getSource() instanceof JToggleButton) {
-            // Either iconify the frame or deiconify and activate it.
-            JToggleButton button = (JToggleButton)evt.getSource();
-            try {
-                boolean selected = button.isSelected();
-                if (!selected && !frame.isIconifiable()) {
-                    button.setSelected(true);
-                } else {
-                    frame.setIcon(!selected);
-                    if (selected) {
-                        frame.setSelected(true);
-                    }
-                }
-            } catch (PropertyVetoException e2) {
-            }
-        }
-    }
-
     public void propertyChange(PropertyChangeEvent evt) {
         if (evt.getSource() instanceof JInternalFrame.JDesktopIcon) {
             if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
@@ -191,4 +215,25 @@
             }
         }
     }
+
+    private final class Handler implements ActionListener {
+        public void actionPerformed(ActionEvent evt) {
+            if (evt.getSource() instanceof JToggleButton) {
+                // Either iconify the frame or deiconify and activate it.
+                JToggleButton button = (JToggleButton)evt.getSource();
+                try {
+                    boolean selected = button.isSelected();
+                    if (!selected && !frame.isIconifiable()) {
+                        button.setSelected(true);
+                    } else {
+                        frame.setIcon(!selected);
+                        if (selected) {
+                            frame.setSelected(true);
+                        }
+                    }
+                } catch (PropertyVetoException e2) {
+                }
+            }
+        }
+    }
 }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -29,34 +29,38 @@
 import javax.swing.border.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicDesktopPaneUI;
-
 import java.beans.*;
-
 import java.awt.event.*;
-import java.awt.Dimension;
-import java.awt.Insets;
-import java.awt.Graphics;
-import java.awt.KeyboardFocusManager;
 import java.awt.*;
-import java.util.Vector;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth L&F for a desktop.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JDesktopPane}.
  *
  * @author Joshua Outwater
  * @author Steve Wilson
+ * @since 1.7
  */
-class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
+public class SynthDesktopPaneUI extends BasicDesktopPaneUI implements
                   PropertyChangeListener, SynthUI {
     private SynthStyle style;
     private TaskBar taskBar;
     private DesktopManager oldDesktopManager;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthDesktopPaneUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         desktop.addPropertyChangeListener(this);
@@ -68,6 +72,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         updateStyle(desktop);
 
@@ -114,6 +122,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         if (taskBar != null) {
             desktop.removeComponentListener(taskBar);
@@ -123,6 +135,10 @@
         super.uninstallListeners();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(desktop, ENABLED);
 
@@ -147,6 +163,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDesktopManager() {
         if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
             desktopManager = oldDesktopManager = desktop.getDesktopManager();
@@ -159,6 +179,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDesktopManager() {
         if (oldDesktopManager != null && !(oldDesktopManager instanceof UIResource)) {
             desktopManager = desktop.getDesktopManager();
@@ -397,7 +421,10 @@
         }
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -407,14 +434,14 @@
                      SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -425,6 +452,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -432,14 +463,28 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintDesktopPaneBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent evt) {
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
             updateStyle((JDesktopPane)evt.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -31,47 +31,52 @@
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicEditorPaneUI;
 import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Provides the look and feel for a JEditorPane in the
- * Synth look and feel.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JEditorPane}.
  *
  * @author  Shannon Hickey
+ * @since 1.7
  */
-class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
+public class SynthEditorPaneUI extends BasicEditorPaneUI implements SynthUI {
     private SynthStyle style;
     /*
      * I would prefer to use UIResource instad of this.
      * Unfortunately Boolean is a final class
      */
     private Boolean localTrue = Boolean.TRUE;
-    private Boolean localFalse = Boolean.FALSE;
 
     /**
-     * Creates a UI for the JTextPane.
+     * Creates a new UI object for the given component.
      *
-     * @param c the JTextPane component
-     * @return the UI
+     * @param c component to create UI object for
+     * @return the UI object
      */
     public static ComponentUI createUI(JComponent c) {
         return new SynthEditorPaneUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         // Installs the text cursor on the component
         super.installDefaults();
         JComponent c = getComponent();
         Object clientProperty =
             c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
-        if (clientProperty == null
-            || clientProperty == localFalse) {
-            c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
-                                localTrue);
+        if (clientProperty == null) {
+            c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, localTrue);
         }
         updateStyle(getComponent());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(getComponent(), ENABLED);
         JComponent c = getComponent();
@@ -84,7 +89,7 @@
         Object clientProperty =
             c.getClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES);
         if (clientProperty == localTrue) {
-            getComponent().putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
+            c.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES,
                                              Boolean.FALSE);
         }
         super.uninstallDefaults();
@@ -100,6 +105,7 @@
      *
      * @param evt the property change event
      */
+    @Override
     protected void propertyChange(PropertyChangeEvent evt) {
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
             updateStyle((JTextComponent)evt.getSource());
@@ -124,6 +130,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -137,6 +147,10 @@
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -146,10 +160,20 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void paintBackground(Graphics g) {
         // Overriden to do nothing, all our painting is done from update/paint.
     }
@@ -159,6 +183,10 @@
                                                   c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintEditorPaneBorder(context, g, x, y, w, h);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthFormattedTextFieldUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,16 +24,17 @@
  */
 package javax.swing.plaf.synth;
 
-import java.awt.*;
-import javax.swing.*;
+import java.awt.Graphics;
+import javax.swing.JComponent;
 import javax.swing.plaf.ComponentUI;
 
 /**
- * Provides the look and feel implementation for
- * <code>JFormattedTextField</code>.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JFormattedTextField}.
  *
+ * @since 1.7
  */
-class SynthFormattedTextFieldUI extends SynthTextFieldUI {
+public class SynthFormattedTextFieldUI extends SynthTextFieldUI {
     /**
      * Creates a UI for a JFormattedTextField.
      *
@@ -51,15 +52,24 @@
      *
      * @return the name "FormattedTextField"
      */
+    @Override
     protected String getPropertyPrefix() {
         return "FormattedTextField";
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
         context.getPainter().paintFormattedTextFieldBackground(context, g, 0,
                              0, c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintFormattedTextFieldBorder(context, g, x, y,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java	Wed Jul 05 17:04:26 2017 +0200
@@ -30,14 +30,9 @@
 import javax.swing.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
-import javax.swing.border.*;
-import javax.swing.event.InternalFrameEvent;
-import java.util.EventListener;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import java.beans.VetoableChangeListener;
 import java.beans.PropertyVetoException;
-import sun.swing.plaf.synth.SynthUI;
 import sun.swing.SwingUtilities2;
 
 /**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,52 +27,61 @@
 
 import java.awt.*;
 import java.awt.event.*;
-import java.awt.peer.LightweightPeer;
-
 import javax.swing.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicInternalFrameUI;
-import javax.swing.event.*;
-
 import java.beans.*;
-import java.io.Serializable;
-import sun.swing.plaf.synth.SynthUI;
 
 
 /**
- * Synth's InternalFrameUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JInternalFrame}.
  *
  * @author David Kloba
  * @author Joshua Outwater
  * @author Rich Schiavi
+ * @since 1.7
  */
-class SynthInternalFrameUI extends BasicInternalFrameUI implements SynthUI,
-        PropertyChangeListener {
+public class SynthInternalFrameUI extends BasicInternalFrameUI
+                                  implements SynthUI, PropertyChangeListener {
     private SynthStyle style;
 
-    private static DesktopManager sharedDesktopManager;
-    private boolean componentListenerAdded = false;
-
-    private Rectangle parentBounds;
-
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param b component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent b) {
         return new SynthInternalFrameUI((JInternalFrame)b);
     }
 
-    public SynthInternalFrameUI(JInternalFrame b) {
+    protected SynthInternalFrameUI(JInternalFrame b) {
         super(b);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void installDefaults() {
         frame.setLayout(internalFrameLayout = createLayoutManager());
         updateStyle(frame);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         frame.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallComponents() {
         if (frame.getComponentPopupMenu() instanceof UIResource) {
             frame.setComponentPopupMenu(null);
@@ -80,6 +89,10 @@
         super.uninstallComponents();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         frame.removePropertyChangeListener(this);
         super.uninstallListeners();
@@ -104,6 +117,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(frame, ENABLED);
         style.uninstallDefaults(context);
@@ -115,6 +132,10 @@
 
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -124,24 +145,28 @@
                             SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    public int getComponentState(JComponent c) {
+    private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected JComponent createNorthPane(JInternalFrame w) {
         titlePane = new SynthInternalFrameTitlePane(w);
         titlePane.setName("InternalFrame.northPane");
         return titlePane;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected ComponentListener createComponentListener() {
         if (UIManager.getBoolean("InternalFrame.useTaskBar")) {
             return new ComponentHandler() {
-                public void componentResized(ComponentEvent e) {
+                @Override public void componentResized(ComponentEvent e) {
                     if (frame != null && frame.isMaximum()) {
                         JDesktopPane desktop = (JDesktopPane)e.getSource();
                         for (Component comp : desktop.getComponents()) {
@@ -168,6 +193,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -178,6 +207,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -185,15 +218,29 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintInternalFrameBorder(context,
                                                             g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent evt) {
         SynthStyle oldStyle = style;
         JInternalFrame f = (JInternalFrame)evt.getSource();
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -29,38 +29,37 @@
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
 import javax.swing.text.View;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.Component;
-import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.Rectangle;
 import java.awt.Insets;
-import java.awt.Color;
 import java.awt.Graphics;
-import java.awt.Font;
 import java.awt.FontMetrics;
 import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's LabelUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JLabel}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthLabelUI extends BasicLabelUI implements SynthUI {
+public class SynthLabelUI extends BasicLabelUI implements SynthUI {
     private SynthStyle style;
 
     /**
      * Returns the LabelUI implementation used for the skins look and feel.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
      */
     public static ComponentUI createUI(JComponent c){
         return new SynthLabelUI();
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults(JLabel c) {
         updateStyle(c);
     }
@@ -71,6 +70,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults(JLabel c){
         SynthContext context = getContext(c, ENABLED);
 
@@ -79,6 +82,10 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -88,10 +95,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         int state = SynthLookAndFeel.getComponentState(c);
         if (SynthLookAndFeel.selectedUI == this &&
@@ -101,6 +104,10 @@
         return state;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public int getBaseline(JComponent c, int width, int height) {
         if (c == null) {
             throw new NullPointerException("Component must be non-null");
@@ -153,6 +160,10 @@
      * component.  This method is invoked by <code>JComponent</code>
      * when the specified component is being painted.
      */
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -163,6 +174,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -170,6 +185,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         JLabel label = (JLabel)context.getComponent();
         Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -185,11 +206,19 @@
             label.getIconTextGap(), label.getDisplayedMnemonicIndex(), 0);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintLabelBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         JLabel label = (JLabel)c;
         Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -207,7 +236,10 @@
         return size;
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getMinimumSize(JComponent c) {
         JLabel label = (JLabel)c;
         Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -225,6 +257,10 @@
         return size;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getMaximumSize(JComponent c) {
         JLabel label = (JLabel)c;
         Icon icon = (label.isEnabled()) ? label.getIcon() :
@@ -242,7 +278,10 @@
         return size;
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         super.propertyChange(e);
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,38 +27,39 @@
 
 import javax.swing.*;
 import javax.swing.border.*;
-import javax.swing.event.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
-import javax.swing.text.Position;
-
 import java.awt.*;
-import java.awt.event.*;
-import java.awt.datatransfer.Transferable;
-import java.awt.dnd.*;
-
-import java.util.ArrayList;
-import java.util.TooManyListenersException;
-
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's ListUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JList}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthListUI extends BasicListUI implements PropertyChangeListener,
-                               SynthUI {
+public class SynthListUI extends BasicListUI
+                         implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
     private boolean useListColors;
     private boolean useUIBorder;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param list component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent list) {
         return new SynthListUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -69,27 +70,47 @@
         paint(g, c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintListBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         list.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JList)e.getSource());
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         list.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         if (list.getCellRenderer() == null ||
                  (list.getCellRenderer() instanceof UIResource)) {
@@ -135,6 +156,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         super.uninstallDefaults();
 
@@ -145,6 +170,10 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -154,27 +183,23 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
 
     private class SynthListCellRenderer extends DefaultListCellRenderer.UIResource {
-        public String getName() {
+        @Override public String getName() {
             return "List.cellRenderer";
         }
 
-        public void setBorder(Border b) {
+        @Override public void setBorder(Border b) {
             if (useUIBorder || b instanceof SynthBorder) {
                 super.setBorder(b);
             }
         }
 
-        public Component getListCellRendererComponent(JList list, Object value,
+        @Override public Component getListCellRendererComponent(JList list, Object value,
                   int index, boolean isSelected, boolean cellHasFocus) {
             if (!useListColors && (isSelected || cellHasFocus)) {
                 SynthLookAndFeel.setSelectedUI((SynthLabelUI)SynthLookAndFeel.
@@ -190,7 +215,7 @@
             return this;
         }
 
-        public void paint(Graphics g) {
+        @Override public void paint(Graphics g) {
             super.paint(g);
             SynthLookAndFeel.resetSelectedUI();
         }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLookAndFeel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -234,44 +234,9 @@
      * <code>shouldUpdateStyleOnAncestorChanged</code> as necessary.
      */
     static boolean shouldUpdateStyle(PropertyChangeEvent event) {
-        String eName = event.getPropertyName();
-        if ("name" == eName) {
-            // Always update on a name change
-            return true;
-        }
-        else if ("componentOrientation" == eName) {
-            // Always update on a component orientation change
-            return true;
-        }
-        else if ("ancestor" == eName && event.getNewValue() != null) {
-            // Only update on an ancestor change when getting a valid
-            // parent and the LookAndFeel wants this.
-            LookAndFeel laf = UIManager.getLookAndFeel();
-            return (laf instanceof SynthLookAndFeel &&
-                    ((SynthLookAndFeel)laf).
-                     shouldUpdateStyleOnAncestorChanged());
-        }
-        // Note: The following two nimbus based overrides should be refactored
-        // to be in the Nimbus LAF. Due to constraints in an update release,
-        // we couldn't actually provide the public API necessary to allow
-        // NimbusLookAndFeel (a subclass of SynthLookAndFeel) to provide its
-        // own rules for shouldUpdateStyle.
-        else if ("Nimbus.Overrides" == eName) {
-            // Always update when the Nimbus.Overrides client property has
-            // been changed
-            return true;
-        }
-        else if ("Nimbus.Overrides.InheritDefaults" == eName) {
-            // Always update when the Nimbus.Overrides.InheritDefaults
-            // client property has changed
-            return true;
-        }
-        else if ("JComponent.sizeVariant" == eName) {
-            // Always update when the JComponent.sizeVariant
-            // client property has changed
-            return true;
-        }
-        return false;
+        LookAndFeel laf = UIManager.getLookAndFeel();
+        return (laf instanceof SynthLookAndFeel &&
+                ((SynthLookAndFeel) laf).shouldUpdateStyleOnEvent(event));
     }
 
     /**
@@ -303,12 +268,6 @@
      * @param c Component to update style for.
      */
     public static void updateStyles(Component c) {
-        _updateStyles(c);
-        c.repaint();
-    }
-
-    // Implementation for updateStyles
-    private static void _updateStyles(Component c) {
         if (c instanceof JComponent) {
             // Yes, this is hacky. A better solution is to get the UI
             // and cast, but JComponent doesn't expose a getter for the UI
@@ -332,6 +291,7 @@
                 updateStyles(child);
             }
         }
+        c.repaint();
     }
 
     /**
@@ -789,6 +749,27 @@
     }
 
     /**
+     * Returns whether or not the UIs should update their styles when a
+     * particular event occurs.
+     *
+     * @param ev a {@code PropertyChangeEvent}
+     * @return whether or not the UIs should update their styles
+     * @since 1.7
+     */
+    protected boolean shouldUpdateStyleOnEvent(PropertyChangeEvent ev) {
+        String eName = ev.getPropertyName();
+        if ("name" == eName || "componentOrientation" == eName) {
+            return true;
+        }
+        if ("ancestor" == eName && ev.getNewValue() != null) {
+            // Only update on an ancestor change when getting a valid
+            // parent and the LookAndFeel wants this.
+            return shouldUpdateStyleOnAncestorChanged();
+        }
+        return false;
+    }
+
+    /**
      * Returns the antialiasing information as specified by the host desktop.
      * Antialiasing might be forced off if the desktop is GNOME and the user
      * has set his locale to Chinese, Japanese or Korean. This is consistent
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,45 +25,49 @@
 package javax.swing.plaf.synth;
 
 import javax.swing.*;
-import javax.swing.event.*;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
 import java.awt.Graphics;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.Rectangle;
-import java.awt.event.*;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-
-import javax.swing.border.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's MenuBarUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JMenuBar}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthMenuBarUI extends BasicMenuBarUI implements PropertyChangeListener,
-                                  SynthUI {
+public class SynthMenuBarUI extends BasicMenuBarUI
+                            implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param x component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent x) {
         return new SynthMenuBarUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         if (menuBar.getLayout() == null ||
             menuBar.getLayout() instanceof UIResource) {
-            menuBar.setLayout(new DefaultMenuLayout(menuBar,BoxLayout.LINE_AXIS));
+            menuBar.setLayout(new SynthMenuLayout(menuBar,BoxLayout.LINE_AXIS));
         }
         updateStyle(menuBar);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         menuBar.addPropertyChangeListener(this);
@@ -82,6 +86,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(menuBar, ENABLED);
 
@@ -90,11 +98,19 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         menuBar.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -104,14 +120,14 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -122,6 +138,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -129,14 +149,28 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintMenuBarBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JMenuBar)e.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,41 +24,44 @@
  */
 package javax.swing.plaf.synth;
 
-import javax.swing.plaf.basic.BasicHTML;
 import java.awt.*;
-import java.awt.event.*;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
-
 import javax.swing.*;
-import javax.swing.event.*;
-import javax.swing.border.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
-import javax.swing.text.View;
-import sun.swing.plaf.synth.*;
 import sun.swing.MenuItemLayoutHelper;
 
 
 /**
- * Synth's MenuItemUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JMenuItem}.
  *
  * @author Georges Saab
  * @author David Karlton
  * @author Arnaud Weber
  * @author Fredrik Lagerblad
+ * @since 1.7
  */
-class SynthMenuItemUI extends BasicMenuItemUI implements
+public class SynthMenuItemUI extends BasicMenuItemUI implements
                                    PropertyChangeListener, SynthUI {
     private SynthStyle style;
     private SynthStyle accStyle;
 
-    private String acceleratorDelimiter;
-
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthMenuItemUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void uninstallUI(JComponent c) {
         super.uninstallUI(c);
         // Remove values from the parent's Client Properties.
@@ -69,10 +72,18 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         updateStyle(menuItem);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         menuItem.addPropertyChangeListener(this);
@@ -122,6 +133,10 @@
         accContext.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(menuItem, ENABLED);
         style.uninstallDefaults(context);
@@ -137,11 +152,19 @@
         super.uninstallDefaults();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         menuItem.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -151,7 +174,7 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    public SynthContext getContext(JComponent c, Region region) {
+    SynthContext getContext(JComponent c, Region region) {
         return getContext(c, region, getComponentState(c, region));
     }
 
@@ -160,10 +183,6 @@
                                        region, accStyle, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         int state;
 
@@ -186,6 +205,10 @@
         return getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected Dimension getPreferredMenuItemSize(JComponent c,
                                                      Icon checkIcon,
                                                      Icon arrowIcon,
@@ -203,6 +226,10 @@
     }
 
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -212,6 +239,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -219,6 +250,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext accContext = getContext(menuItem,
                                              Region.MENU_ITEM_ACCELERATOR);
@@ -236,11 +273,19 @@
         SynthGraphicsUtils.paintBackground(context, g, c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintMenuItemBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JMenuItem)e.getSource());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuLayout.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.swing.plaf.synth;
+
+import javax.swing.plaf.basic.DefaultMenuLayout;
+import javax.swing.JPopupMenu;
+import java.awt.Container;
+import java.awt.Dimension;
+
+/**
+ * @inheritDoc
+ *
+ * @author Georges Saab
+ */
+
+class SynthMenuLayout extends DefaultMenuLayout {
+    public SynthMenuLayout(Container target, int axis) {
+        super(target, axis);
+    }
+
+    public Dimension preferredLayoutSize(Container target) {
+        if (target instanceof JPopupMenu) {
+            JPopupMenu popupMenu = (JPopupMenu) target;
+            popupMenu.putClientProperty(
+                    SynthMenuItemLayoutHelper.MAX_ACC_OR_ARROW_WIDTH, null);
+        }
+
+        return super.preferredLayoutSize(target);
+    }
+}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,40 +25,48 @@
 package javax.swing.plaf.synth;
 
 import java.awt.*;
-import java.awt.event.*;
 import java.beans.*;
 import javax.swing.*;
-import javax.swing.event.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
-import javax.swing.border.*;
-import java.util.Arrays;
-import java.util.ArrayList;
-import sun.swing.plaf.synth.SynthUI;
 import sun.swing.MenuItemLayoutHelper;
 
 /**
- * Synth's MenuUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JMenu}.
  *
  * @author Georges Saab
  * @author David Karlton
  * @author Arnaud Weber
+ * @since 1.7
  */
-class SynthMenuUI extends BasicMenuUI implements PropertyChangeListener,
-                               SynthUI {
+public class SynthMenuUI extends BasicMenuUI
+                         implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
     private SynthStyle accStyle;
 
-    private String acceleratorDelimiter;
-
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param x component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent x) {
         return new SynthMenuUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         updateStyle(menuItem);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         menuItem.addPropertyChangeListener(this);
@@ -111,6 +119,10 @@
         accContext.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void uninstallUI(JComponent c) {
         super.uninstallUI(c);
         // Remove values from the parent's Client Properties.
@@ -121,6 +133,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(menuItem, ENABLED);
         style.uninstallDefaults(context);
@@ -136,22 +152,30 @@
         super.uninstallDefaults();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         menuItem.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
 
     SynthContext getContext(JComponent c, int state) {
-        Region region = getRegion(c);
+        Region region = SynthLookAndFeel.getRegion(c);
         return SynthContext.getContext(SynthContext.class, c, region,
                                        style, state);
     }
 
-    public SynthContext getContext(JComponent c, Region region) {
+    SynthContext getContext(JComponent c, Region region) {
         return getContext(c, region, getComponentState(c, region));
     }
 
@@ -160,10 +184,6 @@
                                        region, accStyle, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         int state;
 
@@ -186,6 +206,10 @@
         return getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected Dimension getPreferredMenuItemSize(JComponent c,
                                                      Icon checkIcon,
                                                      Icon arrowIcon,
@@ -202,7 +226,10 @@
         return value;
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -213,6 +240,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -220,6 +251,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext accContext = getContext(menuItem,
                                              Region.MENU_ITEM_ACCELERATOR);
@@ -232,11 +269,19 @@
         accContext.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintMenuBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JMenu)e.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,34 +28,45 @@
 import java.awt.*;
 import java.beans.*;
 import javax.swing.*;
-import javax.swing.event.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
 import sun.swing.DefaultLookup;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's OptionPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JOptionPane}.
  *
  * @author James Gosling
  * @author Scott Violet
  * @author Amy Fowler
+ * @since 1.7
  */
-class SynthOptionPaneUI extends BasicOptionPaneUI implements
+public class SynthOptionPaneUI extends BasicOptionPaneUI implements
                                 PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
     /**
-      * Creates a new BasicOptionPaneUI instance.
-      */
+     * Creates a new UI object for the given component.
+     *
+     * @param x component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent x) {
         return new SynthOptionPaneUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         updateStyle(optionPane);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         optionPane.addPropertyChangeListener(this);
@@ -80,6 +91,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(optionPane, ENABLED);
 
@@ -88,11 +103,19 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         optionPane.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installComponents() {
         optionPane.add(createMessageArea());
 
@@ -108,6 +131,10 @@
         optionPane.applyComponentOrientation(optionPane.getComponentOrientation());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -117,14 +144,14 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -135,6 +162,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -142,30 +173,49 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintOptionPaneBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JOptionPane)e.getSource());
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected boolean getSizeButtonsToSameWidth() {
         return DefaultLookup.getBoolean(optionPane, this,
                                         "OptionPane.sameSizeButtons", true);
     }
 
     /**
-     * Messaged from installComponents to create a Container containing the
-     * body of the message. The icon is the created by calling
-     * <code>addIcon</code>.
+     * Called from {@link #installComponents} to create a {@code Container}
+     * containing the body of the message. The icon is the created by calling
+     * {@link #addIcon}.
      */
+    @Override
     protected Container createMessageArea() {
         JPanel top = new JPanel();
         top.setName("OptionPane.messageArea");
@@ -206,6 +256,10 @@
         return top;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected Container createSeparator() {
         JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);
 
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPainter.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,7 +25,6 @@
 package javax.swing.plaf.synth;
 
 import java.awt.*;
-import javax.swing.*;
 
 /**
  * <code>SynthPainter</code> is used for painting portions of
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,29 +25,37 @@
 
 package javax.swing.plaf.synth;
 
-import java.awt.*;
 import javax.swing.*;
-import javax.swing.border.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicPanelUI;
 import java.awt.*;
-import java.awt.event.*;
 import java.beans.*;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's PanelUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JPanel}.
  *
  * @author Steve Wilson
+ * @since 1.7
  */
-class SynthPanelUI extends BasicPanelUI implements PropertyChangeListener,
-        SynthUI {
+public class SynthPanelUI extends BasicPanelUI
+                          implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthPanelUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void installUI(JComponent c) {
         JPanel p = (JPanel)c;
 
@@ -55,6 +63,10 @@
         installListeners(p);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void uninstallUI(JComponent c) {
         JPanel p = (JPanel)c;
 
@@ -62,18 +74,36 @@
         super.uninstallUI(c);
     }
 
+    /**
+     * Installs listeners into the panel.
+     *
+     * @param p the {@code JPanel} object
+     */
     protected void installListeners(JPanel p) {
         p.addPropertyChangeListener(this);
     }
 
+    /**
+     * Uninstalls listeners from the panel.
+     *
+     * @param p the {@code JPanel} object
+     */
     protected void uninstallListeners(JPanel p) {
         p.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults(JPanel p) {
         updateStyle(p);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults(JPanel p) {
         SynthContext context = getContext(p, ENABLED);
 
@@ -88,6 +118,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -97,14 +131,14 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -115,6 +149,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -122,15 +160,29 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         // do actual painting
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintPanelBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent pce) {
         if (SynthLookAndFeel.shouldUpdateStyle(pce)) {
             updateStyle((JPanel)pce.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPasswordFieldUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,21 +25,19 @@
 
 package javax.swing.plaf.synth;
 
-import java.awt.*;
+import java.awt.Graphics;
 import javax.swing.*;
 import javax.swing.text.*;
-import javax.swing.plaf.*;
+import javax.swing.plaf.ComponentUI;
 
 /**
- * Provides the Synth look and feel for a password field.
- * The only difference from the standard text field is that
- * the view of the text is simply a string of the echo
- * character as specified in JPasswordField, rather than the
- * real text contained in the field.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JPasswordField}.
  *
  * @author  Shannon Hickey
+ * @since 1.7
  */
-class SynthPasswordFieldUI extends SynthTextFieldUI {
+public class SynthPasswordFieldUI extends SynthTextFieldUI {
 
     /**
      * Creates a UI for a JPasswordField.
@@ -58,6 +56,7 @@
      *
      * @return the name ("PasswordField")
      */
+    @Override
     protected String getPropertyPrefix() {
         return "PasswordField";
     }
@@ -68,20 +67,33 @@
      * @param elem the element
      * @return the view
      */
+    @Override
     public View create(Element elem) {
         return new PasswordView(elem);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
         context.getPainter().paintPasswordFieldBackground(context, g, 0, 0,
                                                 c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintPasswordFieldBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installKeyboardActions() {
         super.installKeyboardActions();
         ActionMap map = SwingUtilities.getUIActionMap(getComponent());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,49 +26,43 @@
 package javax.swing.plaf.synth;
 
 import javax.swing.*;
-import javax.swing.event.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
-import javax.swing.border.*;
-
-import java.applet.Applet;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Dimension;
 import java.awt.Graphics;
-import java.awt.KeyboardFocusManager;
-import java.awt.Window;
-import java.awt.event.*;
-import java.awt.AWTEvent;
-import java.awt.Toolkit;
-
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
 
-import java.util.*;
-import sun.swing.plaf.synth.SynthUI;
-
 /**
- * Synth's PopupMenuUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JPopupMenu}.
  *
  * @author Georges Saab
  * @author David Karlton
  * @author Arnaud Weber
+ * @since 1.7
  */
-class SynthPopupMenuUI extends BasicPopupMenuUI implements
-                PropertyChangeListener, SynthUI {
+public class SynthPopupMenuUI extends BasicPopupMenuUI
+                              implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param x component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent x) {
         return new SynthPopupMenuUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void installDefaults() {
         if (popupMenu.getLayout() == null ||
             popupMenu.getLayout() instanceof UIResource) {
-            popupMenu.setLayout(new DefaultMenuLayout(
-                                    popupMenu, BoxLayout.Y_AXIS));
+            popupMenu.setLayout(new SynthMenuLayout(popupMenu, BoxLayout.Y_AXIS));
         }
         updateStyle(popupMenu);
     }
@@ -86,11 +80,19 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         popupMenu.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(popupMenu, ENABLED);
 
@@ -103,11 +105,19 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         popupMenu.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -117,14 +127,14 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -135,6 +145,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -142,14 +156,28 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintPopupMenuBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle(popupMenu);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -32,16 +32,17 @@
 import javax.swing.plaf.basic.BasicProgressBarUI;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
 import sun.swing.SwingUtilities2;
 
 /**
- * Synth's ProgressBarUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JProgressBar}.
  *
  * @author Joshua Outwater
+ * @since 1.7
  */
-class SynthProgressBarUI extends BasicProgressBarUI implements SynthUI,
-        PropertyChangeListener {
+public class SynthProgressBarUI extends BasicProgressBarUI
+                                implements SynthUI, PropertyChangeListener {
     private SynthStyle style;
     private int progressPadding;
     private boolean rotateText; // added for Nimbus LAF
@@ -49,22 +50,37 @@
     private boolean tileWhenIndeterminate; //whether to tile indeterminate painting
     private int tileWidth; //the width of each tile
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param x component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent x) {
         return new SynthProgressBarUI();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installListeners() {
         super.installListeners();
         progressBar.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         progressBar.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installDefaults() {
         updateStyle(progressBar);
@@ -101,6 +117,9 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(progressBar, ENABLED);
@@ -110,6 +129,10 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -119,14 +142,13 @@
                             SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public int getBaseline(JComponent c, int width, int height) {
         super.getBaseline(c, width, height);
@@ -142,6 +164,9 @@
         return -1;
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected Rectangle getBox(Rectangle r) {
         if (tileWhenIndeterminate) {
@@ -151,6 +176,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void setAnimationIndex(int newValue) {
         if (paintOutsideClip) {
@@ -164,6 +192,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -176,6 +207,9 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -184,6 +218,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         JProgressBar pBar = (JProgressBar)context.getComponent();
         int x = 0, y = 0, width = 0, height = 0;
@@ -261,8 +301,14 @@
         }
     }
 
-    protected void paintText(SynthContext context, Graphics g,
-            String title) {
+    /**
+     * Paints the component's text.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     * @param title the text to paint
+     */
+    protected void paintText(SynthContext context, Graphics g, String title) {
         if (progressBar.isStringPainted()) {
             SynthStyle style = context.getStyle();
             Font font = style.getFont(context);
@@ -323,12 +369,20 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintProgressBarBorder(context, g, x, y, w, h,
                                                     progressBar.getOrientation());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e) ||
                 "indeterminate".equals(e.getPropertyName())) {
@@ -336,6 +390,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public Dimension getPreferredSize(JComponent c) {
         Dimension size = null;
@@ -398,5 +455,5 @@
         size.height += border.top + border.bottom;
 
         return size;
-   }
+    }
 }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonMenuItemUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,49 +27,46 @@
 
 import javax.swing.*;
 import java.awt.*;
-import java.awt.event.*;
 import javax.swing.plaf.*;
-import javax.swing.border.*;
 
 /**
- * Synth's RadioButtonMenuItemUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JRadioButtonMenuItem}.
  *
  * @author Georges Saab
  * @author David Karlton
+ * @since 1.7
  */
-class SynthRadioButtonMenuItemUI extends SynthMenuItemUI {
+public class SynthRadioButtonMenuItemUI extends SynthMenuItemUI {
+
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param b component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent b) {
         return new SynthRadioButtonMenuItemUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected String getPropertyPrefix() {
         return "RadioButtonMenuItem";
     }
 
-    public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
-        Point p = e.getPoint();
-        if(p.x >= 0 && p.x < item.getWidth() &&
-           p.y >= 0 && p.y < item.getHeight()) {
-            if(e.getID() == MouseEvent.MOUSE_RELEASED) {
-                manager.clearSelectedPath();
-                item.doClick(0);
-                item.setArmed(false);
-            } else
-                manager.setSelectedPath(path);
-        } else if(item.getModel().isArmed()) {
-            MenuElement newPath[] = new MenuElement[path.length-1];
-            int i,c;
-            for(i=0,c=path.length-1;i<c;i++)
-                newPath[i] = path[i];
-            manager.setSelectedPath(newPath);
-        }
-    }
-
+    @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
         context.getPainter().paintRadioButtonMenuItemBackground(context, g, 0,
                              0, c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintRadioButtonMenuItemBorder(context, g, x,
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRadioButtonUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,42 +26,58 @@
 package javax.swing.plaf.synth;
 
 import java.awt.*;
-import java.awt.event.*;
 import javax.swing.*;
-import javax.swing.border.*;
 import javax.swing.plaf.*;
-import javax.swing.text.View;
 
 /**
- * Synth's RadioButtonUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JRadioButton}.
  *
  * @author Jeff Dinkins
+ * @since 1.7
  */
-class SynthRadioButtonUI extends SynthToggleButtonUI {
+public class SynthRadioButtonUI extends SynthToggleButtonUI {
 
     // ********************************
     //        Create PLAF
     // ********************************
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param b component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent b) {
         return new SynthRadioButtonUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected String getPropertyPrefix() {
         return "RadioButton.";
     }
 
     /**
-     * Returns the Icon used in calculating the pref/min/max size.
+     * Returns the Icon used in calculating the
+     * preferred/minimum/maximum size.
      */
+    @Override
     protected Icon getSizingIcon(AbstractButton b) {
         return getIcon(b);
     }
 
+    @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
         context.getPainter().paintRadioButtonBackground(context, g, 0, 0,
                                                 c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintRadioButtonBorder(context, g, x, y, w, h);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,30 +26,43 @@
 package javax.swing.plaf.synth;
 
 import java.awt.*;
-import java.awt.event.ActionEvent;
 import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
 import javax.swing.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicRootPaneUI;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's RootPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JRootPane}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI {
+public class SynthRootPaneUI extends BasicRootPaneUI implements SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthRootPaneUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults(JRootPane c){
         updateStyle(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults(JRootPane root) {
         SynthContext context = getContext(root, ENABLED);
 
@@ -58,6 +71,10 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -67,10 +84,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         return SynthLookAndFeel.getComponentState(c);
     }
@@ -88,6 +101,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -98,6 +115,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -105,9 +126,19 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintRootPaneBorder(context, g, x, y, w, h);
@@ -118,6 +149,7 @@
      * indicates the <code>defaultButton</code> has changed, this will
      * reinstall the keyboard actions.
      */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JRootPane)e.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -30,41 +30,33 @@
 import javax.swing.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
-import sun.swing.plaf.synth.SynthUI;
 
 
 /**
- * Synth's ScrollBarUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JScrollBar}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthScrollBarUI extends BasicScrollBarUI implements
-                                    PropertyChangeListener, SynthUI {
+public class SynthScrollBarUI extends BasicScrollBarUI
+                              implements PropertyChangeListener, SynthUI {
 
     private SynthStyle style;
     private SynthStyle thumbStyle;
     private SynthStyle trackStyle;
 
     private boolean validMinimumThumbSize;
-    private int scrollBarWidth;
-
-    //These two variables should be removed when the corrosponding ones in BasicScrollBarUI are made protected
-    private int incrGap;
-    private int decrGap;
 
     public static ComponentUI createUI(JComponent c)    {
         return new SynthScrollBarUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
-        //NOTE: This next line of code was added because, since incrGap and decrGap in
-        //BasicScrollBarUI are private, I need to have some way of updating them.
-        //This is an incomplete solution (since it implies that the incrGap and decrGap
-        //are set once, and not reset per state. Probably ok, but not always ok).
-        //This line of code should be removed at the same time that incrGap and
-        //decrGap are removed and made protected in the super class.
-        super.installDefaults();
-
         trackHighlight = NO_HIGHLIGHT;
         if (scrollbar.getLayout() == null ||
                      (scrollbar.getLayout() instanceof UIResource)) {
@@ -73,6 +65,10 @@
         updateStyle(scrollbar);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void configureScrollBarColors() {
     }
 
@@ -137,16 +133,28 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         scrollbar.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         scrollbar.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults(){
         SynthContext context = getContext(scrollbar, ENABLED);
         style.uninstallDefaults(context);
@@ -166,9 +174,12 @@
         super.uninstallDefaults();
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -176,14 +187,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
     private SynthContext getContext(JComponent c, Region region) {
         return getContext(c, region, getComponentState(c, region));
     }
@@ -206,6 +209,10 @@
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public boolean getSupportsAbsolutePositioning() {
         SynthContext context = getContext(scrollbar);
         boolean value = style.getBoolean(context,
@@ -214,6 +221,10 @@
         return value;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -225,6 +236,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -232,6 +247,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         SynthContext subcontext = getContext(scrollbar,
                                              Region.SCROLL_BAR_TRACK);
@@ -243,31 +264,49 @@
         subcontext.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintScrollBarBorder(context, g, x, y, w, h,
                                                   scrollbar.getOrientation());
     }
 
-    protected void paintTrack(SynthContext ss, Graphics g,
+    /**
+     * Paints the scrollbar track.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     * @param trackBounds bounding box for the track
+     */
+    protected void paintTrack(SynthContext context, Graphics g,
                               Rectangle trackBounds) {
-        SynthLookAndFeel.updateSubregion(ss, g, trackBounds);
-        ss.getPainter().paintScrollBarTrackBackground(ss, g, trackBounds.x,
+        SynthLookAndFeel.updateSubregion(context, g, trackBounds);
+        context.getPainter().paintScrollBarTrackBackground(context, g, trackBounds.x,
                         trackBounds.y, trackBounds.width, trackBounds.height,
                         scrollbar.getOrientation());
-        ss.getPainter().paintScrollBarTrackBorder(ss, g, trackBounds.x,
+        context.getPainter().paintScrollBarTrackBorder(context, g, trackBounds.x,
                         trackBounds.y, trackBounds.width, trackBounds.height,
                         scrollbar.getOrientation());
     }
 
-    protected void paintThumb(SynthContext ss, Graphics g,
+    /**
+     * Paints the scrollbar thumb.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     * @param thumbBounds bounding box for the thumb
+     */
+    protected void paintThumb(SynthContext context, Graphics g,
                               Rectangle thumbBounds) {
-        SynthLookAndFeel.updateSubregion(ss, g, thumbBounds);
+        SynthLookAndFeel.updateSubregion(context, g, thumbBounds);
         int orientation = scrollbar.getOrientation();
-        ss.getPainter().paintScrollBarThumbBackground(ss, g, thumbBounds.x,
+        context.getPainter().paintScrollBarThumbBackground(context, g, thumbBounds.x,
                         thumbBounds.y, thumbBounds.width, thumbBounds.height,
                         orientation);
-        ss.getPainter().paintScrollBarThumbBorder(ss, g, thumbBounds.x,
+        context.getPainter().paintScrollBarThumbBorder(context, g, thumbBounds.x,
                         thumbBounds.y, thumbBounds.width, thumbBounds.height,
                         orientation);
     }
@@ -288,6 +327,7 @@
      * @see #getMaximumSize
      * @see #getMinimumSize
      */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         Insets insets = c.getInsets();
         return (scrollbar.getOrientation() == JScrollBar.VERTICAL)
@@ -295,6 +335,10 @@
             : new Dimension(48, scrollBarWidth + insets.top + insets.bottom);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected Dimension getMinimumThumbSize() {
         if (!validMinimumThumbSize) {
             if (scrollbar.getOrientation() == JScrollBar.VERTICAL) {
@@ -308,6 +352,10 @@
         return minimumThumbSize;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected JButton createDecreaseButton(int orientation)  {
         SynthArrowButton synthArrowButton = new SynthArrowButton(orientation) {
             @Override
@@ -333,6 +381,10 @@
         return synthArrowButton;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected JButton createIncreaseButton(int orientation)  {
         SynthArrowButton synthArrowButton = new SynthArrowButton(orientation) {
             @Override
@@ -360,6 +412,10 @@
         return synthArrowButton;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void setThumbRollover(boolean active) {
         if (isThumbRollover() != active) {
             scrollbar.repaint(getThumbBounds());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -40,24 +40,32 @@
 import java.awt.event.FocusListener;
 import java.awt.event.FocusEvent;
 
-import sun.swing.plaf.synth.SynthUI;
-
-
 /**
- * Synth's ScrollPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JScrollPane}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthScrollPaneUI extends BasicScrollPaneUI implements
-                 PropertyChangeListener, SynthUI {
+public class SynthScrollPaneUI extends BasicScrollPaneUI
+                               implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
     private boolean viewportViewHasFocus = false;
     private ViewportViewFocusHandler viewportViewFocusHandler;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param x component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent x) {
         return new SynthScrollPaneUI();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -69,6 +77,9 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -77,6 +88,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         Border vpBorder = scrollpane.getViewportBorder();
         if (vpBorder != null) {
@@ -85,12 +102,18 @@
         }
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintScrollPaneBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installDefaults(JScrollPane scrollpane) {
         updateStyle(scrollpane);
@@ -114,7 +137,9 @@
         context.dispose();
     }
 
-
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installListeners(JScrollPane c) {
         super.installListeners(c);
@@ -129,6 +154,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallDefaults(JScrollPane c) {
         SynthContext context = getContext(c, ENABLED);
@@ -141,7 +169,9 @@
         }
     }
 
-
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallListeners(JComponent c) {
         super.uninstallListeners(c);
@@ -156,7 +186,10 @@
         }
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -166,12 +199,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-
     private int getComponentState(JComponent c) {
         int baseState = SynthLookAndFeel.getComponentState(c);
         if (viewportViewFocusHandler!=null && viewportViewHasFocus){
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,33 +34,51 @@
 import javax.swing.plaf.SeparatorUI;
 import javax.swing.plaf.UIResource;
 import javax.swing.plaf.DimensionUIResource;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * A Synth L&F implementation of SeparatorUI.  This implementation
- * is a "combined" view/controller.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JSeparator}.
  *
  * @author Shannon Hickey
  * @author Joshua Outwater
+ * @since 1.7
  */
-class SynthSeparatorUI extends SeparatorUI implements PropertyChangeListener,
-                                    SynthUI {
+public class SynthSeparatorUI extends SeparatorUI
+                              implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthSeparatorUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void installUI(JComponent c) {
         installDefaults((JSeparator)c);
         installListeners((JSeparator)c);
     }
 
-    public void uninstallDefaults(JComponent c) {
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public void uninstallUI(JComponent c) {
         uninstallListeners((JSeparator)c);
         uninstallDefaults((JSeparator)c);
     }
 
+    /**
+     * Installs default setting. This method is called when a
+     * {@code LookAndFeel} is installed.
+     */
     public void installDefaults(JSeparator c) {
         updateStyle(c);
     }
@@ -88,6 +106,10 @@
         context.dispose();
     }
 
+    /**
+     * Uninstalls default setting. This method is called when a
+     * {@code LookAndFeel} is uninstalled.
+     */
     public void uninstallDefaults(JSeparator c) {
         SynthContext context = getContext(c, ENABLED);
 
@@ -96,14 +118,26 @@
         style = null;
     }
 
+    /**
+     * Installs listeners. This method is called when a
+     * {@code LookAndFeel} is installed.
+     */
     public void installListeners(JSeparator c) {
         c.addPropertyChangeListener(this);
     }
 
+    /**
+     * Uninstalls listeners. This method is called when a
+     * {@code LookAndFeel} is uninstalled.
+     */
     public void uninstallListeners(JSeparator c) {
         c.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -116,6 +150,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -123,6 +161,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         JSeparator separator = (JSeparator)context.getComponent();
         context.getPainter().paintSeparatorForeground(context, g, 0, 0,
@@ -130,6 +174,10 @@
                              separator.getOrientation());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         JSeparator separator = (JSeparator)context.getComponent();
@@ -137,6 +185,10 @@
                                                   separator.getOrientation());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         SynthContext context = getContext(c);
 
@@ -155,16 +207,28 @@
         return size;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getMinimumSize(JComponent c) {
         return getPreferredSize(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getMaximumSize(JComponent c) {
         return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -172,14 +236,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
     public void propertyChange(PropertyChangeEvent evt) {
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
             updateStyle((JSeparator)evt.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -38,20 +38,20 @@
 import javax.swing.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicSliderUI;
-import sun.swing.plaf.synth.SynthUI;
 import sun.swing.SwingUtilities2;
 
 
 /**
- * Synth's SliderUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JSlider}.
  *
  * @author Joshua Outwater
+ * @since 1.7
  */
-class SynthSliderUI extends BasicSliderUI implements PropertyChangeListener,
-        SynthUI {
-    protected Dimension contentDim = new Dimension();
-    protected Rectangle valueRect = new Rectangle();
-    protected boolean paintValue;
+public class SynthSliderUI extends BasicSliderUI
+                           implements PropertyChangeListener, SynthUI {
+    private Rectangle valueRect = new Rectangle();
+    private boolean paintValue;
 
     /**
      * When a JSlider is used as a renderer in a JTable, its layout is not
@@ -83,18 +83,32 @@
     ///////////////////////////////////////////////////
     // ComponentUI Interface Implementation methods
     ///////////////////////////////////////////////////
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthSliderUI((JSlider)c);
     }
 
-    public SynthSliderUI(JSlider c) {
+    protected SynthSliderUI(JSlider c) {
         super(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults(JSlider slider) {
         updateStyle(slider);
     }
 
+    /**
+     * Uninstalls default setting. This method is called when a
+     * {@code LookAndFeel} is uninstalled.
+     */
     protected void uninstallDefaults() {
         SynthContext context = getContext(slider, ENABLED);
         style.uninstallDefaults(context);
@@ -112,11 +126,19 @@
         sliderThumbStyle = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners(JSlider slider) {
         super.installListeners(slider);
         slider.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners(JSlider slider) {
         slider.removePropertyChangeListener(this);
         super.uninstallListeners(slider);
@@ -177,6 +199,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected TrackListener createTrackListener(JSlider s) {
         return new SynthTrackListener();
     }
@@ -204,6 +230,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public int getBaseline(JComponent c, int width, int height) {
         if (c == null) {
             throw new NullPointerException("Component must be non-null");
@@ -271,9 +301,13 @@
         return -1;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getPreferredSize(JComponent c)  {
         recalculateIfInsetsChanged();
-        Dimension d = new Dimension(contentDim);
+        Dimension d = new Dimension(contentRect.width, contentRect.height);
         if (slider.getOrientation() == JSlider.VERTICAL) {
             d.height = 200;
         } else {
@@ -285,9 +319,13 @@
         return d;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getMinimumSize(JComponent c) {
         recalculateIfInsetsChanged();
-        Dimension d = new Dimension(contentDim);
+        Dimension d = new Dimension(contentRect.width, contentRect.height);
         if (slider.getOrientation() == JSlider.VERTICAL) {
             d.height = thumbRect.height + insetCache.top + insetCache.bottom;
         } else {
@@ -296,11 +334,18 @@
         return d;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void calculateGeometry() {
         layout();
         calculateThumbLocation();
     }
 
+    /**
+     * Lays out the slider.
+     */
     protected void layout() {
         SynthContext context = getContext(slider);
         SynthGraphicsUtils synthGraphics = style.getGraphicsUtils(context);
@@ -336,10 +381,10 @@
                 labelRect.height = getHeightOfTallestLabel();
             }
 
-            contentDim.height = valueRect.height + trackRect.height
+            contentRect.height = valueRect.height + trackRect.height
                 + trackInsets.top + trackInsets.bottom
                 + tickRect.height + labelRect.height + 4;
-            contentDim.width = slider.getWidth() - insetCache.left
+            contentRect.width = slider.getWidth() - insetCache.left
                 - insetCache.right;
 
             // Check if any of the labels will paint out of bounds.
@@ -348,7 +393,7 @@
                 // Calculate the track rectangle.  It is necessary for
                 // xPositionForValue to return correct values.
                 trackRect.x = insetCache.left;
-                trackRect.width = contentDim.width;
+                trackRect.width = contentRect.width;
 
                 Dictionary dictionary = slider.getLabelTable();
                 if (dictionary != null) {
@@ -381,9 +426,9 @@
             valueRect.x = trackRect.x = tickRect.x = labelRect.x =
                 (insetCache.left + pad);
             valueRect.width = trackRect.width = tickRect.width =
-                labelRect.width = (contentDim.width - (pad * 2));
+                labelRect.width = (contentRect.width - (pad * 2));
 
-            int centerY = slider.getHeight() / 2 - contentDim.height / 2;
+            int centerY = slider.getHeight() / 2 - contentRect.height / 2;
 
             valueRect.y = centerY;
             centerY += valueRect.height + 2;
@@ -430,18 +475,18 @@
             int w1 = trackInsets.left + trackRect.width / 2;
             int w2 = trackRect.width / 2 + trackInsets.right +
                               tickRect.width + labelRect.width;
-            contentDim.width = Math.max(w1, l) + Math.max(w2, l) +
+            contentRect.width = Math.max(w1, l) + Math.max(w2, l) +
                     2 + insetCache.left + insetCache.right;
-            contentDim.height = slider.getHeight() -
+            contentRect.height = slider.getHeight() -
                                     insetCache.top - insetCache.bottom;
 
             // Layout the components.
             trackRect.y = tickRect.y = labelRect.y =
                 valueRect.y + valueRect.height;
             trackRect.height = tickRect.height = labelRect.height =
-                contentDim.height - valueRect.height;
+                contentRect.height - valueRect.height;
 
-            int startX = slider.getWidth() / 2 - contentDim.width / 2;
+            int startX = slider.getWidth() / 2 - contentRect.width / 2;
             if (SynthLookAndFeel.isLeftToRight(slider)) {
                 if (l > w1) {
                     startX += (l - w1);
@@ -491,6 +536,10 @@
         return pad;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void calculateThumbLocation() {
         super.calculateThumbLocation();
         if (slider.getOrientation() == JSlider.HORIZONTAL) {
@@ -504,6 +553,10 @@
        }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void calculateTickRect() {
         if (slider.getOrientation() == JSlider.HORIZONTAL) {
             tickRect.x = trackRect.x;
@@ -533,6 +586,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void setThumbLocation(int x, int y) {
         super.setThumbLocation(x, y);
         // Value rect is tied to the thumb location.  We need to repaint when
@@ -542,6 +599,10 @@
         setThumbActive(false);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected int xPositionForValue(int value) {
         int min = slider.getMinimum();
         int max = slider.getMaximum();
@@ -567,6 +628,10 @@
         return xPosition;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected int yPositionForValue(int value, int trackY, int trackHeight) {
         int min = slider.getMinimum();
         int max = slider.getMaximum();
@@ -593,10 +658,9 @@
     }
 
     /**
-     * Returns a value give a y position.  If yPos is past the track at the
-     * top or the bottom it will set the value to the min or max of the
-     * slider, depending if the slider is inverted or not.
+     * @inheritDoc
      */
+    @Override
     public int valueForYPosition(int yPos) {
         int value;
         int minValue = slider.getMinimum();
@@ -623,10 +687,9 @@
     }
 
     /**
-     * Returns a value give an x position.  If xPos is past the track at the
-     * left or the right it will set the value to the min or max of the
-     * slider, depending if the slider is inverted or not.
+     * @inheritDoc
      */
+    @Override
     public int valueForXPosition(int xPos) {
         int value;
         int minValue = slider.getMinimum();
@@ -652,6 +715,10 @@
         return value;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected Dimension getThumbSize() {
         Dimension size = new Dimension();
 
@@ -665,6 +732,10 @@
         return size;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void recalculateIfInsetsChanged() {
         SynthContext context = getContext(slider);
         Insets newInsets = style.getInsets(context, null);
@@ -678,20 +749,20 @@
         context.dispose();
     }
 
-    public Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public SynthContext getContext(JComponent c) {
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
-    public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
-    }
-
-    public SynthContext getContext(JComponent c, int state) {
+    private SynthContext getContext(JComponent c, int state) {
         return SynthContext.getContext(SynthContext.class, c,
                             SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    public SynthContext getContext(JComponent c, Region subregion) {
+    private SynthContext getContext(JComponent c, Region subregion) {
         return getContext(c, subregion, getComponentState(c, subregion));
     }
 
@@ -707,10 +778,6 @@
         return SynthContext.getContext(klass, c, subregion, style, state);
     }
 
-    public int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
     private int getComponentState(JComponent c, Region region) {
         if (region == Region.SLIDER_THUMB && thumbActive &&c.isEnabled()) {
             int state = thumbPressed ? PRESSED : MOUSE_OVER;
@@ -720,6 +787,10 @@
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
         SynthLookAndFeel.update(context, g);
@@ -730,13 +801,23 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
         paint(context, g);
         context.dispose();
     }
 
-    public void paint(SynthContext context, Graphics g) {
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
+    protected void paint(SynthContext context, Graphics g) {
         recalculateIfInsetsChanged();
         recalculateIfOrientationChanged();
         Rectangle clip = g.getClipBounds();
@@ -755,8 +836,8 @@
             // For horizontal sliders, make sure value is not painted
             // outside slider bounds.
             if (slider.getOrientation() == JSlider.HORIZONTAL) {
-                if (valueRect.x + labelWidth > insetCache.left + contentDim.width) {
-                    valueRect.x =  (insetCache.left + contentDim.width) - labelWidth;
+                if (valueRect.x + labelWidth > insetCache.left + contentRect.width) {
+                    valueRect.x =  (insetCache.left + contentRect.width) - labelWidth;
                 }
                 valueRect.x = Math.max(valueRect.x, 0);
             }
@@ -785,13 +866,24 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintSliderBorder(context, g, x, y, w, h,
                                                slider.getOrientation());
     }
 
-    public void paintThumb(SynthContext context, Graphics g,
+    /**
+     * Paints the slider thumb.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     * @param thumbBounds bounding box for the thumb
+     */
+    protected void paintThumb(SynthContext context, Graphics g,
             Rectangle thumbBounds)  {
         int orientation = slider.getOrientation();
         SynthLookAndFeel.updateSubregion(context, g, thumbBounds);
@@ -803,7 +895,14 @@
                              thumbBounds.height, orientation);
     }
 
-    public void paintTrack(SynthContext context, Graphics g,
+    /**
+     * Paints the slider track.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     * @param trackBounds bounding box for the track
+     */
+    protected void paintTrack(SynthContext context, Graphics g,
             Rectangle trackBounds) {
         int orientation = slider.getOrientation();
         SynthLookAndFeel.updateSubregion(context, g, trackBounds);
@@ -815,6 +914,10 @@
                 trackBounds.height, orientation);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JSlider)e.getSource());
@@ -827,23 +930,23 @@
     /**
      * Track mouse movements.
      */
-    protected class SynthTrackListener extends TrackListener {
+    private class SynthTrackListener extends TrackListener {
 
-        public void mouseExited(MouseEvent e) {
+        @Override public void mouseExited(MouseEvent e) {
             setThumbActive(false);
         }
 
-        public void mousePressed(MouseEvent e) {
+        @Override public void mousePressed(MouseEvent e) {
             super.mousePressed(e);
             setThumbPressed(thumbRect.contains(e.getX(), e.getY()));
         }
 
-        public void mouseReleased(MouseEvent e) {
+        @Override public void mouseReleased(MouseEvent e) {
             super.mouseReleased(e);
             updateThumbState(e.getX(), e.getY(), false);
         }
 
-        public void mouseDragged(MouseEvent e) {
+        @Override public void mouseDragged(MouseEvent e) {
             int thumbMiddle;
 
             if (!slider.isEnabled()) {
@@ -914,7 +1017,7 @@
             }
         }
 
-        public void mouseMoved(MouseEvent e) {
+        @Override public void mouseMoved(MouseEvent e) {
             updateThumbState(e.getX(), e.getY());
         }
     }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,22 +26,21 @@
 
 import java.awt.*;
 import java.awt.event.*;
-
 import javax.swing.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicSpinnerUI;
-
 import java.beans.*;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Synth's SpinnerUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JSpinner}.
  *
  * @author Hans Muller
  * @author Joshua Outwater
+ * @since 1.7
  */
-class SynthSpinnerUI extends BasicSpinnerUI implements PropertyChangeListener,
-        SynthUI {
+public class SynthSpinnerUI extends BasicSpinnerUI
+                            implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
     /**
      * A FocusListener implementation which causes the entire spinner to be
@@ -65,6 +64,9 @@
         return new SynthSpinnerUI();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installListeners() {
         super.installListeners();
@@ -79,12 +81,7 @@
     }
 
     /**
-     * Removes the <code>propertyChangeListener</code> added
-     * by installListeners.
-     * <p>
-     * This method is called by <code>uninstallUI</code>.
-     *
-     * @see #installListeners
+     * @inheritDoc
      */
     @Override
     protected void uninstallListeners() {
@@ -100,7 +97,7 @@
     }
 
     /**
-     * Initialize the <code>JSpinner</code> <code>border</code>,
+     * Initializes the <code>JSpinner</code> <code>border</code>,
      * <code>foreground</code>, and <code>background</code>, properties
      * based on the corresponding "Spinner.*" properties from defaults table.
      * The <code>JSpinners</code> layout is set to the value returned by
@@ -112,6 +109,7 @@
      * @see LookAndFeel#installBorder
      * @see LookAndFeel#installColors
      */
+    @Override
     protected void installDefaults() {
         LayoutManager layout = spinner.getLayout();
 
@@ -144,6 +142,7 @@
      * @see #installDefaults
      * @see #uninstallUI
      */
+    @Override
     protected void uninstallDefaults() {
         if (spinner.getLayout() instanceof UIResource) {
             spinner.setLayout(null);
@@ -156,25 +155,19 @@
         style = null;
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected LayoutManager createLayout() {
         return new SpinnerLayout();
     }
 
 
     /**
-     * Create a component that will replace the spinner models value
-     * with the object returned by <code>spinner.getPreviousValue</code>.
-     * By default the <code>previousButton</code> is a JButton
-     * who's <code>ActionListener</code> updates it's <code>JSpinner</code>
-     * ancestors model.  If a previousButton isn't needed (in a subclass)
-     * then override this method to return null.
-     *
-     * @return a component that will replace the spinners model with the
-     *     next value in the sequence, or null
-     * @see #installUI
-     * @see #createNextButton
+     * @inheritDoc
      */
+    @Override
     protected Component createPreviousButton() {
         JButton b = new SynthArrowButton(SwingConstants.SOUTH);
         b.setName("Spinner.previousButton");
@@ -184,18 +177,9 @@
 
 
     /**
-     * Create a component that will replace the spinner models value
-     * with the object returned by <code>spinner.getNextValue</code>.
-     * By default the <code>nextButton</code> is a JButton
-     * who's <code>ActionListener</code> updates it's <code>JSpinner</code>
-     * ancestors model.  If a nextButton isn't needed (in a subclass)
-     * then override this method to return null.
-     *
-     * @return a component that will replace the spinners model with the
-     *     next value in the sequence, or null
-     * @see #installUI
-     * @see #createPreviousButton
+     * @inheritDoc
      */
+    @Override
     protected Component createNextButton() {
         JButton b = new SynthArrowButton(SwingConstants.NORTH);
         b.setName("Spinner.nextButton");
@@ -227,6 +211,7 @@
      * @see #replaceEditor
      * @see JSpinner#getEditor
      */
+    @Override
     protected JComponent createEditor() {
         JComponent editor = spinner.getEditor();
         editor.setName("Spinner.editor");
@@ -250,6 +235,7 @@
      * @see #createEditor
      * @see #createPropertyChangeListener
      */
+    @Override
     protected void replaceEditor(JComponent oldEditor, JComponent newEditor) {
         spinner.remove(oldEditor);
         spinner.add(newEditor, "Editor");
@@ -283,8 +269,12 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -292,17 +282,10 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -314,6 +297,10 @@
     }
 
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -321,10 +308,19 @@
         context.dispose();
     }
 
-
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintSpinnerBorder(context, g, x, y, w, h);
@@ -426,9 +422,11 @@
         }
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
-        String propertyName = e.getPropertyName();
         JSpinner spinner = (JSpinner)(e.getSource());
         SpinnerUI spinnerUI = spinner.getUI();
 
@@ -444,34 +442,13 @@
     /** Listen to editor text field focus changes and repaint whole spinner */
     private class EditorFocusHandler implements FocusListener{
         /** Invoked when a editor text field gains the keyboard focus. */
-        public void focusGained(FocusEvent e) {
+        @Override public void focusGained(FocusEvent e) {
             spinner.repaint();
         }
 
         /** Invoked when a editor text field loses the keyboard focus. */
-        public void focusLost(FocusEvent e) {
+        @Override public void focusLost(FocusEvent e) {
             spinner.repaint();
         }
     }
-
-    /** Override the arrowbuttons focus handling to follow the text fields focus */
-    private class SpinnerArrowButton extends SynthArrowButton{
-        public SpinnerArrowButton(int direction) {
-            super(direction);
-        }
-
-        @Override
-        public boolean isFocusOwner() {
-            if (spinner == null){
-                return super.isFocusOwner();
-            } else if (spinner.getEditor() instanceof JSpinner.DefaultEditor){
-                return ((JSpinner.DefaultEditor)spinner.getEditor())
-                        .getTextField().isFocusOwner();
-            } else if (spinner.getEditor()!= null) {
-                return spinner.getEditor().isFocusOwner();
-            } else {
-                return super.isFocusOwner();
-            }
-        }
-    }
 }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -31,19 +31,19 @@
 import java.beans.*;
 import java.util.*;
 import javax.swing.*;
-import javax.swing.event.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
-import sun.swing.plaf.synth.SynthUI;
 
 
 /**
- * Synth's SplitPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JSplitPane}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthSplitPaneUI extends BasicSplitPaneUI implements
-                                    PropertyChangeListener, SynthUI {
+public class SynthSplitPaneUI extends BasicSplitPaneUI
+                              implements PropertyChangeListener, SynthUI {
     /**
      * Keys to use for forward focus traversal when the JComponent is
      * managing focus.
@@ -68,6 +68,9 @@
 
     /**
      * Creates a new SynthSplitPaneUI instance
+     *
+     * @param x component to create UI object for
+     * @return the UI object
      */
     public static ComponentUI createUI(JComponent x) {
         return new SynthSplitPaneUI();
@@ -76,6 +79,7 @@
     /**
      * Installs the UI defaults.
      */
+    @Override
     protected void installDefaults() {
         updateStyle(splitPane);
 
@@ -161,6 +165,7 @@
     /**
      * Installs the event listeners for the UI.
      */
+    @Override
     protected void installListeners() {
         super.installListeners();
         splitPane.addPropertyChangeListener(this);
@@ -169,6 +174,7 @@
     /**
      * Uninstalls the UI defaults.
      */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(splitPane, ENABLED);
 
@@ -186,16 +192,20 @@
 
 
     /**
-     * Uninstalls the event listeners for the UI.
+     * Uninstalls the event listeners from the UI.
      */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         splitPane.removePropertyChangeListener(this);
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -203,14 +213,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
     SynthContext getContext(JComponent c, Region region) {
         return getContext(c, region, getComponentState(c, region));
     }
@@ -233,7 +235,10 @@
         return state;
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JSplitPane)e.getSource());
@@ -243,6 +248,7 @@
     /**
      * Creates the default divider.
      */
+    @Override
     public BasicSplitPaneDivider createDefaultDivider() {
         SynthSplitPaneDivider divider = new SynthSplitPaneDivider(this);
 
@@ -250,6 +256,10 @@
         return divider;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected Component createDefaultNonContinuousLayoutDivider() {
         return new Canvas() {
             public void paint(Graphics g) {
@@ -258,6 +268,10 @@
         };
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -268,6 +282,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -275,13 +293,22 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         // This is done to update package private variables in
         // BasicSplitPaneUI
         super.paint(g, splitPane);
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintSplitPaneBorder(context, g, x, y, w, h);
@@ -299,6 +326,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
         if(jc == splitPane && getLastDragLocation() != -1 &&
                               !isContinuousLayout() && !draggingHW) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyle.java	Wed Jul 05 17:04:26 2017 +0200
@@ -33,7 +33,6 @@
 import java.util.HashMap;
 import java.util.Map;
 import javax.swing.text.JTextComponent;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
  * <code>SynthStyle</code> is a set of style properties.
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyleFactory.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthStyleFactory.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,10 +24,7 @@
  */
 package javax.swing.plaf.synth;
 
-import java.awt.*;
-import java.util.*;
-import javax.swing.plaf.*;
-import javax.swing.*;
+import javax.swing.JComponent;
 
 /**
  * Factory used for obtaining <code>SynthStyle</code>s.  Each of the
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,19 +34,21 @@
 import java.awt.event.*;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
 import sun.swing.SwingUtilities2;
 
 /**
- * A Synth L&F implementation of TabbedPaneUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JTabbedPane}.
+ *
+ * <p>Looks up the {@code selectedTabPadInsets} property from the Style,
+ * which represents additional insets for the selected tab.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-/**
- * Looks up 'selectedTabPadInsets' from the Style, which will be additional
- * insets for the selected tab.
- */
-class SynthTabbedPaneUI extends BasicTabbedPaneUI implements SynthUI, PropertyChangeListener  {
+public class SynthTabbedPaneUI extends BasicTabbedPaneUI
+                               implements PropertyChangeListener, SynthUI {
+
     /**
      * <p>If non-zero, tabOverlap indicates the amount that the tab bounds
      * should be altered such that they would overlap with a tab on either the
@@ -103,11 +105,17 @@
 
     private boolean selectedTabIsPressed = false;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthTabbedPaneUI();
     }
 
-    SynthTabbedPaneUI() {
+    private SynthTabbedPaneUI() {
         textRect = new Rectangle();
         iconRect = new Rectangle();
     }
@@ -116,6 +124,10 @@
         return (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         updateStyle(tabPane);
     }
@@ -175,16 +187,28 @@
             tabContentStyle.getInsets(tabContentContext, null);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         tabPane.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         tabPane.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(tabPane, ENABLED);
         style.uninstallDefaults(context);
@@ -207,19 +231,19 @@
         tabContentStyle = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
-    public SynthContext getContext(JComponent c, int state) {
+    private SynthContext getContext(JComponent c, int state) {
         return SynthContext.getContext(SynthContext.class, c,
                     SynthLookAndFeel.getRegion(c),style, state);
     }
 
-    public SynthContext getContext(JComponent c, Region subregion) {
-        return getContext(c, subregion, getComponentState(c));
-    }
-
     private SynthContext getContext(JComponent c, Region subregion, int state){
         SynthStyle style = null;
         Class klass = SynthContext.class;
@@ -236,14 +260,10 @@
         return SynthContext.getContext(klass, c, subregion, style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected JButton createScrollButton(int direction) {
         // added for Nimbus LAF so that it can use the basic arrow buttons
         // UIManager is queried directly here because this is called before
@@ -256,6 +276,10 @@
         return new SynthScrollableTabButton(direction);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle(tabPane);
@@ -313,6 +337,9 @@
         };
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected) {
         if (nudgeSelectedLabel) {
@@ -322,6 +349,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected int getTabLabelShiftY(int tabPlacement, int tabIndex, boolean isSelected) {
         if (nudgeSelectedLabel) {
@@ -331,6 +361,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -341,6 +375,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected int getBaseline(int tab) {
         if (tabPane.getTabComponentAt(tab) != null ||
                 getTextViewForTab(tab) != null) {
@@ -361,11 +399,19 @@
         return textRect.y + metrics.getAscent() + getBaselineOffset();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintTabbedPaneBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -373,6 +419,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         int selectedIndex = tabPane.getSelectedIndex();
         int tabPlacement = tabPane.getTabPlacement();
@@ -426,6 +478,10 @@
     }
 
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void paintTabArea(Graphics g, int tabPlacement,
                                 int selectedIndex) {
         // This can be invoked from ScrollabeTabPanel
@@ -439,7 +495,7 @@
                      new Rectangle(x, y, width, height));
     }
 
-    protected void paintTabArea(SynthContext ss, Graphics g,
+    private void paintTabArea(SynthContext ss, Graphics g,
                                 int tabPlacement, int selectedIndex,
                                 Rectangle tabAreaBounds) {
         Rectangle clipRect = g.getClipBounds();
@@ -493,6 +549,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void setRolloverTab(int index) {
         int oldRolloverTab = getRolloverTab();
         super.setRolloverTab(index);
@@ -519,7 +579,7 @@
         }
     }
 
-    protected void paintTab(SynthContext ss, Graphics g,
+    private void paintTab(SynthContext ss, Graphics g,
                             int tabPlacement, Rectangle[] rects, int tabIndex,
                             Rectangle iconRect, Rectangle textRect) {
         Rectangle tabRect = rects[tabIndex];
@@ -587,7 +647,7 @@
         }
     }
 
-    protected void layoutLabel(SynthContext ss, int tabPlacement,
+    private void layoutLabel(SynthContext ss, int tabPlacement,
                                FontMetrics metrics, int tabIndex,
                                String title, Icon icon,
                                Rectangle tabRect, Rectangle iconRect,
@@ -614,7 +674,7 @@
         textRect.y += yNudge;
     }
 
-    protected void paintText(SynthContext ss,
+    private void paintText(SynthContext ss,
                              Graphics g, int tabPlacement,
                              Font font, FontMetrics metrics, int tabIndex,
                              String title, Rectangle textRect,
@@ -636,7 +696,7 @@
     }
 
 
-    protected void paintContentBorder(SynthContext ss, Graphics g,
+    private void paintContentBorder(SynthContext ss, Graphics g,
                                       int tabPlacement, int selectedIndex) {
         int width = tabPane.getWidth();
         int height = tabPane.getHeight();
@@ -683,7 +743,10 @@
         }
     }
 
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected int calculateMaxTabHeight(int tabPlacement) {
         FontMetrics metrics = getFontMetrics(tabContext.getStyle().getFont(
                                              tabContext));
@@ -696,6 +759,10 @@
         return result;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected int calculateTabWidth(int tabPlacement, int tabIndex,
                                     FontMetrics metrics) {
         Icon icon = getIconForTab(tabIndex);
@@ -723,6 +790,10 @@
         return width;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected int calculateMaxTabWidth(int tabPlacement) {
         FontMetrics metrics = getFontMetrics(tabContext.getStyle().getFont(
                                      tabContext));
@@ -735,17 +806,25 @@
         return result;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected Insets getTabInsets(int tabPlacement, int tabIndex) {
         updateTabContext(tabIndex, false, false, false,
                           (getFocusIndex() == tabIndex));
         return tabInsets;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected FontMetrics getFontMetrics() {
         return getFontMetrics(tabContext.getStyle().getFont(tabContext));
     }
 
-    protected FontMetrics getFontMetrics(Font font) {
+    private FontMetrics getFontMetrics(Font font) {
         return tabPane.getFontMetrics(font);
     }
 
@@ -787,7 +866,8 @@
      * Overridden to create a TabbedPaneLayout subclass which takes into
      * account tabOverlap.
      */
-    @Override protected LayoutManager createLayoutManager() {
+    @Override
+    protected LayoutManager createLayoutManager() {
         if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT) {
             return super.createLayoutManager();
         } else { /* WRAP_TAB_LAYOUT */
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -32,19 +32,18 @@
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.*;
 import javax.swing.table.*;
-
-import sun.swing.DefaultLookup;
-import sun.swing.plaf.synth.*;
 import sun.swing.table.*;
 
 /**
- * SynthTableHeaderUI implementation
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.table.JTableHeader}.
  *
  * @author Alan Chung
  * @author Philip Milne
+ * @since 1.7
  */
-class SynthTableHeaderUI extends BasicTableHeaderUI implements
-           PropertyChangeListener, SynthUI {
+public class SynthTableHeaderUI extends BasicTableHeaderUI
+                                implements PropertyChangeListener, SynthUI {
 
 //
 // Instance Variables
@@ -54,10 +53,20 @@
 
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param h component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent h) {
         return new SynthTableHeaderUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         prevRenderer = header.getDefaultRenderer();
         if (prevRenderer instanceof UIResource) {
@@ -79,11 +88,19 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners() {
         super.installListeners();
         header.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         if (header.getDefaultRenderer() instanceof HeaderRenderer) {
             header.setDefaultRenderer(prevRenderer);
@@ -96,11 +113,19 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         header.removePropertyChangeListener(this);
         super.uninstallListeners();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -111,6 +136,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -118,10 +147,20 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, context.getComponent());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintTableHeaderBorder(context, g, x, y, w, h);
@@ -129,8 +168,12 @@
 //
 // SynthUI
 //
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -138,26 +181,25 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
+    /**
+     * @inheritDoc
+     */
+    @Override
+    protected void rolloverColumnUpdated(int oldColumn, int newColumn) {
+        header.repaint(header.getHeaderRect(oldColumn));
+        header.repaint(header.getHeaderRect(newColumn));
     }
 
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent evt) {
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
             updateStyle((JTableHeader)evt.getSource());
         }
     }
 
-    @Override
-    protected void rolloverColumnUpdated(int oldColumn, int newColumn) {
-        header.repaint(header.getHeaderRect(oldColumn));
-        header.repaint(header.getHeaderRect(newColumn));
-    }
-
     private class HeaderRenderer extends DefaultTableCellHeaderRenderer {
         HeaderRenderer() {
             setHorizontalAlignment(JLabel.LEADING);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -54,15 +54,15 @@
 import javax.swing.table.TableColumn;
 import javax.swing.table.TableColumnModel;
 
-import sun.swing.plaf.synth.SynthUI;
-
 /**
- * SynthTableUI implementation
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JTable}.
  *
  * @author Philip Milne
+ * @since 1.7
  */
-class SynthTableUI extends BasicTableUI implements SynthUI,
-        PropertyChangeListener {
+public class SynthTableUI extends BasicTableUI
+                          implements SynthUI, PropertyChangeListener {
 //
 // Instance Variables
 //
@@ -88,18 +88,25 @@
 //  The installation/uninstall procedures and support
 //
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthTableUI();
     }
 
     /**
-     * Initialize JTable properties, e.g. font, foreground, and background.
+     * Initializes JTable properties, such as font, foreground, and background.
      * The font, foreground, and background properties are only set if their
      * current value is either null or a UIResource, other properties are set
      * if the current value is null.
      *
      * @see #installUI
      */
+    @Override
     protected void installDefaults() {
         dateRenderer = installRendererIfPossible(Date.class, null);
         numberRenderer = installRendererIfPossible(Number.class, null);
@@ -189,11 +196,16 @@
     /**
      * Attaches listeners to the JTable.
      */
+    @Override
     protected void installListeners() {
         super.installListeners();
         table.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         table.setDefaultRenderer(Date.class, dateRenderer);
         table.setDefaultRenderer(Number.class, numberRenderer);
@@ -213,6 +225,10 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners() {
         table.removePropertyChangeListener(this);
         super.uninstallListeners();
@@ -221,8 +237,13 @@
     //
     // SynthUI
     //
+
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -230,18 +251,14 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
 //
 //  Paint methods and support
 //
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -252,11 +269,19 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintTableBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -264,6 +289,12 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         Rectangle clip = g.getClipBounds();
 
@@ -647,6 +678,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent event) {
         if (SynthLookAndFeel.shouldUpdateStyle(event)) {
             updateStyle((JTable)event.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -33,7 +33,6 @@
 import java.awt.event.FocusListener;
 import java.awt.event.FocusEvent;
 import java.beans.PropertyChangeEvent;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
  * Provides the look and feel for a plain text editor in the
@@ -50,40 +49,42 @@
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author  Shannon Hickey
+ * @since 1.7
  */
-class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI, FocusListener {
+public class SynthTextAreaUI extends BasicTextAreaUI implements SynthUI {
+    private Handler handler = new Handler();
     private SynthStyle style;
 
     /**
-     * Creates a UI for a JTextArea.
+     * Creates a UI object for a JTextArea.
      *
      * @param ta a text area
-     * @return the UI
+     * @return the UI object
      */
     public static ComponentUI createUI(JComponent ta) {
         return new SynthTextAreaUI();
     }
 
-    public void focusGained(FocusEvent e) {
-        getComponent().repaint();
-    }
-
-    public void focusLost(FocusEvent e) {
-        getComponent().repaint();
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         // Installs the text cursor on the component
         super.installDefaults();
         updateStyle(getComponent());
-        getComponent().addFocusListener(this);
+        getComponent().addFocusListener(handler);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(getComponent(), ENABLED);
 
         getComponent().putClientProperty("caretAspectRatio", null);
-        getComponent().removeFocusListener(this);
+        getComponent().removeFocusListener(handler);
 
         style.uninstallDefaults(context);
         context.dispose();
@@ -91,10 +92,6 @@
         super.uninstallDefaults();
     }
 
-    public void installUI(JComponent c) {
-        super.installUI(c);
-    }
-
     private void updateStyle(JTextComponent comp) {
         SynthContext context = getContext(comp, ENABLED);
         SynthStyle oldStyle = style;
@@ -112,8 +109,12 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -121,10 +122,10 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -135,14 +136,30 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
     }
 
+    /**
+     * @inheritDoc
+     *
+     * Overridden to do nothing.
+     */
+    @Override
     protected void paintBackground(Graphics g) {
         // Overriden to do nothing, all our painting is done from update/paint.
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintTextAreaBorder(context, g, x, y, w, h);
@@ -158,10 +175,21 @@
      *
      * @param evt the property change event
      */
+    @Override
     protected void propertyChange(PropertyChangeEvent evt) {
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
             updateStyle((JTextComponent)evt.getSource());
         }
         super.propertyChange(evt);
     }
+
+    private final class Handler implements FocusListener {
+        public void focusGained(FocusEvent e) {
+            getComponent().repaint();
+        }
+
+        public void focusLost(FocusEvent e) {
+            getComponent().repaint();
+        }
+    }
 }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,6 @@
 
 import javax.swing.*;
 import javax.swing.text.*;
-import javax.swing.event.*;
 import javax.swing.plaf.*;
 import javax.swing.plaf.basic.BasicTextFieldUI;
 import java.awt.*;
@@ -35,11 +34,9 @@
 import java.awt.event.FocusListener;
 import java.beans.PropertyChangeEvent;
 
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Basis of a look and feel for a JTextField in the Synth
- * look and feel.
+ * Provides the Synth L&F UI delegate for {@link javax.swing.JTextField}.
  * <p>
  * <strong>Warning:</strong>
  * Serialized objects of this class will not be compatible with
@@ -51,27 +48,22 @@
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author  Shannon Hickey
+ * @since 1.7
  */
-class SynthTextFieldUI
-    extends BasicTextFieldUI
-    implements SynthUI, FocusListener
-{
+public class SynthTextFieldUI extends BasicTextFieldUI implements SynthUI {
+    private Handler handler = new Handler();
     private SynthStyle style;
 
     /**
      * Creates a UI for a JTextField.
      *
      * @param c the text field
-     * @return the UI
+     * @return the UI object
      */
     public static ComponentUI createUI(JComponent c) {
         return new SynthTextFieldUI();
     }
 
-    public SynthTextFieldUI() {
-        super();
-    }
-
     private void updateStyle(JTextComponent comp) {
         SynthContext context = getContext(comp, ENABLED);
         SynthStyle oldStyle = style;
@@ -155,8 +147,12 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -164,10 +160,10 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -178,12 +174,15 @@
     }
 
     /**
-     * Paints the interface.  This is routed to the
-     * paintSafely method under the guarantee that
-     * the model won't change from the view of this thread
-     * while it's rendering (if the associated model is
-     * derived from AbstractDocument).  This enables the
+     * Paints the specified component.
+     * <p>This is routed to the {@link #paintSafely} method under
+     * the guarantee that the model does not change from the view of this
+     * thread while it is rendering (if the associated model is
+     * derived from {@code AbstractDocument}).  This enables the
      * model to potentially be updated asynchronously.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
      */
     protected void paint(SynthContext context, Graphics g) {
         super.paint(g, getComponent());
@@ -194,11 +193,20 @@
                                                 c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintTextFieldBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     * Overridden to do nothing.
+     */
+    @Override
     protected void paintBackground(Graphics g) {
         // Overriden to do nothing, all our painting is done from update/paint.
     }
@@ -214,6 +222,7 @@
      *
      * @param evt the property change event
      */
+    @Override
     protected void propertyChange(PropertyChangeEvent evt) {
         if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
             updateStyle((JTextComponent)evt.getSource());
@@ -221,26 +230,26 @@
         super.propertyChange(evt);
     }
 
-    public void focusGained(FocusEvent e) {
-        getComponent().repaint();
-    }
-
-    public void focusLost(FocusEvent e) {
-        getComponent().repaint();
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults() {
         // Installs the text cursor on the component
         super.installDefaults();
         updateStyle(getComponent());
-        getComponent().addFocusListener(this);
+        getComponent().addFocusListener(handler);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(getComponent(), ENABLED);
 
         getComponent().putClientProperty("caretAspectRatio", null);
-        getComponent().removeFocusListener(this);
+        getComponent().removeFocusListener(handler);
 
         style.uninstallDefaults(context);
         context.dispose();
@@ -248,7 +257,13 @@
         super.uninstallDefaults();
     }
 
-    public void installUI(JComponent c) {
-        super.installUI(c);
+    private final class Handler implements FocusListener {
+        public void focusGained(FocusEvent e) {
+            getComponent().repaint();
+        }
+
+        public void focusLost(FocusEvent e) {
+            getComponent().repaint();
+        }
     }
 }
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextPaneUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -45,14 +45,15 @@
  * Please see {@link java.beans.XMLEncoder}.
  *
  * @author  Shannon Hickey
+ * @since 1.7
  */
-class SynthTextPaneUI extends SynthEditorPaneUI {
+public class SynthTextPaneUI extends SynthEditorPaneUI {
 
     /**
      * Creates a UI for the JTextPane.
      *
      * @param c the JTextPane object
-     * @return the UI
+     * @return the UI object
      */
     public static ComponentUI createUI(JComponent c) {
         return new SynthTextPaneUI();
@@ -65,10 +66,15 @@
      *
      * @return the name ("TextPane")
      */
+    @Override
     protected String getPropertyPrefix() {
         return "TextPane";
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void installUI(JComponent c) {
         super.installUI(c);
         updateForeground(c.getForeground());
@@ -86,6 +92,7 @@
      *
      * @param evt the property change event
      */
+    @Override
     protected void propertyChange(PropertyChangeEvent evt) {
         super.propertyChange(evt);
 
@@ -150,11 +157,16 @@
         }
     }
 
+    @Override
     void paintBackground(SynthContext context, Graphics g, JComponent c) {
         context.getPainter().paintTextPaneBackground(context, g, 0, 0,
                                                   c.getWidth(), c.getHeight());
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintTextPaneBorder(context, g, x, y, w, h);
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToggleButtonUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -31,18 +31,30 @@
 import javax.swing.plaf.ComponentUI;
 
 /**
- * Synth's ToggleButtonUI.
- * <p>
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JToggleButton}.
+ *
  * @author Jeff Dinkins
+ * @since 1.7
  */
-class SynthToggleButtonUI extends SynthButtonUI {
+public class SynthToggleButtonUI extends SynthButtonUI {
     // ********************************
     //          Create PLAF
     // ********************************
+
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param b component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent b) {
         return new SynthToggleButtonUI();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected String getPropertyPrefix() {
         return "ToggleButton.";
@@ -57,6 +69,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -42,39 +42,53 @@
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicToolBarUI;
 import sun.swing.plaf.synth.SynthIcon;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * A Synth L&F implementation of ToolBarUI.  This implementation
- * is a "combined" view/controller.
- * <p>
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JToolBar}.
  *
+ * @since 1.7
  */
-class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener,
-           SynthUI {
-    protected Icon handleIcon = null;
-    protected Rectangle contentRect = new Rectangle();
+public class SynthToolBarUI extends BasicToolBarUI
+                            implements PropertyChangeListener, SynthUI {
+    private Icon handleIcon = null;
+    private Rectangle contentRect = new Rectangle();
 
     private SynthStyle style;
     private SynthStyle contentStyle;
     private SynthStyle dragWindowStyle;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthToolBarUI();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installDefaults() {
         toolBar.setLayout(createLayout());
         updateStyle(toolBar);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installListeners() {
         super.installListeners();
         toolBar.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
@@ -106,6 +120,9 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(toolBar, ENABLED);
@@ -131,18 +148,33 @@
         toolBar.setLayout(null);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installComponents() {}
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallComponents() {}
 
+    /**
+     * Creates a {@code LayoutManager} to use with the toolbar.
+     *
+     * @return a {@code LayoutManager} instance
+     */
     protected LayoutManager createLayout() {
         return new SynthToolBarLayoutManager();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -161,18 +193,13 @@
                                        style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
     private int getComponentState(JComponent c, Region region) {
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -185,6 +212,9 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -193,6 +223,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintToolBarBorder(context, g, x, y, w, h,
@@ -200,17 +234,32 @@
     }
 
     // Overloaded to do nothing so we can share listeners.
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void setBorderToNonRollover(Component c) {}
 
     // Overloaded to do nothing so we can share listeners.
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void setBorderToRollover(Component c) {}
 
     // Overloaded to do nothing so we can share listeners.
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void setBorderToNormal(Component c) {}
 
+    /**
+     * Paints the toolbar.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         if (handleIcon != null && toolBar.isFloatable()) {
             int startX = toolBar.getComponentOrientation().isLeftToRight() ?
@@ -227,7 +276,14 @@
         subcontext.dispose();
     }
 
-    public void paintContent(SynthContext context, Graphics g,
+    /**
+     * Paints the toolbar content.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     * @param bounds bounding box for the toolbar
+     */
+    protected void paintContent(SynthContext context, Graphics g,
             Rectangle bounds) {
         SynthLookAndFeel.updateSubregion(context, g, bounds);
         context.getPainter().paintToolBarContentBackground(context, g,
@@ -238,6 +294,9 @@
                              toolBar.getOrientation());
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void paintDragWindow(Graphics g) {
         int w = dragWindow.getWidth();
@@ -258,6 +317,10 @@
     // PropertyChangeListener
     //
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JToolBar)e.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,23 +34,33 @@
 import javax.swing.plaf.basic.BasicToolTipUI;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.text.View;
-import sun.swing.plaf.synth.SynthUI;
 
 
 /**
- * Synth's ToolTipUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JToolTip}.
  *
  * @author Joshua Outwater
+ * @since 1.7
  */
-class SynthToolTipUI extends BasicToolTipUI implements PropertyChangeListener,
-               SynthUI {
+public class SynthToolTipUI extends BasicToolTipUI
+                            implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
-
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthToolTipUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installDefaults(JComponent c) {
         updateStyle(c);
     }
@@ -61,6 +71,10 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallDefaults(JComponent c) {
         SynthContext context = getContext(c, ENABLED);
         style.uninstallDefaults(context);
@@ -68,14 +82,26 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void installListeners(JComponent c) {
         c.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     protected void uninstallListeners(JComponent c) {
         c.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
         return getContext(c, getComponentState(c));
     }
@@ -85,10 +111,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JComponent c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
     private int getComponentState(JComponent c) {
         JComponent comp = ((JToolTip)c).getComponent();
 
@@ -98,6 +120,10 @@
         return SynthLookAndFeel.getComponentState(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -108,11 +134,19 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintToolTipBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -120,9 +154,14 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         JToolTip tip = (JToolTip)context.getComponent();
-        String tipText = tip.getToolTipText();
 
         Insets insets = tip.getInsets();
         View v = (View)tip.getClientProperty(BasicHTML.propertyKey);
@@ -140,6 +179,10 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public Dimension getPreferredSize(JComponent c) {
         SynthContext context = getContext(c);
         Insets insets = c.getInsets();
@@ -164,6 +207,10 @@
         return prefSize;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JToolTip)e.getSource());
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -48,15 +48,16 @@
 import javax.swing.tree.TreeModel;
 import javax.swing.tree.TreePath;
 import sun.swing.plaf.synth.SynthIcon;
-import sun.swing.plaf.synth.SynthUI;
 
 /**
- * Skinnable TreeUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JTree}.
  *
  * @author Scott Violet
+ * @since 1.7
  */
-class SynthTreeUI extends BasicTreeUI implements PropertyChangeListener,
-                               SynthUI {
+public class SynthTreeUI extends BasicTreeUI
+                         implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
     private SynthStyle cellStyle;
 
@@ -67,27 +68,33 @@
 
     private Object linesStyle;
 
-    private int leadRow;
-
     private int padding;
 
     private boolean useTreeColors;
 
-    private Icon expandedIconWrapper;
+    private Icon expandedIconWrapper = new ExpandedIconWrapper();
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param x component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent x) {
         return new SynthTreeUI();
     }
 
-    SynthTreeUI() {
-        expandedIconWrapper = new ExpandedIconWrapper();
-    }
-
+    /**
+     * @inheritDoc
+     */
     @Override
     public Icon getExpandedIcon() {
         return expandedIconWrapper;
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installDefaults() {
         updateStyle(tree);
@@ -148,15 +155,21 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void installListeners() {
         super.installListeners();
         tree.addPropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -164,14 +177,6 @@
                     SynthLookAndFeel.getRegion(c), style, state);
     }
 
-    private Region getRegion(JTree c) {
-        return SynthLookAndFeel.getRegion(c);
-    }
-
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
     private SynthContext getContext(JComponent c, Region region) {
         return getContext(c, region, getComponentState(c, region));
     }
@@ -187,6 +192,9 @@
         return ENABLED | SELECTED;
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected TreeCellEditor createDefaultCellEditor() {
         TreeCellRenderer renderer = tree.getCellRenderer();
@@ -202,11 +210,17 @@
         return editor;
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected TreeCellRenderer createDefaultCellRenderer() {
         return new SynthTreeCellRenderer();
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallDefaults() {
         SynthContext context = getContext(tree, ENABLED);
@@ -226,12 +240,18 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void uninstallListeners() {
         super.uninstallListeners();
         tree.removePropertyChangeListener(this);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -243,11 +263,18 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         context.getPainter().paintTreeBorder(context, g, x, y, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
@@ -256,14 +283,16 @@
         context.dispose();
     }
 
-    private void updateLeadRow() {
-        leadRow = getRowForPath(tree, tree.getLeadSelectionPath());
-    }
-
+    /**
+     * Paints the specified component.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
         paintContext = context;
 
-        updateLeadRow();
+        updateLeadSelectionRow();
 
         Rectangle paintBounds = g.getClipBounds();
         Insets insets = tree.getInsets();
@@ -288,7 +317,6 @@
             boolean isExpanded;
             boolean hasBeenExpanded;
             boolean isLeaf;
-            Rectangle boundsBuffer = new Rectangle();
             Rectangle rowBounds = new Rectangle(0, 0, tree.getWidth(),0);
             Rectangle bounds;
             TreePath path;
@@ -392,83 +420,6 @@
         rendererPane.removeAll();
     }
 
-    private boolean isDropLine(JTree.DropLocation loc) {
-        return loc != null && loc.getPath() != null && loc.getChildIndex() != -1;
-    }
-
-    private void paintDropLine(Graphics g) {
-        JTree.DropLocation loc = tree.getDropLocation();
-        if (!isDropLine(loc)) {
-            return;
-        }
-
-        Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
-        if (c != null) {
-            g.setColor(c);
-            Rectangle rect = getDropLineRect(loc);
-            g.fillRect(rect.x, rect.y, rect.width, rect.height);
-        }
-    }
-
-    private Rectangle getDropLineRect(JTree.DropLocation loc) {
-        Rectangle rect;
-        TreePath path = loc.getPath();
-        int index = loc.getChildIndex();
-        boolean ltr = tree.getComponentOrientation().isLeftToRight();
-
-        Insets insets = tree.getInsets();
-
-        if (tree.getRowCount() == 0) {
-            rect = new Rectangle(insets.left,
-                                 insets.top,
-                                 tree.getWidth() - insets.left - insets.right,
-                                 0);
-        } else {
-            int row = tree.getRowForPath(path);
-            TreeModel model = getModel();
-            Object root = model.getRoot();
-
-            if (path.getLastPathComponent() == root
-                    && index >= model.getChildCount(root)) {
-
-                rect = tree.getRowBounds(tree.getRowCount() - 1);
-                rect.y = rect.y + rect.height;
-                Rectangle xRect;
-
-                if (!tree.isRootVisible()) {
-                    xRect = tree.getRowBounds(0);
-                } else if (model.getChildCount(root) == 0){
-                    xRect = tree.getRowBounds(0);
-                    xRect.x += totalChildIndent;
-                    xRect.width -= totalChildIndent + totalChildIndent;
-                } else {
-                    TreePath lastChildPath = path.pathByAddingChild(
-                        model.getChild(root, model.getChildCount(root) - 1));
-                    xRect = tree.getPathBounds(lastChildPath);
-                }
-
-                rect.x = xRect.x;
-                rect.width = xRect.width;
-            } else {
-                rect = tree.getPathBounds(path.pathByAddingChild(
-                    model.getChild(path.getLastPathComponent(), index)));
-            }
-        }
-
-        if (rect.y != 0) {
-            rect.y--;
-        }
-
-        if (!ltr) {
-            rect.x = rect.x + rect.width - 100;
-        }
-
-        rect.width = 100;
-        rect.height = 2;
-
-        return rect;
-    }
-
     private void configureRenderer(SynthContext context) {
         TreeCellRenderer renderer = tree.getCellRenderer();
 
@@ -502,6 +453,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds,
                                             Insets insets, Rectangle bounds,
@@ -516,6 +470,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void paintHorizontalLine(Graphics g, JComponent c, int y,
                                       int left, int right) {
@@ -523,6 +480,9 @@
             paintContext, "Tree.horizontalLine", g, left, y, right, y, linesStyle);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void paintVerticalPartOfLeg(Graphics g,
                                           Rectangle clipBounds, Insets insets,
@@ -532,6 +492,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void paintVerticalLine(Graphics g, JComponent c, int x, int top,
                                     int bottom) {
@@ -539,7 +502,7 @@
             paintContext, "Tree.verticalLine", g, x, top, x, bottom, linesStyle);
     }
 
-    protected void paintRow(TreeCellRenderer renderer,
+    private void paintRow(TreeCellRenderer renderer,
                DefaultTreeCellRenderer dtcr, SynthContext treeContext,
                SynthContext cellContext, Graphics g, Rectangle clipBounds,
                Insets insets, Rectangle bounds, Rectangle rowBounds,
@@ -558,7 +521,7 @@
             state |= SELECTED;
         }
 
-        if (tree.isFocusOwner() && row == leadRow) {
+        if (tree.isFocusOwner() && row == getLeadSelectionRow()) {
             state |= FOCUSED;
         }
 
@@ -583,7 +546,7 @@
         int leadIndex;
 
         if (tree.hasFocus()) {
-            leadIndex = leadRow;
+            leadIndex = getLeadSelectionRow();
         }
         else {
             leadIndex = -1;
@@ -625,6 +588,9 @@
         paintContext.setComponentState(state);
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected void drawCentered(Component c, Graphics graphics, Icon icon,
                                 int x, int y) {
@@ -636,6 +602,10 @@
                             y - h/2, w, h);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent event) {
         if (SynthLookAndFeel.shouldUpdateStyle(event)) {
             updateStyle((JTree)event.getSource());
@@ -648,6 +618,24 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
+    protected void paintDropLine(Graphics g) {
+        JTree.DropLocation loc = tree.getDropLocation();
+        if (!isDropLine(loc)) {
+            return;
+        }
+
+        Color c = (Color)style.get(paintContext, "Tree.dropLineColor");
+        if (c != null) {
+            g.setColor(c);
+            Rectangle rect = getDropLineRect(loc);
+            g.fillRect(rect.x, rect.y, rect.width, rect.height);
+        }
+    }
+
     private void repaintDropLocation(JTree.DropLocation loc) {
         if (loc == null) {
             return;
@@ -670,6 +658,9 @@
         }
     }
 
+    /**
+     * @inheritDoc
+     */
     @Override
     protected int getRowX(int row, int depth) {
         return super.getRowX(row, depth) + padding;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package javax.swing.plaf.synth;
+
+import java.awt.Graphics;
+import javax.swing.JComponent;
+
+/**
+ * SynthUI is used to fetch the SynthContext for a particular Component.
+ *
+ * @author Scott Violet
+ * @since 1.7
+ */
+public interface SynthUI extends SynthConstants {
+
+    /**
+     * Returns the Context for the specified component.
+     *
+     * @param c Component requesting SynthContext.
+     * @return SynthContext describing component.
+     */
+    public SynthContext getContext(JComponent c);
+
+    /**
+     * Paints the border.
+     *
+     * @param context a component context
+     * @param g {@code Graphics} to paint on
+     * @param x the X coordinate
+     * @param y the Y coordinate
+     * @param w width of the border
+     * @param h height of the border
+     */
+    public void paintBorder(SynthContext context, Graphics g, int x,
+                            int y, int w, int h);
+}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,40 +25,57 @@
 
 package javax.swing.plaf.synth;
 
-import java.awt.*;
 import java.beans.*;
 import javax.swing.*;
-import javax.swing.border.*;
 import javax.swing.plaf.*;
 import java.awt.*;
-import java.awt.event.*;
-import sun.swing.plaf.synth.SynthUI;
 
 
 /**
- * Synth's ViewportUI.
+ * Provides the Synth L&F UI delegate for
+ * {@link javax.swing.JViewport}.
  *
+ * @since 1.7
  */
-class SynthViewportUI extends ViewportUI implements
-           PropertyChangeListener, SynthUI {
+public class SynthViewportUI extends ViewportUI
+                             implements PropertyChangeListener, SynthUI {
     private SynthStyle style;
 
+    /**
+     * Creates a new UI object for the given component.
+     *
+     * @param c component to create UI object for
+     * @return the UI object
+     */
     public static ComponentUI createUI(JComponent c) {
         return new SynthViewportUI();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void installUI(JComponent c) {
         super.installUI(c);
         installDefaults(c);
         installListeners(c);
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void uninstallUI(JComponent c) {
         super.uninstallUI(c);
         uninstallListeners(c);
         uninstallDefaults(c);
     }
 
+    /**
+     * Installs defaults for a viewport.
+     *
+     * @param c a {@code JViewport} object
+     */
     protected void installDefaults(JComponent c) {
         updateStyle(c);
     }
@@ -85,14 +102,29 @@
         context.dispose();
     }
 
+    /**
+     * Installs listeners into the viewport.
+     *
+     * @param c a {@code JViewport} object
+     */
     protected void installListeners(JComponent c) {
         c.addPropertyChangeListener(this);
     }
 
+    /**
+     * Uninstalls listeners from the viewport.
+     *
+     * @param c a {@code JViewport} object
+     */
     protected void uninstallListeners(JComponent c) {
         c.removePropertyChangeListener(this);
     }
 
+    /**
+     * Uninstalls defaults from a viewport.
+     *
+     * @param c a {@code JViewport} object
+     */
     protected void uninstallDefaults(JComponent c) {
         SynthContext context = getContext(c, ENABLED);
         style.uninstallDefaults(context);
@@ -100,8 +132,12 @@
         style = null;
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public SynthContext getContext(JComponent c) {
-        return getContext(c, getComponentState(c));
+        return getContext(c, SynthLookAndFeel.getComponentState(c));
     }
 
     private SynthContext getContext(JComponent c, int state) {
@@ -113,10 +149,10 @@
         return SynthLookAndFeel.getRegion(c);
     }
 
-    private int getComponentState(JComponent c) {
-        return SynthLookAndFeel.getComponentState(c);
-    }
-
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void update(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -127,12 +163,20 @@
         context.dispose();
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paintBorder(SynthContext context, Graphics g, int x,
                             int y, int w, int h) {
         // This does nothing on purpose, JViewport doesn't allow a border
         // and therefor this will NEVER be called.
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void paint(Graphics g, JComponent c) {
         SynthContext context = getContext(c);
 
@@ -140,9 +184,19 @@
         context.dispose();
     }
 
+    /**
+     * Paints the specified component. This implementation does nothing.
+     *
+     * @param context context for the component being painted
+     * @param g {@code Graphics} object used for painting
+     */
     protected void paint(SynthContext context, Graphics g) {
     }
 
+    /**
+     * @inheritDoc
+     */
+    @Override
     public void propertyChange(PropertyChangeEvent e) {
         if (SynthLookAndFeel.shouldUpdateStyle(e)) {
             updateStyle((JComponent)e.getSource());
--- a/jdk/src/share/classes/org/ietf/jgss/GSSContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/org/ietf/jgss/GSSContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2000-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -678,7 +678,7 @@
      * are not definitive then the method will attempt to treat all
      * available bytes as part of the token.<p>
      *
-     * Other than the possible blocking behaviour described above, this
+     * Other than the possible blocking behavior described above, this
      * method is equivalent to the byte array based {@link #unwrap(byte[],
      * int, int, MessageProp) unwrap} method.<p>
      *
@@ -826,7 +826,7 @@
      * are not definitive then the method will attempt to treat all
      * available bytes as part of the token.<p>
      *
-     * Other than the possible blocking behaviour described above, this
+     * Other than the possible blocking behavior described above, this
      * method is equivalent to the byte array based {@link #verifyMIC(byte[],
      * int, int, byte[], int, int, MessageProp) verifyMIC} method.<p>
      *
@@ -917,7 +917,7 @@
      * getMutualAuthState} method.<p>
      *
      * @param state a boolean value indicating whether mutual
-     * authentication shouls be used or not.
+     * authentication should be used or not.
      * @see #getMutualAuthState()
      *
      * @throws GSSException containing the following
@@ -928,7 +928,7 @@
 
     /**
      * Requests that replay detection be enabled for the
-     * per-message security services after context establishemnt. This
+     * per-message security services after context establishment. This
      * request can only be made on the context initiator's side and it has
      * to be done prior to the first call to
      * <code>initSecContext</code>. During context establishment replay
@@ -958,7 +958,7 @@
 
     /**
      * Requests that sequence checking be enabled for the
-     * per-message security services after context establishemnt. This
+     * per-message security services after context establishment. This
      * request can only be made on the context initiator's side and it has
      * to be done prior to the first call to
      * <code>initSecContext</code>. During context establishment sequence
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Wed Jul 05 17:04:26 2017 +0200
@@ -98,7 +98,7 @@
          * Returns whether the component is visible without invoking
          * any client code.
          */
-        boolean isVisible_NoClientCode(Component comp);
+        boolean isVisible(Component comp);
 
         /**
          * Sets the RequestFocusController.
@@ -114,6 +114,112 @@
          * Sets the appContext of the component.
          */
         void setAppContext(Component comp, AppContext appContext);
+
+        /**
+         * Returns the parent of the component.
+         */
+        Container getParent(Component comp);
+
+        /**
+         * Sets the parent of the component to the specified parent.
+         */
+        void setParent(Component comp, Container parent);
+
+        /**
+         * Resizes the component to the specified width and height.
+         */
+        void setSize(Component comp, int width, int height);
+
+        /**
+         * Returns the location of the component.
+         */
+        Point getLocation(Component comp);
+
+        /**
+         * Moves the component to the new location.
+         */
+        void setLocation(Component comp, int x, int y);
+
+        /**
+         * Determines whether this component is enabled.
+         */
+        boolean isEnabled(Component comp);
+
+        /**
+         * Determines whether this component is displayable.
+         */
+        boolean isDisplayable(Component comp);
+
+        /**
+         * Gets the cursor set in the component.
+         */
+        Cursor getCursor(Component comp);
+
+        /**
+         * Returns the peer of the component.
+         */
+        ComponentPeer getPeer(Component comp);
+
+        /**
+         * Sets the peer of the component to the specified peer.
+         */
+        void setPeer(Component comp, ComponentPeer peer);
+
+        /**
+         * Determines whether this component is lightweight.
+         */
+        boolean isLightweight(Component comp);
+
+        /**
+         * Returns whether or not paint messages received from
+         * the operating system should be ignored.
+         */
+        boolean getIgnoreRepaint(Component comp);
+
+        /**
+         * Returns the width of the component.
+         */
+        int getWidth(Component comp);
+
+        /**
+         * Returns the height of the component.
+         */
+        int getHeight(Component comp);
+
+        /**
+         * Returns the x coordinate of the component.
+         */
+        int getX(Component comp);
+
+        /**
+         * Returns the y coordinate of the component.
+         */
+        int getY(Component comp);
+
+        /**
+         * Gets the foreground color of this component.
+         */
+        Color getForeground(Component comp);
+
+        /**
+         * Gets the background color of this component.
+         */
+        Color getBackground(Component comp);
+
+        /**
+         * Sets the background of this component to the specified color.
+         */
+        void setBackground(Component comp, Color background);
+
+        /**
+         * Gets the font of the component.
+         */
+        Font getFont(Component comp);
+
+        /**
+         * Processes events occurring on this component.
+         */
+        void processEvent(Component comp, AWTEvent e);
     }
 
     /*
@@ -169,6 +275,22 @@
          * components in the specified window to the specified value.
          */
         void setLWRequestStatus(Window changed, boolean status);
+
+        /**
+         * Indicates whether this window should receive focus on subsequently
+         * being shown, or being moved to the front.
+         */
+        boolean isAutoRequestFocus(Window w);
+
+        /**
+         * Indicates whether the specified window is an utility window for TrayIcon.
+         */
+        boolean isTrayIconWindow(Window w);
+
+        /**
+         * Marks the specified window as an utility window for TrayIcon.
+         */
+        void setTrayIconWindow(Window w, boolean isTrayIconWindow);
     }
 
     /*
@@ -249,13 +371,13 @@
      */
     public interface EventQueueAccessor {
         /*
-         * Gets the next event queue.
-         */
-        EventQueue getNextQueue(EventQueue eventQueue);
-        /*
          * Gets the event dispatch thread.
          */
         Thread getDispatchThread(EventQueue eventQueue);
+        /*
+         * Checks if the current thread is EDT for the given EQ.
+         */
+        public boolean isDispatchThreadImpl(EventQueue eventQueue);
     }
 
     /*
--- a/jdk/src/share/classes/sun/awt/AppContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/awt/AppContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -43,6 +43,9 @@
 import java.beans.PropertyChangeSupport;
 import java.beans.PropertyChangeListener;
 import sun.util.logging.PlatformLogger;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
 
 /**
  * The AppContext is a table referenced by ThreadGroup which stores
@@ -132,10 +135,17 @@
     /* Since the contents of an AppContext are unique to each Java
      * session, this class should never be serialized. */
 
-    /* The key to put()/get() the Java EventQueue into/from the AppContext.
+    /*
+     * The key to put()/get() the Java EventQueue into/from the AppContext.
      */
     public static final Object EVENT_QUEUE_KEY = new StringBuffer("EventQueue");
 
+    /*
+     * The keys to store EventQueue push/pop lock and condition.
+     */
+    public final static Object EVENT_QUEUE_LOCK_KEY = new StringBuilder("EventQueue.Lock");
+    public final static Object EVENT_QUEUE_COND_KEY = new StringBuilder("EventQueue.Condition");
+
     /* A map of AppContexts, referenced by ThreadGroup.
      */
     private static final Map<ThreadGroup, AppContext> threadGroup2appContext =
@@ -244,6 +254,13 @@
                         return Thread.currentThread().getContextClassLoader();
                     }
                 });
+
+        // Initialize push/pop lock and its condition to be used by all the
+        // EventQueues within this AppContext
+        Lock eventQueuePushPopLock = new ReentrantLock();
+        put(EVENT_QUEUE_LOCK_KEY, eventQueuePushPopLock);
+        Condition eventQueuePushPopCond = eventQueuePushPopLock.newCondition();
+        put(EVENT_QUEUE_COND_KEY, eventQueuePushPopCond);
     }
 
     private static final ThreadLocal<AppContext> threadAppContext =
--- a/jdk/src/share/classes/sun/awt/ComponentAccessor.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,483 +0,0 @@
-/*
- * Copyright 2002-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.awt;
-
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.AWTEvent;
-import java.awt.Font;
-import java.awt.Color;
-import java.awt.Cursor;
-import java.awt.Point;
-
-import java.awt.peer.ComponentPeer;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-
-import sun.util.logging.PlatformLogger;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * A collection of methods for modifying package private fields in AWT components.
- * This class is meant to be used by Peer code only. Previously peer code
- * got around this problem by modifying fields from native code. However
- * as we move away from native code to Pure-java peers we need this class.
- *
- * @author Bino George
- */
-
-
-public class ComponentAccessor
-{
-    private static Class componentClass;
-    private static Field fieldX;
-    private static Field fieldY;
-    private static Field fieldWidth;
-    private static Field fieldHeight;
-    private static Method methodGetParentNoClientCode;
-    private static Method methodGetFontNoClientCode;
-    private static Method methodProcessEvent;
-    private static Method methodEnableEvents;
-    private static Field fieldParent;
-    private static Field fieldBackground;
-    private static Field fieldForeground;
-    private static Field fieldFont;
-    private static Field fieldPacked;
-    private static Field fieldIgnoreRepaint;
-    private static Field fieldPeer;
-    private static Field fieldVisible;
-    private static Method methodIsEnabledImpl;
-    private static Method methodGetCursorNoClientCode;
-    private static Method methodLocationNoClientCode;
-
-    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.ComponentAccessor");
-
-    private ComponentAccessor() {
-    }
-
-    static {
-        AccessController.doPrivileged( new PrivilegedAction() {
-                public Object run() {
-                    try {
-                        componentClass = Class.forName("java.awt.Component");
-                        fieldX  = componentClass.getDeclaredField("x");
-                        fieldX.setAccessible(true);
-                        fieldY  = componentClass.getDeclaredField("y");
-                        fieldY.setAccessible(true);
-                        fieldWidth  = componentClass.getDeclaredField("width");
-                        fieldWidth.setAccessible(true);
-                        fieldHeight  = componentClass.getDeclaredField("height");
-                        fieldHeight.setAccessible(true);
-                        fieldForeground  = componentClass.getDeclaredField("foreground");
-                        fieldForeground.setAccessible(true);
-                        fieldBackground  = componentClass.getDeclaredField("background");
-                        fieldBackground.setAccessible(true);
-                        fieldFont = componentClass.getDeclaredField("font");
-                        fieldFont.setAccessible(true);
-                        methodGetParentNoClientCode = componentClass.getDeclaredMethod("getParent_NoClientCode", (Class[]) null);
-                        methodGetParentNoClientCode.setAccessible(true);
-                        methodGetFontNoClientCode = componentClass.getDeclaredMethod("getFont_NoClientCode", (Class[]) null);
-                        methodGetFontNoClientCode.setAccessible(true);
-                        Class[] argTypes = { AWTEvent.class };
-                        methodProcessEvent = componentClass.getDeclaredMethod("processEvent",argTypes);
-                        methodProcessEvent.setAccessible(true);
-                        Class[] argTypesForMethodEnableEvents = { Long.TYPE };
-                        methodEnableEvents = componentClass.getDeclaredMethod("enableEvents",argTypesForMethodEnableEvents);
-                        methodEnableEvents.setAccessible(true);
-
-                        fieldParent  = componentClass.getDeclaredField("parent");
-                        fieldParent.setAccessible(true);
-                        fieldPacked = componentClass.getDeclaredField("isPacked");
-                        fieldPacked.setAccessible(true);
-                        fieldIgnoreRepaint = componentClass.getDeclaredField("ignoreRepaint");
-                        fieldIgnoreRepaint.setAccessible(true);
-
-                        fieldPeer = componentClass.getDeclaredField("peer");
-                        fieldPeer.setAccessible(true);
-
-                        fieldVisible = componentClass.getDeclaredField("visible");
-                        fieldVisible.setAccessible(true);
-
-                        methodIsEnabledImpl = componentClass.getDeclaredMethod("isEnabledImpl", (Class[]) null);
-                        methodIsEnabledImpl.setAccessible(true);
-
-                        methodGetCursorNoClientCode = componentClass.getDeclaredMethod("getCursor_NoClientCode", (Class[]) null);
-                        methodGetCursorNoClientCode.setAccessible(true);
-
-                        methodLocationNoClientCode = componentClass.getDeclaredMethod("location_NoClientCode", (Class[]) null);
-                        methodLocationNoClientCode.setAccessible(true);
-                    }
-                    catch (NoSuchFieldException e) {
-                        log.fine("Unable to initialize ComponentAccessor", e);
-                    }
-                    catch (ClassNotFoundException e) {
-                        log.fine("Unable to initialize ComponentAccessor", e);
-                    }
-                    catch (NoSuchMethodException e) {
-                        log.fine("Unable to initialize ComponentAccessor", e);
-                    }
-                    // to please javac
-                    return null;
-                }
-            });
-    }
-
-    public static void setX(Component c, int x)
-    {
-        try {
-            fieldX.setInt(c,x);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setY(Component c, int y)
-    {
-        try {
-            fieldY.setInt(c,y);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setWidth(Component c, int width)
-    {
-        try {
-            fieldWidth.setInt(c,width);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setHeight(Component c, int height)
-    {
-        try {
-            fieldHeight.setInt(c,height);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static void setBounds(Component c, int x, int y, int width, int height)
-    {
-        try {
-            fieldX.setInt(c,x);
-            fieldY.setInt(c,y);
-            fieldWidth.setInt(c,width);
-            fieldHeight.setInt(c,height);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static int getX(Component c) {
-        try {
-            return fieldX.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static int getY(Component c) {
-        try {
-            return fieldY.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static int getWidth(Component c) {
-        try {
-            return fieldWidth.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static int getHeight(Component c) {
-        try {
-            return fieldHeight.getInt(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return 0;
-    }
-
-    public static boolean getIsPacked(Component c) {
-        try {
-            return fieldPacked.getBoolean(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return false;
-    }
-
-    public static Container getParent_NoClientCode(Component c) {
-        Container parent=null;
-
-        try {
-            parent = (Container) methodGetParentNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return parent;
-    }
-
-    public static Font getFont_NoClientCode(Component c) {
-        Font font=null;
-
-        try {
-            font = (Font) methodGetFontNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return font;
-    }
-
-    public static void processEvent(Component c, AWTEvent event) {
-        Font font=null;
-
-        try {
-            Object[] args = new Object[1];
-            args[0] = event;
-            methodProcessEvent.invoke(c,args);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-    }
-
-    public static void enableEvents(Component c, long event_mask) {
-        try {
-            Object[] args = new Object[1];
-            args[0] = Long.valueOf(event_mask);
-            methodEnableEvents.invoke(c,args);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-    }
-
-    public static void setParent(Component c, Container parent)
-    {
-        try {
-            fieldParent.set(c,parent);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static Color getForeground(Component c)
-    {
-        Color color = null;
-        try {
-            color = (Color) fieldForeground.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return color;
-    }
-
-    public static Color getBackground(Component c)
-    {
-        Color color = null;
-        try {
-            color = (Color) fieldBackground.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return color;
-    }
-
-    public static void setBackground(Component c, Color color) {
-        try {
-            fieldBackground.set(c, color);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static Font getFont(Component c)
-    {
-        Font f = null;
-        try {
-            f = (Font) fieldFont.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return f;
-    }
-
-    public static ComponentPeer getPeer(Component c) {
-        ComponentPeer peer = null;
-        try {
-            peer = (ComponentPeer)fieldPeer.get(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return peer;
-    }
-
-    public static void setPeer(Component c, ComponentPeer peer) {
-        try {
-            fieldPeer.set(c, peer);
-        } catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-    }
-
-    public static boolean getIgnoreRepaint(Component comp) {
-        try {
-            return fieldIgnoreRepaint.getBoolean(comp);
-        }
-        catch (IllegalAccessException e) {
-            log.fine("Unable to access the Component object", e);
-        }
-
-        return false;
-    }
-
-    public static boolean getVisible(Component c) {
-        try {
-            return fieldVisible.getBoolean(c);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        return false;
-    }
-
-    public static boolean isEnabledImpl(Component c) {
-        boolean enabled = true;
-        try {
-            enabled = (Boolean) methodIsEnabledImpl.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-        return enabled;
-    }
-
-    public static Cursor getCursor_NoClientCode(Component c) {
-        Cursor cursor = null;
-
-        try {
-            cursor = (Cursor) methodGetCursorNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return cursor;
-    }
-
-    public static Point getLocation_NoClientCode(Component c) {
-        Point loc = null;
-
-        try {
-            loc = (Point) methodLocationNoClientCode.invoke(c, (Object[]) null);
-        }
-        catch (IllegalAccessException e)
-        {
-            log.fine("Unable to access the Component object", e);
-        }
-        catch (InvocationTargetException e) {
-            log.fine("Unable to invoke on the Component object", e);
-        }
-
-        return loc;
-    }
-
-}
--- a/jdk/src/share/classes/sun/awt/GlobalCursorManager.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/awt/GlobalCursorManager.java	Wed Jul 05 17:04:26 2017 +0200
@@ -183,7 +183,7 @@
             }
 
             if (comp instanceof Window) {
-                p = ComponentAccessor.getLocation_NoClientCode(comp);
+                p = AWTAccessor.getComponentAccessor().getLocation(comp);
             } else if (comp instanceof Container) {
                 p = getLocationOnScreen(comp);
             }
@@ -202,7 +202,7 @@
                 }
             }
 
-            setCursor(comp, ComponentAccessor.getCursor_NoClientCode(comp), useCache);
+            setCursor(comp, AWTAccessor.getComponentAccessor().getCursor(comp), useCache);
 
         } catch (IllegalComponentStateException e) {
             // Shouldn't happen, but if it does, abort.
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Jul 05 17:04:26 2017 +0200
@@ -722,13 +722,7 @@
         EventQueue eq = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
 
         AWTAccessor.EventQueueAccessor accessor = AWTAccessor.getEventQueueAccessor();
-        EventQueue next = accessor.getNextQueue(eq);
-        while (next != null) {
-            eq = next;
-            next = accessor.getNextQueue(eq);
-        }
-
-        return (Thread.currentThread() == accessor.getDispatchThread(eq));
+        return accessor.isDispatchThreadImpl(eq);
     }
 
     public Dimension getScreenSize() {
@@ -806,17 +800,9 @@
     }
 
 
-    /**
-     * Makes the window OverrideRedirect, on X11 platforms. See
-     * ICCCM specification for more details about OverrideRedirect
-     * windows. Implemented in XToolkit, no-op in WToolkit.
-     */
-    public void setOverrideRedirect(Window target) {
-    }
+    static final SoftCache imgCache = new SoftCache();
 
-    static SoftCache imgCache = new SoftCache();
-
-    static synchronized Image getImageFromHash(Toolkit tk, URL url) {
+    static Image getImageFromHash(Toolkit tk, URL url) {
         SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             try {
@@ -844,32 +830,36 @@
                     sm.checkConnect(url.getHost(), url.getPort());
             }
         }
-        Image img = (Image)imgCache.get(url);
-        if (img == null) {
-            try {
-                img = tk.createImage(new URLImageSource(url));
-                imgCache.put(url, img);
-            } catch (Exception e) {
+        synchronized (imgCache) {
+            Image img = (Image)imgCache.get(url);
+            if (img == null) {
+                try {
+                    img = tk.createImage(new URLImageSource(url));
+                    imgCache.put(url, img);
+                } catch (Exception e) {
+                }
             }
+            return img;
         }
-        return img;
     }
 
-    static synchronized Image getImageFromHash(Toolkit tk,
+    static Image getImageFromHash(Toolkit tk,
                                                String filename) {
         SecurityManager security = System.getSecurityManager();
         if (security != null) {
             security.checkRead(filename);
         }
-        Image img = (Image)imgCache.get(filename);
-        if (img == null) {
-            try {
-                img = tk.createImage(new FileImageSource(filename));
-                imgCache.put(filename, img);
-            } catch (Exception e) {
+        synchronized (imgCache) {
+            Image img = (Image)imgCache.get(filename);
+            if (img == null) {
+                try {
+                    img = tk.createImage(new FileImageSource(filename));
+                    imgCache.put(filename, img);
+                } catch (Exception e) {
+                }
             }
+            return img;
         }
-        return img;
     }
 
     public Image getImage(String filename) {
@@ -1129,6 +1119,18 @@
     }
 
     /**
+     * Gives native peers the ability to query the closest HW component.
+     * If the given component is heavyweight, then it returns this. Otherwise,
+     * it goes one level up in the hierarchy and tests next component.
+     */
+    public static Component getHeavyweightComponent(Component c) {
+        while (c != null && AWTAccessor.getComponentAccessor().isLightweight(c)) {
+            c = AWTAccessor.getComponentAccessor().getParent(c);
+        }
+        return c;
+    }
+
+    /**
      * Returns a new input method window, with behavior as specified in
      * {@link java.awt.im.spi.InputMethodContext#createInputMethodWindow}.
      * If the inputContext is not null, the window should return it from its
--- a/jdk/src/share/classes/sun/awt/WindowAccessor.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.awt;
-
-import java.awt.Window;
-
-import java.lang.reflect.Field;
-
-import sun.util.logging.PlatformLogger;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-public class WindowAccessor {
-
-    private static Class windowClass;
-    private static Field fieldIsAutoRequestFocus;
-    private static Field fieldIsTrayIconWindow;
-
-    private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.WindowAccessor");
-
-    private WindowAccessor() {
-    }
-
-    static {
-        AccessController.doPrivileged( new PrivilegedAction() {
-                public Object run() {
-                    try {
-                        windowClass = Class.forName("java.awt.Window");
-                        fieldIsAutoRequestFocus = windowClass.getDeclaredField("autoRequestFocus");
-                        fieldIsAutoRequestFocus.setAccessible(true);
-                        fieldIsTrayIconWindow = windowClass.getDeclaredField("isTrayIconWindow");
-                        fieldIsTrayIconWindow.setAccessible(true);
-
-                    } catch (NoSuchFieldException e) {
-                        log.fine("Unable to initialize WindowAccessor: ", e);
-                    } catch (ClassNotFoundException e) {
-                        log.fine("Unable to initialize WindowAccessor: ", e);
-                    }
-                    return null;
-                }
-            });
-    }
-
-    public static boolean isAutoRequestFocus(Window w) {
-        try {
-            return fieldIsAutoRequestFocus.getBoolean(w);
-
-        } catch (IllegalAccessException e) {
-            log.fine("Unable to access the Window object", e);
-        }
-        return true;
-    }
-
-    public static boolean isTrayIconWindow(Window w) {
-        try {
-            return fieldIsTrayIconWindow.getBoolean(w);
-
-        } catch (IllegalAccessException e) {
-            log.fine("Unable to access the Window object", e);
-        }
-        return false;
-    }
-
-    public static void setTrayIconWindow(Window w, boolean isTrayIconWindow) {
-        try {
-            fieldIsTrayIconWindow.set(w, isTrayIconWindow);
-
-        } catch (IllegalAccessException e) {
-            log.fine("Unable to access the Window object", e);
-        }
-    }
-}
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -51,6 +51,9 @@
 import java.io.SequenceInputStream;
 import java.io.StringReader;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
@@ -626,6 +629,14 @@
     public abstract boolean isImageFormat(long format);
 
     /**
+     * Determines whether the format is a URI list we can convert to
+     * a DataFlavor.javaFileListFlavor.
+     */
+    protected boolean isURIListFormat(long format) {
+        return false;
+    }
+
+    /**
      * Returns a Map whose keys are all of the possible formats into which the
      * Transferable's transfer data flavors can be translated. The value of
      * each key is the DataFlavor in which the Transferable's data should be
@@ -1297,45 +1308,53 @@
             if (!DataFlavor.javaFileListFlavor.equals(flavor)) {
                 throw new IOException("data translation failed");
             }
+
             final List list = (List)obj;
 
-            final ArrayList fileList = new ArrayList();
-
             final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
 
-            int nFiles = 0;
-            for (int i = 0; i < list.size(); i++) {
-                Object o = list.get(i);
-                if (o instanceof File || o instanceof String) {
-                    nFiles++;
+            final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
+
+            bos = convertFileListToBytes(fileList);
+
+
+        // Target data is a URI list. Source data must be a
+        // java.util.List which contains java.io.File or String instances.
+        } else if (isURIListFormat(format)) {
+            if (!DataFlavor.javaFileListFlavor.equals(flavor)) {
+                throw new IOException("data translation failed");
+            }
+            String nat = getNativeForFormat(format);
+            String targetCharset = null;
+            if (nat != null) {
+                try {
+                    targetCharset = new DataFlavor(nat).getParameter("charset");
+                } catch (ClassNotFoundException cnfe) {
+                    throw new IOException(cnfe);
                 }
             }
-
-            try {
-                AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                    public Object run() throws IOException {
-                        for (Object fileObject : list)
-                        {
-                            File file = castToFile(fileObject);
-                            if (null == System.getSecurityManager() ||
-                                !(isFileInWebstartedCache(file) ||
-                                isForbiddenToRead(file, userProtectionDomain)))
-                            {
-                                fileList.add(file.getCanonicalPath());
-                            }
-                        }
-                        return null;
-                    }
-                });
-            } catch (PrivilegedActionException pae) {
-                throw new IOException(pae.getMessage());
+            if (targetCharset == null) {
+                targetCharset = "UTF-8";
             }
-
-            for (int i = 0; i < fileList.size(); i++)
-            {
-                byte[] bytes = ((String)fileList.get(i)).getBytes();
-                if (i != 0) bos.write(0);
+            final List list = (List)obj;
+            final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
+            final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
+            final ArrayList<String> uriList = new ArrayList<String>(fileList.size());
+            for (String fileObject : fileList) {
+                final URI uri = new File(fileObject).toURI();
+                // Some implementations are fussy about the number of slashes (file:///path/to/file is best)
+                try {
+                    uriList.add(new URI(uri.getScheme(), "", uri.getPath(), uri.getFragment()).toString());
+                } catch (URISyntaxException uriSyntaxException) {
+                    throw new IOException(uriSyntaxException);
+                  }
+              }
+
+            byte[] eoln = "\r\n".getBytes(targetCharset);
+            for (int i = 0; i < uriList.size(); i++) {
+                byte[] bytes = uriList.get(i).getBytes(targetCharset);
                 bos.write(bytes, 0, bytes.length);
+                bos.write(eoln, 0, eoln.length);
             }
 
         // Source data is an InputStream. For arbitrary flavors, just grab the
@@ -1385,6 +1404,8 @@
         return ret;
     }
 
+    protected abstract ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList) throws IOException;
+
     private String removeSuspectedData(DataFlavor flavor, final Transferable contents, final String str)
             throws IOException
     {
@@ -1452,6 +1473,33 @@
         return true;
     }
 
+    private ArrayList<String> castToFiles(final List files,
+                                          final ProtectionDomain userProtectionDomain) throws IOException
+    {
+        final ArrayList<String> fileList = new ArrayList<String>();
+        try {
+            AccessController.doPrivileged(new PrivilegedExceptionAction() {
+                public Object run() throws IOException {
+                    for (Object fileObject : files)
+                    {
+                        File file = castToFile(fileObject);
+                        if (file != null &&
+                            (null == System.getSecurityManager() ||
+                            !(isFileInWebstartedCache(file) ||
+                            isForbiddenToRead(file, userProtectionDomain))))
+                        {
+                            fileList.add(file.getCanonicalPath());
+                        }
+                    }
+                    return null;
+                }
+            });
+        } catch (PrivilegedActionException pae) {
+            throw new IOException(pae.getMessage());
+        }
+        return fileList;
+    }
+
     // It is important do not use user's successors
     // of File class.
     private File castToFile(Object fileObject) throws IOException {
@@ -1460,6 +1508,8 @@
             filePath = ((File)fileObject).getCanonicalPath();
         } else if (fileObject instanceof String) {
            filePath = (String) fileObject;
+        } else {
+           return null;
         }
         return new File(filePath);
     }
@@ -1565,6 +1615,29 @@
             // Turn the list of Files into a List and return
             return Arrays.asList(files);
 
+        // Source data is a URI list. Convert to DataFlavor.javaFileListFlavor
+        // where possible.
+        } else if (isURIListFormat(format) && DataFlavor.javaFileListFlavor.equals(flavor)) {
+            try {
+                URI uris[] = dragQueryURIs(str, bytes, format, localeTransferable);
+                if (uris == null) {
+                    return null;
+                }
+                ArrayList files = new ArrayList();
+                for (URI uri : uris) {
+                    try {
+                        files.add(new File(uri));
+                    } catch (IllegalArgumentException illegalArg) {
+                        // When converting from URIs to less generic files,
+                        // common practice (Wine, SWT) seems to be to
+                        // silently drop the URIs that aren't local files.
+                    }
+                }
+                return files;
+            } finally {
+                str.close();
+            }
+
         // Target data is a String. Strip terminating NUL bytes. Decode bytes
         // into characters. Search-and-replace EOLN.
         } else if (String.class.equals(flavor.getRepresentationClass()) &&
@@ -1950,6 +2023,19 @@
     protected abstract String[] dragQueryFile(byte[] bytes);
 
     /**
+     * Decodes URIs from either a byte array or a stream.
+     */
+    protected URI[] dragQueryURIs(InputStream stream,
+                                  byte[] bytes,
+                                  long format,
+                                  Transferable localeTransferable)
+      throws IOException
+    {
+        throw new IOException(
+            new UnsupportedOperationException("not implemented on this platform"));
+    }
+
+    /**
      * Translates either a byte array or an input stream which contain
      * platform-specific image data in the given format into an Image.
      */
--- a/jdk/src/share/classes/sun/font/StandardGlyphVector.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/font/StandardGlyphVector.java	Wed Jul 05 17:04:26 2017 +0200
@@ -396,12 +396,19 @@
 
     // !!! not cached, assume TextLayout will cache if necessary
     public Rectangle2D getVisualBounds() {
-        if (glyphs.length == 0) {
-            return new Rectangle2D.Float(0, 0, 0, 0);
+        Rectangle2D result = null;
+        for (int i = 0; i < glyphs.length; ++i) {
+            Rectangle2D glyphVB = getGlyphVisualBounds(i).getBounds2D();
+            if (!glyphVB.isEmpty()) {
+                if (result == null) {
+                    result = glyphVB;
+                } else {
+                    Rectangle2D.union(result, glyphVB, result);
+                }
+            }
         }
-        Rectangle2D result = getGlyphVisualBounds(0).getBounds2D();
-        for (int i = 1; i < glyphs.length; ++i) {
-            Rectangle2D.union(result, getGlyphVisualBounds(i).getBounds2D(), result);
+        if (result == null) {
+            result = new Rectangle2D.Float(0, 0, 0, 0);
         }
         return result;
     }
@@ -1787,8 +1794,19 @@
                 gp.transform(sgv.invdtx);
                 result = gp.getBounds2D();
             }
-            result.setRect(result.getMinX() + x + dx, result.getMinY() + y + dy,
-                           result.getWidth(), result.getHeight());
+            /* Since x is the logical advance of the glyph to this point.
+             * Because of the way that Rectangle.union is specified, this
+             * means that subsequent unioning of a rect including that
+             * will be affected, even if the glyph is empty. So skip such
+             * cases. This alone isn't a complete solution since x==0
+             * may also not be what is wanted. The code that does the
+             * unioning also needs to be aware to ignore empty glyphs.
+             */
+            if (!result.isEmpty()) {
+                result.setRect(result.getMinX() + x + dx,
+                               result.getMinY() + y + dy,
+                               result.getWidth(), result.getHeight());
+            }
             return result;
         }
 
--- a/jdk/src/share/classes/sun/net/www/protocol/http/spnego/NegotiatorImpl.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/net/www/protocol/http/spnego/NegotiatorImpl.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,6 +25,7 @@
 
 package sun.net.www.protocol.http.spnego;
 
+import com.sun.security.jgss.ExtendedGSSContext;
 import java.io.IOException;
 
 import org.ietf.jgss.GSSContext;
@@ -100,15 +101,10 @@
                                         null,
                                         GSSContext.DEFAULT_LIFETIME);
 
-        // In order to support credential delegation in HTTP/SPNEGO,
-        // we always request it before initSecContext. The current
-        // implementation will check the OK-AS-DELEGATE flag inside
-        // the service ticket of the web server, and only enable
-        // delegation when this flag is set. This check is only
-        // performed when the GSS caller is CALLER_HTTP_NEGOTIATE,
-        // so all other normal GSS-API calls are not affected.
-
-        context.requestCredDeleg(true);
+        // Always respect delegation policy in HTTP/SPNEGO.
+        if (context instanceof ExtendedGSSContext) {
+            ((ExtendedGSSContext)context).requestDelegPolicy(true);
+        }
         oneToken = context.initSecContext(new byte[0], 0, 0);
     }
 
--- a/jdk/src/share/classes/sun/security/jgss/GSSContextImpl.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/GSSContextImpl.java	Wed Jul 05 17:04:26 2017 +0200
@@ -89,7 +89,8 @@
  */
 class GSSContextImpl implements ExtendedGSSContext {
 
-    private GSSManagerImpl gssManager = null;
+    private final GSSManagerImpl gssManager;
+    private final boolean initiator;
 
     // private flags for the context state
     private static final int PRE_INIT = 1;
@@ -99,14 +100,12 @@
 
     // instance variables
     private int currentState = PRE_INIT;
-    private boolean initiator;
 
     private GSSContextSpi mechCtxt = null;
     private Oid mechOid = null;
     private ObjectIdentifier objId = null;
 
     private GSSCredentialImpl myCred = null;
-    private GSSCredentialImpl delegCred = null;
 
     private GSSNameImpl srcName = null;
     private GSSNameImpl targName = null;
@@ -121,6 +120,7 @@
     private boolean reqSequenceDetState = true;
     private boolean reqCredDelegState = false;
     private boolean reqAnonState = false;
+    private boolean reqDelegPolicyState = false;
 
     /**
      * Creates a GSSContextImp on the context initiator's side.
@@ -221,6 +221,7 @@
                 mechCtxt.requestSequenceDet(reqSequenceDetState);
                 mechCtxt.requestAnonymity(reqAnonState);
                 mechCtxt.setChannelBinding(channelBindings);
+                mechCtxt.requestDelegPolicy(reqDelegPolicyState);
 
                 objId = new ObjectIdentifier(mechOid.toString());
 
@@ -465,42 +466,42 @@
     }
 
     public void requestMutualAuth(boolean state) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqMutualAuthState = state;
     }
 
     public void requestReplayDet(boolean state) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqReplayDetState = state;
     }
 
     public void requestSequenceDet(boolean state) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqSequenceDetState = state;
     }
 
     public void requestCredDeleg(boolean state) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqCredDelegState = state;
     }
 
     public void requestAnonymity(boolean state) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqAnonState = state;
     }
 
     public void requestConf(boolean state) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqConfState = state;
     }
 
     public void requestInteg(boolean state) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqIntegState = state;
     }
 
     public void requestLifetime(int lifetime) throws GSSException {
-        if (mechCtxt == null)
+        if (mechCtxt == null && initiator)
             reqLifetime = lifetime;
     }
 
@@ -630,6 +631,8 @@
         targName = null;
     }
 
+    // ExtendedGSSContext methods:
+
     @Override
     public Object inquireSecContext(InquireType type) throws GSSException {
         SecurityManager security = System.getSecurityManager();
@@ -641,4 +644,18 @@
         }
         return mechCtxt.inquireSecContext(type);
     }
+
+    @Override
+    public void requestDelegPolicy(boolean state) throws GSSException {
+        if (mechCtxt == null && initiator)
+            reqDelegPolicyState = state;
+    }
+
+    @Override
+    public boolean getDelegPolicyState() {
+        if (mechCtxt != null)
+            return mechCtxt.getDelegPolicyState();
+        else
+            return reqDelegPolicyState;
+    }
 }
--- a/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/InitialToken.java	Wed Jul 05 17:04:26 2017 +0200
@@ -85,34 +85,41 @@
             int size = CHECKSUM_LENGTH_SIZE + CHECKSUM_BINDINGS_SIZE +
                 CHECKSUM_FLAGS_SIZE;
 
-            if (context.getCredDelegState()) {
-                if (context.getCaller() instanceof HttpCaller &&
-                        !serviceTicket.getFlags()[Krb5.TKT_OPTS_DELEGATE]) {
-                    // When the caller is HTTP/SPNEGO and OK-AS-DELEGATE
-                    // is not present in the service ticket, delegation
-                    // is disabled.
-                    context.setCredDelegState(false);
-                } else if (!tgt.isForwardable()) {
-                    // XXX log this resetting of delegation state
-                    context.setCredDelegState(false);
+            if (!tgt.isForwardable()) {
+                context.setCredDelegState(false);
+                context.setDelegPolicyState(false);
+            } else if (context.getCredDelegState()) {
+                if (context.getDelegPolicyState()) {
+                    if (!serviceTicket.checkDelegate()) {
+                        // delegation not permitted by server policy, mark it
+                        context.setDelegPolicyState(false);
+                    }
+                }
+            } else if (context.getDelegPolicyState()) {
+                if (serviceTicket.checkDelegate()) {
+                    context.setCredDelegState(true);
                 } else {
-                    KrbCred krbCred = null;
-                    CipherHelper cipherHelper =
-                        context.getCipherHelper(serviceTicket.getSessionKey());
-                    if (useNullKey(cipherHelper)) {
-                        krbCred = new KrbCred(tgt, serviceTicket,
-                                                  EncryptionKey.NULL_KEY);
-                    } else {
-                        krbCred = new KrbCred(tgt, serviceTicket,
-                                        serviceTicket.getSessionKey());
-                    }
-                    krbCredMessage = krbCred.getMessage();
-                    size += CHECKSUM_DELEG_OPT_SIZE +
-                            CHECKSUM_DELEG_LGTH_SIZE +
-                            krbCredMessage.length;
+                    context.setDelegPolicyState(false);
                 }
             }
 
+            if (context.getCredDelegState()) {
+                KrbCred krbCred = null;
+                CipherHelper cipherHelper =
+                    context.getCipherHelper(serviceTicket.getSessionKey());
+                if (useNullKey(cipherHelper)) {
+                    krbCred = new KrbCred(tgt, serviceTicket,
+                                              EncryptionKey.NULL_KEY);
+                } else {
+                    krbCred = new KrbCred(tgt, serviceTicket,
+                                    serviceTicket.getSessionKey());
+                }
+                krbCredMessage = krbCred.getMessage();
+                size += CHECKSUM_DELEG_OPT_SIZE +
+                        CHECKSUM_DELEG_LGTH_SIZE +
+                        krbCredMessage.length;
+            }
+
             checksumBytes = new byte[size];
 
             checksumBytes[pos++] = CHECKSUM_FIRST_BYTES[0];
@@ -296,6 +303,7 @@
             return delegCreds;
         }
 
+        // Only called by acceptor
         public void setContextFlags(Krb5Context context) {
                 // default for cred delegation is false
             if ((flags & CHECKSUM_DELEG_FLAG) > 0)
--- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5Context.java	Wed Jul 05 17:04:26 2017 +0200
@@ -78,6 +78,7 @@
     private boolean sequenceDetState  = true;
     private boolean confState  = true;
     private boolean integState  = true;
+    private boolean delegPolicyState = false;
 
     private int mySeqNumber;
     private int peerSeqNumber;
@@ -299,6 +300,21 @@
         return sequenceDetState || replayDetState;
     }
 
+    /**
+     * Requests that the deleg policy be respected.
+     */
+    public final void requestDelegPolicy(boolean value) {
+        if (state == STATE_NEW && isInitiator())
+            delegPolicyState = value;
+    }
+
+    /**
+     * Is deleg policy respected?
+     */
+    public final boolean getDelegPolicyState() {
+        return delegPolicyState;
+    }
+
     /*
      * Anonymity is a little different in that after an application
      * requests anonymity it will want to know whether the mechanism
@@ -422,6 +438,10 @@
         integState = state;
     }
 
+    final void setDelegPolicyState(boolean state) {
+        delegPolicyState = state;
+    }
+
     /**
      * Sets the channel bindings to be used during context
      * establishment.
--- a/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/spi/GSSContextSpi.java	Wed Jul 05 17:04:26 2017 +0200
@@ -124,6 +124,8 @@
 
     public void requestInteg(boolean state) throws GSSException;
 
+    public void requestDelegPolicy(boolean state) throws GSSException;
+
     public void setChannelBinding(ChannelBinding cb) throws GSSException;
 
     public boolean getCredDelegState();
@@ -136,6 +138,8 @@
 
     public boolean getAnonymityState();
 
+    public boolean getDelegPolicyState();
+
     public boolean isTransferable() throws GSSException;
 
     public boolean isProtReady();
--- a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -63,6 +63,7 @@
     private boolean sequenceDetState = true;
     private boolean confState = true;
     private boolean integState = true;
+    private boolean delegPolicyState = false;
 
     private GSSNameSpi peerName = null;
     private GSSNameSpi myName = null;
@@ -154,6 +155,14 @@
     }
 
     /**
+     * Requests that deleg policy be respected.
+     */
+    public final void requestDelegPolicy(boolean value) throws GSSException {
+        if (state == STATE_NEW && isInitiator())
+            delegPolicyState = value;
+    }
+
+    /**
      * Is integrity available?
      */
     public final boolean getIntegState() {
@@ -161,6 +170,19 @@
     }
 
     /**
+     * Is deleg policy respected?
+     */
+    public final boolean getDelegPolicyState() {
+        if (isInitiator() && mechContext != null &&
+                mechContext instanceof ExtendedGSSContext &&
+                (state == STATE_IN_PROCESS || state == STATE_DONE)) {
+            return ((ExtendedGSSContext)mechContext).getDelegPolicyState();
+        } else {
+            return delegPolicyState;
+        }
+    }
+
+    /**
      * Requests that credential delegation be done during context
      * establishment.
      */
@@ -173,7 +195,7 @@
      * Is credential delegation enabled?
      */
     public final boolean getCredDelegState() {
-        if (mechContext != null &&
+        if (isInitiator() && mechContext != null &&
                 (state == STATE_IN_PROCESS || state == STATE_DONE)) {
             return mechContext.getCredDelegState();
         } else {
@@ -201,30 +223,6 @@
         return mutualAuthState;
     }
 
-    final void setCredDelegState(boolean state) {
-        credDelegState = state;
-    }
-
-    final void setMutualAuthState(boolean state) {
-        mutualAuthState = state;
-    }
-
-    final void setReplayDetState(boolean state) {
-        replayDetState = state;
-    }
-
-    final void setSequenceDetState(boolean state) {
-        sequenceDetState = state;
-    }
-
-    final void setConfState(boolean state) {
-        confState = state;
-    }
-
-    final void setIntegState(boolean state) {
-        integState = state;
-    }
-
     /**
      * Returns the mechanism oid.
      *
@@ -319,14 +317,9 @@
                 mechToken = GSS_initSecContext(null);
 
                 errorCode = GSSException.DEFECTIVE_TOKEN;
-                byte[] micToken = null;
-                if (!GSSUtil.useMSInterop()) {
-                    // calculate MIC only in normal mode
-                    micToken = generateMechListMIC(DER_mechTypes);
-                }
                 // generate SPNEGO token
                 initToken = new NegTokenInit(DER_mechTypes, getContextFlags(),
-                                        mechToken, micToken);
+                                        mechToken, null);
                 if (DEBUG) {
                     System.out.println("SpNegoContext.initSecContext: " +
                                 "sending token of type = " +
@@ -585,15 +578,9 @@
                                 "negotiated result = " + negoResult);
                 }
 
-                // calculate MIC only in normal mode
-                byte[] micToken = null;
-                if (!GSSUtil.useMSInterop() && valid) {
-                    micToken = generateMechListMIC(DER_mechTypes);
-                }
-
                 // generate SPNEGO token
                 NegTokenTarg targToken = new NegTokenTarg(negoResult.ordinal(),
-                                mech_wanted, accept_token, micToken);
+                                mech_wanted, accept_token, null);
                 if (DEBUG) {
                     System.out.println("SpNegoContext.acceptSecContext: " +
                                 "sending token of type = " +
@@ -653,6 +640,10 @@
             throw gssException;
         }
 
+        if (state == STATE_DONE) {
+            // now set the context flags for acceptor
+            setContextFlags();
+        }
         return retVal;
     }
 
@@ -703,36 +694,39 @@
         return out;
     }
 
+    // Only called on acceptor side. On the initiator side, most flags
+    // are already set at request. For those that might get chanegd,
+    // state from mech below is used.
     private void setContextFlags() {
 
         if (mechContext != null) {
             // default for cred delegation is false
             if (mechContext.getCredDelegState()) {
-                setCredDelegState(true);
+                credDelegState = true;
             }
             // default for the following are true
             if (!mechContext.getMutualAuthState()) {
-                setMutualAuthState(false);
+                mutualAuthState = false;
             }
             if (!mechContext.getReplayDetState()) {
-                setReplayDetState(false);
+                replayDetState = false;
             }
             if (!mechContext.getSequenceDetState()) {
-                setSequenceDetState(false);
+                sequenceDetState = false;
             }
             if (!mechContext.getIntegState()) {
-                setIntegState(false);
+                integState = false;
             }
             if (!mechContext.getConfState()) {
-                setConfState(false);
+                confState = false;
             }
         }
     }
 
     /**
-     * generate MIC on mechList
+     * generate MIC on mechList. Not used at the moment.
      */
-    private byte[] generateMechListMIC(byte[] mechTypes)
+    /*private byte[] generateMechListMIC(byte[] mechTypes)
         throws GSSException {
 
         // sanity check the required input
@@ -769,7 +763,7 @@
             }
         }
         return mic;
-    }
+    }*/
 
     /**
      * verify MIC on MechList
@@ -837,6 +831,10 @@
             mechContext.requestMutualAuth(mutualAuthState);
             mechContext.requestReplayDet(replayDetState);
             mechContext.requestSequenceDet(sequenceDetState);
+            if (mechContext instanceof ExtendedGSSContext) {
+                ((ExtendedGSSContext)mechContext).requestDelegPolicy(
+                        delegPolicyState);
+            }
         }
 
         // pass token
@@ -1202,5 +1200,5 @@
                     "inquireSecContext not supported by underlying mech.");
         }
     }
+}
 
-}
--- a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoMechFactory.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoMechFactory.java	Wed Jul 05 17:04:26 2017 +0200
@@ -57,6 +57,12 @@
                         GSSName.NT_HOSTBASED_SERVICE,
                         GSSName.NT_EXPORT_NAME};
 
+    // The default underlying mech of SPNEGO, must not be SPNEGO itself.
+    private static final Oid DEFAULT_SPNEGO_MECH_OID =
+            ProviderList.DEFAULT_MECH_OID.equals(GSS_SPNEGO_MECH_OID)?
+                GSSUtil.GSS_KRB5_MECH_OID:
+                ProviderList.DEFAULT_MECH_OID;
+
     // Use an instance of a GSSManager whose provider list
     // does not include native provider
     final GSSManagerImpl manager;
@@ -100,18 +106,27 @@
                 availableMechs[j++] = mechs[i];
             }
         }
+        // Move the preferred mech to first place
+        for (int i=0; i<availableMechs.length; i++) {
+            if (availableMechs[i].equals(DEFAULT_SPNEGO_MECH_OID)) {
+                if (i != 0) {
+                    availableMechs[i] = availableMechs[0];
+                    availableMechs[0] = DEFAULT_SPNEGO_MECH_OID;
+                }
+                break;
+            }
+        }
     }
 
     public GSSNameSpi getNameElement(String nameStr, Oid nameType)
-        throws GSSException {
-        // get NameElement for the default Mechanism
-        return manager.getNameElement(nameStr, nameType, null);
+            throws GSSException {
+        return manager.getNameElement(
+                nameStr, nameType, DEFAULT_SPNEGO_MECH_OID);
     }
 
     public GSSNameSpi getNameElement(byte[] name, Oid nameType)
-        throws GSSException {
-        // get NameElement for the default Mechanism
-        return manager.getNameElement(name, nameType, null);
+            throws GSSException {
+        return manager.getNameElement(name, nameType, DEFAULT_SPNEGO_MECH_OID);
     }
 
     public GSSCredentialSpi getCredentialElement(GSSNameSpi name,
--- a/jdk/src/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/jgss/wrapper/NativeGSSContext.java	Wed Jul 05 17:04:26 2017 +0200
@@ -549,6 +549,9 @@
     public void requestInteg(boolean state) throws GSSException {
         changeFlags(GSS_C_INTEG_FLAG, state);
     }
+    public void requestDelegPolicy(boolean state) throws GSSException {
+        // Not supported, ignore
+    }
     public void requestLifetime(int lifetime) throws GSSException {
         if (isInitiator && pContext == 0) {
             this.lifetime = lifetime;
@@ -590,6 +593,9 @@
     public boolean getIntegState() {
         return checkFlags(GSS_C_INTEG_FLAG);
     }
+    public boolean getDelegPolicyState() {
+        return false;
+    }
     public int getLifetime() {
         return cStub.getContextTime(pContext);
     }
--- a/jdk/src/share/classes/sun/security/krb5/Credentials.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/krb5/Credentials.java	Wed Jul 05 17:04:26 2017 +0200
@@ -234,7 +234,19 @@
      * @return true if OK-AS_DELEGATE flag is set, otherwise, return false.
      */
     public boolean checkDelegate() {
-        return (flags.get(Krb5.TKT_OPTS_DELEGATE));
+        return flags.get(Krb5.TKT_OPTS_DELEGATE);
+    }
+
+    /**
+     * Reset TKT_OPTS_DELEGATE to false, called at credentials acquirement
+     * when one of the cross-realm TGTs does not have the OK-AS-DELEGATE
+     * flag set. This info must be preservable and restorable through
+     * the Krb5Util.credsToTicket/ticketToCreds() methods so that even if
+     * the service ticket is cached it still remembers the cross-realm
+     * authentication result.
+     */
+    public void resetDelegate() {
+        flags.set(Krb5.TKT_OPTS_DELEGATE, false);
     }
 
     public Credentials renew() throws KrbException, IOException {
--- a/jdk/src/share/classes/sun/security/krb5/internal/CredentialsUtil.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/krb5/internal/CredentialsUtil.java	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2001-2004 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2001-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,6 +117,7 @@
 
         // Get a list of realms to traverse
         String[] realms = Realm.getRealmsList(localRealm, serviceRealm);
+        boolean okAsDelegate = true;
 
         if (realms == null || realms.length == 0)
         {
@@ -194,6 +195,15 @@
              */
 
             newTgtRealm = newTgt.getServer().getInstanceComponent();
+            if (okAsDelegate && !newTgt.checkDelegate()) {
+                if (DEBUG)
+                {
+                    System.out.println(">>> Credentials acquireServiceCreds: " +
+                            "global OK-AS-DELEGATE turned off at " +
+                            newTgt.getServer());
+                }
+                okAsDelegate = false;
+            }
 
             if (DEBUG)
             {
@@ -283,6 +293,9 @@
                 System.out.println(">>> Credentials acquireServiceCreds: returning creds:");
                 Credentials.printDebug(theCreds);
             }
+            if (!okAsDelegate) {
+                theCreds.resetDelegate();
+            }
             return theCreds;
         }
         throw new KrbApErrException(Krb5.KRB_AP_ERR_GEN_CRED,
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS10.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS10.java	Wed Jul 05 17:04:26 2017 +0200
@@ -44,7 +44,6 @@
 import sun.security.x509.AlgorithmId;
 import sun.security.x509.X509Key;
 import sun.security.x509.X500Name;
-import sun.security.x509.X500Signer;
 
 /**
  * A PKCS #10 certificate request is created and sent to a Certificate
@@ -183,13 +182,13 @@
      * Create the signed certificate request.  This will later be
      * retrieved in either string or binary format.
      *
-     * @param requester identifies the signer (by X.500 name)
-     *          and provides the private key used to sign.
+     * @param subject identifies the signer (by X.500 name).
+     * @param signature private key and signing algorithm to use.
      * @exception IOException on errors.
      * @exception CertificateException on certificate handling errors.
      * @exception SignatureException on signature handling errors.
      */
-    public void encodeAndSign(X500Signer requester)
+    public void encodeAndSign(X500Name subject, Signature signature)
     throws CertificateException, IOException, SignatureException {
         DerOutputStream out, scratch;
         byte[]          certificateRequestInfo;
@@ -198,7 +197,7 @@
         if (encoded != null)
             throw new SignatureException("request is already signed");
 
-        subject = requester.getSigner();
+        this.subject = subject;
 
         /*
          * Encode cert request info, wrap in a sequence for signing
@@ -217,14 +216,20 @@
         /*
          * Sign it ...
          */
-        requester.update(certificateRequestInfo, 0,
+        signature.update(certificateRequestInfo, 0,
                 certificateRequestInfo.length);
-        sig = requester.sign();
+        sig = signature.sign();
 
         /*
          * Build guts of SIGNED macro
          */
-        requester.getAlgorithmId().encode(scratch);     // sig algorithm
+        AlgorithmId algId = null;
+        try {
+            algId = AlgorithmId.getAlgorithmId(signature.getAlgorithm());
+        } catch (NoSuchAlgorithmException nsae) {
+            throw new SignatureException(nsae);
+        }
+        algId.encode(scratch);     // sig algorithm
         scratch.putBitString(sig);                      // sig
 
         /*
--- a/jdk/src/share/classes/sun/security/provider/IdentityDatabase.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,427 +0,0 @@
-/*
- * Copyright 1996-2006 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.security.provider;
-
-import java.io.*;
-import java.util.*;
-import java.security.*;
-
-/**
- * An implementation of IdentityScope as a persistent identity
- * database.
- *
- * @see Identity
- * @see Key
- *
- * @author Benjamin Renaud
- */
-public
-class IdentityDatabase extends IdentityScope implements Serializable {
-
-    /** use serialVersionUID from JDK 1.1. for interoperability */
-    private static final long serialVersionUID = 4923799573357658384L;
-
-    /* Are we debugging? */
-    private static final boolean debug = false;
-
-    /* Are we printing out error messages? */
-    private static final boolean error = true;
-
-    /* The source file, if any, for this database.*/
-    File sourceFile;
-
-    /* The private representation of the database.*/
-    Hashtable<String, Identity> identities;
-
-    IdentityDatabase() throws InvalidParameterException {
-        this("restoring...");
-    }
-
-    /**
-     * Construct a new, empty database with a specified source file.
-     *
-     * @param file the source file.
-     */
-    public IdentityDatabase(File file) throws InvalidParameterException {
-        this(file.getName());
-        sourceFile = file;
-    }
-
-    /**
-     * Construct a new, empty database.
-     */
-    public IdentityDatabase(String name) throws InvalidParameterException {
-        super(name);
-        identities = new Hashtable<String, Identity>();
-    }
-
-    /**
-     * Initialize an identity database from a stream. The stream should
-     * contain data to initialized a serialized IdentityDatabase
-     * object.
-     *
-     * @param is the input stream from which to restore the database.
-     *
-     * @exception IOException if a stream IO exception occurs
-     */
-    public static IdentityDatabase fromStream(InputStream is)
-    throws IOException {
-        IdentityDatabase db = null;
-        try {
-            ObjectInputStream ois = new ObjectInputStream(is);
-            db = (IdentityDatabase)ois.readObject();
-        } catch (ClassNotFoundException e) {
-            // this can't happen.
-            debug("This should not be happening.", e);
-            error(
-                "The version of the database is obsolete. Cannot initialize.");
-
-        } catch (InvalidClassException e) {
-            // this may happen in developers workspaces happen.
-            debug("This should not be happening.", e);
-            error("Unable to initialize system identity scope: " +
-                  " InvalidClassException. \nThis is most likely due to " +
-                  "a serialization versioning problem: a class used in " +
-                  "key management was obsoleted");
-
-        } catch (StreamCorruptedException e) {
-            debug("The serialization stream is corrupted. Unable to load.", e);
-            error("Unable to initialize system identity scope." +
-                  " StreamCorruptedException.");
-        }
-
-        if (db == null) {
-            db = new IdentityDatabase("uninitialized");
-        }
-
-        return db;
-    }
-
-    /**
-     * Initialize an IdentityDatabase from file.
-     *
-     * @param f the filename where the identity database is stored.
-     *
-     * @exception IOException a file-related exception occurs (e.g.
-     * the directory of the file passed does not exists, etc.
-     *
-     * @IOException if a file IO exception occurs.
-     */
-    public static IdentityDatabase fromFile(File f) throws IOException {
-        FileInputStream fis = new FileInputStream(f);
-        IdentityDatabase edb = fromStream(fis);
-        edb.sourceFile = f;
-        return edb;
-    }
-
-
-
-    /**
-     * @return the number of identities in the database.
-     */
-   public int size() {
-       return identities.size();
-   }
-
-
-    /**
-     * @param name the name of the identity to be retrieved.
-     *
-     * @return the identity named name, or null if there are
-     * no identities named name in the database.
-     */
-    public Identity getIdentity(String name) {
-        Identity id = identities.get(name);
-        if (id instanceof Signer) {
-            localCheck("get.signer");
-        }
-        return id;
-    }
-
-    /**
-     * Get an identity by key.
-     *
-     * @param name the key of the identity to be retrieved.
-     *
-     * @return the identity with a given key, or null if there are no
-     * identities with that key in the database.
-     */
-    public Identity getIdentity(PublicKey key) {
-        if (key == null) {
-            return null;
-        }
-        Enumeration<Identity> e = identities();
-        while (e.hasMoreElements()) {
-            Identity i = e.nextElement();
-            PublicKey k = i.getPublicKey();
-            if (k != null && keyEqual(k, key)) {
-                if (i instanceof Signer) {
-                    localCheck("get.signer");
-                }
-                return i;
-            }
-        }
-        return null;
-    }
-
-    private boolean keyEqual(Key key1, Key key2) {
-        if (key1 == key2) {
-            return true;
-        } else {
-            return MessageDigest.isEqual(key1.getEncoded(), key2.getEncoded());
-        }
-    }
-
-    /**
-     * Adds an identity to the database.
-     *
-     * @param identity the identity to be added.
-     *
-     * @exception KeyManagementException if a name or key clash
-     * occurs, or if another exception occurs.
-     */
-    public void addIdentity(Identity identity)
-    throws KeyManagementException {
-        localCheck("add.identity");
-        Identity byName = getIdentity(identity.getName());
-        Identity byKey = getIdentity(identity.getPublicKey());
-        String msg = null;
-
-        if (byName != null) {
-            msg = "name conflict";
-        }
-        if (byKey != null) {
-            msg = "key conflict";
-        }
-        if (msg != null) {
-            throw new KeyManagementException(msg);
-        }
-        identities.put(identity.getName(), identity);
-    }
-
-    /**
-     * Removes an identity to the database.
-     */
-    public void removeIdentity(Identity identity)
-    throws KeyManagementException {
-        localCheck("remove.identity");
-        String name = identity.getName();
-        if (identities.get(name) == null) {
-            throw new KeyManagementException("there is no identity named " +
-                                             name + " in " + this);
-        }
-        identities.remove(name);
-    }
-
-    /**
-     * @return an enumeration of all identities in the database.
-     */
-    public Enumeration<Identity> identities() {
-        return identities.elements();
-    }
-
-    /**
-     * Set the source file for this database.
-     */
-    void setSourceFile(File f) {
-        sourceFile = f;
-    }
-
-    /**
-     * @return the source file for this database.
-     */
-    File getSourceFile() {
-        return sourceFile;
-    }
-
-    /**
-     * Save the database in its current state to an output stream.
-     *
-     * @param os the output stream to which the database should be serialized.
-     *
-     * @exception IOException if an IO exception is raised by stream
-     * operations.
-     */
-    public void save(OutputStream os) throws IOException {
-        try {
-            ObjectOutputStream oos = new ObjectOutputStream(os);
-            oos.writeObject(this);
-            oos.flush();
-        } catch (InvalidClassException e) {
-            debug("This should not be happening.", e);
-            return;
-        }
-    }
-
-    /**
-     * Save the database to a file.
-     *
-     * @exception IOException if an IO exception is raised by stream
-     * operations.
-     */
-    void save(File f) throws IOException {
-        setSourceFile(f);
-        FileOutputStream fos = new FileOutputStream(f);
-        save(fos);
-    }
-
-    /**
-     * Saves the database to the default source file.
-     *
-     * @exception KeyManagementException when there is no default source
-     * file specified for this database.
-     */
-    public void save() throws IOException {
-        if (sourceFile == null) {
-            throw new IOException("this database has no source file");
-        }
-        save(sourceFile);
-    }
-
-    /**
-     * This method returns the file from which to initialize the
-     * system database.
-     */
-    private static File systemDatabaseFile() {
-
-        // First figure out where the identity database is hiding, if anywhere.
-        String dbPath = Security.getProperty("identity.database");
-        // if nowhere, it's the canonical place.
-        if (dbPath == null) {
-            dbPath = System.getProperty("user.home") + File.separatorChar +
-                "identitydb.obj";
-        }
-        return new File(dbPath);
-    }
-
-
-    /* This block initializes the system database, if there is one. */
-    static {
-        java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<Void>() {
-            public Void run() {
-                initializeSystem();
-                return null;
-            }
-        });
-    }
-
-    /**
-     * This method initializes the system's identity database. The
-     * canonical location is
-     * <user.home>/identitydatabase.obj. This is settable through
-     * the identity.database property.  */
-    private static void initializeSystem() {
-
-        IdentityDatabase systemDatabase;
-        File dbFile = systemDatabaseFile();
-
-        // Second figure out if it's there, and if it isn't, create one.
-        try {
-            if (dbFile.exists()) {
-                debug("loading system database from file: " + dbFile);
-                systemDatabase = fromFile(dbFile);
-            } else {
-                systemDatabase = new IdentityDatabase(dbFile);
-            }
-            IdentityScope.setSystemScope(systemDatabase);
-            debug("System database initialized: " + systemDatabase);
-        } catch (IOException e) {
-            debug("Error initializing identity database: " + dbFile, e);
-            return;
-        } catch (InvalidParameterException e) {
-            debug("Error trying to instantiate a system identities db in " +
-                               dbFile, e);
-            return;
-        }
-    }
-
-    /*
-    private static File securityPropFile(String filename) {
-        // maybe check for a system property which will specify where to
-        // look.
-        String sep = File.separator;
-        return new File(System.getProperty("java.home") +
-                        sep + "lib" + sep + "security" +
-                        sep + filename);
-    }
-    */
-
-    public String toString() {
-        return "sun.security.provider.IdentityDatabase, source file: " +
-            sourceFile;
-    }
-
-
-    private static void debug(String s) {
-        if (debug) {
-            System.err.println(s);
-        }
-    }
-
-    private static void debug(String s, Throwable t) {
-        if (debug) {
-            t.printStackTrace();
-            System.err.println(s);
-        }
-    }
-
-    private static void error(String s) {
-        if (error) {
-            System.err.println(s);
-        }
-    }
-
-    void localCheck(String directive) {
-        SecurityManager security = System.getSecurityManager();
-        if (security != null) {
-            directive = this.getClass().getName() + "." +
-                directive + "." + localFullName();
-            security.checkSecurityAccess(directive);
-        }
-    }
-
-    /**
-     * Returns a parsable name for identity: identityName.scopeName
-     */
-    String localFullName() {
-        String parsable = getName();
-        if (getScope() != null) {
-            parsable += "." +getScope().getName();
-        }
-        return parsable;
-    }
-
-    /**
-     * Serialization write.
-     */
-    private synchronized void writeObject (java.io.ObjectOutputStream stream)
-    throws IOException {
-        localCheck("serialize.identity.database");
-        stream.writeObject(identities);
-        stream.writeObject(sourceFile);
-    }
-}
--- a/jdk/src/share/classes/sun/security/provider/PolicyFile.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/provider/PolicyFile.java	Wed Jul 05 17:04:26 2017 +0200
@@ -295,16 +295,13 @@
 
     private static final int DEFAULT_CACHE_SIZE = 1;
 
-    /** the scope to check */
-    private static IdentityScope scope = null;
-
     // contains the policy grant entries, PD cache, and alias mapping
     private AtomicReference<PolicyInfo> policyInfo =
         new AtomicReference<PolicyInfo>();
     private boolean constructed = false;
 
     private boolean expandProperties = true;
-    private boolean ignoreIdentityScope = false;
+    private boolean ignoreIdentityScope = true;
     private boolean allowSystemProperties = true;
     private boolean notUtf8 = false;
     private URL url;
@@ -2024,85 +2021,9 @@
     private boolean checkForTrustedIdentity(final Certificate cert,
         PolicyInfo myInfo)
     {
-        if (cert == null)
-            return false;
-
-        // see if we are ignoring the identity scope or not
-        if (ignoreIdentityScope)
-            return false;
-
-        // try to initialize scope
-        synchronized(PolicyFile.class) {
-            if (scope == null) {
-                IdentityScope is = IdentityScope.getSystemScope();
-
-                if (is instanceof sun.security.provider.IdentityDatabase) {
-                    scope = is;
-                } else {
-                    // leave scope null
-                }
-            }
-        }
-
-        if (scope == null) {
-            ignoreIdentityScope = true;
-            return false;
-        }
-
-        // need privileged block for getIdentity in case we are trying
-        // to get a signer
-        final Identity id = AccessController.doPrivileged(
-                              new java.security.PrivilegedAction<Identity>() {
-            public Identity run() {
-                return scope.getIdentity(cert.getPublicKey());
-            }
-        });
-
-        if (isTrusted(id)) {
-            if (debug != null) {
-                debug.println("Adding policy entry for trusted Identity: ");
-                //needed for identity toString!
-                AccessController.doPrivileged(
-                      new java.security.PrivilegedAction<Void>() {
-                    public Void run() {
-                        debug.println("  identity = " + id);
-                        return null;
-                    }
-                });
-                debug.println("");
-            }
-
-            // add it to the policy for future reference
-            Certificate certs[] = new Certificate[] {cert};
-            PolicyEntry pe = new PolicyEntry(new CodeSource(null, certs));
-            pe.add(SecurityConstants.ALL_PERMISSION);
-
-            myInfo.identityPolicyEntries.add(pe);
-
-            // add it to the mapping as well so
-            // we don't have to go through this again
-            myInfo.aliasMapping.put(cert, id.getName());
-
-            return true;
-        }
         return false;
     }
 
-    private static boolean isTrusted(Identity id) {
-            if (id instanceof SystemIdentity) {
-                SystemIdentity sysid = (SystemIdentity)id;
-                if (sysid.isTrusted()) {
-                    return true;
-                }
-            } else if (id instanceof SystemSigner) {
-                SystemSigner sysid = (SystemSigner)id;
-                if (sysid.isTrusted()) {
-                    return true;
-                }
-            }
-            return false;
-    }
-
     /**
      * Each entry in the policy configuration file is represented by a
      * PolicyEntry object.  <p>
--- a/jdk/src/share/classes/sun/security/provider/SystemIdentity.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-/*
- * Copyright 1996-2000 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.security.provider;
-
-import java.io.Serializable;
-import java.util.Enumeration;
-import java.security.*;
-
-/**
- * An identity with a very simple trust mechanism.
- *
- * @author      Benjamin Renaud
- */
-
-public class SystemIdentity extends Identity implements Serializable {
-
-    /** use serialVersionUID from JDK 1.1. for interoperability */
-    private static final long serialVersionUID = 9060648952088498478L;
-
-    /* This should be changed to ACL */
-    boolean trusted = false;
-
-    /* Free form additional information about this identity. */
-    private String info;
-
-    public SystemIdentity(String name, IdentityScope scope)
-    throws InvalidParameterException, KeyManagementException {
-        super(name, scope);
-    }
-
-    /**
-     * Is this identity trusted by sun.* facilities?
-     */
-    public boolean isTrusted() {
-        return trusted;
-    }
-
-    /**
-     * Set the trust status of this identity.
-     */
-    protected void setTrusted(boolean trusted) {
-        this.trusted = trusted;
-    }
-
-    void setIdentityInfo(String info) {
-        super.setInfo(info);
-    }
-
-    String getIndentityInfo() {
-        return super.getInfo();
-    }
-
-    /**
-     * Call back method into a protected method for package friends.
-     */
-    void setIdentityPublicKey(PublicKey key) throws KeyManagementException {
-        setPublicKey(key);
-    }
-
-    /**
-     * Call back method into a protected method for package friends.
-     */
-    void addIdentityCertificate(Certificate cert)
-    throws KeyManagementException {
-        addCertificate(cert);
-    }
-
-    void clearCertificates() throws KeyManagementException {
-        Certificate[] certs = certificates();
-        for (int i = 0; i < certs.length; i++) {
-            removeCertificate(certs[i]);
-        }
-    }
-
-    public String toString() {
-        String trustedString = "not trusted";
-        if (trusted) {
-            trustedString = "trusted";
-        }
-        return super.toString() + "[" + trustedString + "]";
-    }
-
-
-}
--- a/jdk/src/share/classes/sun/security/provider/SystemSigner.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright 1996-2000 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.security.provider;
-
-import java.util.*;
-import java.security.*;
-
-/**
- * SunSecurity signer. Like SystemIdentity, it has a trust bit, which
- * can be set by SunSecurity classes, and a set of accessors for other
- * classes in sun.security.*.
- *
- * @author Benjamin Renaud
- */
-
-public class SystemSigner extends Signer {
-
-    /** use serialVersionUID from JDK 1.1. for interoperability */
-    private static final long serialVersionUID = -2127743304301557711L;
-
-    /* Is this signer trusted */
-    private boolean trusted = false;
-
-    /**
-     * Construct a signer with a given name.
-     */
-    public SystemSigner(String name) {
-        super(name);
-    }
-
-    /**
-     * Construct a signer with a name and a scope.
-     *
-     * @param name the signer's name.
-     *
-     * @param scope the scope for this signer.
-     */
-    public SystemSigner(String name, IdentityScope scope)
-     throws KeyManagementException {
-
-        super(name, scope);
-    }
-
-    /* Set the trust status of this signer */
-    void setTrusted(boolean trusted) {
-        this.trusted = trusted;
-    }
-
-    /**
-     * Returns true if this signer is trusted.
-     */
-    public boolean isTrusted() {
-        return trusted;
-    }
-
-    /* friendly callback for set keys */
-    void setSignerKeyPair(KeyPair pair)
-    throws InvalidParameterException, KeyException {
-        setKeyPair(pair);
-    }
-
-    /* friendly callback for getting private keys */
-    PrivateKey getSignerPrivateKey() {
-        return getPrivateKey();
-    }
-
-    void setSignerInfo(String s) {
-        setInfo(s);
-    }
-
-    /**
-     * Call back method into a protected method for package friends.
-     */
-    void addSignerCertificate(Certificate cert) throws KeyManagementException {
-        addCertificate(cert);
-    }
-
-    void clearCertificates() throws KeyManagementException {
-        Certificate[] certs = certificates();
-        for (int i = 0; i < certs.length; i++) {
-            removeCertificate(certs[i]);
-        }
-    }
-
-    public String toString() {
-        String trustedString = "not trusted";
-        if (trusted) {
-            trustedString = "trusted";
-        }
-        return super.toString() + "[" + trustedString + "]";
-    }
-}
--- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPChecker.java	Wed Jul 05 17:04:26 2017 +0200
@@ -335,10 +335,13 @@
             response = OCSP.check(Collections.singletonList(certId), uri,
                 responderCert, pkixParams.getDate());
         } catch (Exception e) {
-            // Wrap all exceptions in CertPathValidatorException so that
-            // we can fallback to CRLs, if enabled.
-            throw new CertPathValidatorException
-                ("Unable to send OCSP request", e);
+            if (e instanceof CertPathValidatorException) {
+                throw (CertPathValidatorException) e;
+            } else {
+                // Wrap exceptions in CertPathValidatorException so that
+                // we can fallback to CRLs, if enabled.
+                throw new CertPathValidatorException(e);
+            }
         }
 
         RevocationStatus rs = (RevocationStatus) response.getSingleResponse(certId);
--- a/jdk/src/share/classes/sun/security/tools/JarSigner.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java	Wed Jul 05 17:04:26 2017 +0200
@@ -118,8 +118,6 @@
     KeyStore store;                 // the keystore specified by -keystore
                                     // or the default keystore, never null
 
-    IdentityScope scope;
-
     String keystore; // key store file
     boolean nullStream = false; // null keystore input stream (NONE)
     boolean token = false; // token-based keystore
@@ -212,7 +210,6 @@
             if (verify) {
                 try {
                     loadKeyStore(keystore, false);
-                    scope = IdentityScope.getSystemScope();
                 } catch (Exception e) {
                     if ((keystore != null) || (storepass != null)) {
                         System.out.println(rb.getString("jarsigner error: ") +
@@ -984,13 +981,6 @@
                         result |= IN_KEYSTORE;
                     }
                 }
-                if (!found && (scope != null)) {
-                    Identity id = scope.getIdentity(c.getPublicKey());
-                    if (id != null) {
-                        result |= IN_SCOPE;
-                        storeHash.put(c, "[" + id.getName() + "]");
-                    }
-                }
                 if (ckaliases.contains(alias)) {
                     result |= SIGNED_BY_ALIAS;
                 }
--- a/jdk/src/share/classes/sun/security/tools/KeyTool.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/tools/KeyTool.java	Wed Jul 05 17:04:26 2017 +0200
@@ -40,7 +40,6 @@
 import java.security.UnrecoverableKeyException;
 import java.security.Principal;
 import java.security.Provider;
-import java.security.Identity;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
@@ -57,9 +56,6 @@
 import sun.misc.BASE64Encoder;
 import sun.security.util.ObjectIdentifier;
 import sun.security.pkcs.PKCS10;
-import sun.security.provider.IdentityDatabase;
-import sun.security.provider.SystemSigner;
-import sun.security.provider.SystemIdentity;
 import sun.security.provider.X509Factory;
 import sun.security.util.DerOutputStream;
 import sun.security.util.Password;
@@ -1163,18 +1159,16 @@
         Signature signature = Signature.getInstance(sigAlgName);
         signature.initSign(privateKey);
 
-        X500Signer signer = new X500Signer(signature, issuer);
-
         X509CertInfo info = new X509CertInfo();
         info.set(X509CertInfo.VALIDITY, interval);
         info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
                     new java.util.Random().nextInt() & 0x7fffffff));
         info.set(X509CertInfo.VERSION,
-                     new CertificateVersion(CertificateVersion.V3));
+                    new CertificateVersion(CertificateVersion.V3));
         info.set(X509CertInfo.ALGORITHM_ID,
-                     new CertificateAlgorithmId(signer.getAlgorithmId()));
-        info.set(X509CertInfo.ISSUER,
-                     new CertificateIssuerName(signer.getSigner()));
+                    new CertificateAlgorithmId(
+                        AlgorithmId.getAlgorithmId(sigAlgName)));
+        info.set(X509CertInfo.ISSUER, new CertificateIssuerName(issuer));
 
         BufferedReader reader = new BufferedReader(new InputStreamReader(in));
         boolean canRead = false;
@@ -1249,7 +1243,7 @@
         request.getAttributes().setAttribute(X509CertInfo.EXTENSIONS,
                 new PKCS10Attribute(PKCS9Attribute.EXTENSION_REQUEST_OID, ext));
 
-        // Construct an X500Signer object, so that we can sign the request
+        // Construct a Signature object, so that we can sign the request
         if (sigAlgName == null) {
             sigAlgName = getCompatibleSigAlgName(privKey.getAlgorithm());
         }
@@ -1259,10 +1253,9 @@
         X500Name subject = dname == null?
                 new X500Name(((X509Certificate)cert).getSubjectDN().toString()):
                 new X500Name(dname);
-        X500Signer signer = new X500Signer(signature, subject);
 
         // Sign the request and base-64 encode it
-        request.encodeAndSign(signer);
+        request.encodeAndSign(subject, signature);
         request.print(out);
     }
 
@@ -1564,75 +1557,8 @@
     private void doImportIdentityDatabase(InputStream in)
         throws Exception
     {
-        byte[] encoded;
-        ByteArrayInputStream bais;
-        java.security.cert.X509Certificate newCert;
-        java.security.cert.Certificate[] chain = null;
-        PrivateKey privKey;
-        boolean modified = false;
-
-        IdentityDatabase idb = IdentityDatabase.fromStream(in);
-        for (Enumeration<Identity> enum_ = idb.identities();
-                                        enum_.hasMoreElements();) {
-            Identity id = enum_.nextElement();
-            newCert = null;
-            // only store trusted identities in keystore
-            if ((id instanceof SystemSigner && ((SystemSigner)id).isTrusted())
-                || (id instanceof SystemIdentity
-                    && ((SystemIdentity)id).isTrusted())) {
-                // ignore if keystore entry with same alias name already exists
-                if (keyStore.containsAlias(id.getName())) {
-                    MessageFormat form = new MessageFormat
-                        (rb.getString("Keystore entry for <id.getName()> already exists"));
-                    Object[] source = {id.getName()};
-                    System.err.println(form.format(source));
-                    continue;
-                }
-                java.security.Certificate[] certs = id.certificates();
-                if (certs!=null && certs.length>0) {
-                    // we can only store one user cert per identity.
-                    // convert old-style to new-style cert via the encoding
-                    DerOutputStream dos = new DerOutputStream();
-                    certs[0].encode(dos);
-                    encoded = dos.toByteArray();
-                    bais = new ByteArrayInputStream(encoded);
-                    newCert = (X509Certificate)cf.generateCertificate(bais);
-                    bais.close();
-
-                    // if certificate is self-signed, make sure it verifies
-                    if (isSelfSigned(newCert)) {
-                        PublicKey pubKey = newCert.getPublicKey();
-                        try {
-                            newCert.verify(pubKey);
-                        } catch (Exception e) {
-                            // ignore this cert
-                            continue;
-                        }
-                    }
-
-                    if (id instanceof SystemSigner) {
-                        MessageFormat form = new MessageFormat(rb.getString
-                            ("Creating keystore entry for <id.getName()> ..."));
-                        Object[] source = {id.getName()};
-                        System.err.println(form.format(source));
-                        if (chain==null) {
-                            chain = new java.security.cert.Certificate[1];
-                        }
-                        chain[0] = newCert;
-                        privKey = ((SystemSigner)id).getPrivateKey();
-                        keyStore.setKeyEntry(id.getName(), privKey, storePass,
-                                             chain);
-                    } else {
-                        keyStore.setCertificateEntry(id.getName(), newCert);
-                    }
-                    kssave = true;
-                }
-            }
-        }
-        if (!kssave) {
-            System.err.println(rb.getString
-                ("No entries from identity database added"));
-        }
+        System.err.println(rb.getString
+            ("No entries from identity database added"));
     }
 
     /**
--- a/jdk/src/share/classes/sun/security/util/SecurityConstants.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/util/SecurityConstants.java	Wed Jul 05 17:04:26 2017 +0200
@@ -33,7 +33,6 @@
 import java.security.BasicPermission;
 import java.security.SecurityPermission;
 import java.security.AllPermission;
-import javax.security.auth.AuthPermission;
 
 /**
  * Permission constants and string constants used to create permissions
@@ -259,12 +258,4 @@
     // java.lang.SecurityManager
     public static final SocketPermission LOCAL_LISTEN_PERMISSION =
         new SocketPermission("localhost:1024-", SOCKET_LISTEN_ACTION);
-
-    // javax.security.auth.Subject
-    public static final AuthPermission DO_AS_PERMISSION =
-        new AuthPermission("doAs");
-
-    // javax.security.auth.Subject
-    public static final AuthPermission DO_AS_PRIVILEGED_PERMISSION =
-        new AuthPermission("doAsPrivileged");
 }
--- a/jdk/src/share/classes/sun/security/validator/PKIXValidator.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/validator/PKIXValidator.java	Wed Jul 05 17:04:26 2017 +0200
@@ -150,9 +150,17 @@
                 ("null or zero-length certificate chain");
         }
         if (TRY_VALIDATOR) {
-            // check if chain contains trust anchor
+            // check that chain is in correct order and check if chain contains
+            // trust anchor
+            X500Principal prevIssuer = null;
             for (int i = 0; i < chain.length; i++) {
-                if (trustedCerts.contains(chain[i])) {
+                X509Certificate cert = chain[i];
+                if (i != 0 &&
+                    !cert.getSubjectX500Principal().equals(prevIssuer)) {
+                    // chain is not ordered correctly, call builder instead
+                    return doBuild(chain, otherCerts);
+                }
+                if (trustedCerts.contains(cert)) {
                     if (i == 0) {
                         return new X509Certificate[] {chain[0]};
                     }
@@ -161,6 +169,7 @@
                     System.arraycopy(chain, 0, newChain, 0, i);
                     return doValidate(newChain);
                 }
+                prevIssuer = cert.getIssuerX500Principal();
             }
 
             // apparently issued by trust anchor?
@@ -303,5 +312,4 @@
                 ("PKIX path building failed: " + e.toString(), e);
         }
     }
-
 }
--- a/jdk/src/share/classes/sun/security/x509/CertAndKeyGen.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/security/x509/CertAndKeyGen.java	Wed Jul 05 17:04:26 2017 +0200
@@ -190,41 +190,6 @@
 
 
     /**
-     * Returns a self-signed X.509v1 certificate for the public key.
-     * The certificate is immediately valid.
-     *
-     * <P>Such certificates normally are used to identify a "Certificate
-     * Authority" (CA).  Accordingly, they will not always be accepted by
-     * other parties.  However, such certificates are also useful when
-     * you are bootstrapping your security infrastructure, or deploying
-     * system prototypes.
-     *
-     * @deprecated Use the new <a href =
-     * "#getSelfCertificate(sun.security.x509.X500Name, long)">
-     *
-     * @param myname X.500 name of the subject (who is also the issuer)
-     * @param validity how long the certificate should be valid, in seconds
-     */
-    @Deprecated
-    public X509Cert             getSelfCert (X500Name myname, long validity)
-    throws InvalidKeyException, SignatureException, NoSuchAlgorithmException
-    {
-        X509Certificate cert;
-
-        try {
-            cert = getSelfCertificate(myname, validity);
-            return new X509Cert(cert.getEncoded());
-        } catch (CertificateException e) {
-            throw new SignatureException(e.getMessage());
-        } catch (NoSuchProviderException e) {
-            throw new NoSuchAlgorithmException(e.getMessage());
-        } catch (IOException e) {
-            throw new SignatureException(e.getMessage());
-        }
-    }
-
-
-    /**
      * Returns a self-signed X.509v3 certificate for the public key.
      * The certificate is immediately valid. No extensions.
      *
@@ -248,13 +213,10 @@
     throws CertificateException, InvalidKeyException, SignatureException,
         NoSuchAlgorithmException, NoSuchProviderException
     {
-        X500Signer      issuer;
         X509CertImpl    cert;
         Date            lastDate;
 
         try {
-            issuer = getSigner (myname);
-
             lastDate = new Date ();
             lastDate.setTime (firstDate.getTime () + validity * 1000);
 
@@ -267,14 +229,13 @@
                      new CertificateVersion(CertificateVersion.V3));
             info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(
                     new java.util.Random().nextInt() & 0x7fffffff));
-            AlgorithmId algID = issuer.getAlgorithmId();
+            AlgorithmId algID = AlgorithmId.getAlgorithmId(sigAlg);
             info.set(X509CertInfo.ALGORITHM_ID,
                      new CertificateAlgorithmId(algID));
             info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(myname));
             info.set(X509CertInfo.KEY, new CertificateX509Key(publicKey));
             info.set(X509CertInfo.VALIDITY, interval);
-            info.set(X509CertInfo.ISSUER,
-                     new CertificateIssuerName(issuer.getSigner()));
+            info.set(X509CertInfo.ISSUER, new CertificateIssuerName(myname));
 
             cert = new X509CertImpl(info);
             cert.sign(privateKey, this.sigAlg);
@@ -315,7 +276,9 @@
         PKCS10  req = new PKCS10 (publicKey);
 
         try {
-            req.encodeAndSign (getSigner (myname));
+            Signature signature = Signature.getInstance(sigAlg);
+            signature.initSign (privateKey);
+            req.encodeAndSign(myname, signature);
 
         } catch (CertificateException e) {
             throw new SignatureException (sigAlg + " CertificateException");
@@ -330,18 +293,6 @@
         return req;
     }
 
-    private X500Signer getSigner (X500Name me)
-    throws InvalidKeyException, NoSuchAlgorithmException
-    {
-        Signature signature = Signature.getInstance(sigAlg);
-
-        // XXX should have a way to pass prng to the signature
-        // algorithm ... appropriate for DSS/DSA, not RSA
-
-        signature.initSign (privateKey);
-        return new X500Signer (signature, me);
-    }
-
     private SecureRandom        prng;
     private String              sigAlg;
     private KeyPairGenerator    keyGen;
--- a/jdk/src/share/classes/sun/security/x509/X500Signer.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright 1996-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.security.x509;
-
-import java.security.Signature;
-import java.security.SignatureException;
-import java.security.Signer;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * This class provides a binding between a Signature object and an
- * authenticated X.500 name (from an X.509 certificate chain), which
- * is needed in many public key signing applications.
- *
- * <P>The name of the signer is important, both because knowing it is the
- * whole point of the signature, and because the associated X.509 certificate
- * is always used to verify the signature.
- *
- * <P><em>The X.509 certificate chain is temporarily not associated with
- * the signer, but this omission will be resolved.</em>
- *
- *
- * @author David Brownell
- * @author Amit Kapoor
- * @author Hemma Prafullchandra
- */
-public final class X500Signer extends Signer
-{
-    private static final long serialVersionUID = -8609982645394364834L;
-
-    /**
-     * Called for each chunk of the data being signed.  That
-     * is, you can present the data in many chunks, so that
-     * it doesn't need to be in a single sequential buffer.
-     *
-     * @param buf buffer holding the next chunk of the data to be signed
-     * @param offset starting point of to-be-signed data
-     * @param len how many bytes of data are to be signed
-     * @exception SignatureException on errors.
-     */
-    public void update(byte buf[], int offset, int len)
-    throws SignatureException {
-        sig.update (buf, offset, len);
-    }
-
-    /**
-     * Produces the signature for the data processed by update().
-     *
-     * @exception SignatureException on errors.
-     */
-    public byte[] sign() throws SignatureException {
-        return sig.sign();
-    }
-
-    /**
-     * Returns the algorithm used to sign.
-     */
-    public AlgorithmId  getAlgorithmId() {
-        return algid;
-    }
-
-    /**
-     * Returns the name of the signing agent.
-     */
-    public X500Name     getSigner() {
-        return agent;
-    }
-
-    /*
-     * Constructs a binding between a signature and an X500 name
-     * from an X.509 certificate.
-     */
-    // package private  ----hmmmmm ?????
-    public X500Signer(Signature sig, X500Name agent) {
-        if (sig == null || agent == null)
-            throw new IllegalArgumentException ("null parameter");
-
-        this.sig = sig;
-        this.agent = agent;
-
-        try {
-          this.algid = AlgorithmId.getAlgorithmId(sig.getAlgorithm());
-
-        } catch (NoSuchAlgorithmException e) {
-            throw new RuntimeException("internal error! " + e.getMessage());
-        }
-    }
-
-    private Signature   sig;
-    private X500Name    agent;          // XXX should be X509CertChain
-    private AlgorithmId algid;
-}
--- a/jdk/src/share/classes/sun/security/x509/X509Cert.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,892 +0,0 @@
-/*
- * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.security.x509;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.math.BigInteger;
-import java.security.*;
-import java.util.Date;
-import java.util.Enumeration;
-
-import sun.security.util.*;     // DER
-
-/**
- * @author David Brownell
- *
- * @see CertAndKeyGen
- * @deprecated  Use the new X509Certificate class.
- *              This class is only restored for backwards compatibility.
- */
-@Deprecated
-public class X509Cert implements Certificate, Serializable {
-
-    static final long serialVersionUID = -52595524744692374L;
-
-    /*
-     * NOTE: All fields are marked transient, because we do not want them to
-     * be included in the class description when we serialize an object of
-     * this class. We override "writeObject" and "readObject" to use the
-     * ASN.1 encoding of a certificate as the serialized form, instead of
-     * calling the default routines which would operate on the field values.
-     *
-     * MAKE SURE TO MARK ANY FIELDS THAT ARE ADDED IN THE FUTURE AS TRANSIENT.
-     */
-
-    /* The algorithm id */
-    transient protected AlgorithmId algid;
-
-    /*
-     * Certificate data, and its envelope
-     */
-    transient private byte rawCert [];
-    transient private byte signature [];
-    transient private byte signedCert [];
-
-    /*
-     * X509.v1 data (parsed)
-     */
-    transient private X500Name subject; // from subject
-    transient private PublicKey pubkey;
-
-    transient private Date notafter;    // from CA (constructor)
-    transient private Date notbefore;
-
-    transient private int version;      // from CA (signAndEncode)
-    transient private BigInteger serialnum;
-    transient private X500Name issuer;
-    transient private AlgorithmId issuerSigAlg;
-
-    /*
-     * flag to indicate whether or not this certificate has already been parsed
-     * (through a call to one of the constructors or the "decode" or
-     * "readObject" methods). This is to ensure that certificates are
-     * immutable.
-     */
-    transient private boolean parsed=false;
-
-    /*
-     * X509.v2 extensions
-     */
-
-    /*
-     * X509.v3 extensions
-     */
-
-    /*
-     * Other extensions ... Netscape, Verisign, SET, etc
-     */
-
-
-    /**
-     * Construct a uninitialized X509 Cert on which <a href="#decode">
-     * decode</a> must later be called (or which may be deserialized).
-     */
-    // XXX deprecated, delete this
-    public X509Cert() { }
-
-
-    /**
-     * Unmarshals a certificate from its encoded form, parsing the
-     * encoded bytes.  This form of constructor is used by agents which
-     * need to examine and use certificate contents.  That is, this is
-     * one of the more commonly used constructors.  Note that the buffer
-     * must include only a certificate, and no "garbage" may be left at
-     * the end.  If you need to ignore data at the end of a certificate,
-     * use another constructor.
-     *
-     * @param cert the encoded bytes, with no terminatu (CONSUMED)
-     * @exception IOException when the certificate is improperly encoded.
-     */
-    public X509Cert(byte cert []) throws IOException
-    {
-        DerValue in = new DerValue (cert);
-        parse (in);
-        if (in.data.available () != 0)
-            throw new CertParseError ("garbage at end");
-        signedCert = cert;
-    }
-
-
-    /**
-     * Unmarshals a certificate from its encoded form, parsing the
-     * encoded bytes.  This form of constructor is used by agents which
-     * need to examine and use certificate contents.  That is, this is
-     * one of the most commonly used constructors.
-     *
-     * @param buf the buffer holding the encoded bytes
-     * @param offset the offset in the buffer where the bytes begin
-     * @param len how many bytes of certificate exist
-     *
-     * @exception IOException when the certificate is improperly encoded.
-     */
-    public X509Cert(byte buf [], int offset, int len) throws IOException
-    {
-        DerValue in = new DerValue (buf, offset, len);
-
-        parse (in);
-        if (in.data.available () != 0)
-            throw new CertParseError ("garbage at end");
-        signedCert = new byte [len];
-        System.arraycopy (buf, offset, signedCert, 0, len);
-    }
-
-
-    /**
-     * Unmarshal a certificate from its encoded form, parsing a DER value.
-     * This form of constructor is used by agents which need to examine
-     * and use certificate contents.
-     *
-     * @param derVal the der value containing the encoded cert.
-     * @exception IOException when the certificate is improperly encoded.
-     */
-    public X509Cert(DerValue derVal) throws IOException
-    {
-        parse (derVal);
-        if (derVal.data.available () != 0)
-            throw new CertParseError ("garbage at end");
-        signedCert = derVal.toByteArray ();
-    }
-
-
-    /**
-     * Partially constructs a certificate from descriptive parameters.
-     * This constructor may be used by Certificate Authority (CA) code,
-     * which later <a href="#signAndEncode">signs and encodes</a> the
-     * certificate.  Also, self-signed certificates serve as CA certificates,
-     * and are sometimes used as certificate requests.
-     *
-     * <P>Until the certificate has been signed and encoded, some of
-     * the mandatory fields in the certificate will not be available
-     * via accessor functions:  the serial number, issuer name and signing
-     * algorithm, and of course the signed certificate.  The fields passed
-     * to this constructor are available, and must be non-null.
-     *
-     * <P>Note that the public key being signed is generally independent of
-     * the signature algorithm being used.  So for example Diffie-Hellman
-     * keys (which do not support signatures) can be placed in X.509
-     * certificates when some other signature algorithm (e.g. DSS/DSA,
-     * or one of the RSA based algorithms) is used.
-     *
-     * @see CertAndKeyGen
-     *
-     * @param subjectName the X.500 distinguished name being certified
-     * @param subjectPublicKey the public key being certified.  This
-     *  must be an "X509Key" implementing the "PublicKey" interface.
-     * @param notBefore the first time the certificate is valid
-     * @param notAfter the last time the certificate is valid
-     *
-     * @exception CertException if the public key is inappropriate
-     */
-    public X509Cert(X500Name subjectName, X509Key subjectPublicKey,
-                    Date notBefore, Date notAfter) throws CertException
-    {
-        subject = subjectName;
-
-        if (!(subjectPublicKey instanceof PublicKey))
-            throw new CertException (CertException.err_INVALID_PUBLIC_KEY,
-                "Doesn't implement PublicKey interface");
-
-        // The X509 cert API requires X509 keys, else things break.
-        pubkey = subjectPublicKey;
-        notbefore = notBefore;
-        notafter = notAfter;
-        version = 0;
-    }
-
-
-    /**
-     * Decode an X.509 certificate from an input stream.
-     *
-     * @param in an input stream holding at least one certificate
-     * @exception IOException when the certificate is improperly encoded, or
-     * if it has already been parsed.
-     */
-    public void decode(InputStream in) throws IOException
-    {
-        DerValue val = new DerValue(in);
-        parse(val);
-        signedCert = val.toByteArray();
-    }
-
-
-    /**
-     * Appends the certificate to an output stream.
-     *
-     * @param out an input stream to which the certificate is appended.
-     * @exception IOException when appending fails.
-     */
-    public void encode (OutputStream out) throws IOException
-        { out.write (getSignedCert ()); }
-
-
-    /**
-     * Compares two certificates.  This is false if the
-     * certificates are not both X.509 certs, otherwise it
-     * compares them as binary data.
-     *
-     * @param other the object being compared with this one
-     * @return true iff the certificates are equivalent
-     */
-    public boolean      equals (Object other)
-    {
-        if (other instanceof X509Cert)
-            return equals ((X509Cert) other);
-        else
-            return false;
-    }
-
-
-    /**
-     * Compares two certificates, returning false if any data
-     * differs between the two.
-     *
-     * @param other the object being compared with this one
-     * @return true iff the certificates are equivalent
-     */
-    public boolean      equals (X509Cert src)
-    {
-        if (this == src)
-            return true;
-        if (signedCert == null || src.signedCert == null)
-            return false;
-        if (signedCert.length != src.signedCert.length)
-            return false;
-        for (int i = 0; i < signedCert.length; i++)
-            if (signedCert [i] != src.signedCert [i])
-                return false;
-        return true;
-    }
-
-
-    /** Returns the "X.509" format identifier. */
-    public String getFormat () // for Certificate
-        { return "X.509"; }
-
-
-    /** Returns <a href="#getIssuerName">getIssuerName</a> */
-    public Principal getGuarantor () // for Certificate
-        { return getIssuerName (); }
-
-
-    /** Returns <a href="#getSubjectName">getSubjectName</a> */
-    public Principal getPrincipal ()
-        { return getSubjectName (); }
-
-
-    /**
-     * Throws an exception if the certificate is invalid because it is
-     * now outside of the certificate's validity period, or because it
-     * was not signed using the verification key provided.  Successfully
-     * verifying a certificate does <em>not</em> indicate that one should
-     * trust the entity which it represents.
-     *
-     * <P><em>Note that since this class represents only a single X.509
-     * certificate, it cannot know anything about the certificate chain
-     * which is used to provide the verification key and to establish trust.
-     * Other code must manage and use those cert chains.
-     *
-     * <P>For now, you must walk the cert chain being used to verify any
-     * given cert.  Start at the root, which is a self-signed certificate;
-     * verify it using the key inside the certificate.  Then use that to
-     * verify the next certificate in the chain, issued by that CA.  In
-     * this manner, verify each certificate until you reach the particular
-     * certificate you wish to verify.  You should not use a certificate
-     * if any of the verification operations for its certificate chain
-     * were unsuccessful.
-     * </em>
-     *
-     * @param issuerPublicKey the public key of the issuing CA
-     * @exception CertException when the certificate is not valid.
-     */
-    public void verify (PublicKey issuerPublicKey)
-    throws CertException
-    {
-        Date    now = new Date ();
-
-        if (now.before (notbefore))
-            throw new CertException (CertException.verf_INVALID_NOTBEFORE);
-        if (now.after (notafter))
-            throw new CertException (CertException.verf_INVALID_EXPIRED);
-        if (signedCert == null)
-            throw new CertException (CertException.verf_INVALID_SIG,
-                "?? certificate is not signed yet ??");
-
-        //
-        // Verify the signature ...
-        //
-        String          algName = null;
-
-        try {
-            Signature   sigVerf = null;
-
-            algName = issuerSigAlg.getName();
-            sigVerf = Signature.getInstance(algName);
-            sigVerf.initVerify (issuerPublicKey);
-            sigVerf.update (rawCert, 0, rawCert.length);
-
-            if (!sigVerf.verify (signature)) {
-                throw new CertException (CertException.verf_INVALID_SIG,
-                    "Signature ... by <" + issuer + "> for <" + subject + ">");
-            }
-
-        // Gag -- too many catch clauses, let most through.
-
-        } catch (NoSuchAlgorithmException e) {
-            throw new CertException (CertException.verf_INVALID_SIG,
-                "Unsupported signature algorithm (" + algName + ")");
-
-        } catch (InvalidKeyException e) {
-            // e.printStackTrace();
-            throw new CertException (CertException.err_INVALID_PUBLIC_KEY,
-                "Algorithm (" + algName + ") rejected public key");
-
-        } catch (SignatureException e) {
-            throw new CertException (CertException.verf_INVALID_SIG,
-                "Signature by <" + issuer + "> for <" + subject + ">");
-        }
-    }
-
-
-    /**
-     * Creates an X.509 certificate, and signs it using the issuer
-     * passed (associating a signature algorithm and an X.500 name).
-     * This operation is used to implement the certificate generation
-     * functionality of a certificate authority.
-     *
-     * @see #getSignedCert
-     * @see #getSigner
-     * @see CertAndKeyGen
-     *
-     * @param serial the serial number of the certificate (non-null)
-     * @param issuer the certificate issuer (CA) (non-null)
-     * @return the signed certificate, as returned by getSignedCert
-     *
-     * @exception IOException if any of the data could not be encoded,
-     *  or when any mandatory data was omitted
-     * @exception SignatureException on signing failures
-     */
-    public byte []
-    encodeAndSign (
-        BigInteger      serial,
-        X500Signer      issuer
-    ) throws IOException, SignatureException
-    {
-        rawCert = null;
-
-        /*
-         * Get the remaining cert parameters, and make sure we have enough.
-         *
-         * We deduce version based on what attribute data are available
-         * For now, we have no attributes, so we always deduce X.509v1 !
-         */
-        version = 0;
-        serialnum = serial;
-        this.issuer = issuer.getSigner ();
-        issuerSigAlg = issuer.getAlgorithmId ();
-
-        if (subject == null || pubkey == null
-                || notbefore == null || notafter == null)
-            throw new IOException ("not enough cert parameters");
-
-        /*
-         * Encode the raw cert, create its signature and put it
-         * into the envelope.
-         */
-        rawCert = DERencode ();
-        signedCert = sign (issuer, rawCert);
-        return signedCert;
-    }
-
-
-    /**
-     * Returns an X500Signer that may be used to create signatures.  Those
-     * signature may in turn be verified using this certificate (or a
-     * copy of it).
-     *
-     * <P><em><b>NOTE:</b>  If the private key is by itself capable of
-     * creating signatures, this fact may not be recognized at this time.
-     * Specifically, the case of DSS/DSA keys which get their algorithm
-     * parameters from higher in the certificate chain is not supportable
-     * without using an X509CertChain API, and there is no current support
-     * for other sources of algorithm parameters.</em>
-     *
-     * @param algorithm the signature algorithm to be used.  Note that a
-     *  given public/private key pair may support several such algorithms.
-     * @param privateKey the private key used to create the signature,
-     *  which must correspond to the public key in this certificate
-     * @return the Signer object
-     *
-     * @exception NoSuchAlgorithmException if the signature
-     *  algorithm is not supported
-     * @exception InvalidKeyException if either the key in the certificate,
-     *  or the private key parameter, does not support the requested
-     *  signature algorithm
-     */
-    public X500Signer   getSigner (AlgorithmId algorithmId,
-                                   PrivateKey privateKey)
-    throws NoSuchAlgorithmException, InvalidKeyException
-    {
-        String algorithm;
-        Signature       sig;
-
-        if (privateKey instanceof Key) {
-            Key key = (Key)privateKey;
-            algorithm = key.getAlgorithm();
-        } else {
-            throw new InvalidKeyException("private key not a key!");
-        }
-
-        sig = Signature.getInstance(algorithmId.getName());
-
-        if (!pubkey.getAlgorithm ().equals (algorithm)) {
-
-          throw new InvalidKeyException( "Private key algorithm " +
-                                         algorithm +
-                                         " incompatible with certificate " +
-                                         pubkey.getAlgorithm());
-        }
-        sig.initSign (privateKey);
-        return new X500Signer (sig, subject);
-    }
-
-
-    /**
-     * Returns a signature object that may be used to verify signatures
-     * created using a specified signature algorithm and the public key
-     * contained in this certificate.
-     *
-     * <P><em><b>NOTE:</b>  If the public key in this certificate is not by
-     * itself capable of verifying signatures, this may not be recognized
-     * at this time.  Specifically, the case of DSS/DSA keys which get
-     * their algorithm parameters from higher in the certificate chain
-     * is not supportable without using an X509CertChain API, and there
-     * is no current support for other sources of algorithm parameters.</em>
-     *
-     * @param algorithm the algorithm of the signature to be verified
-     * @return the Signature object
-     * @exception NoSuchAlgorithmException if the signature
-     *  algorithm is not supported
-     * @exception InvalidKeyException if the key in the certificate
-     *  does not support the requested signature algorithm
-     */
-    public Signature getVerifier(String algorithm)
-    throws NoSuchAlgorithmException, InvalidKeyException
-    {
-        String          algName;
-        Signature       sig;
-
-        sig = Signature.getInstance(algorithm);
-        sig.initVerify (pubkey);
-        return sig;
-    }
-
-
-
-    /**
-     * Return the signed X.509 certificate as a byte array.
-     * The bytes are in standard DER marshaled form.
-     * Null is returned in the case of a partially constructed cert.
-     */
-    public byte []      getSignedCert ()
-        { return signedCert.clone(); }
-
-
-    /**
-     * Returns the certificate's serial number.
-     * Null is returned in the case of a partially constructed cert.
-     */
-    public BigInteger   getSerialNumber ()
-        { return serialnum; }
-
-
-    /**
-     * Returns the subject's X.500 distinguished name.
-     */
-    public X500Name     getSubjectName ()
-        { return subject; }
-
-
-    /**
-     * Returns the certificate issuer's X.500 distinguished name.
-     * Null is returned in the case of a partially constructed cert.
-     */
-    public X500Name     getIssuerName ()
-        { return issuer; }
-
-
-    /**
-     * Returns the algorithm used by the issuer to sign the certificate.
-     * Null is returned in the case of a partially constructed cert.
-     */
-    public AlgorithmId  getIssuerAlgorithmId ()
-        { return issuerSigAlg; }
-
-
-    /**
-     * Returns the first time the certificate is valid.
-     */
-    public Date getNotBefore ()
-        { return new Date(notbefore.getTime()); }
-
-
-    /**
-     * Returns the last time the certificate is valid.
-     */
-    public Date getNotAfter ()
-        { return new Date(notafter.getTime()); }
-
-
-    /**
-     * Returns the subject's public key.  Note that some public key
-     * algorithms support an optional certificate generation policy
-     * where the keys in the certificates are not in themselves sufficient
-     * to perform a public key operation.  Those keys need to be augmented
-     * by algorithm parameters, which the certificate generation policy
-     * chose not to place in the certificate.
-     *
-     * <P>Two such public key algorithms are:  DSS/DSA, where algorithm
-     * parameters could be acquired from a CA certificate in the chain
-     * of issuers; and Diffie-Hellman, with a similar solution although
-     * the CA then needs both a Diffie-Hellman certificate and a signature
-     * capable certificate.
-     */
-    public PublicKey            getPublicKey ()
-        { return pubkey; }
-
-
-    /**
-     * Returns the X.509 version number of this certificate, zero based.
-     * That is, "2" indicates an X.509 version 3 (1993) certificate,
-     * and "0" indicates X.509v1 (1988).
-     * Zero is returned in the case of a partially constructed cert.
-     */
-    public int          getVersion ()
-        { return version; }
-
-
-    /**
-     * Calculates a hash code value for the object.  Objects
-     * which are equal will also have the same hashcode.
-     */
-    public int          hashCode ()
-    {
-        int     retval = 0;
-
-        for (int i = 0; i < signedCert.length; i++)
-            retval += signedCert [i] * i;
-        return retval;
-    }
-
-
-    /**
-     * Returns a printable representation of the certificate.  This does not
-     * contain all the information available to distinguish this from any
-     * other certificate.  The certificate must be fully constructed
-     * before this function may be called; in particular, if you are
-     * creating certificates you must call encodeAndSign() before calling
-     * this function.
-     */
-    public String       toString ()
-    {
-        String          s;
-
-        if (subject == null || pubkey == null
-                || notbefore == null || notafter == null
-                || issuer == null || issuerSigAlg == null
-                || serialnum == null)
-            throw new NullPointerException ("X.509 cert is incomplete");
-
-        s = "  X.509v" + (version + 1) + " certificate,\n";
-        s += "  Subject is " + subject + "\n";
-        s += "  Key:  " + pubkey;
-        s += "  Validity <" + notbefore + "> until <" + notafter + ">\n";
-        s += "  Issuer is " + issuer + "\n";
-        s += "  Issuer signature used " + issuerSigAlg.toString () + "\n";
-        s += "  Serial number = " + Debug.toHexString(serialnum) + "\n";
-
-        // optional v2, v3 extras
-
-        return "[\n" + s + "]";
-    }
-
-
-    /**
-     * Returns a printable representation of the certificate.
-     *
-     * @param detailed true iff lots of detail is requested
-     */
-    public String       toString (boolean detailed)
-        { return toString (); }
-
-
-    /************************************************************/
-
-    /*
-     * Cert is a SIGNED ASN.1 macro, a three elment sequence:
-     *
-     *  - Data to be signed (ToBeSigned) -- the "raw" cert
-     *  - Signature algorithm (SigAlgId)
-     *  - The signature bits
-     *
-     * This routine unmarshals the certificate, saving the signature
-     * parts away for later verification.
-     */
-    private void parse (DerValue val) throws IOException
-    {
-        if (parsed == true) {
-            throw new IOException("Certificate already parsed");
-        }
-
-        DerValue seq [] = new DerValue [3];
-
-        seq [0] = val.data.getDerValue ();
-        seq [1] = val.data.getDerValue ();
-        seq [2] = val.data.getDerValue ();
-
-        if (val.data.available () != 0)
-            throw new CertParseError ("signed overrun, bytes = "
-                    + val.data.available ());
-        if (seq [0].tag != DerValue.tag_Sequence)
-            throw new CertParseError ("signed fields invalid");
-
-        rawCert = seq [0].toByteArray ();       // XXX slow; fixme!
-
-
-        issuerSigAlg = AlgorithmId.parse (seq [1]);
-        signature = seq [2].getBitString ();
-
-        if (seq [1].data.available () != 0) {
-            // XXX why was this error check commented out?
-            // It was originally part of the next check.
-            throw new CertParseError ("algid field overrun");
-        }
-
-        if (seq [2].data.available () != 0)
-            throw new CertParseError ("signed fields overrun");
-
-        /*
-         * Let's have fun parsing the cert itself.
-         */
-        DerInputStream  in;
-        DerValue        tmp;
-
-        in = seq [0].data;
-
-        /*
-         * Version -- this is optional (default zero). If it's there it's
-         * the first field and is specially tagged.
-         *
-         * Both branches leave "tmp" holding a value for the serial
-         * number that comes next.
-         */
-        version = 0;
-        tmp = in.getDerValue ();
-        if (tmp.isConstructed () && tmp.isContextSpecific ()) {
-            version = tmp.data.getInteger();
-            if (tmp.data.available () != 0)
-                throw new IOException ("X.509 version, bad format");
-            tmp = in.getDerValue ();
-        }
-
-        /*
-         * serial number ... an integer
-         */
-        serialnum = tmp.getBigInteger ();
-
-        /*
-         * algorithm type for CA's signature ... needs to match the
-         * one on the envelope, and that's about it!  different IDs
-         * may represent a signature attack.  In general we want to
-         * inherit parameters.
-         */
-        tmp = in.getDerValue ();
-        {
-            AlgorithmId         algid;
-
-
-            algid = AlgorithmId.parse(tmp);
-
-            if (!algid.equals (issuerSigAlg))
-                throw new CertParseError ("CA Algorithm mismatch!");
-
-            this.algid = algid;
-        }
-
-        /*
-         * issuer name
-         */
-        issuer = new X500Name (in);
-
-        /*
-         * validity:  SEQUENCE { start date, end date }
-         */
-        tmp = in.getDerValue ();
-        if (tmp.tag != DerValue.tag_Sequence)
-            throw new CertParseError ("corrupt validity field");
-
-        notbefore = tmp.data.getUTCTime ();
-        notafter = tmp.data.getUTCTime ();
-        if (tmp.data.available () != 0)
-            throw new CertParseError ("excess validity data");
-
-        /*
-         * subject name and public key
-         */
-        subject = new X500Name (in);
-
-        tmp = in.getDerValue ();
-        pubkey = X509Key.parse (tmp);
-
-        /*
-         * XXX for v2 and later, a bunch of tagged options follow
-         */
-
-        if (in.available () != 0) {
-            /*
-             * Until we parse V2/V3 data ... ignore it.
-             *
-            // throw new CertParseError ("excess cert data");
-            System.out.println (
-                    "@end'o'cert, optional V2/V3 data unparsed:  "
-                    + in.available ()
-                    + " bytes"
-                    );
-            */
-        }
-
-        parsed = true;
-    }
-
-
-    /*
-     * Encode only the parts that will later be signed.
-     */
-    private byte [] DERencode () throws IOException
-    {
-        DerOutputStream raw = new DerOutputStream ();
-
-        encode (raw);
-        return raw.toByteArray ();
-    }
-
-
-    /*
-     * Marshal the contents of a "raw" certificate into a DER sequence.
-     */
-    private void encode (DerOutputStream out) throws IOException
-    {
-        DerOutputStream tmp = new DerOutputStream ();
-
-        /*
-         * encode serial number, issuer signing algorithm,
-         * and issuer name into the data we'll return
-         */
-        tmp.putInteger (serialnum);
-        issuerSigAlg.encode (tmp);
-        issuer.encode (tmp);
-
-        /*
-         * Validity is a two element sequence ... encode the
-         * elements, then wrap them into the data we'll return
-         */
-        {
-            DerOutputStream     seq = new DerOutputStream ();
-
-            seq.putUTCTime (notbefore);
-            seq.putUTCTime (notafter);
-            tmp.write (DerValue.tag_Sequence, seq);
-        }
-
-        /*
-         * Encode subject (principal) and associated key
-         */
-        subject.encode (tmp);
-        tmp.write(pubkey.getEncoded());
-
-        /*
-         * Wrap the data; encoding of the "raw" cert is now complete.
-         */
-        out.write (DerValue.tag_Sequence, tmp);
-    }
-
-
-    /*
-     * Calculate the signature of the "raw" certificate,
-     * and marshal the cert with the signature and a
-     * description of the signing algorithm.
-     */
-    private byte [] sign (X500Signer issuer, byte data [])
-    throws IOException, SignatureException
-    {
-        /*
-         * Encode the to-be-signed data, then the algorithm used
-         * to create the signature.
-         */
-        DerOutputStream out = new DerOutputStream ();
-        DerOutputStream tmp = new DerOutputStream ();
-
-        tmp.write (data);
-        issuer.getAlgorithmId ().encode(tmp);
-
-
-        /*
-         * Create and encode the signature itself.
-         */
-        issuer.update (data, 0, data.length);
-        signature = issuer.sign ();
-        tmp.putBitString (signature);
-
-        /*
-         * Wrap the signed data in a SEQUENCE { data, algorithm, sig }
-         */
-        out.write (DerValue.tag_Sequence, tmp);
-        return out.toByteArray ();
-    }
-
-
-    /**
-     * Serialization write ... X.509 certificates serialize as
-     * themselves, and they're parsed when they get read back.
-     * (Actually they serialize as some type data from the
-     * serialization subsystem, then the cert data.)
-     */
-    private void writeObject (java.io.ObjectOutputStream stream)
-        throws IOException
-        { encode(stream); }
-
-    /**
-     * Serialization read ... X.509 certificates serialize as
-     * themselves, and they're parsed when they get read back.
-     */
-    private void readObject (ObjectInputStream stream)
-        throws IOException
-        { decode(stream); }
-}
--- a/jdk/src/share/classes/sun/swing/plaf/synth/SynthUI.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright 2002-2003 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-package sun.swing.plaf.synth;
-
-import java.awt.Graphics;
-import javax.swing.JComponent;
-import javax.swing.plaf.synth.*;
-
-/**
- * SynthUI is used to fetch the SynthContext for a particular Component.
- *
- * @author Scott Violet
- */
-public interface SynthUI extends SynthConstants {
-    /**
-     * Returns the Context for the specified component.
-     *
-     * @param c Component requesting SynthContext.
-     * @return SynthContext describing component.
-     */
-    public SynthContext getContext(JComponent c);
-
-    /**
-     * Paints the border.
-     */
-    public void paintBorder(SynthContext context, Graphics g, int x,
-                            int y, int w, int h);
-}
--- a/jdk/src/share/classes/sun/tools/jar/JarVerifierStream.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-/*
- * Copyright 1996-2008 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-package sun.tools.jar;
-
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-import java.util.jar.*;
-import java.security.cert.Certificate;
-import java.security.AccessController;
-import java.security.cert.X509Certificate;
-import java.security.PublicKey;
-import java.security.Principal;
-import sun.security.provider.SystemIdentity;
-
-/**
- * This is OBSOLETE. DO NOT USE THIS. Use
- * java.util.jar.JarEntry.getCertificates instead. It has to stay here
- * because some apps (namely HJ and HJV) call directly into it.
- *
- * This class is stripped down greatly from JDK 1.1.x.
- *
- * @author Roland Schemers
- */
-public class JarVerifierStream extends ZipInputStream {
-
-    private JarEntry current;
-    private Hashtable<String, Vector<SystemIdentity>> verified
-        = new Hashtable<String, Vector<SystemIdentity>>();
-    private JarInputStream jis;
-    private sun.tools.jar.Manifest man = null;
-
-    /**
-     * construct a JarVerfierStream from an input stream.
-     */
-    public JarVerifierStream(InputStream is)
-         throws IOException
-    {
-        super(is);
-        jis = new JarInputStream(is);
-    }
-
-    public void close()
-        throws IOException
-    {
-        jis.close();
-    }
-
-    public void closeEntry() throws IOException {
-        jis.closeEntry();
-    }
-
-    /**
-     * This method scans to see which entry we're parsing and
-     * keeps various state information depending on what type of
-     * file is being parsed. Files it treats specially are: <ul>
-     *
-     * <li>Manifest files. At any point, this stream can be queried
-     * for a manifest. If it is present, a Manifest object will be
-     * returned.
-     *
-     * <li>Block Signature file. Like with the manifest, the stream
-     * can be queried at any time for all blocks parsed thus far.
-     *
-     * </ul>
-     */
-    public synchronized ZipEntry getNextEntry() throws IOException {
-        current = (JarEntry) jis.getNextEntry();
-        return current;
-    }
-
-    /**
-     * read a single byte.
-     */
-    public int read() throws IOException {
-        int n = jis.read();
-        if (n == -1) {
-            addIds();
-        }
-        return n;
-    }
-
-    /**
-     * read an array of bytes.
-     */
-    public int read(byte[] b, int off, int len) throws IOException {
-        int n = jis.read(b, off, len);
-        if (n == -1) {
-            addIds();
-        }
-        return n;
-    }
-
-    private void addIds()
-    {
-
-        if (current != null) {
-            Certificate[] certs = current.getCertificates();
-            if (certs != null) {
-                Vector<SystemIdentity> ids = getIds(certs);
-                if (ids != null) {
-                    verified.put(current.getName(), ids);
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns a Hashtable mapping filenames to vectors of identities.
-     */
-    public Hashtable getVerifiedSignatures() {
-        /* we may want to return a copy of this at some point.
-           For now we simply trust the caller */
-        if (verified.isEmpty())
-            return null;
-        else
-            return verified;
-    }
-
-    /**
-     * Returns an enumeration of PKCS7 blocks. This looks bogus,
-     * but Hotjava just checks to see if enumeration is not null
-     * to see if anything was signed!
-     */
-    public Enumeration getBlocks() {
-        if (verified.isEmpty()) {
-            return null;
-        } else {
-            return new Enumeration() {
-                public boolean hasMoreElements() { return false; }
-                public Object nextElement() { return null; }
-            };
-        }
-    }
-
-    /**
-     * This method used to be called by various versions of
-     * AppletResourceLoader, even though they didn't do anything with
-     * the result. We leave them and return null for backwards compatability.
-     */
-    public Hashtable getNameToHash() {
-        return null;
-    }
-
-    /**
-     * Convert java.util.jar.Manifest object to a sun.tools.jar.Manifest
-     * object.
-     */
-
-    public sun.tools.jar.Manifest getManifest() {
-        if (man == null) {
-            try {
-                java.util.jar.Manifest jman = jis.getManifest();
-                if (jman == null)
-                    return null;
-                ByteArrayOutputStream baos = new ByteArrayOutputStream();
-                jman.write(baos);
-                byte[] data = baos.toByteArray();
-                man = new sun.tools.jar.Manifest(data);
-            } catch (IOException ioe) {
-                // return null
-            }
-        }
-        return man;
-    }
-
-    static class CertCache {
-        Certificate [] certs;
-        Vector<SystemIdentity> ids;
-
-        boolean equals(Certificate[] certs) {
-                if (this.certs == null) {
-                    if (certs!= null)
-                        return false;
-                    else
-                        return true;
-                }
-
-                if (certs == null)
-                    return false;
-
-                boolean match;
-
-                for (int i = 0; i < certs.length; i++) {
-                    match = false;
-                    for (int j = 0; j < this.certs.length; j++) {
-                        if (certs[i].equals(this.certs[j])) {
-                            match = true;
-                            break;
-                        }
-                    }
-                    if (!match) return false;
-                }
-
-                for (int i = 0; i < this.certs.length; i++) {
-                    match = false;
-                    for (int j = 0; j < certs.length; j++) {
-                        if (this.certs[i].equals(certs[j])) {
-                            match = true;
-                            break;
-                        }
-                    }
-                    if (!match) return false;
-                }
-                return true;
-        }
-    }
-
-    private ArrayList<CertCache> certCache = null;
-
-
-    /**
-     * Returns the Identity vector for the given array of Certificates
-     */
-    protected Vector<SystemIdentity> getIds(Certificate[] certs) {
-        if (certs == null)
-            return null;
-
-        if (certCache == null)
-            certCache = new ArrayList<CertCache>();
-        CertCache cc;
-        for (int i = 0; i < certCache.size(); i++) {
-            cc = certCache.get(i);
-            if (cc.equals(certs)) {
-                return cc.ids;
-            }
-        }
-        cc = new CertCache();
-        cc.certs = certs;
-
-        if (certs.length > 0) {
-            for (int i=0; i<certs.length; i++) {
-                try {
-                    X509Certificate cert = (X509Certificate) certs[i];
-                    Principal tmpName = cert.getSubjectDN();
-                    final SystemIdentity id = new SystemIdentity(
-                                                           tmpName.getName(),
-                                                           null);
-
-                    byte[] encoded = cert.getEncoded();
-                    final java.security.Certificate oldC =
-                        new sun.security.x509.X509Cert(encoded);
-                    try {
-                        AccessController.doPrivileged(
-                         new java.security.PrivilegedExceptionAction<Void>() {
-                            public Void run()
-                                throws java.security.KeyManagementException
-                            {
-                                id.addCertificate(oldC);
-                                return null;
-                            }
-                        });
-                    } catch (java.security.PrivilegedActionException pae) {
-                        throw (java.security.KeyManagementException)
-                            pae.getException();
-                    }
-                    if (cc.ids == null)
-                        cc.ids = new Vector<SystemIdentity>();
-                    cc.ids.addElement(id);
-                } catch (java.security.KeyManagementException kme) {
-                    // ignore if we can't create Identity
-                } catch (IOException ioe) {
-                    // ignore if we can't parse
-                } catch (java.security.cert.CertificateEncodingException cee) {
-                    // ignore if we can't encode
-                }
-            }
-        }
-        certCache.add(cc);
-        return cc.ids;
-    }
-}
--- a/jdk/src/share/classes/sun/tracing/MultiplexProviderFactory.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/tracing/MultiplexProviderFactory.java	Wed Jul 05 17:04:26 2017 +0200
@@ -30,7 +30,6 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Set;
-import java.util.logging.Logger;
 
 import com.sun.tracing.ProviderFactory;
 import com.sun.tracing.Provider;
@@ -65,13 +64,7 @@
             providers.add(factory.createProvider(cls));
         }
         MultiplexProvider provider = new MultiplexProvider(cls, providers);
-        try {
-            provider.init();
-        } catch (Exception e) {
-            // Probably a permission problem (can't get declared members)
-            Logger.getAnonymousLogger().warning(
-                "Could not initialize tracing provider: " + e.getMessage());
-        }
+        provider.init();
         return provider.newProxyInstance();
     }
 }
--- a/jdk/src/share/classes/sun/tracing/NullProviderFactory.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/tracing/NullProviderFactory.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,6 @@
 package sun.tracing;
 
 import java.lang.reflect.Method;
-import java.util.logging.Logger;
 
 import com.sun.tracing.ProviderFactory;
 import com.sun.tracing.Provider;
@@ -53,13 +52,7 @@
      */
     public <T extends Provider> T createProvider(Class<T> cls) {
         NullProvider provider = new NullProvider(cls);
-        try {
-            provider.init();
-        } catch (Exception e) {
-            // Probably a permission problem (can't get declared members)
-            Logger.getAnonymousLogger().warning(
-                "Could not initialize tracing provider: " + e.getMessage());
-        }
+        provider.init();
         return provider.newProxyInstance();
     }
 }
--- a/jdk/src/share/classes/sun/tracing/PrintStreamProviderFactory.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/tracing/PrintStreamProviderFactory.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,7 +28,6 @@
 import java.lang.reflect.Method;
 import java.io.PrintStream;
 import java.util.HashMap;
-import java.util.logging.Logger;
 
 import com.sun.tracing.ProviderFactory;
 import com.sun.tracing.Provider;
@@ -54,13 +53,7 @@
 
     public <T extends Provider> T createProvider(Class<T> cls) {
         PrintStreamProvider provider = new PrintStreamProvider(cls, stream);
-        try {
-            provider.init();
-        } catch (Exception e) {
-            // Probably a permission problem (can't get declared members)
-            Logger.getAnonymousLogger().warning(
-                "Could not initialize tracing provider: " + e.getMessage());
-        }
+        provider.init();
         return provider.newProxyInstance();
     }
 }
--- a/jdk/src/share/classes/sun/tracing/ProviderSkeleton.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/tracing/ProviderSkeleton.java	Wed Jul 05 17:04:26 2017 +0200
@@ -32,6 +32,8 @@
 import java.lang.reflect.AnnotatedElement;
 import java.lang.annotation.Annotation;
 import java.util.HashMap;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import com.sun.tracing.Provider;
 import com.sun.tracing.Probe;
@@ -99,7 +101,13 @@
      * It is up to the factory implementations to call this after construction.
      */
     public void init() {
-        for (Method m : providerType.getDeclaredMethods()) {
+        Method[] methods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
+            public Method[] run() {
+                return providerType.getDeclaredMethods();
+            }
+        });
+
+        for (Method m : methods) {
             if ( m.getReturnType() != Void.TYPE ) {
                 throw new IllegalArgumentException(
                    "Return value of method is not void");
--- a/jdk/src/share/classes/sun/tracing/dtrace/DTraceProviderFactory.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/share/classes/sun/tracing/dtrace/DTraceProviderFactory.java	Wed Jul 05 17:04:26 2017 +0200
@@ -29,7 +29,6 @@
 import java.util.Set;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.logging.Logger;
 import java.security.Permission;
 
 import com.sun.tracing.ProviderFactory;
@@ -80,15 +79,8 @@
         DTraceProvider jsdt = new DTraceProvider(cls);
         T proxy = jsdt.newProxyInstance();
         jsdt.setProxy(proxy);
-        try {
-            jsdt.init();
-            new Activation(jsdt.getModuleName(), new DTraceProvider[] { jsdt });
-        } catch (Exception e) {
-            // Probably a permission problem (can't get declared members)
-            Logger.getAnonymousLogger().warning(
-                "Could not initialize tracing provider: " + e.getMessage());
-            jsdt.dispose();
-        }
+        jsdt.init();
+        new Activation(jsdt.getModuleName(), new DTraceProvider[] { jsdt });
         return proxy;
     }
 
--- a/jdk/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-#warn This file is preprocessed before being compiled
-
-package sun.util;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.ResourceBundle.Control;
-
-/**
- * This is a convenient class for loading some of internal resources faster
- * if they are built with Resources.gmk defined in J2SE workspace. Also,
- * they have to be in class file format.
- *
- * "LOCALE_LIST" will be replaced at built time by a list of locales we
- * defined in Defs.gmk. We want to exclude these locales from search to
- * gain better performance. For example, since we know if the resource
- * is built with Resources.gmk, they are not going to provide basename_en.class
- * & basename_en_US.class resources, in that case, continuing searching them
- * is expensive. By excluding them from the candidate locale list, these
- * resources won't be searched.
- *
- * @since 1.6.
- */
-public class CoreResourceBundleControl extends ResourceBundle.Control {
-    /* the candidate locale list to search */
-    private final Collection<Locale> excludedJDKLocales;
-    /* singlton instance of the resource bundle control. */
-    private static CoreResourceBundleControl resourceBundleControlInstance =
-        new CoreResourceBundleControl();
-
-    protected CoreResourceBundleControl() {
-        excludedJDKLocales = Arrays.asList(#LOCALE_LIST#);
-    }
-
-    /**
-     * This method is to provide a customized ResourceBundle.Control to speed
-     * up the search of resources in JDK.
-     *
-     * @return the instance of resource bundle control.
-     */
-    public static CoreResourceBundleControl getRBControlInstance() {
-        return resourceBundleControlInstance;
-    }
-
-    /**
-     * This method is to provide a customized ResourceBundle.Control to speed
-     * up the search of resources in JDK, with the bundle's package name check.
-     *
-     * @param bundleName bundle name to check
-     * @return the instance of resource bundle control if the bundle is JDK's,
-     *    otherwise returns null.
-     */
-    public static CoreResourceBundleControl getRBControlInstance(String bundleName) {
-        if (bundleName.startsWith("com.sun.") ||
-            bundleName.startsWith("java.") ||
-            bundleName.startsWith("javax.") ||
-            bundleName.startsWith("sun.")) {
-            return resourceBundleControlInstance;
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * @returns a list of candidate locales to search from.
-     * @exception NullPointerException if baseName or locale is null.
-     */
-    @Override
-    public List<Locale> getCandidateLocales(String baseName, Locale locale) {
-        List<Locale> candidates = super.getCandidateLocales(baseName, locale);
-        candidates.removeAll(excludedJDKLocales);
-        return candidates;
-    }
-
-    /**
-     * @ returns TTL_DONT_CACHE so that ResourceBundle instance won't be cached.
-     * User of this CoreResourceBundleControl should probably maintain a hard reference
-     * to the ResourceBundle object themselves.
-     */
-    @Override
-    public long getTimeToLive(String baseName, Locale locale) {
-        return ResourceBundle.Control.TTL_DONT_CACHE;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/CoreResourceBundleControl-XLocales.java.template	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+package sun.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.ResourceBundle.Control;
+
+/**
+ * This is a convenient class for loading some of internal resources faster
+ * if they are built with Resources.gmk defined in J2SE workspace. Also,
+ * they have to be in class file format.
+ *
+ * "LOCALE_LIST" will be replaced at built time by a list of locales we
+ * defined in Defs.gmk. We want to exclude these locales from search to
+ * gain better performance. For example, since we know if the resource
+ * is built with Resources.gmk, they are not going to provide basename_en.class
+ * & basename_en_US.class resources, in that case, continuing searching them
+ * is expensive. By excluding them from the candidate locale list, these
+ * resources won't be searched.
+ *
+ * @since 1.6.
+ */
+public class CoreResourceBundleControl extends ResourceBundle.Control {
+    /* the candidate locale list to search */
+    private final Collection<Locale> excludedJDKLocales;
+    /* singlton instance of the resource bundle control. */
+    private static CoreResourceBundleControl resourceBundleControlInstance =
+        new CoreResourceBundleControl();
+
+    protected CoreResourceBundleControl() {
+        excludedJDKLocales = Arrays.asList(#LOCALE_LIST#);
+    }
+
+    /**
+     * This method is to provide a customized ResourceBundle.Control to speed
+     * up the search of resources in JDK.
+     *
+     * @return the instance of resource bundle control.
+     */
+    public static CoreResourceBundleControl getRBControlInstance() {
+        return resourceBundleControlInstance;
+    }
+
+    /**
+     * This method is to provide a customized ResourceBundle.Control to speed
+     * up the search of resources in JDK, with the bundle's package name check.
+     *
+     * @param bundleName bundle name to check
+     * @return the instance of resource bundle control if the bundle is JDK's,
+     *    otherwise returns null.
+     */
+    public static CoreResourceBundleControl getRBControlInstance(String bundleName) {
+        if (bundleName.startsWith("com.sun.") ||
+            bundleName.startsWith("java.") ||
+            bundleName.startsWith("javax.") ||
+            bundleName.startsWith("sun.")) {
+            return resourceBundleControlInstance;
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * @returns a list of candidate locales to search from.
+     * @exception NullPointerException if baseName or locale is null.
+     */
+    @Override
+    public List<Locale> getCandidateLocales(String baseName, Locale locale) {
+        List<Locale> candidates = super.getCandidateLocales(baseName, locale);
+        candidates.removeAll(excludedJDKLocales);
+        return candidates;
+    }
+
+    /**
+     * @ returns TTL_DONT_CACHE so that ResourceBundle instance won't be cached.
+     * User of this CoreResourceBundleControl should probably maintain a hard reference
+     * to the ResourceBundle object themselves.
+     */
+    @Override
+    public long getTimeToLive(String baseName, Locale locale) {
+        return ResourceBundle.Control.TTL_DONT_CACHE;
+    }
+}
--- a/jdk/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
- * 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.  Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-#warn This file is preprocessed before being compiled
-
-/*
- * This class contains a map which records the locale list string for
- * each resource in sun.util.resources & sun.text.resources.
- * It is used to avoid loading non-existent localized resources so that
- * jar files won't be opened unnecessary to look up them.
- *
- * @since 1.6
- */
-package sun.util;
-
-import java.util.HashMap;
-
-
-public class LocaleDataMetaInfo {
-
-    private static final HashMap<String, String> resourceNameToLocales =
-        new HashMap<String, String>(6);
-
-
-    static {
-        /* During JDK build time, #XXX_YYY# will be replaced by a string contain all the locales
-           supported by the resource.
-
-           Don't remove the space character between " and #. That is put there purposely so that
-           look up locale string such as "en" could be based on if it contains " en ".
-        */
-        resourceNameToLocales.put("sun.text.resources.FormatData",
-                                  " #FormatData_EuroLocales# | #FormatData_NonEuroLocales# ");
-
-        resourceNameToLocales.put("sun.text.resources.CollationData",
-                                  " #CollationData_EuroLocales# | #CollationData_NonEuroLocales# ");
-
-        resourceNameToLocales.put("sun.util.resources.TimeZoneNames",
-                                  " #TimeZoneNames_EuroLocales# | #TimeZoneNames_NonEuroLocales# ");
-
-        resourceNameToLocales.put("sun.util.resources.LocaleNames",
-                                  " #LocaleNames_EuroLocales# | #LocaleNames_NonEuroLocales# ");
-
-        resourceNameToLocales.put("sun.util.resources.CurrencyNames",
-                                  " #CurrencyNames_EuroLocales# | #CurrencyNames_NonEuroLocales# ");
-
-        resourceNameToLocales.put("sun.util.resources.CalendarData",
-                                  " #CalendarData_EuroLocales# | #CalendarData_NonEuroLocales# ");
-    }
-
-    /*
-     * @param resourceName the resource name
-     * @return the supported locale string for the passed in resource.
-     */
-    public static String getSupportedLocaleString(String resourceName) {
-
-        return resourceNameToLocales.get(resourceName);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/util/LocaleDataMetaInfo-XLocales.java.template	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+#warn This file is preprocessed before being compiled
+
+/*
+ * This class contains a map which records the locale list string for
+ * each resource in sun.util.resources & sun.text.resources.
+ * It is used to avoid loading non-existent localized resources so that
+ * jar files won't be opened unnecessary to look up them.
+ *
+ * @since 1.6
+ */
+package sun.util;
+
+import java.util.HashMap;
+
+
+public class LocaleDataMetaInfo {
+
+    private static final HashMap<String, String> resourceNameToLocales =
+        new HashMap<String, String>(6);
+
+
+    static {
+        /* During JDK build time, #XXX_YYY# will be replaced by a string contain all the locales
+           supported by the resource.
+
+           Don't remove the space character between " and #. That is put there purposely so that
+           look up locale string such as "en" could be based on if it contains " en ".
+        */
+        resourceNameToLocales.put("sun.text.resources.FormatData",
+                                  " #FormatData_EuroLocales# | #FormatData_NonEuroLocales# ");
+
+        resourceNameToLocales.put("sun.text.resources.CollationData",
+                                  " #CollationData_EuroLocales# | #CollationData_NonEuroLocales# ");
+
+        resourceNameToLocales.put("sun.util.resources.TimeZoneNames",
+                                  " #TimeZoneNames_EuroLocales# | #TimeZoneNames_NonEuroLocales# ");
+
+        resourceNameToLocales.put("sun.util.resources.LocaleNames",
+                                  " #LocaleNames_EuroLocales# | #LocaleNames_NonEuroLocales# ");
+
+        resourceNameToLocales.put("sun.util.resources.CurrencyNames",
+                                  " #CurrencyNames_EuroLocales# | #CurrencyNames_NonEuroLocales# ");
+
+        resourceNameToLocales.put("sun.util.resources.CalendarData",
+                                  " #CalendarData_EuroLocales# | #CalendarData_NonEuroLocales# ");
+    }
+
+    /*
+     * @param resourceName the resource name
+     * @return the supported locale string for the passed in resource.
+     */
+    public static String getSupportedLocaleString(String resourceName) {
+
+        return resourceNameToLocales.get(resourceName);
+    }
+
+}
--- a/jdk/src/solaris/bin/java_md.c	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/bin/java_md.c	Wed Jul 05 17:04:26 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 1998-2009 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,9 +51,9 @@
  * two data models and cohabitation of jre/jdk bits with both data
  * models is supported, then DUAL_MODE is defined.  When DUAL_MODE is
  * defined, the architecture names for the narrow and wide version of
- * the architecture are defined in LIBARCH64NAME and LIBARCH32NAME.  Currently
- * only Solaris on sparc/sparcv9 and i586/amd64 is DUAL_MODE; linux
- * i586/amd64 could be defined as DUAL_MODE but that is not the
+ * the architecture are defined in LIBARCH64NAME and LIBARCH32NAME.
+ * Currently  only Solaris on sparc/sparcv9 and i586/amd64 is DUAL_MODE;
+ * linux i586/amd64 could be defined as DUAL_MODE but that is not the
  * current policy.
  */
 
@@ -103,49 +103,56 @@
  * platform independent routine SelectVersion.  This may result in
  * the exec of the specified launcher version.
  *
- * Typically, the launcher execs at least once to ensure a suitable
- * LD_LIBRARY_PATH is in effect for the process.  The first exec
- * screens out all the data model options; leaving the choice of data
- * model implicit in the binary selected to run.  However, in case no
- * exec is done, the data model options are screened out before the vm
- * is invoked.
+ * Previously the launcher modified the LD_LIBRARY_PATH appropriately for the
+ * desired data model path, regardless if data models matched or not. The
+ * launcher subsequently exec'ed the desired executable, in order to make the
+ * LD_LIBRARY_PATH path available for the runtime linker. This is no longer the
+ * case, the launcher dlopens the target libjvm.so. All other required
+ * libraries are loaded by the runtime linker, by virtue of the $ORIGIN paths
+ * baked into the shared libraries, by the build infrastructure at compile time.
  *
- *  incoming argv ------------------------------
- *  |                                          |
- * \|/                                         |
- * CheckJVMType                                |
- * (removes -client, -server, etc.)            |
- *                                            \|/
- *                                            CreateExecutionEnvironment
- *                                            (removes -d32 and -d64,
- *                                             determines desired data model,
- *                                             sets up LD_LIBRARY_PATH,
- *                                             and exec's)
- *                                             |
- *  --------------------------------------------
+ *  Main
+ *  (incoming argv)
+ *  |
+ * \|/
+ * SelectVersion
+ * (selects the JRE version, note: not data model)
+ *  |
+ * \|/
+ * CreateExecutionEnvironment
+ * (determines desired data model)
+ *  |
  *  |
  * \|/
- * exec child 1 incoming argv -----------------
+ *  Have Desired Model ? --> NO --> Is Dual-Mode ? --> NO --> Exit(with error)
+ *  |                                          |
  *  |                                          |
- * \|/                                         |
- * CheckJVMType                                |
- * (removes -client, -server, etc.)            |
+ *  |                                         \|/
+ *  |                                         YES
+ *  |                                          |
+ *  |                                          |
  *  |                                         \|/
- *  |                                          CreateExecutionEnvironment
- *  |                                          (verifies desired data model
- *  |                                           is running and acceptable
- *  |                                           LD_LIBRARY_PATH;
- *  |                                           no-op in child)
+ *  |                                CheckJvmType
+ *  |                               (removes -client, -server etc.)
+ *  |                                          |
+ *  |                                          |
+ * \|/                                        \|/
+ * YES                              (find the desired executable and exec child)
+ *  |                                          |
+ *  |                                          |
+ * \|/                                        \|/
+ * CheckJvmType                                Main
+ * (removes -client, -server, etc.)
+ *  |
  *  |
  * \|/
  * TranslateDashJArgs...
  * (Prepare to pass args to vm)
  *  |
  *  |
- *  |
  * \|/
  * ParseArguments
- * (ignores -d32 and -d64,
+ * (removes -d32 and -d64 if any,
  *  processes version options,
  *  creates argument list for vm,
  *  etc.)
@@ -199,17 +206,13 @@
     /* Compute/set the name of the executable */
     SetExecname(*_argvp);
 
-    /* Set the LD_LIBRARY_PATH environment variable, check data model
-       flags, and exec process, if needed */
+    /* Check data model flags, and exec process, if needed */
     {
       char *arch        = (char *)GetArch(); /* like sparc or sparcv9 */
       char * jvmtype    = NULL;
       int argc          = *_argcp;
       char **argv       = original_argv;
 
-      char *runpath     = NULL; /* existing effective LD_LIBRARY_PATH
-                                   setting */
-
       int running       = CURRENT_DATA_MODEL;
 
       int wanted        = running;      /* What data mode is being
@@ -217,18 +220,8 @@
                                            fine unless another model
                                            is asked for */
 
-      char* new_runpath = NULL; /* desired new LD_LIBRARY_PATH string */
-      char* newpath     = NULL; /* path on new LD_LIBRARY_PATH */
-      char* lastslash   = NULL;
-
-      char** newenvp    = NULL; /* current environment */
-
       char** newargv    = NULL;
       int    newargc    = 0;
-#ifdef __solaris__
-      char*  dmpath     = NULL;  /* data model specific LD_LIBRARY_PATH,
-                                    Solaris only */
-#endif
 
       /*
        * Starting in 1.5, all unix platforms accept the -d32 and -d64
@@ -306,6 +299,11 @@
           JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
           exit(4);
         }
+        /*
+         * we seem to have everything we need, so without further ado
+         * we return back.
+         */
+        return;
       } else {  /* do the same speculatively or exit */
 #ifdef DUAL_MODE
         if (running != wanted) {
@@ -335,190 +333,6 @@
 #endif
       }
 
-      /*
-       * We will set the LD_LIBRARY_PATH as follows:
-       *
-       *     o          $JVMPATH (directory portion only)
-       *     o          $JRE/lib/$LIBARCHNAME
-       *     o          $JRE/../lib/$LIBARCHNAME
-       *
-       * followed by the user's previous effective LD_LIBRARY_PATH, if
-       * any.
-       */
-
-#ifdef __solaris__
-      /*
-       * Starting in Solaris 7, ld.so.1 supports three LD_LIBRARY_PATH
-       * variables:
-       *
-       * 1. LD_LIBRARY_PATH -- used for 32 and 64 bit searches if
-       * data-model specific variables are not set.
-       *
-       * 2. LD_LIBRARY_PATH_64 -- overrides and replaces LD_LIBRARY_PATH
-       * for 64-bit binaries.
-       *
-       * 3. LD_LIBRARY_PATH_32 -- overrides and replaces LD_LIBRARY_PATH
-       * for 32-bit binaries.
-       *
-       * The vm uses LD_LIBRARY_PATH to set the java.library.path system
-       * property.  To shield the vm from the complication of multiple
-       * LD_LIBRARY_PATH variables, if the appropriate data model
-       * specific variable is set, we will act as if LD_LIBRARY_PATH had
-       * the value of the data model specific variant and the data model
-       * specific variant will be unset.  Note that the variable for the
-       * *wanted* data model must be used (if it is set), not simply the
-       * current running data model.
-       */
-
-      switch(wanted) {
-      case 0:
-        if(running == 32) {
-          dmpath = getenv("LD_LIBRARY_PATH_32");
-          wanted = 32;
-        }
-        else {
-          dmpath = getenv("LD_LIBRARY_PATH_64");
-          wanted = 64;
-        }
-        break;
-
-      case 32:
-        dmpath = getenv("LD_LIBRARY_PATH_32");
-        break;
-
-      case 64:
-        dmpath = getenv("LD_LIBRARY_PATH_64");
-        break;
-
-      default:
-        JLI_ReportErrorMessage(JRE_ERROR3, __LINE__);
-        exit(1); /* unknown value in wanted */
-        break;
-      }
-
-      /*
-       * If dmpath is NULL, the relevant data model specific variable is
-       * not set and normal LD_LIBRARY_PATH should be used.
-       */
-      if( dmpath == NULL) {
-        runpath = getenv("LD_LIBRARY_PATH");
-      }
-      else {
-        runpath = dmpath;
-      }
-#else
-      /*
-       * If not on Solaris, assume only a single LD_LIBRARY_PATH
-       * variable.
-       */
-      runpath = getenv("LD_LIBRARY_PATH");
-#endif /* __solaris__ */
-
-#ifdef __linux
-      /*
-       * On linux, if a binary is running as sgid or suid, glibc sets
-       * LD_LIBRARY_PATH to the empty string for security purposes.  (In
-       * contrast, on Solaris the LD_LIBRARY_PATH variable for a
-       * privileged binary does not lose its settings; but the dynamic
-       * linker does apply more scrutiny to the path.) The launcher uses
-       * the value of LD_LIBRARY_PATH to prevent an exec loop.
-       * Therefore, if we are running sgid or suid, this function's
-       * setting of LD_LIBRARY_PATH will be ineffective and we should
-       * return from the function now.  Getting the right libraries to
-       * be found must be handled through other mechanisms.
-       */
-      if((getgid() != getegid()) || (getuid() != geteuid()) ) {
-        return;
-      }
-#endif
-
-      /* runpath contains current effective LD_LIBRARY_PATH setting */
-
-      jvmpath = JLI_StringDup(jvmpath);
-      new_runpath = JLI_MemAlloc( ((runpath!=NULL)?JLI_StrLen(runpath):0) +
-                              2*JLI_StrLen(jrepath) + 2*JLI_StrLen(arch) +
-                              JLI_StrLen(jvmpath) + 52);
-      newpath = new_runpath + JLI_StrLen("LD_LIBRARY_PATH=");
-
-
-      /*
-       * Create desired LD_LIBRARY_PATH value for target data model.
-       */
-      {
-        /* remove the name of the .so from the JVM path */
-        lastslash = JLI_StrRChr(jvmpath, '/');
-        if (lastslash)
-          *lastslash = '\0';
-
-
-        /* jvmpath, ((running != wanted)?((wanted==64)?"/"LIBARCH64NAME:"/.."):""), */
-
-        sprintf(new_runpath, "LD_LIBRARY_PATH="
-                "%s:"
-                "%s/lib/%s:"
-                "%s/../lib/%s",
-                jvmpath,
-#ifdef DUAL_MODE
-                jrepath, GetArchPath(wanted),
-                jrepath, GetArchPath(wanted)
-#else
-                jrepath, arch,
-                jrepath, arch
-#endif
-                );
-
-
-        /*
-         * Check to make sure that the prefix of the current path is the
-         * desired environment variable setting.
-         */
-        if (runpath != NULL &&
-            JLI_StrNCmp(newpath, runpath, JLI_StrLen(newpath))==0 &&
-            (runpath[JLI_StrLen(newpath)] == 0 || runpath[JLI_StrLen(newpath)] == ':') &&
-            (running == wanted) /* data model does not have to be changed */
-#ifdef __solaris__
-            && (dmpath == NULL)    /* data model specific variables not set  */
-#endif
-            ) {
-
-          return;
-
-        }
-      }
-
-      /*
-       * Place the desired environment setting onto the prefix of
-       * LD_LIBRARY_PATH.  Note that this prevents any possible infinite
-       * loop of execv() because we test for the prefix, above.
-       */
-      if (runpath != 0) {
-        JLI_StrCat(new_runpath, ":");
-        JLI_StrCat(new_runpath, runpath);
-      }
-
-      if( putenv(new_runpath) != 0) {
-        exit(1); /* problem allocating memory; LD_LIBRARY_PATH not set
-                    properly */
-      }
-
-      /*
-       * Unix systems document that they look at LD_LIBRARY_PATH only
-       * once at startup, so we have to re-exec the current executable
-       * to get the changed environment variable to have an effect.
-       */
-
-#ifdef __solaris__
-      /*
-       * If dmpath is not NULL, remove the data model specific string
-       * in the environment for the exec'ed child.
-       */
-
-      if( dmpath != NULL)
-        (void)UnsetEnv((wanted==32)?"LD_LIBRARY_PATH_32":"LD_LIBRARY_PATH_64");
-#endif
-
-      newenvp = environ;
-
       {
         char *newexec = execname;
 #ifdef DUAL_MODE
@@ -549,17 +363,16 @@
           argv[0] = newexec;
         }
 #endif
-
+        JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
         (void)fflush(stdout);
         (void)fflush(stderr);
-        execve(newexec, argv, newenvp);
+        execv(newexec, argv);
         JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
 
 #ifdef DUAL_MODE
         if (running != wanted) {
           JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
 #  ifdef __solaris__
-
 #    ifdef __sparc
           JLI_ReportErrorMessage(JRE_ERROR6);
 #    else
@@ -570,13 +383,11 @@
 #endif
 
       }
-
       exit(1);
     }
 
 }
 
-
 /*
  * On Solaris VM choosing is done by the launcher (java.c).
  */
@@ -1123,6 +934,7 @@
             printf(" %s", argv[i]);
         printf("\n");
     }
+    JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
     (void)fflush(stdout);
     (void)fflush(stderr);
     execv(wanted, argv);
--- a/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java	Wed Jul 05 17:04:26 2017 +0200
@@ -45,6 +45,7 @@
 
     protected InfoWindow(Frame parent, Color borderColor) {
         super(parent);
+        setType(Window.Type.POPUP);
         container = new Container() {
             @Override
             public Insets getInsets() {
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -212,27 +212,6 @@
         return true;
     }
 
-    static XComponentPeer getNativeContainer(Component comp) {
-        if (comp == null) {
-            return null;
-        }
-
-        synchronized(comp.getTreeLock()) {
-            while (comp != null && (ComponentAccessor.getPeer(comp) instanceof LightweightPeer)) {
-                comp = ComponentAccessor.getParent_NoClientCode(comp);
-            }
-
-            if (comp != null) {
-                ComponentPeer peer = ComponentAccessor.getPeer(comp);
-                if (peer != null && peer instanceof XComponentPeer) {
-                    return (XComponentPeer)peer;
-                }
-            }
-        }
-
-        return null;
-    }
-
     /*************************************************
      * FOCUS STUFF
      *************************************************/
@@ -508,13 +487,14 @@
     }
 
     XWindowPeer getParentTopLevel() {
-        Container parent = (target instanceof Container) ? ((Container)target) : (ComponentAccessor.getParent_NoClientCode(target));
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target));
         // Search for parent window
         while (parent != null && !(parent instanceof Window)) {
-            parent = ComponentAccessor.getParent_NoClientCode(parent);
+            parent = compAccessor.getParent(parent);
         }
         if (parent != null) {
-            return (XWindowPeer)ComponentAccessor.getPeer(parent);
+            return (XWindowPeer)compAccessor.getPeer(parent);
         } else {
             return null;
         }
@@ -828,7 +808,7 @@
 
     public void endLayout() {
         if (!paintPending && !paintArea.isEmpty()
-            && !ComponentAccessor.getIgnoreRepaint(target))
+            && !AWTAccessor.getComponentAccessor().getIgnoreRepaint(target))
         {
             // if not waiting for native painting repaint damaged area
             postEvent(new PaintEvent(target, PaintEvent.PAINT,
@@ -1239,11 +1219,11 @@
     // End of multi-buffering
 
     public void notifyTextComponentChange(boolean add){
-        Container parent = ComponentAccessor.getParent_NoClientCode(target);
+        Container parent = AWTAccessor.getComponentAccessor().getParent(target);
         while(!(parent == null ||
                 parent instanceof java.awt.Frame ||
                 parent instanceof java.awt.Dialog)) {
-        parent = ComponentAccessor.getParent_NoClientCode(parent);
+            parent = AWTAccessor.getComponentAccessor().getParent(parent);
         }
 
 /*      FIX ME - FIX ME need to implement InputMethods
--- a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java	Wed Jul 05 17:04:26 2017 +0200
@@ -32,7 +32,7 @@
 
 import sun.util.logging.PlatformLogger;
 
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 /**
  * This class implements window which serves as content window for decorated frames.
@@ -135,8 +135,7 @@
     // NOTE: This method may be called by privileged threads.
     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
     public void handleResize(Rectangle bounds) {
-        ComponentAccessor.setWidth((Component)target, bounds.width);
-        ComponentAccessor.setHeight((Component)target, bounds.height);
+        AWTAccessor.getComponentAccessor().setSize((Component)target, bounds.width, bounds.height);
         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,14 +28,21 @@
 import java.awt.Image;
 
 import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
 
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
 import java.awt.image.WritableRaster;
 
+import java.io.BufferedReader;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.IOException;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -48,6 +55,8 @@
 import sun.awt.datatransfer.DataTransferer;
 import sun.awt.datatransfer.ToolkitThreadBlockedHandler;
 
+import java.io.ByteArrayOutputStream;
+
 /**
  * Platform-specific support for the data transfer subsystem.
  */
@@ -108,6 +117,22 @@
         return super.getCharsetForTextFormat(lFormat);
     }
 
+    protected boolean isURIListFormat(long format) {
+        String nat = getNativeForFormat(format);
+        if (nat == null) {
+            return false;
+        }
+        try {
+            DataFlavor df = new DataFlavor(nat);
+            if (df.getPrimaryType().equals("text") && df.getSubType().equals("uri-list")) {
+                return true;
+            }
+        } catch (Exception e) {
+            // Not a MIME format.
+        }
+        return false;
+    }
+
     public boolean isFileFormat(long format) {
         return format == FILE_NAME_ATOM.getAtom() ||
             format == DT_NET_FILE_ATOM.getAtom();
@@ -170,6 +195,19 @@
         }
     }
 
+    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();
+               if (i != 0) bos.write(0);
+               bos.write(bytes, 0, bytes.length);
+        }
+        return bos;
+    }
+
     /**
      * Translates either a byte array or an input stream which contain
      * platform-specific image data in the given format into an Image.
@@ -215,6 +253,52 @@
         }
     }
 
+    protected URI[] dragQueryURIs(InputStream stream,
+                                  byte[] bytes,
+                                  long format,
+                                  Transferable localeTransferable)
+      throws IOException {
+
+        String charset = null;
+        if (localeTransferable != null &&
+            isLocaleDependentTextFormat(format) &&
+            localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
+            try {
+                charset = new String(
+                    (byte[])localeTransferable.getTransferData(javaTextEncodingFlavor),
+                    "UTF-8"
+                );
+            } catch (UnsupportedFlavorException cannotHappen) {
+            }
+        } else {
+            charset = getCharsetForTextFormat(format);
+        }
+        if (charset == null) {
+            // Only happens when we have a custom text type.
+            charset = getDefaultTextCharset();
+        }
+
+        BufferedReader reader = null;
+        try {
+            reader = new BufferedReader(new InputStreamReader(stream, charset));
+            String line;
+            ArrayList<URI> uriList = new ArrayList<URI>();
+            URI uri;
+            while ((line = reader.readLine()) != null) {
+                try {
+                    uri = new URI(line);
+                } catch (URISyntaxException uriSyntaxException) {
+                    throw new IOException(uriSyntaxException);
+                }
+                uriList.add(uri);
+            }
+            return uriList.toArray(new URI[uriList.size()]);
+        } finally {
+            if (reader != null)
+                reader.close();
+        }
+    }
+
     /**
      * Returns true if and only if the name of the specified format Atom
      * constitutes a valid MIME type with the specified primary type.
--- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -32,7 +32,7 @@
 
 import sun.util.logging.PlatformLogger;
 
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 
 abstract class XDecoratedPeer extends XWindowPeer {
@@ -167,10 +167,11 @@
     }
 
     public Graphics getGraphics() {
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
         return getGraphics(content.surfaceData,
-                           ComponentAccessor.getForeground(target),
-                           ComponentAccessor.getBackground(target),
-                           ComponentAccessor.getFont_NoClientCode(target));
+                           compAccessor.getForeground(target),
+                           compAccessor.getBackground(target),
+                           compAccessor.getFont(target));
     }
 
     public void setTitle(String title) {
@@ -404,8 +405,7 @@
 
     public void handleMoved(WindowDimensions dims) {
         Point loc = dims.getLocation();
-        ComponentAccessor.setX((Component)target, loc.x);
-        ComponentAccessor.setY((Component)target, loc.y);
+        AWTAccessor.getComponentAccessor().setLocation((Component)target, loc.x, loc.y);
         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_MOVED));
     }
 
@@ -511,8 +511,8 @@
                 // its location changes.
                 Point oldLocation = getLocation();
 
-                Point newLocation = new Point(ComponentAccessor.getX((Component)target),
-                                              ComponentAccessor.getY((Component)target));
+                Point newLocation = new Point(AWTAccessor.getComponentAccessor().getX((Component)target),
+                                              AWTAccessor.getComponentAccessor().getY((Component)target));
 
                 if (!newLocation.equals(oldLocation)) {
                     handleMoved(newDimensions);
@@ -710,10 +710,7 @@
         updateChildrenSizes();
 
         // Bounds of the window
-        Rectangle targetBounds = new Rectangle(ComponentAccessor.getX((Component)target),
-                ComponentAccessor.getY((Component)target),
-                ComponentAccessor.getWidth((Component)target),
-                ComponentAccessor.getHeight((Component)target));
+        Rectangle targetBounds = AWTAccessor.getComponentAccessor().getBounds((Component)target);
 
         Point newLocation = targetBounds.getLocation();
         if (xe.get_send_event() || runningWM == XWM.NO_WM || XWM.isNonReparentingWM()) {
@@ -1042,10 +1039,11 @@
     }
 
     final void dumpTarget() {
-        int getWidth = ComponentAccessor.getWidth((Component)target);
-        int getHeight = ComponentAccessor.getHeight((Component)target);
-        int getTargetX = ComponentAccessor.getX((Component)target);
-        int getTargetY = ComponentAccessor.getY((Component)target);
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        int getWidth = compAccessor.getWidth((Component)target);
+        int getHeight = compAccessor.getHeight((Component)target);
+        int getTargetX = compAccessor.getX((Component)target);
+        int getTargetY = compAccessor.getY((Component)target);
         System.err.println(">>> Target: " + getTargetX + ", " + getTargetY + ", " + getWidth + ", " + getHeight);
     }
 
@@ -1099,9 +1097,9 @@
         return false;
     }
 
+    @Override
     boolean isOverrideRedirect() {
-//        return false;
-        return ((XToolkit)Toolkit.getDefaultToolkit()).isOverrideRedirect((Window)target);
+        return Window.Type.POPUP.equals(getWindowType());
     }
 
     public boolean requestWindowFocus(long time, boolean timeProvided) {
@@ -1208,7 +1206,7 @@
             Window owner = XWindowPeer.getDecoratedOwner(actualFocusedWindow);
 
             if (owner != null && owner == target) {
-                setActualFocusedWindow((XWindowPeer) ComponentAccessor.getPeer(actualFocusedWindow));
+                setActualFocusedWindow((XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(actualFocusedWindow));
             }
         }
         super.handleWindowFocusOut(oppositeWindow, serial);
--- a/jdk/src/solaris/classes/sun/awt/X11/XDialogPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDialogPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,7 +28,7 @@
 import java.awt.*;
 import java.awt.peer.*;
 import java.awt.event.*;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 import sun.awt.*;
 
@@ -117,7 +117,7 @@
         try {
             javaToplevels = XWindowPeer.collectJavaToplevels();
             for (Window w : toBlock) {
-                XWindowPeer wp = (XWindowPeer)ComponentAccessor.getPeer(w);
+                XWindowPeer wp = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
                 if (wp != null) {
                     wp.setModalBlocked((Dialog)target, true, javaToplevels);
                 }
@@ -139,7 +139,7 @@
         XWindowPeer focusedWindowPeer = null;
 
         if (focusedWindow != null) {
-            focusedWindowPeer = (XWindowPeer)ComponentAccessor.getPeer(focusedWindow);
+            focusedWindowPeer = (XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(focusedWindow);
         } else {
             /*
              * For the case when a potential blocked window is not yet focused
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -39,11 +39,10 @@
 
 import sun.util.logging.PlatformLogger;
 
-import sun.awt.ComponentAccessor;
-
 import sun.awt.dnd.SunDragSourceContextPeer;
 import sun.awt.dnd.SunDropTargetContextPeer;
 import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
 
 /**
  * The XDragSourceContextPeer class is the class responsible for handling
@@ -117,7 +116,7 @@
         XWindowPeer wpeer = null;
 
         for (c = component; c != null && !(c instanceof Window);
-             c = ComponentAccessor.getParent_NoClientCode(c));
+             c = AWTAccessor.getComponentAccessor().getParent(c));
 
         if (c instanceof Window) {
             wpeer = (XWindowPeer)c.getPeer();
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxy.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxy.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,7 @@
 
 import java.awt.Component;
 import java.awt.Toolkit;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class XEmbedChildProxy extends Component {
     long handle;
@@ -39,8 +39,9 @@
 
     public void addNotify() {
         synchronized(getTreeLock()) {
-            if (ComponentAccessor.getPeer(this) == null) {
-                ComponentAccessor.setPeer(this, ((XToolkit)Toolkit.getDefaultToolkit()).createEmbedProxy(this));
+            if (AWTAccessor.getComponentAccessor().getPeer(this) == null) {
+                AWTAccessor.getComponentAccessor().
+                    setPeer(this,((XToolkit)Toolkit.getDefaultToolkit()).createEmbedProxy(this));
             }
             super.addNotify();
         }
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java	Wed Jul 05 17:04:26 2017 +0200
@@ -133,7 +133,7 @@
     }
     void handleFocusIn(int detail) {
         if (embedded.focusAllowedFor()) {
-            embedded.handleWindowFocusInSync(0);
+            embedded.handleWindowFocusIn(0);
         }
         switch(detail) {
           case XEMBED_FOCUS_CURRENT:
@@ -205,7 +205,7 @@
         // embedded is an active window before sending WINDOW_LOST_FOCUS
         // to shared code
         if (XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow() == embedded.target) {
-            embedded.handleWindowFocusOutSync(null, 0);
+            embedded.handleWindowFocusOut(null, 0);
         }
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java	Wed Jul 05 17:04:26 2017 +0200
@@ -216,7 +216,12 @@
 
         XToolkit.awtLock();
         try {
-            keycode = XWindow.getAWTKeyCodeForKeySym((int)keysym);
+            XKeysym.Keysym2JavaKeycode kc = XKeysym.getJavaKeycode( keysym );
+            if(kc == null) {
+                keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
+            }else{
+                keycode = kc.getJavaKeycode();
+            }
         } finally {
             XToolkit.awtUnlock();
         }
--- a/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XGlobalCursorManager.java	Wed Jul 05 17:04:26 2017 +0200
@@ -31,7 +31,7 @@
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 import sun.awt.GlobalCursorManager;
 import sun.awt.SunToolkit;
@@ -94,11 +94,11 @@
                 nc = nativeContainer.get();
             }
         } else {
-            nc = getNativeContainer(comp);
+           nc = SunToolkit.getHeavyweightComponent(comp);
         }
 
         if (nc != null) {
-            ComponentPeer nc_peer = ComponentAccessor.getPeer(nc);
+            ComponentPeer nc_peer = AWTAccessor.getComponentAccessor().getPeer(nc);
             if (nc_peer instanceof XComponentPeer) {
                 synchronized (this) {
                     nativeContainer = new WeakReference<Component>(nc);
@@ -133,13 +133,6 @@
         updateGrabbedCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
     }
 
-    private Component getNativeContainer(Component comp) {
-        while (comp != null && ComponentAccessor.getPeer(comp) instanceof LightweightPeer) {
-            comp = ComponentAccessor.getParent_NoClientCode(comp);
-        }
-        return comp;
-    }
-
     protected void getCursorPos(Point p) {
 
         if (!((XToolkit)Toolkit.getDefaultToolkit()).getLastCursorPos(p)) {
@@ -186,27 +179,29 @@
     }
 
     private Cursor getCapableCursor(Component comp) {
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+
         Component c = comp;
         while ((c != null) && !(c instanceof Window)
-               && ComponentAccessor.isEnabledImpl(c)
-               && ComponentAccessor.getVisible(c)
-               && ComponentAccessor.getPeer(c) != null)
+               && compAccessor.isEnabled(c)
+               && compAccessor.isVisible(c)
+               && compAccessor.isDisplayable(c))
         {
-            c = ComponentAccessor.getParent_NoClientCode(c);
+            c = compAccessor.getParent(c);
         }
         if (c instanceof Window) {
-            return (ComponentAccessor.isEnabledImpl(c)
-                    && ComponentAccessor.getVisible(c)
-                    && (ComponentAccessor.getPeer(c) != null)
-                    && ComponentAccessor.isEnabledImpl(comp))
+            return (compAccessor.isEnabled(c)
+                    && compAccessor.isVisible(c)
+                    && compAccessor.isDisplayable(c)
+                    && compAccessor.isEnabled(comp))
                    ?
-                    ComponentAccessor.getCursor_NoClientCode(comp)
+                    compAccessor.getCursor(comp)
                    :
                     Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
         } else if (c == null) {
             return null;
         }
-        return getCapableCursor(ComponentAccessor.getParent_NoClientCode(c));
+        return getCapableCursor(compAccessor.getParent(c));
     }
 
     /* This methods needs to be called from within XToolkit.awtLock / XToolkit.awtUnlock section. */
--- a/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XKeysym.java	Wed Jul 05 17:04:26 2017 +0200
@@ -69,6 +69,8 @@
     static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
     static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
     static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
+    static Keysym2JavaKeycode kanaLock = new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_KANA_LOCK,
+                                                                java.awt.event.KeyEvent.KEY_LOCATION_STANDARD);
     private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XKeysym");
     public static char convertKeysym( long ks, int state ) {
 
@@ -214,12 +216,35 @@
         }
         return keysym;
     }
+
+    /**
+        Return java.awt.KeyEvent constant meaning (Java) keycode, derived from X keysym.
+        Some keysyms maps to more than one keycode, these would require extra processing.
+    */
+    static Keysym2JavaKeycode getJavaKeycode( long keysym ) {
+        if(keysym == XKeySymConstants.XK_Mode_switch){
+           /* XK_Mode_switch on solaris maps either to VK_ALT_GRAPH (default) or VK_KANA_LOCK */
+           if( XToolkit.isKanaKeyboard() ) {
+               return kanaLock;
+           }
+        }else if(keysym == XKeySymConstants.XK_L1){
+           /* if it is Sun keyboard, trick hash to return VK_STOP else VK_F11 (default) */
+           if( XToolkit.isSunKeyboard() ) {
+               keysym = XKeySymConstants.SunXK_Stop;
+           }
+        }else if(keysym == XKeySymConstants.XK_L2) {
+           /* if it is Sun keyboard, trick hash to return VK_AGAIN else VK_F12 (default) */
+           if( XToolkit.isSunKeyboard() ) {
+               keysym = XKeySymConstants.SunXK_Again;
+           }
+        }
+
+        return  keysym2JavaKeycodeHash.get( keysym );
+    }
     /**
         Return java.awt.KeyEvent constant meaning (Java) keycode, derived from X Window KeyEvent.
         Algorithm is, extract via XKeycodeToKeysym  a proper keysym according to Xlib spec rules and
         err exceptions, then search a java keycode in a table.
-        Some keysyms maps to more than one keycode, these would require extra processing. If someone
-        points me to such a keysym.
     */
     static Keysym2JavaKeycode getJavaKeycode( XKeyEvent ev ) {
         // get from keysym2JavaKeycodeHash.
@@ -234,7 +259,7 @@
             keysym = xkeycode2keysym(ev, ndx);
         }
 
-        Keysym2JavaKeycode jkc = keysym2JavaKeycodeHash.get( keysym );
+        Keysym2JavaKeycode jkc = getJavaKeycode( keysym );
         return jkc;
     }
     static int getJavaKeycodeOnly( XKeyEvent ev ) {
@@ -259,7 +284,7 @@
             ndx = 0;
             keysym = xkeycode2keysym_noxkb(ev, ndx);
         }
-        Keysym2JavaKeycode jkc = keysym2JavaKeycodeHash.get( keysym );
+        Keysym2JavaKeycode jkc = getJavaKeycode( keysym );
         return jkc == null ? java.awt.event.KeyEvent.VK_UNDEFINED : jkc.getJavaKeycode();
     }
     static long javaKeycode2Keysym( int jkey ) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java	Wed Jul 05 17:04:26 2017 +0200
@@ -252,8 +252,11 @@
     XAtom XA_NET_WM_STATE_SKIP_TASKBAR = XAtom.get("_NET_WM_STATE_SKIP_TASKBAR");
     XAtom XA_NET_WM_STATE_SKIP_PAGER = XAtom.get("_NET_WM_STATE_SKIP_PAGER");
 
-    XAtom XA_NET_WM_WINDOW_TYPE = XAtom.get("_NET_WM_WINDOW_TYPE");
-    XAtom XA_NET_WM_WINDOW_TYPE_DIALOG = XAtom.get("_NET_WM_WINDOW_TYPE_DIALOG");
+    public final XAtom XA_NET_WM_WINDOW_TYPE = XAtom.get("_NET_WM_WINDOW_TYPE");
+    public final XAtom XA_NET_WM_WINDOW_TYPE_NORMAL = XAtom.get("_NET_WM_WINDOW_TYPE_NORMAL");
+    public final XAtom XA_NET_WM_WINDOW_TYPE_DIALOG = XAtom.get("_NET_WM_WINDOW_TYPE_DIALOG");
+    public final XAtom XA_NET_WM_WINDOW_TYPE_UTILITY = XAtom.get("_NET_WM_WINDOW_TYPE_UTILITY");
+    public final XAtom XA_NET_WM_WINDOW_TYPE_POPUP_MENU = XAtom.get("_NET_WM_WINDOW_TYPE_POPUP_MENU");
 
     XAtom XA_NET_WM_WINDOW_OPACITY = XAtom.get("_NET_WM_WINDOW_OPACITY");
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -60,7 +60,7 @@
 import javax.swing.plaf.BorderUIResource;
 import java.awt.im.InputMethodRequests;
 import sun.awt.CausedFocusEvent;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 
 class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
@@ -119,13 +119,14 @@
         textPane.setVisible(true);
         textPane.validate();
 
-        foreground = ComponentAccessor.getForeground(target);
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        foreground = compAccessor.getForeground(target);
         if (foreground == null)  {
             foreground = SystemColor.textText;
         }
         setForeground(foreground);
 
-        background = ComponentAccessor.getBackground(target);
+        background = compAccessor.getBackground(target);
         if (background == null) {
             if (target.isEditable()) background = SystemColor.text;
             else background = SystemColor.control;
@@ -134,8 +135,8 @@
 
         if (!target.isBackgroundSet()) {
             // This is a way to set the background color of the TextArea
-            // without calling setBackground - go through reflection
-            ComponentAccessor.setBackground(target, background);
+            // without calling setBackground - go through accessor
+            compAccessor.setBackground(target, background);
         }
         if (!target.isForegroundSet()) {
             target.setForeground(SystemColor.textText);
@@ -311,13 +312,13 @@
     }
 
     void handleJavaKeyEvent(KeyEvent e) {
-        ComponentAccessor.processEvent(jtext,e);
+        AWTAccessor.getComponentAccessor().processEvent(jtext,e);
     }
 
     public boolean handlesWheelScrolling() { return true; }
 
     void handleJavaMouseWheelEvent(MouseWheelEvent e) {
-        ComponentAccessor.processEvent(textPane,e);
+        AWTAccessor.getComponentAccessor().processEvent(textPane,e);
     }
 
     public void handleJavaMouseEvent( MouseEvent e ) {
@@ -1111,7 +1112,7 @@
             this.xwin = xwin;
             setDoubleBuffered(true);
             jt.addFocusListener(this);
-            ComponentAccessor.setParent(this,parent);
+            AWTAccessor.getComponentAccessor().setParent(this,parent);
             setViewportBorder(new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight) );
             this.jtext = jt;
             setFocusable(false);
@@ -1308,7 +1309,7 @@
                         c = current.getButton();
                         p = toLocalSpace( c, p );
                     }
-                    ComponentAccessor.processEvent( c, newMouseEvent( c, p, event ) );
+                    AWTAccessor.getComponentAccessor().processEvent( c, newMouseEvent( c, p, event ) );
                     break;
             }
         }
--- a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -55,7 +55,7 @@
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.CausedFocusEvent;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11.XTextField");
@@ -115,13 +115,14 @@
 
         setBounds(x, y, width, height, SET_BOUNDS);
 
-        foreground = ComponentAccessor.getForeground(target);
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+        foreground = compAccessor.getForeground(target);
         if (foreground == null)
             foreground = SystemColor.textText;
 
         setForeground(foreground);
 
-        background = ComponentAccessor.getBackground(target);
+        background = compAccessor.getBackground(target);
         if (background == null) {
             if (((TextField)target).isEditable()) background = SystemColor.text;
             else background = SystemColor.control;
@@ -130,8 +131,8 @@
 
         if (!target.isBackgroundSet()) {
             // This is a way to set the background color of the TextArea
-            // without calling setBackground - go through reflection
-            ComponentAccessor.setBackground(target, background);
+            // without calling setBackground - go through accessor
+            compAccessor.setBackground(target, background);
         }
         if (!target.isForegroundSet()) {
             target.setForeground(SystemColor.textText);
@@ -392,7 +393,7 @@
     }
 
     void handleJavaKeyEvent(KeyEvent e) {
-        ComponentAccessor.processEvent(xtext,e);
+        AWTAccessor.getComponentAccessor().processEvent(xtext,e);
     }
 
 
@@ -620,7 +621,7 @@
             this.peer = peer;
             setDoubleBuffered(true);
             setFocusable(false);
-            ComponentAccessor.setParent(this,parent);
+            AWTAccessor.getComponentAccessor().setParent(this,parent);
             setBackground(peer.getPeerBackground());
             setForeground(peer.getPeerForeground());
             setFont(peer.getPeerFont());
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Jul 05 17:04:26 2017 +0200
@@ -109,11 +109,6 @@
     static int awt_multiclick_time;
     static boolean securityWarningEnabled;
 
-    // WeakSet should be used here, but there is no such class
-    // in JDK (at least in JDK6 and earlier versions)
-    private WeakHashMap<Window, Boolean> overrideRedirectWindows =
-        new WeakHashMap<Window, Boolean>();
-
     private static int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
     static long awt_defaultFg; // Pixel
     private static XMouseInfoPeer xPeer;
@@ -538,6 +533,16 @@
             processGlobalMotionEvent(ev);
         }
 
+        if( ev.get_type() == XConstants.MappingNotify ) {
+            // The 'window' field in this event is unused.
+            // This application itself does nothing to initiate such an event
+            // (no calls of XChangeKeyboardMapping etc.).
+            // SunRay server sends this event to the application once on every
+            // keyboard (not just layout) change which means, quite seldom.
+            XlibWrapper.XRefreshKeyboardMapping(ev.pData);
+            resetKeyboardSniffer();
+            setupModifierMap();
+        }
         XBaseWindow.dispatchToWindow(ev);
 
         Collection dispatchers = null;
@@ -631,7 +636,7 @@
                     Component owner =
                         XKeyboardFocusManagerPeer.getCurrentNativeFocusOwner();
                     if (owner != null) {
-                        XWindow ownerWindow = (XWindow) ComponentAccessor.getPeer(owner);
+                        XWindow ownerWindow = (XWindow) AWTAccessor.getComponentAccessor().getPeer(owner);
                         if (ownerWindow != null) {
                             w = ownerWindow.getContentWindow();
                         }
@@ -1316,19 +1321,6 @@
         }
     }
 
-    @Override
-    public void setOverrideRedirect(Window target) {
-        synchronized (overrideRedirectWindows) {
-            overrideRedirectWindows.put(target, true);
-        }
-    }
-
-    public boolean isOverrideRedirect(Window target) {
-        synchronized (overrideRedirectWindows) {
-            return overrideRedirectWindows.containsKey(target);
-        }
-    }
-
     static void dumpPeers() {
         if (log.isLoggable(PlatformLogger.FINE)) {
             log.fine("Mapped windows:");
@@ -1457,7 +1449,7 @@
      * (which is assigned to the virtual pointer) reports the maximum
      * capabilities of the mouse pointer (i.e. 32 physical buttons).
      */
-    private native synchronized int getNumberOfButtonsImpl();
+    private native int getNumberOfButtonsImpl();
 
     @Override
     public int getNumberOfButtons(){
@@ -2130,6 +2122,11 @@
 
     static final int XSUN_KP_BEHAVIOR = 1;
     static final int XORG_KP_BEHAVIOR = 2;
+    static final int    IS_SUN_KEYBOARD = 1;
+    static final int IS_NONSUN_KEYBOARD = 2;
+    static final int    IS_KANA_KEYBOARD = 1;
+    static final int IS_NONKANA_KEYBOARD = 2;
+
 
     static int     awt_IsXsunKPBehavior = 0;
     static boolean awt_UseXKB         = false;
@@ -2159,6 +2156,33 @@
             awtUnlock();
         }
     }
+
+    static int  sunOrNotKeyboard = 0;
+    static int kanaOrNotKeyboard = 0;
+    static void resetKeyboardSniffer() {
+        sunOrNotKeyboard  = 0;
+        kanaOrNotKeyboard = 0;
+    }
+    static boolean isSunKeyboard() {
+        if( sunOrNotKeyboard == 0 ) {
+            if( XlibWrapper.IsSunKeyboard( getDisplay() )) {
+                sunOrNotKeyboard = IS_SUN_KEYBOARD;
+            }else{
+                sunOrNotKeyboard = IS_NONSUN_KEYBOARD;
+            }
+        }
+        return (sunOrNotKeyboard == IS_SUN_KEYBOARD);
+    }
+    static boolean isKanaKeyboard() {
+        if( kanaOrNotKeyboard == 0 ) {
+            if( XlibWrapper.IsKanaKeyboard( getDisplay() )) {
+                kanaOrNotKeyboard = IS_KANA_KEYBOARD;
+            }else{
+                kanaOrNotKeyboard = IS_NONKANA_KEYBOARD;
+            }
+        }
+        return (kanaOrNotKeyboard == IS_KANA_KEYBOARD);
+    }
     static boolean isXKBenabled() {
         awtLock();
         try {
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -295,7 +295,7 @@
     }
 
     public static void suppressWarningString(Window w) {
-        WindowAccessor.setTrayIconWindow(w, true);
+        AWTAccessor.getWindowAccessor().setTrayIconWindow(w, true);
     }
 
     public void setToolTip(String tooltip) {
@@ -483,12 +483,6 @@
         }
     }
 
-    static boolean isTrayIconStuffWindow(Window w) {
-        return (w instanceof InfoWindow.Tooltip) ||
-               (w instanceof InfoWindow.Balloon) ||
-               (w instanceof XTrayIconEmbeddedFrame);
-    }
-
     // ***************************************
     // Special embedded frame for tray icon
     // ***************************************
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Wed Jul 05 17:04:26 2017 +0200
@@ -325,9 +325,9 @@
         if (!(target instanceof Container) || win == null || win.getTarget() == null) {
             return false;
         }
-        Container parent = ComponentAccessor.getParent_NoClientCode(win.target);
+        Container parent = AWTAccessor.getComponentAccessor().getParent(win.target);
         while (parent != null && parent != target) {
-            parent = ComponentAccessor.getParent_NoClientCode(parent);
+            parent = AWTAccessor.getComponentAccessor().getParent(parent);
         }
         return (parent == target);
     }
@@ -560,10 +560,11 @@
         int h = xe.get_height();
 
         Component target = (Component)getEventSource();
+        AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
 
-        if (!ComponentAccessor.getIgnoreRepaint(target)
-            && ComponentAccessor.getWidth(target) != 0
-            && ComponentAccessor.getHeight(target) != 0)
+        if (!compAccessor.getIgnoreRepaint(target)
+            && compAccessor.getWidth(target) != 0
+            && compAccessor.getHeight(target) != 0)
         {
             handleExposeEvent(target, x, y, w, h);
         }
@@ -950,7 +951,7 @@
                     XAwtState.setComponentMouseEntered(null);
                 }
             } else {
-                ((XComponentPeer) ComponentAccessor.getPeer(target))
+                ((XComponentPeer) AWTAccessor.getComponentAccessor().getPeer(target))
                     .pSetCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
             }
         }
@@ -1387,7 +1388,7 @@
             Component comp = target;
 
             while (comp != null && !(comp instanceof Window)) {
-                comp = ComponentAccessor.getParent_NoClientCode(comp);
+                comp = AWTAccessor.getComponentAccessor().getParent(comp);
             }
 
             // applets, embedded, etc - translate directly
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -35,18 +35,22 @@
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.WindowPeer;
 
+import java.io.UnsupportedEncodingException;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 import java.util.Vector;
 
+import java.util.concurrent.atomic.AtomicBoolean;
+
 import sun.util.logging.PlatformLogger;
 
 import sun.awt.AWTAccessor;
-import sun.awt.ComponentAccessor;
-import sun.awt.WindowAccessor;
-import sun.awt.AWTAccessor;
 import sun.awt.DisplayChangedListener;
 import sun.awt.SunToolkit;
 import sun.awt.X11GraphicsDevice;
@@ -90,6 +94,8 @@
     private boolean mustControlStackPosition = false; // Am override-redirect not on top
     private XEventDispatcher rootPropertyEventDispatcher = null;
 
+    private static final AtomicBoolean isStartupNotificationRemoved = new AtomicBoolean();
+
     /*
      * Focus related flags
      */
@@ -97,6 +103,18 @@
     private boolean isBeforeFirstMapNotify = false; // Is the window (being shown) between
                                                     //    setVisible(true) & handleMapNotify().
 
+    /**
+     * The type of the window.
+     *
+     * The type is supposed to be immutable while the peer object exists.
+     * The value gets initialized in the preInit() method.
+     */
+    private Window.Type windowType = Window.Type.NORMAL;
+
+    public final Window.Type getWindowType() {
+        return windowType;
+    }
+
     // It need to be accessed from XFramePeer.
     protected Vector <ToplevelStateListener> toplevelStateListeners = new Vector<ToplevelStateListener>();
     XWindowPeer(XCreateWindowParams params) {
@@ -128,6 +146,7 @@
 
     void preInit(XCreateWindowParams params) {
         target = (Component)params.get(TARGET);
+        windowType = ((Window)target).getType();
         params.put(REPARENTED,
                    Boolean.valueOf(isOverrideRedirect() || isSimpleWindow()));
         super.preInit(params);
@@ -233,7 +252,7 @@
         if (((Window)target).getWarningString() != null) {
             // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
             // and TrayIcon balloon windows without a warning window.
-            if (!WindowAccessor.isTrayIconWindow((Window)target)) {
+            if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) {
                 warningWindow = new XWarningWindow((Window)target, getWindow(), this);
             }
         }
@@ -525,7 +544,7 @@
 
     boolean isAutoRequestFocus() {
         if (XToolkit.isToolkitThread()) {
-            return WindowAccessor.isAutoRequestFocus((Window)target);
+            return AWTAccessor.getWindowAccessor().isAutoRequestFocus((Window)target);
         } else {
             return ((Window)target).isAutoRequestFocus();
         }
@@ -1065,10 +1084,11 @@
         if (warningWindow != null) {
             // We can't use the coordinates stored in the XBaseWindow since
             // they are zeros for decorated frames.
-            int x = ComponentAccessor.getX(target);
-            int y = ComponentAccessor.getY(target);
-            int width = ComponentAccessor.getWidth(target);
-            int height = ComponentAccessor.getHeight(target);
+            AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
+            int x = compAccessor.getX(target);
+            int y = compAccessor.getY(target);
+            int width = compAccessor.getWidth(target);
+            int height = compAccessor.getHeight(target);
             warningWindow.reposition(x, y, width, height);
         }
     }
@@ -1119,9 +1139,8 @@
     }
 
     boolean isOverrideRedirect() {
-        return (XWM.getWMID() == XWM.OPENLOOK_WM ? true : false) ||
-            ((XToolkit)Toolkit.getDefaultToolkit()).isOverrideRedirect((Window)target) ||
-            XTrayIconPeer.isTrayIconStuffWindow((Window)target);
+        return XWM.getWMID() == XWM.OPENLOOK_WM ||
+            Window.Type.POPUP.equals(getWindowType());
     }
 
     final boolean isOLWMDecorBug() {
@@ -1152,7 +1171,7 @@
         if (isSimpleWindow()) {
             if (target == XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow()) {
                 Window owner = getDecoratedOwner((Window)target);
-                ((XWindowPeer)ComponentAccessor.getPeer(owner)).requestWindowFocus();
+                ((XWindowPeer)AWTAccessor.getComponentAccessor().getPeer(owner)).requestWindowFocus();
             }
         }
     }
@@ -1183,7 +1202,77 @@
         }
     }
 
+    private void removeStartupNotification() {
+        if (isStartupNotificationRemoved.getAndSet(true)) {
+            return;
+        }
+
+        final String desktopStartupId = AccessController.doPrivileged(new PrivilegedAction<String>() {
+            public String run() {
+                return XToolkit.getEnv("DESKTOP_STARTUP_ID");
+            }
+        });
+        if (desktopStartupId == null) {
+            return;
+        }
+
+        final StringBuilder messageBuilder = new StringBuilder("remove: ID=");
+        messageBuilder.append('"');
+        for (int i = 0; i < desktopStartupId.length(); i++) {
+            if (desktopStartupId.charAt(i) == '"' || desktopStartupId.charAt(i) == '\\') {
+                messageBuilder.append('\\');
+            }
+            messageBuilder.append(desktopStartupId.charAt(i));
+        }
+        messageBuilder.append('"');
+        messageBuilder.append('\0');
+        final byte[] message;
+        try {
+            message = messageBuilder.toString().getBytes("UTF-8");
+        } catch (UnsupportedEncodingException cannotHappen) {
+            return;
+        }
+
+        XClientMessageEvent req = null;
+
+        XToolkit.awtLock();
+        try {
+            final XAtom netStartupInfoBeginAtom = XAtom.get("_NET_STARTUP_INFO_BEGIN");
+            final XAtom netStartupInfoAtom = XAtom.get("_NET_STARTUP_INFO");
+
+            req = new XClientMessageEvent();
+            req.set_type(XConstants.ClientMessage);
+            req.set_window(getWindow());
+            req.set_message_type(netStartupInfoBeginAtom.getAtom());
+            req.set_format(8);
+
+            for (int pos = 0; pos < message.length; pos += 20) {
+                final int msglen = Math.min(message.length - pos, 20);
+                int i = 0;
+                for (; i < msglen; i++) {
+                    XlibWrapper.unsafe.putByte(req.get_data() + i, message[pos + i]);
+                }
+                for (; i < 20; i++) {
+                    XlibWrapper.unsafe.putByte(req.get_data() + i, (byte)0);
+                }
+                XlibWrapper.XSendEvent(XToolkit.getDisplay(),
+                    XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber()),
+                    false,
+                    XConstants.PropertyChangeMask,
+                    req.pData);
+                req.set_message_type(netStartupInfoAtom.getAtom());
+            }
+        } finally {
+            XToolkit.awtUnlock();
+            if (req != null) {
+                req.dispose();
+            }
+        }
+    }
+
     public void handleMapNotifyEvent(XEvent xev) {
+        removeStartupNotification();
+
         // See 6480534.
         isUnhiding |= isWMStateNetHidden();
 
@@ -1309,7 +1398,7 @@
         XToolkit.awtLock();
         try {
             if (isReparented() && delayedModalBlocking) {
-                addToTransientFors((XDialogPeer) ComponentAccessor.getPeer(modalBlocker));
+                addToTransientFors((XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(modalBlocker));
                 delayedModalBlocking = false;
             }
         } finally {
@@ -1393,7 +1482,7 @@
         try {
             // State lock should always be after awtLock
             synchronized(getStateLock()) {
-                XDialogPeer blockerPeer = (XDialogPeer) ComponentAccessor.getPeer(d);
+                XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d);
                 if (blocked) {
                     log.fine("{0} is blocked by {1}", this, blockerPeer);
                     modalBlocker = d;
@@ -1673,7 +1762,7 @@
         // current chain iterator in the order from next to prev
         XWindowPeer chainToSplit = prevTransientFor;
         while (chainToSplit != null) {
-            XWindowPeer blocker = (XWindowPeer) ComponentAccessor.getPeer(chainToSplit.modalBlocker);
+            XWindowPeer blocker = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(chainToSplit.modalBlocker);
             if (thisChainBlockers.contains(blocker)) {
                 // add to this dialog's chain
                 setToplevelTransientFor(thisChain, chainToSplit, true, false);
@@ -1701,7 +1790,7 @@
 
     static Window getDecoratedOwner(Window window) {
         while ((null != window) && !(window instanceof Frame || window instanceof Dialog)) {
-            window = (Window) ComponentAccessor.getParent_NoClientCode(window);
+            window = (Window) AWTAccessor.getComponentAccessor().getParent(window);
         }
         return window;
     }
@@ -1734,7 +1823,7 @@
         }
         focusLog.fine("Parent window is not active");
 
-        XDecoratedPeer wpeer = (XDecoratedPeer)ComponentAccessor.getPeer(ownerWindow);
+        XDecoratedPeer wpeer = (XDecoratedPeer)AWTAccessor.getComponentAccessor().getPeer(ownerWindow);
         if (wpeer != null && wpeer.requestWindowFocus(this, time, timeProvided)) {
             focusLog.fine("Parent window accepted focus request - generating focus for this window");
             return true;
@@ -1747,12 +1836,49 @@
     void setActualFocusedWindow(XWindowPeer actualFocusedWindow) {
     }
 
+    /**
+     * Applies the current window type.
+     */
+    private void applyWindowType() {
+        XNETProtocol protocol = XWM.getWM().getNETProtocol();
+        if (protocol == null) {
+            return;
+        }
+
+        XAtom typeAtom = null;
+
+        switch (getWindowType())
+        {
+            case NORMAL:
+                typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_NORMAL;
+                break;
+            case UTILITY:
+                typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_UTILITY;
+                break;
+            case POPUP:
+                typeAtom = protocol.XA_NET_WM_WINDOW_TYPE_POPUP_MENU;
+                break;
+        }
+
+        if (typeAtom != null) {
+            XAtomList wtype = new XAtomList();
+            wtype.add(typeAtom);
+            protocol.XA_NET_WM_WINDOW_TYPE.
+                setAtomListProperty(getWindow(), wtype);
+        } else {
+            protocol.XA_NET_WM_WINDOW_TYPE.
+                DeleteProperty(getWindow());
+        }
+    }
+
+    @Override
     public void xSetVisible(boolean visible) {
         if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting visible on " + this + " to " + visible);
         XToolkit.awtLock();
         try {
             this.visible = visible;
             if (visible) {
+                applyWindowType();
                 XlibWrapper.XMapRaised(XToolkit.getDisplay(), getWindow());
             } else {
                 XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), getWindow());
@@ -2027,9 +2153,9 @@
                     if (toplevel != null) {
                         Window w = (Window)toplevel.target;
                         while (w != null && toplevel != this && !(toplevel instanceof XDialogPeer)) {
-                            w = (Window) ComponentAccessor.getParent_NoClientCode(w);
+                            w = (Window) AWTAccessor.getComponentAccessor().getParent(w);
                             if (w != null) {
-                                toplevel = (XWindowPeer) ComponentAccessor.getPeer(w);
+                                toplevel = (XWindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
                             }
                         }
                         if (w == null || (w != this.target && w instanceof Dialog)) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java	Wed Jul 05 17:04:26 2017 +0200
@@ -353,6 +353,8 @@
     static native String ServerVendor(long display);
     static native int VendorRelease(long display);
     static native boolean IsXsunKPBehavior(long display);
+    static native boolean IsSunKeyboard(long display);
+    static native boolean IsKanaKeyboard(long display);
 
     static native void XBell(long display, int percent);
 
@@ -513,8 +515,9 @@
                                     long keysym_uppercase);
 
     static native long XGetModifierMapping(long display);
+    static native void XFreeModifiermap(long keymap);
+    static native void XRefreshKeyboardMapping(long event);
 
-    static native void XFreeModifiermap(long keymap);
 
     static native void XChangeActivePointerGrab(long display, int mask,
                                                 long cursor, long time);
--- a/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/keysym2ucs.h	Wed Jul 05 17:04:26 2017 +0200
@@ -107,6 +107,8 @@
 tojava     static Hashtable<Integer, Long> javaKeycode2KeysymHash = new Hashtable<Integer, Long>();
 tojava     static long keysym_lowercase = unsafe.allocateMemory(Native.getLongSize());
 tojava     static long keysym_uppercase = unsafe.allocateMemory(Native.getLongSize());
+tojava     static Keysym2JavaKeycode kanaLock = new Keysym2JavaKeycode(java.awt.event.KeyEvent.VK_KANA_LOCK,
+tojava                                                                 java.awt.event.KeyEvent.KEY_LOCATION_STANDARD);
 tojava     private static PlatformLogger keyEventLog = PlatformLogger.getLogger("sun.awt.X11.kye.XKeysym");
 tojava     public static char convertKeysym( long ks, int state ) {
 tojava
@@ -252,12 +254,35 @@
 tojava         }
 tojava         return keysym;
 tojava     }
+tojava
+tojava     /**
+tojava         Return java.awt.KeyEvent constant meaning (Java) keycode, derived from X keysym.
+tojava         Some keysyms maps to more than one keycode, these would require extra processing.
+tojava     */
+tojava     static Keysym2JavaKeycode getJavaKeycode( long keysym ) {
+tojava         if(keysym == XKeySymConstants.XK_Mode_switch){
+tojava            /* XK_Mode_switch on solaris maps either to VK_ALT_GRAPH (default) or VK_KANA_LOCK */
+tojava            if( XToolkit.isKanaKeyboard() ) {
+tojava                return kanaLock;
+tojava            }
+tojava         }else if(keysym == XKeySymConstants.XK_L1){
+tojava            /* if it is Sun keyboard, trick hash to return VK_STOP else VK_F11 (default) */
+tojava            if( XToolkit.isSunKeyboard() ) {
+tojava                keysym = XKeySymConstants.SunXK_Stop;
+tojava            }
+tojava         }else if(keysym == XKeySymConstants.XK_L2) {
+tojava            /* if it is Sun keyboard, trick hash to return VK_AGAIN else VK_F12 (default) */
+tojava            if( XToolkit.isSunKeyboard() ) {
+tojava                keysym = XKeySymConstants.SunXK_Again;
+tojava            }
+tojava         }
+tojava
+tojava         return  keysym2JavaKeycodeHash.get( keysym );
+tojava     }
 tojava     /**
 tojava         Return java.awt.KeyEvent constant meaning (Java) keycode, derived from X Window KeyEvent.
 tojava         Algorithm is, extract via XKeycodeToKeysym  a proper keysym according to Xlib spec rules and
 tojava         err exceptions, then search a java keycode in a table.
-tojava         Some keysyms maps to more than one keycode, these would require extra processing. If someone
-tojava         points me to such a keysym.
 tojava     */
 tojava     static Keysym2JavaKeycode getJavaKeycode( XKeyEvent ev ) {
 tojava         // get from keysym2JavaKeycodeHash.
@@ -272,7 +297,7 @@
 tojava             keysym = xkeycode2keysym(ev, ndx);
 tojava         }
 tojava
-tojava         Keysym2JavaKeycode jkc = keysym2JavaKeycodeHash.get( keysym );
+tojava         Keysym2JavaKeycode jkc = getJavaKeycode( keysym );
 tojava         return jkc;
 tojava     }
 tojava     static int getJavaKeycodeOnly( XKeyEvent ev ) {
@@ -297,7 +322,7 @@
 tojava             ndx = 0;
 tojava             keysym = xkeycode2keysym_noxkb(ev, ndx);
 tojava         }
-tojava         Keysym2JavaKeycode jkc = keysym2JavaKeycodeHash.get( keysym );
+tojava         Keysym2JavaKeycode jkc = getJavaKeycode( keysym );
 tojava         return jkc == null ? java.awt.event.KeyEvent.VK_UNDEFINED : jkc.getJavaKeycode();
 tojava     }
 tojava     static long javaKeycode2Keysym( int jkey ) {
--- a/jdk/src/solaris/lib/flavormap.properties	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/lib/flavormap.properties	Wed Jul 05 17:04:26 2017 +0200
@@ -73,5 +73,6 @@
 TEXT=text/plain;eoln="\n";terminators=0
 STRING=text/plain;charset=iso8859-1;eoln="\n";terminators=0
 FILE_NAME=application/x-java-file-list;class=java.util.List
+text/uri-list=application/x-java-file-list;class=java.util.List
 PNG=image/x-java-image;class=java.awt.Image
 JFIF=image/x-java-image;class=java.awt.Image
--- a/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c	Wed Jul 05 17:04:26 2017 +0200
@@ -143,8 +143,12 @@
             ERROR1("snd_pcm_hw_params_malloc returned error %d\n", ret);
         } else {
             ret = snd_pcm_hw_params_any(handle, hwParams);
-            if (ret != 0) {
-                ERROR1("snd_pcm_hw_params_any returned error %d\n", ret);
+            /* snd_pcm_hw_params_any can return a positive value on success too */
+            if (ret < 0) {
+                 ERROR1("snd_pcm_hw_params_any returned error %d\n", ret);
+            } else {
+                /* for the logic following this code, set ret to 0 to indicate success */
+                ret = 0;
             }
         }
         snd_pcm_hw_params_get_format_mask(hwParams, formatMask);
--- a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c	Wed Jul 05 17:04:26 2017 +0200
@@ -33,6 +33,7 @@
 #include <X11/extensions/shape.h>
 #include <string.h>
 #include <stdlib.h>
+#include <X11/Sunkeysym.h>
 
 #include <jni.h>
 #include <jni_util.h>
@@ -1214,6 +1215,48 @@
     }
 }
 
+
+JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsSunKeyboard
+(JNIEnv *env, jclass clazz, jlong display)
+{
+    int xx;
+    AWT_CHECK_HAVE_LOCK();
+    xx = XKeysymToKeycode((Display*)jlong_to_ptr(display), SunXK_F37);
+    return (!xx) ? JNI_FALSE : JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XlibWrapper_IsKanaKeyboard
+(JNIEnv *env, jclass clazz, jlong display)
+{
+    int xx;
+    AWT_CHECK_HAVE_LOCK();
+    static jboolean result = JNI_FALSE;
+
+    int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode;
+    KeySym *keySyms, *keySymsStart, keySym;
+    int32_t i;
+    int32_t kanaCount = 0;
+
+    // There's no direct way to determine whether the keyboard has
+    // a kana lock key. From available keyboard mapping tables, it looks
+    // like only keyboards with the kana lock key can produce keysyms
+    // for kana characters. So, as an indirect test, we check for those.
+    XDisplayKeycodes((Display*)jlong_to_ptr(display), &minKeyCode, &maxKeyCode);
+    keySyms = XGetKeyboardMapping((Display*)jlong_to_ptr(display), minKeyCode, maxKeyCode - minKeyCode + 1, &keySymsPerKeyCode);
+    keySymsStart = keySyms;
+    for (i = 0; i < (maxKeyCode - minKeyCode + 1) * keySymsPerKeyCode; i++) {
+        keySym = *keySyms++;
+        if ((keySym & 0xff00) == 0x0400) {
+            kanaCount++;
+        }
+    }
+    XFree(keySymsStart);
+
+    // use a (somewhat arbitrary) minimum so we don't get confused by a stray function key
+    result = kanaCount > 10;
+    return result ? JNI_TRUE : JNI_FALSE;
+}
+
 JavaVM* jvm = NULL;
 static int ToolkitErrorHandler(Display * dpy, XErrorEvent * event) {
     if (jvm != NULL) {
@@ -1261,6 +1304,7 @@
     return (*(XErrorHandler)jlong_to_ptr(handler))((Display*) jlong_to_ptr(display), (XErrorEvent*) jlong_to_ptr(event_ptr));
 }
 
+
 /*
  * Class:     sun_awt_X11_XlibWrapper
  * Method:    PrintXErrorEvent
@@ -1853,6 +1897,17 @@
     AWT_CHECK_HAVE_LOCK();
     XFreeModifiermap((XModifierKeymap*) jlong_to_ptr(keymap));
 }
+/*
+ * Class:     sun_awt_X11_XlibWrapper
+ * Method:    XRefreshKeyboardMapping
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_sun_awt_X11_XlibWrapper_XRefreshKeyboardMapping
+(JNIEnv *env, jclass clazz, jlong event_ptr)
+{
+    AWT_CHECK_HAVE_LOCK();
+    XRefreshKeyboardMapping((XMappingEvent*) jlong_to_ptr(event_ptr));
+}
 
 JNIEXPORT void JNICALL
 Java_sun_awt_X11_XlibWrapper_XChangeActivePointerGrab(JNIEnv *env, jclass clazz,
--- a/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,8 +28,6 @@
 import java.awt.peer.*;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Method;
-import sun.awt.AWTAccessor;
-import sun.awt.ComponentAccessor;
 import sun.awt.SunToolkit;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.PaintEventDispatcher;
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -57,7 +57,7 @@
 
 import java.awt.dnd.DropTarget;
 import java.awt.dnd.peer.DropTargetPeer;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 import sun.util.logging.PlatformLogger;
 
@@ -817,7 +817,7 @@
     }
 
     private void postPaintIfNecessary(int x, int y, int w, int h) {
-        if ( !ComponentAccessor.getIgnoreRepaint( (Component) target) ) {
+        if ( !AWTAccessor.getComponentAccessor().getIgnoreRepaint( (Component) target) ) {
             PaintEvent event = PaintEventDispatcher.getPaintEventDispatcher().
                 createPaintEvent((Component)target, x, y, w, h);
             if (event != null) {
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -72,6 +72,10 @@
 import sun.awt.image.ImageRepresentation;
 import sun.awt.image.ToolkitImage;
 
+import java.util.ArrayList;
+
+import java.io.ByteArrayOutputStream;
+
 /**
  * Platform-specific support for the data transfer subsystem.
  *
@@ -342,6 +346,33 @@
         return imageDataToPlatformImageBytes(imageData, width, height, format);
     }
 
+    private static final byte [] UNICODE_NULL_TERMINATOR =  new byte [] {0,0};
+
+    protected ByteArrayOutputStream convertFileListToBytes(ArrayList<String> fileList)
+        throws IOException
+    {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+        if(fileList.isEmpty()) {
+            //store empty unicode string (null terminator)
+            bos.write(UNICODE_NULL_TERMINATOR);
+        } else {
+            for (int i = 0; i < fileList.size(); i++) {
+                byte[] bytes = fileList.get(i).getBytes(getDefaultUnicodeEncoding());
+                //store unicode string with null terminator
+                bos.write(bytes, 0, bytes.length);
+                bos.write(UNICODE_NULL_TERMINATOR);
+            }
+        }
+
+        // According to MSDN the byte array have to be double NULL-terminated.
+        // The array contains Unicode characters, so each NULL-terminator is
+        // a pair of bytes
+
+        bos.write(UNICODE_NULL_TERMINATOR);
+        return bos;
+    }
+
    /**
     * Returns a byte array which contains data special for the given format
     * and for the given image data.
--- a/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WDialogPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -53,7 +53,12 @@
         }
     }
 
-    native void create(WComponentPeer parent);
+    native void createAwtDialog(WComponentPeer parent);
+    void create(WComponentPeer parent) {
+        preCreate(parent);
+        createAwtDialog(parent);
+    }
+
     native void showModal();
     native void endModal();
 
@@ -93,7 +98,7 @@
 
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
-            WWindowPeer wp = (WWindowPeer)ComponentAccessor.getPeer(w);
+            WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 wp.setModalBlocked((Dialog)target, true);
             }
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -35,7 +35,7 @@
 import java.util.MissingResourceException;
 import java.util.Vector;
 import sun.awt.AppContext;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
 
@@ -187,7 +187,7 @@
 
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
-            WWindowPeer wp = (WWindowPeer)ComponentAccessor.getPeer(w);
+            WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 blockWindow(wp);
             }
--- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -136,6 +136,7 @@
 
     native void createAwtFrame(WComponentPeer parent);
     void create(WComponentPeer parent) {
+        preCreate(parent);
         createAwtFrame(parent);
     }
 
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -31,7 +31,7 @@
 import java.awt.dnd.DropTarget;
 import java.util.Vector;
 import sun.awt.AppContext;
-import sun.awt.ComponentAccessor;
+import sun.awt.AWTAccessor;
 
 public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
 
@@ -103,7 +103,7 @@
 
     public void blockWindows(java.util.List<Window> toBlock) {
         for (Window w : toBlock) {
-            WWindowPeer wp = (WWindowPeer)ComponentAccessor.getPeer(w);
+            WWindowPeer wp = (WWindowPeer)AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 blockWindow(wp);
             }
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Wed Jul 05 17:04:26 2017 +0200
@@ -199,7 +199,17 @@
     }
 
     native void createAwtWindow(WComponentPeer parent);
+
+    private volatile Window.Type windowType = Window.Type.NORMAL;
+
+    // This method must be called for Window, Dialog, and Frame before creating
+    // the hwnd
+    void preCreate(WComponentPeer parent) {
+        windowType = ((Window)target).getType();
+    }
+
     void create(WComponentPeer parent) {
+        preCreate(parent);
         createAwtWindow(parent);
     }
 
--- a/jdk/src/windows/lib/tzmappings	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/lib/tzmappings	Wed Jul 05 17:04:26 2017 +0200
@@ -92,7 +92,7 @@
 North Asia Standard Time:14,15::Asia/Krasnoyarsk:
 SE Asia:14,15::Asia/Bangkok:
 SE Asia Standard Time:14,15::Asia/Bangkok:
-North Asia East Standard Time:16,17::Asia/Ulaanbaatar:
+North Asia East Standard Time:16,17:RU:Asia/Irkutsk:
 Singapore:16,17:SG:Asia/Singapore:
 Singapore Standard Time:16,17:SG:Asia/Singapore:
 Taipei:16,17::Asia/Taipei:
@@ -184,4 +184,5 @@
 Kamchatka Standard Time:916,916:RU:Asia/Kamchatka:
 Paraguay Standard Time:917,917:PY:America/Asuncion:
 Western Brazilian Standard Time:918,918:BR:America/Rio_Branco:
-Armenian Standard Time:919,919:AM:Asia/Yerevan:
+Ulaanbaatar Standard Time:919,919::Asia/Ulaanbaatar:
+Armenian Standard Time:920,920:AM:Asia/Yerevan:
--- a/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp	Wed Jul 05 17:04:26 2017 +0200
@@ -485,7 +485,7 @@
         }
         if (data.line2Start->isSource) {
             data.startResult =
-                data.line2Start->playBuffer->Play(0, 0, DSCBSTART_LOOPING);
+                data.line2Start->playBuffer->Play(0, 0, DSBPLAY_LOOPING);
         } else {
             data.startResult =
                 data.line2Start->captureBuffer->Start(DSCBSTART_LOOPING);
--- a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp	Wed Jul 05 17:04:26 2017 +0200
@@ -760,7 +760,7 @@
  * Signature: (Lsun/awt/windows/WComponentPeer;)V
  */
 JNIEXPORT void JNICALL
-Java_sun_awt_windows_WDialogPeer_create(JNIEnv *env, jobject self,
+Java_sun_awt_windows_WDialogPeer_createAwtDialog(JNIEnv *env, jobject self,
                                         jobject parent)
 {
     TRY;
--- a/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_DnDDS.cpp	Wed Jul 05 17:04:26 2017 +0200
@@ -648,7 +648,7 @@
             dropfiles->pt.x = m_dropPoint.x;
             dropfiles->pt.y = m_dropPoint.y;
             dropfiles->fNC = m_fNC;
-            dropfiles->fWide = FALSE; // good guess!
+            dropfiles->fWide = TRUE; // good guess!
             dataout += sizeof(DROPFILES);
         }
 
@@ -815,7 +815,7 @@
             dropfiles->pt.x = m_dropPoint.x;
             dropfiles->pt.y = m_dropPoint.y;
             dropfiles->fNC = m_fNC;
-            dropfiles->fWide = FALSE; // good guess!
+            dropfiles->fWide = TRUE; // good guess!
             dataout += sizeof(DROPFILES);
         }
 
--- a/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_Toolkit.cpp	Wed Jul 05 17:04:26 2017 +0200
@@ -1518,6 +1518,7 @@
     return defaultIconSm;
 }
 
+// The icon at index 0 must be gray. See AwtWindow::GetSecurityWarningIcon()
 HICON AwtToolkit::GetSecurityWarningIcon(UINT index, UINT w, UINT h)
 {
     //Note: should not exceed 10 because of the current implementation.
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp	Wed Jul 05 17:04:26 2017 +0200
@@ -163,9 +163,11 @@
 jfieldID AwtWindow::sysYID;
 jfieldID AwtWindow::sysWID;
 jfieldID AwtWindow::sysHID;
+jfieldID AwtWindow::windowTypeID;
 
 jmethodID AwtWindow::getWarningStringMID;
 jmethodID AwtWindow::calculateSecurityWarningPositionMID;
+jmethodID AwtWindow::windowTypeNameMID;
 
 int AwtWindow::ms_instanceCounter = 0;
 HHOOK AwtWindow::ms_hCBTFilter;
@@ -216,6 +218,9 @@
     hContentBitmap = NULL;
 
     ::InitializeCriticalSection(&contentBitmapCS);
+
+    m_windowType = Type::NORMAL;
+    m_alwaysOnTop = false;
 }
 
 AwtWindow::~AwtWindow()
@@ -348,10 +353,10 @@
     RECT rect;
     CalculateWarningWindowBounds(env, &rect);
 
-    ::SetWindowPos(warningWindow, HWND_NOTOPMOST,
+    ::SetWindowPos(warningWindow, IsAlwaysOnTop() ? HWND_TOPMOST : GetHWnd(),
             rect.left, rect.top,
             rect.right - rect.left, rect.bottom - rect.top,
-            SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER |
+            SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE |
             SWP_NOOWNERZORDER
             );
 }
@@ -475,6 +480,9 @@
     }
     env->DeleteLocalRef(target);
 
+    InitType(env, peer);
+    TweakStyle(windowStyle, windowExStyle);
+
     AwtCanvas::CreateHWnd(env, title,
             windowStyle,
             windowExStyle,
@@ -645,7 +653,10 @@
 
 HICON AwtWindow::GetSecurityWarningIcon()
 {
-    HICON ico = AwtToolkit::GetInstance().GetSecurityWarningIcon(securityWarningAnimationStage,
+    // It is assumed that the icon at index 0 is gray
+    const UINT index = securityAnimationKind == akShow ?
+        securityWarningAnimationStage : 0;
+    HICON ico = AwtToolkit::GetInstance().GetSecurityWarningIcon(index,
             warningWindowWidth, warningWindowHeight);
     return ico;
 }
@@ -821,7 +832,9 @@
             securityAnimationTimerElapse, NULL);
 
     if (securityAnimationKind == akShow) {
-        ::SetWindowPos(warningWindow, HWND_NOTOPMOST, 0, 0, 0, 0,
+        ::SetWindowPos(warningWindow,
+                IsAlwaysOnTop() ? HWND_TOPMOST : GetHWnd(),
+                0, 0, 0, 0,
                 SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE |
                 SWP_SHOWWINDOW | SWP_NOOWNERZORDER);
 
@@ -982,6 +995,50 @@
     delete rsws;
 }
 
+void AwtWindow::InitType(JNIEnv *env, jobject peer)
+{
+    jobject type = env->GetObjectField(peer, windowTypeID);
+    if (type == NULL) {
+        return;
+    }
+
+    jstring value = (jstring)env->CallObjectMethod(type, windowTypeNameMID);
+    if (value == NULL) {
+        env->DeleteLocalRef(type);
+        return;
+    }
+
+    const char* valueNative = env->GetStringUTFChars(value, 0);
+    if (valueNative == NULL) {
+        env->DeleteLocalRef(value);
+        env->DeleteLocalRef(type);
+        return;
+    }
+
+    if (strcmp(valueNative, "UTILITY") == 0) {
+        m_windowType = Type::UTILITY;
+    } else if (strcmp(valueNative, "POPUP") == 0) {
+        m_windowType = Type::POPUP;
+    }
+
+    env->ReleaseStringUTFChars(value, valueNative);
+    env->DeleteLocalRef(value);
+    env->DeleteLocalRef(type);
+}
+
+void AwtWindow::TweakStyle(DWORD & style, DWORD & exStyle)
+{
+    switch (GetType()) {
+        case Type::UTILITY:
+            exStyle |= WS_EX_TOOLWINDOW;
+            break;
+        case Type::POPUP:
+            style &= ~WS_OVERLAPPED;
+            style |= WS_POPUP;
+            break;
+    }
+}
+
 /* Create a new AwtWindow object and window.   */
 AwtWindow* AwtWindow::Create(jobject self, jobject parent)
 {
@@ -2216,6 +2273,7 @@
     if (::IsWindow(w->GetHWnd()))
     {
         w->SendMessage(WM_AWT_SETALWAYSONTOP, (WPARAM)value, (LPARAM)w);
+        w->m_alwaysOnTop = (bool)value;
     }
 ret:
     env->DeleteGlobalRef(self);
@@ -3008,6 +3066,11 @@
     AwtWindow::calculateSecurityWarningPositionMID =
         env->GetMethodID(cls, "calculateSecurityWarningPosition", "(DDDD)Ljava/awt/geom/Point2D;");
 
+    jclass windowTypeClass = env->FindClass("java/awt/Window$Type");
+    AwtWindow::windowTypeNameMID =
+        env->GetMethodID(windowTypeClass, "name", "()Ljava/lang/String;");
+    env->DeleteLocalRef(windowTypeClass);
+
     CATCH_BAD_ALLOC;
 }
 
@@ -3035,6 +3098,9 @@
     AwtWindow::sysWID = env->GetFieldID(cls, "sysW", "I");
     AwtWindow::sysHID = env->GetFieldID(cls, "sysH", "I");
 
+    AwtWindow::windowTypeID = env->GetFieldID(cls, "windowType",
+            "Ljava/awt/Window$Type;");
+
     CATCH_BAD_ALLOC;
 }
 
--- a/jdk/src/windows/native/sun/windows/awt_Window.h	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h	Wed Jul 05 17:04:26 2017 +0200
@@ -63,8 +63,11 @@
     static jfieldID sysWID;
     static jfieldID sysHID;
 
+    static jfieldID windowTypeID;
+
     static jmethodID getWarningStringMID;
     static jmethodID calculateSecurityWarningPositionMID;
+    static jmethodID windowTypeNameMID;
 
     AwtWindow();
     virtual ~AwtWindow();
@@ -362,10 +365,28 @@
 
     void EnableTranslucency(BOOL enable);
 
+    // Native representation of the java.awt.Window.Type enum
+    enum Type {
+        NORMAL, UTILITY, POPUP
+    };
+
+    inline Type GetType() { return m_windowType; }
+
 private:
     int m_screenNum;
 
     void InitOwner(AwtWindow *owner);
+
+    Type m_windowType;
+    void InitType(JNIEnv *env, jobject peer);
+
+    // Tweak the style according to the type of the window
+    void TweakStyle(DWORD & style, DWORD & exStyle);
+
+    // Set in _SetAlwaysOnTop()
+    bool m_alwaysOnTop;
+public:
+    inline bool IsAlwaysOnTop() { return m_alwaysOnTop; }
 };
 
 #endif /* AWT_WINDOW_H */
--- a/jdk/test/Makefile	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/Makefile	Wed Jul 05 17:04:26 2017 +0200
@@ -282,11 +282,23 @@
 RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt
 PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt
 FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt
+EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt
+
+TESTEXIT = \
+  if [ ! -s $(EXITCODE) ] ; then \
+    $(ECHO) "ERROR: EXITCODE file not filled in."; \
+    $(ECHO) "1" > $(EXITCODE); \
+  fi ; \
+  testExitCode=`$(CAT) $(EXITCODE)`; \
+  $(ECHO) "EXIT CODE: $${testExitCode}"; \
+  exit ${testExitCode}
+
 BUNDLE_UP_AND_EXIT = \
 ( \
-  exitCode=$$? && \
+  jtregExitCode=$$? && \
   _summary="$(SUMMARY_TXT)"; \
-  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST); \
+  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
+  $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
   if [ -r "$${_summary}" ] ; then \
     $(ECHO) "Summary: $${_summary}" > $(STATS_TXT); \
     $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
@@ -297,10 +309,13 @@
       $(EGREP) ' Error\.' $(RUNLIST); \
       $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
       | $(SORT) | $(UNIQ) > $(FAILLIST); \
-    if [ $${exitCode} != 0 -o -s $(FAILLIST) ] ; then \
+    if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
       $(EXPAND) $(FAILLIST) \
         | $(CUT) -d' ' -f1 \
         | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
+      if [ $${jtregExitCode} = 0 ] ; then \
+        jtregExitCode=1; \
+      fi; \
     fi; \
     runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
@@ -312,8 +327,8 @@
     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
   fi; \
   $(CAT) $(STATS_TXT); \
-  $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) && \
-  exit $${exitCode} \
+  $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) ; \
+  $(TESTEXIT) \
 )
 
 ################################################################
@@ -337,9 +352,11 @@
 # jtreg tests
 
 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
-JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
-ifdef JPRT_JTREG_HOME
-  JT_HOME = $(JPRT_JTREG_HOME)
+ifndef JT_HOME
+  JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
+  ifdef JPRT_JTREG_HOME
+    JT_HOME = $(JPRT_JTREG_HOME)
+  endif
 endif
 
 # Expect JPRT to set TESTDIRS to the jtreg test dirs
@@ -361,21 +378,22 @@
 
 # Some tests annoy me and fail frequently
 PROBLEM_LIST=ProblemList.txt
+PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
 EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
 
 # Create exclude list for this platform and arch
 ifdef NO_EXCLUDES
-$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS)
+$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
 	@$(ECHO) "NOTHING_EXCLUDED" > $@
 else
-$(EXCLUDELIST): $(PROBLEM_LIST) $(TESTDIRS)
+$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
 	@$(RM) $@ $@.temp1 $@.temp2
-	@( ( $(EGREP) -- '$(OS_NAME)-all'           $< ) ;\
-	   ( $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)'    $< ) ;\
-	   ( $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)' $< ) ;\
-	   ( $(EGREP) -- 'generic-$(OS_ARCH)'       $< ) ;\
-           ( $(EGREP) -- 'generic-all'              $< ) ;\
-           ( $(ECHO) "#") ;\
+	@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\
+	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)'   ) ;\
+	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
+	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)'      ) ;\
+          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all'             ) ;\
+          ($(ECHO) "#") ;\
         ) | $(SED) -e 's@^[\ ]*@@' \
           | $(EGREP) -v '^#' > $@.temp1
 	@for tdir in $(TESTDIRS) ; do \
@@ -386,14 +404,18 @@
 	@$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
 endif
 
+# Select list of directories that exist
+define TestDirs
+$(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
+endef
 # Running batches of tests with or without samevm
 define RunSamevmBatch
-$(ECHO) "Running tests in samevm mode: $?"
-$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=true  UNIQUE_DIR=$@ jtreg_tests
+$(ECHO) "Running tests in samevm mode: $(call TestDirs, $?)"
+$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=true  UNIQUE_DIR=$@ jtreg_tests
 endef
 define RunOthervmBatch
-$(ECHO) "Running tests in othervm mode: $?"
-$(MAKE) TESTDIRS="$?" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
+$(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)"
+$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
 endef
 define SummaryInfo
 $(ECHO) "Summary for: $?"
@@ -428,6 +450,9 @@
 jdk_beans3: java/beans/XMLEncoder
 	$(call RunOthervmBatch)
 
+jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
+	@$(SummaryInfo)
+
 # Stable samevm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_io
 jdk_io: java/io
@@ -450,6 +475,9 @@
 jdk_management2: com/sun/jmx com/sun/management sun/management
 	$(call RunOthervmBatch)
 
+jdk_management: jdk_management1 jdk_management2
+	@$(SummaryInfo)
+
 # Stable samevm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_math
 jdk_math: java/math
@@ -482,6 +510,9 @@
 jdk_nio3: com/sun/nio sun/nio
 	$(call RunOthervmBatch)
 
+jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3
+	@$(SummaryInfo)
+
 # Stable othervm testruns (minus items from PROBLEM_LIST)
 #   Using samevm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_rmi
@@ -502,6 +533,9 @@
 jdk_security3: com/sun/security lib/security javax/security sun/security
 	$(call RunOthervmBatch)
 
+jdk_security: jdk_security1 jdk_security2 jdk_security3
+	@$(SummaryInfo)
+
 # Stable othervm testruns (minus items from PROBLEM_LIST)
 #   Using samevm has problems, and doesn't help performance as much as others.
 JDK_ALL_TARGETS += jdk_swing
@@ -517,11 +551,14 @@
 #   Using samevm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_tools1
 jdk_tools1: com/sun/jdi
-	$(call RunOthervmBatch)
+	$(call RunSamevmBatch)
 JDK_ALL_TARGETS += jdk_tools2
 jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
 	$(call RunOthervmBatch)
 
+jdk_tools: jdk_tools1 jdk_tools2
+	@$(SummaryInfo)
+
 # Stable samevm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_util
 jdk_util: java/util sun/util
@@ -576,7 +613,7 @@
               $(JTREG_TEST_OPTIONS)                                          \
               $(TESTDIRS)                                                    \
 	  ) ; $(BUNDLE_UP_AND_EXIT)                                          \
-	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt
+	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
 
 PHONY_LIST += jtreg_tests
 
--- a/jdk/test/ProblemList.txt	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/ProblemList.txt	Wed Jul 05 17:04:26 2017 +0200
@@ -344,6 +344,9 @@
 # Some of these tests (like java/lang/management) may just need to be marked
 #   othervm, but that is partially speculation.
 
+# Samevm failure on OpenSolaris, security manager?
+java/lang/ClassLoader/UninitializedParent.java			generic-all
+
 # Times out on solaris 10 sparc
 java/lang/ClassLoader/Assert.java				generic-all
 
@@ -538,6 +541,18 @@
 # Missing close on file wbmp*, windows samevm
 javax/imageio/plugins/wbmp/CanDecodeTest.java			generic-all
 
+# Failures on OpenSolaris, cannot read input files? samevm issues?
+javax/imageio/metadata/BooleanAttributes.java			generic-all
+javax/imageio/plugins/bmp/BMPSubsamplingTest.java		generic-all
+javax/imageio/plugins/bmp/TopDownTest.java			generic-all
+javax/imageio/plugins/gif/EncodeSubImageTest.java		generic-all
+javax/imageio/plugins/gif/GifTransparencyTest.java		generic-all
+javax/imageio/plugins/png/GrayPngTest.java			generic-all
+javax/imageio/plugins/png/ItxtUtf8Test.java			generic-all
+javax/imageio/plugins/png/MergeStdCommentTest.java		generic-all
+javax/imageio/plugins/png/ShortHistogramTest.java		generic-all
+javax/imageio/plugins/shared/BitDepth.java			generic-all
+
 # Exclude all javax/print tests, even if they passed, they may need samevm work
 
 # Times out on solaris-sparc, sparcv9, x64 -server, some on i586 -client
@@ -1073,9 +1088,6 @@
 #  So most if not all tools tests are now being run with "othervm" mode.
 #  Some of these tools tests have a tendency to use fixed ports, bad idea.
 
-# Solaris 10 client x86, java.lang.IndexOutOfBoundsException resumer Interrupted
-com/sun/jdi/SimulResumerTest.java				generic-all
-
 # Output of jps differs from expected output.
 #   Invalid argument count on solaris-sparc and x64
 sun/tools/jstatd/jstatdPort.sh					generic-all
@@ -1087,12 +1099,17 @@
 sun/tools/jps/jps-Vvml_2.sh					generic-all
 sun/tools/jps/jps-m_2.sh					generic-all
 
+# Fails on OpenSolaris "Could not synchronize with target"
+sun/tools/jps/jps-Defaults.sh					generic-all
+sun/tools/jps/jps-V_2.sh					generic-all
+sun/tools/jps/jps-Vm_2.sh					generic-all
+sun/tools/jps/jps-Vvm.sh					generic-all
+sun/tools/jps/jps-Vvml.sh					generic-all
+sun/tools/jps/jps-m.sh						generic-all
+
 # Server name error, port 2098 problem?
 sun/tools/jstatd/jstatdServerName.sh				generic-all
 
-# Solaris, handshake failed, othervm mode
-com/sun/jdi/RedefineException.sh				generic-all
-
 # These tests fail on solaris sparc, all the time
 com/sun/servicetag/DeleteServiceTag.java			generic-all
 com/sun/servicetag/DuplicateNotFound.java			generic-all
@@ -1117,9 +1134,6 @@
 # Unexpected Monitor Exception, solaris sparc -client
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh	generic-all
 
-# Probably should be samevm, but seem to cause errors even in othervm at times
-sun/tools/jhat/HatHeapDump1Test.java			 	generic-all
-
 # Problems on windows, jmap.exe hangs? (these run jmap)
 sun/tools/jmap/Basic.sh						windows-all
 
@@ -1129,9 +1143,6 @@
 # Solaris sparcv9, jps output does not match, x64 different
 sun/tools/jstatd/jstatdExternalRegistry.sh		 	solaris-all
 
-# Probably should be samevm, but seem to cause errors even in othervm at times
-sun/tools/native2ascii/NativeErrors.java		 	generic-all
-
 # Solaris 10 sparc 32bit -client, java.lang.AssertionError: Some tests failed
 tools/jar/JarEntryTime.java					generic-all
 
--- a/jdk/test/com/sun/jdi/BadHandshakeTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/BadHandshakeTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -110,8 +110,11 @@
         String exe =   System.getProperty("java.home")
                      + File.separator + "bin" + File.separator;
         String arch = System.getProperty("os.arch");
-        if (arch.equals("sparcv9")) {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
             exe += "sparcv9/java";
+        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
+            exe += "amd64/java";
         } else {
             exe += "java";
         }
--- a/jdk/test/com/sun/jdi/DoubleAgentTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/DoubleAgentTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -92,8 +92,11 @@
         String exe =   System.getProperty("java.home")
                      + File.separator + "bin" + File.separator;
         String arch = System.getProperty("os.arch");
-        if (arch.equals("sparcv9")) {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
             exe += "sparcv9/java";
+        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
+            exe += "amd64/java";
         } else {
             exe += "java";
         }
--- a/jdk/test/com/sun/jdi/ExclusiveBind.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/ExclusiveBind.java	Wed Jul 05 17:04:26 2017 +0200
@@ -99,8 +99,11 @@
         String exe = System.getProperty("java.home") + File.separator + "bin" +
             File.separator;
         String arch = System.getProperty("os.arch");
-        if (arch.equals("sparcv9")) {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
             exe += "sparcv9/java";
+        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
+            exe += "amd64/java";
         } else {
             exe += "java";
         }
--- a/jdk/test/com/sun/jdi/JITDebug.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/JITDebug.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -103,10 +103,10 @@
    #if running standalone (no test harness of any kind), compile the
    #support files and the test case
    ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." \
+            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
             TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
    ${TESTJAVA}/bin/javac  -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." -g \
+            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \
             JITDebug.java
 fi
 echo "JDK under test is: $TESTJAVA"
--- a/jdk/test/com/sun/jdi/RepStep.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/RepStep.java	Wed Jul 05 17:04:26 2017 +0200
@@ -29,7 +29,7 @@
  *  @run compile -g RepStepTarg.java
  *  @run build VMConnection RepStep
  *
- *  @run main RepStep
+ *  @run main/othervm RepStep
  *
  * @summary RepStep detects missed step events due to lack of
  * frame pop events (in back-end).
--- a/jdk/test/com/sun/jdi/RunToExit.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/RunToExit.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @summary Test that with server=y, when VM runs to System.exit() no error happens
  *
  * @build VMConnection RunToExit Exit0
- * @run main RunToExit
+ * @run main/othervm RunToExit
  */
 import java.io.InputStream;
 import java.io.IOException;
@@ -115,8 +115,11 @@
         String exe =   System.getProperty("java.home")
                      + File.separator + "bin" + File.separator;
         String arch = System.getProperty("os.arch");
-        if (arch.equals("sparcv9")) {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
             exe += "sparcv9/java";
+        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
+            exe += "amd64/java";
         } else {
             exe += "java";
         }
--- a/jdk/test/com/sun/jdi/ShellScaffold.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/ShellScaffold.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright 2002-2005 Sun Microsystems, Inc.  All Rights Reserved.
+# Copyright 2002-2009 Sun Microsystems, Inc.  All Rights Reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -194,7 +194,7 @@
     # Return 0 if $1 is the pid of a running process.
     if [ -z "$isWin98" ] ; then
         if [ "$osname" = SunOS ] ; then
-            #Solaris and OpenSolaris use pgrep and not ps in psCmd
+            # Solaris and OpenSolaris use pgrep and not ps in psCmd
             findPidCmd="$psCmd"
         else
             #   Never use plain 'ps', which requires a "controlling terminal"
@@ -298,15 +298,15 @@
          # On linux, core files take a long time, and can leave
          # zombie processes
          if [ "$osname" = SunOS ] ; then
-             #Experiments show Solaris '/usr/ucb/ps -axwww' and
-             #'/usr/bin/pgrep -f -l' provide the same small amount of the
-             #argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
-             # 1) This seems to have been working OK in ShellScaffold.
-             # 2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
-             #    instead
-             #The alternative would be to use /usr/bin/pargs [pid] to get
-             #all the args for a process, splice them back into one
-             #long string, then grep.
+             # Experiments show Solaris '/usr/ucb/ps -axwww' and
+             # '/usr/bin/pgrep -f -l' provide the same small amount of the
+             # argv string (PRARGSZ=80 in /usr/include/sys/procfs.h)
+             #  1) This seems to have been working OK in ShellScaffold.
+             #  2) OpenSolaris does not provide /usr/ucb/ps, so use pgrep
+             #     instead
+             # The alternative would be to use /usr/bin/pargs [pid] to get
+             # all the args for a process, splice them back into one
+             # long string, then grep.
              UU=`/usr/xpg4/bin/id -u -n`
              psCmd="pgrep -f -l -U $UU"
          else
@@ -519,7 +519,7 @@
         # if jdb got a cont cmd that caused the debuggee
         # to run to completion, jdb can be gone before
         # we get here.
-        echo quit >& 2
+        echo "--Sending cmd: quit" >& 2
         echo quit
         # See 6562090. Maybe there is a way that the exit
         # can cause jdb to not get the quit.
@@ -531,7 +531,7 @@
     # because after starting jdb, we waited 
     # for the prompt.
     fileSize=`wc -c $jdbOutFile | awk '{ print $1 }'`
-    echo $* >&2
+    echo "--Sending cmd: " $* >&2
 
     # jjh: We have a few intermittent failures here.
     # It is as if every so often, jdb doesn't
@@ -558,12 +558,85 @@
     # seen the ].  
     echo $*
 
-    # wait for jdb output to appear
+    # Now we have to wait for the next jdb prompt.  We wait for a pattern
+    # to appear in the last line of jdb output.  Normally, the prompt is
+    #
+    # 1) ^main[89] @
+    #
+    # where ^ means start of line, and @ means end of file with no end of line
+    # and 89 is the current command counter. But we have complications e.g.,
+    # the following jdb output can appear:
+    #
+    # 2) a[89] = 10
+    #
+    # The above form is an array assignment and not a prompt.
+    #
+    # 3) ^main[89] main[89] ...
+    #
+    # This occurs if the next cmd is one that causes no jdb output, e.g.,
+    # 'trace methods'.
+    #
+    # 4) ^main[89] [main[89]] .... > @
+    #
+    # jdb prints a > as a prompt after something like a cont.
+    # Thus, even though the above is the last 'line' in the file, it
+    # isn't the next prompt we are waiting for after the cont completes.
+    # HOWEVER, sometimes we see this for a cont command:
+    #
+    #   ^main[89] $
+    #      <lines output for hitting a bkpt>
+    #
+    # 5) ^main[89] > @
+    #
+    # i.e., the > prompt comes out AFTER the prompt we we need to wait for.
+    #
+    # So, how do we know when the next prompt has appeared??
+    # 1.  Search for 
+    #         main[89] $
+    #     This will handle cases 1, 2, 3
+    # 2.  This leaves cases 4 and 5.
+    #
+    # What if we wait for 4 more chars to appear and then search for
+    #
+    #    main[89] [>]$
+    #
+    # on the last line?
+    #
+    # a.  if we are currently at
+    #
+    #       ^main[89] main[89] @
+    #
+    #     and a 'trace methods comes in, we will wait until at least
+    #
+    #       ^main[89] main[89] main@
+    #
+    #     and then the search will find the new prompt when it completes.
+    #
+    # b.  if we are currently at
+    #
+    #       ^main[89] main[89] @
+    #
+    #     and the first form of cont comes in, then we will see
+    #
+    #       ^main[89] main[89] > $
+    #       ^x@
+    #
+    #     where x is the first char of the msg output when the bkpt is hit
+    #     and we will start our search, which will find the prompt
+    #     when it comes out after the bkpt output, with or without the
+    #     trailing >
+    #
+
+    # wait for 4 new chars to appear in the jdb output
     count=0
+    desiredFileSize=`expr $fileSize + 4`
     msg1=`echo At start: cmd/size/waiting : $* / $fileSize / \`date\``
     while [ 1 = 1 ] ; do
         newFileSize=`wc -c $jdbOutFile | awk '{ print $1 } '`
-        if [ "$fileSize" != "$newFileSize" ] ; then
+        #echo jj: desired = $desiredFileSize, new = $newFileSize >& 2
+
+        done=`expr $newFileSize \>= $desiredFileSize`
+        if [ $done = 1 ] ; then
             break
         fi
         sleep ${sleep_seconds}
@@ -573,14 +646,19 @@
             echo "--DEBUG: jdb $$ didn't responded to command in $count secs: $*" >& 2
             echo "--DEBUG:" $msg1 >& 2
             echo "--DEBUG: "done size/waiting : / $newFileSize  / `date` >& 2
-            $psCmd | sed -e '/com.sun.javatest/d' -e '/nsk/d' >& 2
+            echo "-- $jdbOutFile follows-------------------------------" >& 2
+            cat $jdbOutFile >& 2
+            echo "------------------------------------------" >& 2
+            dojstack
+            #$psCmd | sed -e '/com.sun.javatest/d' -e '/nsk/d' >& 2
             if [ $count = 60 ] ; then
                 dofail "jdb never responded to command: $*"
             fi
         fi
     done
-
-    waitForJdbMsg '^.*\[[0-9]*\] $' 1 allowExit
+    # Note that this assumes just these chars in thread names.
+    waitForJdbMsg '[a-zA-Z0-9_-][a-zA-Z0-9_-]*\[[1-9][0-9]*\] [ >]*$' \
+        1 allowExit
 }
 
 setBkpts()
@@ -596,15 +674,19 @@
 runToBkpt()
 {
     cmd run
+    # Don't need to do this - the above waits for the next prompt which comes out
+    # AFTER the Breakpoint hit message.
     # Wait for jdb to hit the bkpt
-    waitForJdbMsg "Breakpoint hit" 5
+    #waitForJdbMsg "Breakpoint hit" 5
 }
 
 contToBkpt()
 {
     cmd cont
+    # Don't need to do this - the above waits for the next prompt which comes out
+    # AFTER the Breakpoint hit message.
     # Wait for jdb to hit the bkpt
-    waitForJdbMsg "Breakpoint hit" 5
+    #waitForJdbMsg "Breakpoint hit" 5
 }
 
 
@@ -618,7 +700,7 @@
     nlines=$2
     allowExit="$3"
     myCount=0
-    timeLimit=40  # wait a max of 40 secs for a response from a jdb command
+    timeLimit=40  # wait a max of this many secs for a response from a jdb command
     while [ 1 = 1 ] ; do 
         if [  -r $jdbOutFile ] ; then
             # Something here causes jdb to complain about Unrecognized cmd on x86.
@@ -654,8 +736,11 @@
 
         myCount=`expr $myCount + ${sleep_seconds}`
         if [ $myCount -gt $timeLimit ] ; then
+            echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds, looking for /$1/, in $nlines lines; exitting" >> $failFile
+            echo "vv jdbOutFile  vvvvvvvvvvvvvvvvvvvvvvvvvvvv" >& 2
+            cat $jdbOutFile >& 2
+            echo "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" >& 2
             dojstack
-            echo "--Fail: waitForJdbMsg timed out after $timeLimit seconds; exitting" >> $failFile
             exit 1
         fi
     done
@@ -865,35 +950,29 @@
     # get inserted into the string we are searching for 
     # so ignore those chars.
     if [ -z "$3" ] ; then
-        case "$2" in 
-          *\>*)
-            # Target string contains a > so we better
-            # not ignore it
-            $grep -s "$2" $1  > $devnull 2>&1
-            stat=$?
-            ;;
-          *)
-            # Target string does not contain a >.
-            # Ignore > and '> ' in the file.
-            cat $1 | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
-            stat=$?
-        esac
+        theCmd=cat
     else
-        case "$2" in 
-          *\>*)
-            # Target string contains a > so we better
-            # not ignore it
-            tail -$3 $1 | $grep -s "$2"  > $devnull 2>&1
-            stat=$?
-            ;;
-          *)
-            # Target string does not contain a >.
-            # Ignore > and '> ' in the file.
-            tail -$3 $1 | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
-            stat=$?
-            ;;
-        esac
+        theCmd="tail -$3"
     fi
+    case "$2" in 
+      *\>*)
+        # Target string contains a > so we better
+        # not ignore it
+        $theCmd $1 | $grep -s "$2"  > $devnull 2>&1
+        return $?
+        ;;
+    esac
+    # Target string does not contain a >.
+    # Ignore > and '> ' in the file.
+    # NOTE:  if $1 does not end with a new line, piping it to sed doesn't include the
+    # chars on the last line.  Detect this case, and add a new line.
+    cp $1 $1.tmp
+    if [ `tail -1 $1.tmp | wc -l | sed -e 's@ @@g'` = 0 ] ; then
+        echo >> $1.tmp
+    fi
+    $theCmd $1.tmp | sed -e 's@> @@g' -e 's@>@@g' | $grep -s "$2" > $devnull 2>&1
+    stat=$?
+    rm -f $1.tmp
     return $stat
 }
 
--- a/jdk/test/com/sun/jdi/SimulResumerTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/SimulResumerTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -30,7 +30,7 @@
  *
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -g SimulResumerTest.java
- *  @run main SimulResumerTest
+ *  @run main/othervm SimulResumerTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- a/jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/Solaris32AndSolaris64Test.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -164,10 +164,10 @@
 if [ -n "${STANDALONE}" ] ; then 
    #if running standalone, compile the support files
    ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." \
+            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" \
             TestScaffold.java VMConnection.java TargetListener.java TargetAdapter.java
    ${TESTJAVA}/bin/javac -d ${TESTCLASSES} \
-            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}." -g \
+            -classpath "$TESTJAVA/lib/tools.jar${PATHSEP}${TESTSRC}" -g \
             FetchLocals.java DataModelTest.java
 fi
 
--- a/jdk/test/com/sun/jdi/VMConnection.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/VMConnection.java	Wed Jul 05 17:04:26 2017 +0200
@@ -57,6 +57,7 @@
         if (testClasses == null) {
             return retVal;
         }
+        retVal += "-classpath " + testClasses + " ";
         File myFile = new File(testClasses, "@debuggeeVMOptions");
 
         if (!myFile.canRead()) {
@@ -97,7 +98,7 @@
             if (line.length() != 0 && !line.startsWith("#")) {
                 System.out.println("-- Added debuggeeVM options from file " +
                                    wholePath + ": " + line);
-                retVal = line;
+                retVal += line;
                 break;
             }
             // Else, read he next line.
--- a/jdk/test/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/connect/spi/DebugUsingCustomConnector.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,7 +28,7 @@
  * This tests launches a debuggee using a custom LaunchingConnector.
  *
  * @build DebugUsingCustomConnector SimpleLaunchingConnector Foo NullTransportService
- * @run main DebugUsingCustomConnector
+ * @run main/othervm DebugUsingCustomConnector
  */
 import com.sun.jdi.*;
 import com.sun.jdi.connect.*;
--- a/jdk/test/com/sun/jdi/connect/spi/GeneratedConnectors.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/connect/spi/GeneratedConnectors.java	Wed Jul 05 17:04:26 2017 +0200
@@ -31,7 +31,7 @@
  * created and that they have an "address" argument.
  *
  * @build GeneratedConnectors NullTransportService
- * @run main GeneratedConnectors
+ * @run main/othervm GeneratedConnectors
  */
 
 import com.sun.jdi.*;
--- a/jdk/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/connect/spi/SimpleLaunchingConnector.java	Wed Jul 05 17:04:26 2017 +0200
@@ -145,13 +145,18 @@
         String exe = System.getProperty("java.home") + File.separator + "bin" +
             File.separator;
         String arch = System.getProperty("os.arch");
-        if (arch.equals("sparcv9")) {
+        String osname = System.getProperty("os.name");
+        if (osname.equals("SunOS") && arch.equals("sparcv9")) {
             exe += "sparcv9/java";
+        } else if (osname.equals("SunOS") && arch.equals("amd64")) {
+            exe += "amd64/java";
         } else {
             exe += "java";
         }
         String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
-            key.address() + "" + className;
+            key.address() +
+            " -classpath " + System.getProperty("test.classes") +
+            " " + className;
         Process process = Runtime.getRuntime().exec(cmd);
         Connection conn = ts.accept(key, 30*1000, 9*1000);
         ts.stopListening(key);
--- a/jdk/test/com/sun/jdi/redefine/RedefineTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/com/sun/jdi/redefine/RedefineTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
  *  @run build TestScaffold VMConnection TargetListener TargetAdapter
  *  @run compile -g RedefineTest.java
  *  @run shell RedefineSetUp.sh
- *  @run main RedefineTest
+ *  @run main/othervm RedefineTest
  */
 import com.sun.jdi.*;
 import com.sun.jdi.event.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/tracing/BasicWithSecurityMgr.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * @test
+ * @bug 6899605
+ * @summary Basic unit test for tracing framework with security manager
+ *          enabled
+ */
+
+import com.sun.tracing.*;
+import java.lang.reflect.Method;
+
+@ProviderName("NamedProvider")
+interface BasicProvider extends Provider {
+    void plainProbe();
+    void probeWithArgs(int a, float f, String s, Long l);
+    @ProbeName("namedProbe") void probeWithName();
+    void overloadedProbe();
+    void overloadedProbe(int i);
+}
+
+interface InvalidProvider extends Provider {
+    int nonVoidProbe();
+}
+
+public class BasicWithSecurityMgr {
+
+    public static ProviderFactory factory;
+    public static BasicProvider bp;
+
+    public static void main(String[] args) throws Exception {
+        // enable security manager
+        System.setSecurityManager(new SecurityManager());
+
+        factory = ProviderFactory.getDefaultFactory();
+        if (factory != null) {
+            bp = factory.createProvider(BasicProvider.class);
+        }
+
+        testProviderFactory();
+        testProbe();
+        testProvider();
+    }
+
+    static void fail(String s) throws Exception {
+        throw new Exception(s);
+    }
+
+    static void testProviderFactory() throws Exception {
+        if (factory == null) {
+            fail("ProviderFactory.getDefaultFactory: Did not create factory");
+        }
+        if (bp == null) {
+            fail("ProviderFactory.createProvider: Did not create provider");
+        }
+        try {
+            factory.createProvider(null);
+            fail("ProviderFactory.createProvider: Did not throw NPE for null");
+        } catch (NullPointerException e) {}
+
+       try {
+           factory.createProvider(InvalidProvider.class);
+           fail("Factory.createProvider: Should error with non-void probes");
+       } catch (IllegalArgumentException e) {}
+    }
+
+    public static void testProvider() throws Exception {
+
+       // These just shouldn't throw any exeptions:
+       bp.plainProbe();
+       bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
+       bp.probeWithArgs(42, (float)3.14, null, null);
+       bp.probeWithName();
+       bp.overloadedProbe();
+       bp.overloadedProbe(42);
+
+       Method m = BasicProvider.class.getMethod("plainProbe");
+       Probe p = bp.getProbe(m);
+       if (p == null) {
+           fail("Provider.getProbe: Did not return probe");
+       }
+
+       Method m2 = BasicWithSecurityMgr.class.getMethod("testProvider");
+       p = bp.getProbe(m2);
+       if (p != null) {
+           fail("Provider.getProbe: Got probe with invalid spec");
+       }
+
+       bp.dispose();
+       // These just shouldn't throw any exeptions:
+       bp.plainProbe();
+       bp.probeWithArgs(42, (float)3.14, "spam", new Long(2L));
+       bp.probeWithArgs(42, (float)3.14, null, null);
+       bp.probeWithName();
+       bp.overloadedProbe();
+       bp.overloadedProbe(42);
+
+       if (bp.getProbe(m) != null) {
+           fail("Provider.getProbe: Should return null after dispose()");
+       }
+
+       bp.dispose(); // just to make sure nothing bad happens
+    }
+
+    static void testProbe() throws Exception {
+       Method m = BasicProvider.class.getMethod("plainProbe");
+       Probe p = bp.getProbe(m);
+       p.isEnabled(); // just make sure it doesn't do anything bad
+       p.trigger();
+
+       try {
+         p.trigger(0);
+         fail("Probe.trigger: too many arguments not caught");
+       } catch (IllegalArgumentException e) {}
+
+       p = bp.getProbe(BasicProvider.class.getMethod(
+           "probeWithArgs", int.class, float.class, String.class, Long.class));
+       try {
+         p.trigger();
+         fail("Probe.trigger: too few arguments not caught");
+       } catch (IllegalArgumentException e) {}
+
+       try {
+         p.trigger((float)3.14, (float)3.14, "", new Long(0L));
+         fail("Probe.trigger: wrong type primitive arguments not caught");
+       } catch (IllegalArgumentException e) {}
+    }
+}
--- a/jdk/test/demo/jvmti/hprof/CpuOldTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/CpuOldTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5012882 6299047
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g HelloWorld.java ../DemoRun.java
+ * @compile -g HelloWorld.java ../DemoRun.java
  * @build CpuOldTest
  * @run main CpuOldTest HelloWorld
  */
--- a/jdk/test/demo/jvmti/hprof/CpuSamplesTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/CpuSamplesTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5012882
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g:lines HelloWorld.java ../DemoRun.java
+ * @compile -g:lines HelloWorld.java ../DemoRun.java
  * @build CpuSamplesTest
  * @run main CpuSamplesTest HelloWorld
  */
--- a/jdk/test/demo/jvmti/hprof/CpuTimesDefineClassTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/CpuTimesDefineClassTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5097131 6299047
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g HelloWorld.java DefineClass.java ../DemoRun.java
+ * @compile -g HelloWorld.java DefineClass.java ../DemoRun.java
  * @build CpuTimesDefineClassTest
  * @run main CpuTimesDefineClassTest DefineClass
  *
--- a/jdk/test/demo/jvmti/hprof/CpuTimesTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/CpuTimesTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5012882 6299047
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g HelloWorld.java ../DemoRun.java
+ * @compile -g HelloWorld.java ../DemoRun.java
  * @build CpuTimesTest
  * @run main CpuTimesTest HelloWorld
  */
--- a/jdk/test/demo/jvmti/hprof/HeapAllTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/HeapAllTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5012882 6299047
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g HelloWorld.java ../DemoRun.java
+ * @compile -g HelloWorld.java ../DemoRun.java
  * @build HeapAllTest
  * @run main HeapAllTest HelloWorld
  */
--- a/jdk/test/demo/jvmti/hprof/HeapBinaryFormatTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/HeapBinaryFormatTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 4965057 6313381
  * @summary Test jvmti hprof format=b
  *
- * @compile -source 1.5 -g:source HelloWorld.java ../DemoRun.java
+ * @compile -g:source HelloWorld.java ../DemoRun.java
  * @build HeapBinaryFormatTest
  * @run main HeapBinaryFormatTest HelloWorld
  */
--- a/jdk/test/demo/jvmti/hprof/HeapDumpTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/HeapDumpTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5012882 6299047
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g:source HelloWorld.java ../DemoRun.java
+ * @compile -g:source HelloWorld.java ../DemoRun.java
  * @build HeapDumpTest
  * @run main HeapDumpTest HelloWorld
  */
--- a/jdk/test/demo/jvmti/hprof/HeapSitesTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/HeapSitesTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5012882 6299047
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g:vars HelloWorld.java ../DemoRun.java
+ * @compile -g:vars HelloWorld.java ../DemoRun.java
  * @build HeapSitesTest
  * @run main HeapSitesTest HelloWorld
  */
--- a/jdk/test/demo/jvmti/hprof/OptionsTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/demo/jvmti/hprof/OptionsTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 5083441 6299047
  * @summary Test jvmti hprof
  *
- * @compile -source 1.5 -g:lines HelloWorld.java ../DemoRun.java
+ * @compile -g:lines HelloWorld.java ../DemoRun.java
  * @build OptionsTest
  * @run main OptionsTest HelloWorld
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/EventQueue/PushPopDeadlock2/PushPopTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+  @test
+  @bug 4913324
+  @author Oleg Sukhodolsky: area=eventqueue
+  @run main/timeout=30 PushPopTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.util.EmptyStackException;
+import sun.awt.SunToolkit;
+
+public class PushPopTest {
+
+    public static Frame frame;
+    public static void main(String[] args) {
+        frame = new Frame("");
+        frame.pack();
+
+        Runnable dummy = new Runnable() {
+                public void run() {
+                    System.err.println("Dummy is here.");
+                }
+            };
+        EventQueue seq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+        MyEventQueue1 eq1 = new MyEventQueue1();
+        MyEventQueue2 eq2 = new MyEventQueue2();
+        EventQueue.invokeLater(dummy);
+
+        seq.push(eq1);
+        EventQueue.invokeLater(dummy);
+
+        eq1.push(eq2);
+        EventQueue.invokeLater(dummy);
+        Runnable runnable = new Runnable() {
+                public void run() {
+                    System.err.println("Dummy from SunToolkit");
+                }
+            };
+        InvocationEvent ie = new InvocationEvent(eq2, runnable, null, false);
+        System.err.println(ie);
+        SunToolkit.postEvent(SunToolkit.targetToAppContext(frame), ie);
+        eq1.pop();
+        frame.dispose();
+    }
+}
+
+class MyEventQueue1 extends EventQueue {
+
+    public void pop() throws EmptyStackException {
+        super.pop();
+    }
+}
+
+class MyEventQueue2 extends EventQueue {
+
+    protected void pop() throws EmptyStackException {
+        System.err.println("pop2()");
+        Thread.dumpStack();
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                    public void run() {
+                        Runnable runnable = new Runnable() {
+                                public void run() {
+                                    System.err.println("Dummy from here");
+                                }
+                             };
+                        InvocationEvent ie = new InvocationEvent(MyEventQueue2.this, runnable, null, false);
+                        SunToolkit.postEvent(SunToolkit.targetToAppContext(PushPopTest.frame), ie);
+                        postEvent(ie);
+                    }
+                });
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        } catch (java.lang.reflect.InvocationTargetException ie) {
+            ie.printStackTrace();
+        }
+        super.pop();
+    }
+}
--- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java	Wed Jul 05 17:04:26 2017 +0200
@@ -50,13 +50,7 @@
 
 import java.applet.Applet;
 import java.awt.*;
-import java.lang.reflect.InvocationTargetException;
 import java.awt.event.*;
-import java.awt.peer.DialogPeer;
-import java.awt.peer.ComponentPeer;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
 import test.java.awt.regtesthelpers.Util;
 
@@ -94,11 +88,13 @@
                 }
             }, AWTEvent.KEY_EVENT_MASK);
 
+        KeyboardFocusManager.setCurrentKeyboardFocusManager(new TestKFM());
+
         this.setLayout (new BorderLayout ());
 
         f = new Frame("frame");
         b = new Button("press");
-        d = new TestDialog(f, "dialog", true, robotSema);
+        d = new Dialog(f, "dialog", true);
         ok = new Button("ok");
         d.add(ok);
         d.pack();
@@ -170,6 +166,11 @@
         } catch (InterruptedException ie) {
             throw new RuntimeException("Interrupted!");
         }
+        if (!robotSema.getState()) {
+            throw new RuntimeException("robotSema hasn't been triggered");
+        }
+
+        System.err.println("typing ahead");
         robot.keyPress(KeyEvent.VK_SPACE);
         robot.keyRelease(KeyEvent.VK_SPACE);
         waitForIdle();
@@ -278,65 +279,14 @@
         }
     }
 
-    // Fix for 6446952.
-    // In the process of showing the dialog we have to catch peer.show() call
-    // so that to trigger key events just before it gets invoked.
-    // We base on the fact that a modal dialog sets type-ahead markers
-    // before it calls 'show' on the peer.
-    // Posting the key events before dialog.setVisible(true) would be actually not
-    // good because it would be Ok to dispatch them to the current focus owner,
-    // not to the dialog.
-    class TestDialog extends Dialog {
-        ComponentPeer origDialogPeer;
-        ComponentPeer proxyInstPeer;
-        Semaphore trigger;
-
-        TestDialog(Frame owner, String title, boolean modal, Semaphore trigger) {
-            super(owner, title, modal);
-            this.trigger = trigger;
-        }
-        public ComponentPeer getPeer() {
-            ComponentPeer ret = super.getPeer();
-            if (ret == proxyInstPeer) {
-                return origDialogPeer;
-            } else {
-                return ret;
-            }
-        }
+    class TestKFM extends DefaultKeyboardFocusManager {
+        protected synchronized void enqueueKeyEvents(long after,
+                                                     Component untilFocused)
+        {
+            super.enqueueKeyEvents(after, untilFocused);
 
-        public void addNotify() {
-            super.addNotify();
-            replacePeer();
-        }
-
-        void replacePeer() {
-            origDialogPeer = getPeer();
-
-            InvocationHandler handler = new InvocationHandler() {
-                    public Object invoke(Object proxy, Method method, Object[] args) {
-                        if (method.getName() == "show") {
-                            trigger.raise();
-                        }
-
-                        Object ret = null;
-                        try {
-                            ret = method.invoke(origDialogPeer, args);
-                        } catch (IllegalAccessException iae) {
-                            throw new Error("Test error.", iae);
-                        } catch (InvocationTargetException ita) {
-                            throw new Error("Test error.", ita);
-                        }
-                        return ret;
-                    }
-                };
-
-            proxyInstPeer = (DialogPeer)Proxy.newProxyInstance(
-                DialogPeer.class.getClassLoader(), new Class[] {DialogPeer.class}, handler);
-
-            try {
-                Util.getField(Component.class, "peer").set(d, proxyInstPeer);
-            } catch (IllegalAccessException iae) {
-                throw new Error("Test error.", iae);
+            if (untilFocused == TestDialogTypeAhead.this.ok) {
+                TestDialogTypeAhead.this.robotSema.raise();
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/WindowType/WindowType.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+  @test
+  @bug 6402325
+  @summary Test showing windows of different types
+  @author anthony.petrov@sun.com: area=awt.toplevel
+  @library ../../regtesthelpers
+  @build Util
+  @run main WindowType
+*/
+
+import java.awt.*;
+import test.java.awt.regtesthelpers.Util;
+
+/**
+ * WindowType.java
+ * Summary: Test showing windows of different types.
+ */
+public class WindowType {
+    private static void test(Window window, Window.Type type) {
+        window.setType(type);
+
+        window.setVisible(true);
+        Util.waitForIdle(null);
+        window.setVisible(false);
+    }
+
+    private static void test(Window.Type type) {
+        test(new Window((Frame)null), type);
+        test(new Frame(), type);
+        test(new Dialog((Frame)null), type);
+    }
+
+    public static void main(String[] args) {
+        test(Window.Type.NORMAL);
+        test(Window.Type.UTILITY);
+        test(Window.Type.POPUP);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/AbsoluteComponentCenterCalculator.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.*;
+
+class AbsoluteComponentCenterCalculator {
+    private AbsoluteComponentCenterCalculator () {}
+    public static int calculateXCenterCoordinate(Component component) {
+        return (int)component.getLocationOnScreen().getX()+(component.getWidth()/2);
+    }
+    public static int calculateYCenterCoordinate(Component component) {
+        return (int)component.getLocationOnScreen().getY()+(component.getHeight()/2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/DragUnicodeBetweenJVMTest.html	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,25 @@
+<html>
+<!--  
+  @test
+  @bug 5098433
+  @summary REG: DnD of File-List between JVM is broken for non ASCII file names - Win32
+  @author Denis Fokin: area=dnd
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator 
+  @run applet/othervm DragUnicodeBetweenJVMTest.html
+
+-->
+<head>
+<title> REG: DnD of File-List between JVM is broken for non ASCII file names - Win32</title>
+</head>
+<body>
+
+<h1> DragUnicodeBetweenJVMTest <br>Bug ID: 5098433 </h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="DragUnicodeBetweenJVMTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/DragUnicodeBetweenJVMTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+  test
+  @bug 5098433
+  @summary REG: DnD of File-List between JVM is broken for non ASCII file names - Win32
+  @author Denis Fokin: area=dnd
+  @library    ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator
+
+
+  @run applet/othervm DragUnicodeBetweenJVMTest.html
+*/
+
+/**
+ * DragUnicodeBetweenJVMTest.java
+ *
+ * summary: The test drags a list of files (DataFlavor.javaFileListFlavor) from one jvm to another.
+ *          The files have Unicode names. The list on target side must be equal to
+ *          the list on the source side.
+ */
+
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+
+import test.java.awt.regtesthelpers.process.ProcessCommunicator;
+import test.java.awt.regtesthelpers.process.ProcessResults;
+import test.java.awt.regtesthelpers.Util;
+import static java.lang.Thread.sleep;
+
+public class DragUnicodeBetweenJVMTest extends Applet
+{
+
+    public void init() {
+        setLayout(new BorderLayout());
+    }//End  init()
+
+    public void start() {
+
+        String toolkit = Toolkit.getDefaultToolkit().getClass().getName();
+        if (!toolkit.equals("sun.awt.windows.WToolkit")){
+            System.out.println("This test is for Windows only. Passed.");
+            return;
+        }
+        else{
+            System.out.println("Toolkit = " + toolkit);
+        }
+
+        final Frame sourceFrame = new Frame("Source frame");
+        final SourcePanel sourcePanel = new SourcePanel();
+        sourceFrame.add(sourcePanel);
+        sourceFrame.pack();
+        sourceFrame.addWindowListener( new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                sourceFrame.dispose();
+            }
+        });
+        sourceFrame.setVisible(true);
+
+        Util.waitForIdle(null);
+
+        NextFramePositionCalculator positionCalculator = new NextFramePositionCalculator(sourceFrame);
+
+        String [] args = new String [] {
+                String.valueOf(positionCalculator.getNextLocationX()),
+                String.valueOf(positionCalculator.getNextLocationY()),
+                String.valueOf(AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(sourcePanel)),
+                String.valueOf(AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(sourcePanel)),
+        };
+
+
+       ProcessResults processResults =
+                // ProcessCommunicator.executeChildProcess(this.getClass()," -cp \"C:\\Documents and Settings\\df153228\\IdeaProjects\\UnicodeTestDebug\\out\\production\\UnicodeTestDebug\" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 ", args);
+                ProcessCommunicator.executeChildProcess(this.getClass(), args);
+
+        verifyTestResults(processResults);
+
+    }// start()
+
+
+
+    private static void verifyTestResults(ProcessResults processResults) {
+        if ( InterprocessMessages.FILES_ON_TARGET_ARE_CORRUPTED ==
+                processResults.getExitValue())
+        {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: Target has recieved" +
+                    " broken file list.");
+        }
+        processResults.verifyStdErr(System.err);
+        processResults.verifyProcessExitValue(System.err);
+        processResults.printProcessStandartOutput(System.out);
+    }
+
+    //We cannot make an instance of the applet without the default constructor
+    public DragUnicodeBetweenJVMTest () {
+        super();
+    }
+
+    //We need in this constructor to pass frame position between JVMs
+    public DragUnicodeBetweenJVMTest (Point targetFrameLocation, Point dragSourcePoint)
+            throws InterruptedException
+    {
+        final Frame targetFrame = new Frame("Target frame");
+        final TargetPanel targetPanel = new TargetPanel(targetFrame);
+        targetFrame.add(targetPanel);
+        targetFrame.addWindowListener( new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent e) {
+                targetFrame.dispose();
+            }
+        });
+        targetFrame.setLocation(targetFrameLocation);
+        targetFrame.pack();
+        targetFrame.setVisible(true);
+
+        doTest(dragSourcePoint, targetPanel);
+    }
+
+    private void doTest(Point dragSourcePoint, TargetPanel targetPanel) {
+        Util.waitForIdle(null);
+
+        final Robot robot = Util.createRobot();
+
+        robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
+        try {
+            sleep(100);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            sleep(100);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            sleep(100);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+        Util.drag(robot, dragSourcePoint, new Point (AbsoluteComponentCenterCalculator.calculateXCenterCoordinate(targetPanel),
+                AbsoluteComponentCenterCalculator.calculateYCenterCoordinate(targetPanel)),
+                InputEvent.BUTTON1_MASK);
+    }
+
+
+    enum InterprocessArguments {
+        TARGET_FRAME_X_POSITION_ARGUMENT,
+        TARGET_FRAME_Y_POSITION_ARGUMENT,
+        DRAG_SOURCE_POINT_X_ARGUMENT,
+        DRAG_SOURCE_POINT_Y_ARGUMENT;
+
+        int extract (String [] args) {
+            return Integer.parseInt(args[this.ordinal()]);
+        }
+    }
+
+    public static void main (String [] args) {
+        Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
+                InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
+        Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
+                InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
+
+        try {
+            new DragUnicodeBetweenJVMTest(targetFrameLocation, dragSourcePoint);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/FileListTransferable.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.File;
+import java.util.Arrays;
+import java.util.List;
+
+class FileListTransferable implements Transferable {
+
+    public static File [] files = new File [] {
+        new File ("\u042f\u0020\u0441\u0440\u0430\u0437\u0443\u0020\u0441\u043c\u0430\u0437\u0430\u043b" +
+                "\u0020\u043a\u0430\u0440\u0442\u0443\u0020\u0431\u0443\u0434\u043d\u044f"),
+        new File ("\u043f\u043b\u0435\u0441\u043d\u0443\u0432\u0448\u0438\u0020\u043a\u0440\u0430\u0441" +
+                "\u043a\u0443\u0020\u0438\u0437\u0020\u0441\u0442\u0430\u043a\u0430\u043d\u0430"),
+        new File ("\u044f\u0020\u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0020\u043d\u0430\u0020\u0431" +
+                "\u043b\u044e\u0434\u0435\u0020\u0441\u0442\u0443\u0434\u043d\u044f"),
+        new File ("\u043a\u043e\u0441\u044b\u0435\u0020\u0441\u043a\u0443\u043b\u044b\u0020\u043e\u043a" +
+                "\u0435\u0430\u043d\u0430"),
+        new File ("\u041d\u0430\u0020\u0447\u0435\u0448\u0443\u0435\u0020\u0436\u0435\u0441\u0442\u044f" +
+                "\u043d\u043e\u0439\u0020\u0440\u044b\u0431\u044b"),
+        new File ("\u043f\u0440\u043e\u0447\u0435\u043b\u0020\u044f\u0020\u0437\u043e\u0432\u044b\u0020" +
+                "\u043d\u043e\u0432\u044b\u0445\u0020\u0433\u0443\u0431"),
+        new File ("\u0410\u0020\u0432\u044b"),
+        new File ("\u043d\u043e\u043a\u0442\u044e\u0440\u043d\u0020\u0441\u044b\u0433\u0440\u0430\u0442" +
+                "\u044c"),
+        new File ("\u043c\u043e\u0433\u043b\u0438\u0020\u0431\u044b"),
+        new File ("\u043d\u0430\u0020\u0444\u043b\u0435\u0439\u0442\u0435\u0020\u0432\u043e\u0434\u043e" +
+                "\u0441\u0442\u043e\u0447\u043d\u044b\u0445\u0020\u0442\u0440\u0443\u0431"),
+    };
+
+    public DataFlavor[] getTransferDataFlavors() {
+        return new DataFlavor [] {DataFlavor.javaFileListFlavor};
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        return flavor.equals(DataFlavor.javaFileListFlavor) ;
+    }
+
+    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+        List<File> list = Arrays.asList(files);
+        return list;
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/InterprocessMessages.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+interface InterprocessMessages {
+    final static int EXECUTION_IS_SUCCESSFULL = 0;
+    final static int FILES_ON_TARGET_ARE_CORRUPTED = 212;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/NextFramePositionCalculator.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.*;
+
+
+class NextFramePositionCalculator {
+
+    private final Frame currentFrame;
+
+    public NextFramePositionCalculator (Frame currentFrame) {
+        this.currentFrame = currentFrame;
+    }
+
+    public int getNextLocationX() {
+        return currentFrame.getX()+currentFrame.getWidth();
+    }
+
+    public int getNextLocationY() {
+        return currentFrame.getY();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/SourcePanel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.*;
+
+public class SourcePanel extends Panel
+{
+
+    private final MyDragGestureListener dragGestureListener =
+            new MyDragGestureListener();
+
+    public SourcePanel () {
+        setPreferredSize(new Dimension(200, 200));
+        DragSource defaultDragSource =
+                DragSource.getDefaultDragSource();
+        defaultDragSource.createDefaultDragGestureRecognizer(this,
+                DnDConstants.ACTION_COPY_OR_MOVE, dragGestureListener);
+        setBackground(Color.RED);
+    }
+
+    private class MyDragGestureListener implements DragGestureListener {
+        public void dragGestureRecognized(DragGestureEvent dge) {
+            dge.startDrag(null, new FileListTransferable());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/DragUnicodeBetweenJVMTest/TargetPanel.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.dnd.*;
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Arrays;
+
+public class TargetPanel extends Panel implements DropTargetListener{
+
+    private java.util.List <File> content = new ArrayList<File>();
+
+    //private final CustomDropTargetListener dropTargetListener = new CustomDropTargetListener();
+
+    private Frame frame;
+
+    public TargetPanel (Frame frame)
+    {
+        this.frame = frame;
+        setBackground(Color.DARK_GRAY);
+        setPreferredSize(new Dimension(200, 200));
+        setDropTarget(new DropTarget(this, this));
+    }
+
+    public void dragEnter(DropTargetDragEvent dtde) {
+        if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
+        }
+    }
+
+    public void dragOver(DropTargetDragEvent dtde) {
+        if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
+        }
+    }
+
+    public void dropActionChanged(DropTargetDragEvent dtde) {
+        if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY_OR_MOVE);
+        }
+    }
+
+    public void dragExit(DropTargetEvent dte) {
+
+    }
+
+    public void drop(DropTargetDropEvent dtde) {
+        dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+        if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
+            try {
+                content = (java.util.List)dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
+                repaint();
+            } catch (UnsupportedFlavorException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            dtde.dropComplete(true);
+
+
+
+            boolean listsAreEqual = true;
+
+             for (int i = 0; i < content.size(); i++) {
+                if(!FileListTransferable.files[i].getName().equals(content.get(i).getName())) {
+                    listsAreEqual = false;
+                }
+            }
+
+            if (listsAreEqual) {
+                System.err.println(InterprocessMessages.EXECUTION_IS_SUCCESSFULL);
+                System.exit(0);
+            }
+        }
+        dtde.rejectDrop();
+        System.err.println(InterprocessMessages.FILES_ON_TARGET_ARE_CORRUPTED);
+        System.exit(1);
+    }
+
+    public void paint(Graphics g) {
+        g.setColor(Color.YELLOW);
+        int i = 0;
+        for (Iterator <File> iterator = content.iterator(); iterator.hasNext();i++) {
+            g.drawString(iterator.next().getName(), 5, g.getFontMetrics().getAscent()*i+20);
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListBetweenJVMsTest/FileListTransferable.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.File;
+import java.io.IOException;
+
+class FileListTransferable implements Transferable {
+
+    final private DataFlavor[] supportedFlavors =
+            {DataFlavor.javaFileListFlavor};
+
+    private java.util.List<File> list;
+
+    public FileListTransferable(java.util.List<File> list) {
+        this.list = list;
+    }
+
+    public DataFlavor[] getTransferDataFlavors() {
+        return supportedFlavors;
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor flavor) {
+        for (DataFlavor df:supportedFlavors) {
+            if (df.equals(flavor)) return true;
+        }
+        return false;
+    }
+
+    public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
+        if (flavor.equals(DataFlavor.javaFileListFlavor)) {
+            return list;
+        }
+        throw new UnsupportedFlavorException(flavor);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListBetweenJVMsTest/InterprocessMessages.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+public interface InterprocessMessages {
+    final static int EXECUTION_IS_SUCCESSFULL = 0;
+    final static int WRONG_FILES_NUMBER_ON_TARGET = 212;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListBetweenJVMsTest/SourceFileListFrame.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.io.File;
+import java.util.Arrays;
+
+
+class SourceFileListFrame extends Frame implements DragGestureListener {
+
+    private final static int SOURCE_POINT_SHIFT = 3;
+
+    private List list = new List(URIListBetweenJVMsTest.VISIBLE_RAWS_IN_LIST);
+    private File[] files;
+
+    SourceFileListFrame() {
+        super("Source File List Frame");
+        extractFilesFromTheWorkingDirectory();
+        initList();
+        initGUI();
+        new DragSource().createDefaultDragGestureRecognizer(list,
+                DnDConstants.ACTION_COPY,this);
+    }
+
+    private void extractFilesFromTheWorkingDirectory() {
+        files = new File(System.getProperty("java.home", "")).listFiles();
+    }
+
+    private void initList() {
+        for (File currFile:files) {
+            list.add(currFile.getName());
+        }
+    }
+
+    private void initGUI() {
+        this.addWindowListener(Util.getClosingWindowAdapter());
+        this.setLocation(300,250);
+        this.add(new Panel().add(list));
+        this.pack();
+        this.setVisible(true);
+    }
+
+    int getNextLocationX() {
+        return getX()+getWidth();
+    }
+
+    int getNextLocationY() {
+        return getY();
+    }
+
+    int getDragSourcePointX() {
+        return (int)list.getLocationOnScreen().getX()+(list.getWidth()/2);
+    }
+
+   int getDragSourcePointY() {
+        return (int)list.getLocationOnScreen().getY()+ SOURCE_POINT_SHIFT;
+    }
+
+    int getSourceFilesNumber() {
+        return files.length;
+    }
+
+    public void dragGestureRecognized(DragGestureEvent dge) {
+        String [] filesAsStringArray = list.getItems();
+        File [] files = new File[filesAsStringArray.length];
+        for (int fileNumber=0; fileNumber<filesAsStringArray.length ; fileNumber++ ) {
+            files[fileNumber]=new File(filesAsStringArray[fileNumber]);
+        }
+        dge.startDrag(null, new FileListTransferable(Arrays.asList(files)));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListBetweenJVMsTest/TargetFileListFrame.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.dnd.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+
+class TargetFileListFrame extends Frame implements DropTargetListener {
+
+    private List list = new List(URIListBetweenJVMsTest.VISIBLE_RAWS_IN_LIST);
+    private int expectationTransferredFilesNumber;
+    private DataFlavor dropFlavor;
+
+    TargetFileListFrame(Point location, int expectationTransferredFilesNumber) {
+        try {
+            dropFlavor = new DataFlavor("text/uri-list;class=java.io.Reader");
+        } catch (Exception ex) {
+        }
+        this.expectationTransferredFilesNumber = expectationTransferredFilesNumber;
+        initGUI(location);
+        setDropTarget(new DropTarget(list, DnDConstants.ACTION_COPY,
+                this));
+    }
+
+    private void initGUI(Point location) {
+        this.setLocation(location);
+        this.addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                TargetFileListFrame.this.dispose();
+            }
+        });
+        this.add(new Panel().add(list));
+        this.pack();
+        this.setVisible(true);
+    }
+
+    public void dragEnter(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(dropFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dragOver(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(dropFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dropActionChanged(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(dropFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+        }
+    }
+
+    public void dragExit(DropTargetEvent dte) {}
+
+    public void drop(DropTargetDropEvent dtde) {
+        list.removeAll();
+        dtde.acceptDrop(DnDConstants.ACTION_COPY);
+        java.util.List<File> fileList = extractListOfFiles(dtde);
+        for (File file:fileList) {
+            list.add(file.getName());
+        }
+
+        if (fileList.size() != expectationTransferredFilesNumber)
+        {
+            System.err.println("ERROR: Expected file number:"
+                    + expectationTransferredFilesNumber
+                    + "; Received file number: "
+                    + fileList.size());
+            TargetFileListFrame.this.dispose();
+            System.exit(InterprocessMessages.WRONG_FILES_NUMBER_ON_TARGET);
+        }
+
+        TargetFileListFrame.this.dispose();
+
+    }
+
+    private java.util.List<File> extractListOfFiles(DropTargetDropEvent dtde) {
+        BufferedReader reader = null;
+        ArrayList<File> files = new ArrayList<File>();
+        try {
+            reader = new BufferedReader((Reader)dtde.getTransferable().
+                    getTransferData(dropFlavor));
+            String line;
+            while ((line = reader.readLine()) != null) {
+                files.add(new File(new URI(line)));
+            }
+        } catch (UnsupportedFlavorException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (IllegalArgumentException e) {
+            e.printStackTrace();
+        } catch (URISyntaxException e) {
+            e.printStackTrace();
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException ignored) {
+                }
+            }
+        }
+        return files;
+    }
+
+    Point getDropTargetPoint() {
+       return new Point((int)list.getLocationOnScreen().getX()+(list.getWidth()/2),
+                (int)list.getLocationOnScreen().getY()+(list.getHeight()/2));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.html	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,25 @@
+<html>
+<!--  
+  @test
+  @bug 4899516
+  @summary Transferable has no DataFlavors when dragging from Gnome window to Swing
+  @author : area=dnd
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator 
+  @run applet/othervm URIListBetweenJVMsTest.html
+
+-->
+<head>
+<title> DnD of URI-List across JVM </title>
+</head>
+<body>
+
+<h1>URIListBetweenJVMsTest<br>Bug ID: 4899516</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="URIListBetweenJVMsTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+  test
+  @bug 4899516
+  @summary Transferable has no DataFlavors when dragging from Gnome window to Swing
+  @author : area=dnd
+  @run applet URIListBetweenJVMsTest.html
+*/
+
+/**
+ * URIListBetweenJVMsTest.java
+ *
+ * summary: Transferable has no DataFlavors when dragging from Gnome window to Swing
+ */
+
+import static java.lang.Thread.sleep;
+
+import test.java.awt.regtesthelpers.process.ProcessCommunicator;
+import test.java.awt.regtesthelpers.process.ProcessResults;
+import test.java.awt.regtesthelpers.Util;
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.InputEvent;
+import java.io.*;
+
+public class URIListBetweenJVMsTest extends Applet {
+
+    // information related to the test in common
+    static int VISIBLE_RAWS_IN_LIST=15;
+
+    public void init() {
+        setLayout(new BorderLayout());
+
+    }//End  init()
+
+    public void start() {
+
+    String toolkit = Toolkit.getDefaultToolkit().getClass().getName();
+    if (toolkit.equals("sun.awt.windows.WToolkit")){
+        System.out.println("This test is not for the Windows platform. Passed.");
+        return;
+    } else {
+        System.out.println("Toolkit = " + toolkit);
+    }
+
+        SourceFileListFrame sourceFrame = new SourceFileListFrame();
+
+        Util.waitForIdle(null);
+
+        String [] args = new String [] {
+                String.valueOf(sourceFrame.getNextLocationX()),
+                String.valueOf(sourceFrame.getNextLocationY()),
+                String.valueOf(sourceFrame.getDragSourcePointX()),
+                String.valueOf(sourceFrame.getDragSourcePointY()),
+                String.valueOf(sourceFrame.getSourceFilesNumber())
+        };
+
+        String classpath = System.getProperty("java.class.path");
+        ProcessResults processResults =
+                ProcessCommunicator.executeChildProcess(this.getClass(), classpath, args);
+
+        verifyTestResults(processResults);
+
+    }// start()
+
+    private static void verifyTestResults(ProcessResults processResults) {
+        if ( InterprocessMessages.WRONG_FILES_NUMBER_ON_TARGET ==
+                processResults.getExitValue())
+        {
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: Target has recieved" +
+                    " wrong number of files.");
+        }
+        processResults.verifyStdErr(System.err);
+        processResults.verifyProcessExitValue(System.err);
+        processResults.printProcessStandartOutput(System.out);
+    }
+
+    //We cannot make an instance of the applet without the default constructor
+    public URIListBetweenJVMsTest () {
+        super();
+    }
+
+    //We need in this constructor to pass frame position between JVMs
+    public URIListBetweenJVMsTest (Point targetFrameLocation, Point dragSourcePoint,
+            int transferredFilesNumber)
+            throws InterruptedException
+    {
+        TargetFileListFrame targetFrame = new TargetFileListFrame(targetFrameLocation,
+                transferredFilesNumber);
+
+        Util.waitForIdle(null);
+
+        final Robot robot = Util.createRobot();
+
+        robot.mouseMove((int)dragSourcePoint.getX(),(int)dragSourcePoint.getY());
+        sleep(100);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        sleep(100);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        sleep(100);
+
+        Util.drag(robot, dragSourcePoint, targetFrame.getDropTargetPoint(),
+                InputEvent.BUTTON1_MASK);
+
+    }
+
+    enum InterprocessArguments {
+        TARGET_FRAME_X_POSITION_ARGUMENT,
+        TARGET_FRAME_Y_POSITION_ARGUMENT,
+        DRAG_SOURCE_POINT_X_ARGUMENT,
+        DRAG_SOURCE_POINT_Y_ARGUMENT,
+        FILES_IN_THE_LIST_NUMBER_ARGUMENT;
+
+        int extract (String [] args) {
+            return Integer.parseInt(args[this.ordinal()]);
+        }
+    }
+
+    public static void main (String [] args) {
+        Point dragSourcePoint = new Point(InterprocessArguments.DRAG_SOURCE_POINT_X_ARGUMENT.extract(args),
+                InterprocessArguments.DRAG_SOURCE_POINT_Y_ARGUMENT.extract(args));
+        Point targetFrameLocation = new Point(InterprocessArguments.TARGET_FRAME_X_POSITION_ARGUMENT.extract(args),
+                InterprocessArguments.TARGET_FRAME_Y_POSITION_ARGUMENT.extract(args));
+        int transferredFilesNumber = InterprocessArguments.FILES_IN_THE_LIST_NUMBER_ARGUMENT.extract(args);
+
+        try {
+            new URIListBetweenJVMsTest(targetFrameLocation, dragSourcePoint, transferredFilesNumber);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+
+}// class URIListBetweenJVMsTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/font/GlyphVector/VisualBounds.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @summary leading and trailing spaces must not affect visual bounds
+ * @bug 6904962
+ */
+
+
+import java.awt.*;
+import java.awt.font.*;
+import java.awt.geom.*;
+
+public class VisualBounds {
+
+    public static void main(String args[]) {
+
+        String s1 = "a";
+        String s2 = s1+" ";
+        String s3 = " "+s1;
+        Font f = new Font("Dialog", Font.PLAIN, 12);
+        FontRenderContext frc = new FontRenderContext(null, false, false);
+        GlyphVector gv1 = f.createGlyphVector(frc, s1);
+        GlyphVector gv2 = f.createGlyphVector(frc, s2);
+        GlyphVector gv3 = f.createGlyphVector(frc, s3);
+        Rectangle2D bds1 = gv1.getVisualBounds();
+        Rectangle2D bds2 = gv2.getVisualBounds();
+        Rectangle2D bds3 = gv3.getVisualBounds();
+        GlyphVector gv4 = f.createGlyphVector(frc, " ");
+        Rectangle2D bds4 = gv4.getVisualBounds();
+        System.out.println(bds1);
+        System.out.println(bds2);
+        System.out.println(bds3);
+        System.out.println(bds4);
+
+        if (!bds1.equals(bds2)) {
+          throw new RuntimeException("Trailing space: Visual bounds differ");
+        }
+        if (bds2.getWidth() != bds3.getWidth()) {
+          throw new RuntimeException("Leading space: Visual widths differ");
+       }
+        if (!bds4.isEmpty()) {
+          throw new RuntimeException("Non empty bounds for space");
+       }
+    }
+}
--- a/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java	Wed Jul 05 17:04:26 2017 +0200
@@ -146,7 +146,15 @@
                          final String classPathArguments, final String [] args)
     {
         StringBuilder commandBuilder = new StringBuilder();
-        commandBuilder.append(javaPath).append(classPathArguments).append(classToExecute.getName());
+        commandBuilder.append(javaPath).append(" ");
+        commandBuilder.append("-cp ").append(System.getProperty("test.classes", ".")).append(File.pathSeparatorChar);
+
+        if (classPathArguments.trim().length() > 0) {
+            commandBuilder.append(classPathArguments).append(" ");
+        }
+
+        commandBuilder.append(" ");
+        commandBuilder.append(classToExecute.getName());
         for (String argument:args) {
             commandBuilder.append(" ").append(argument);
         }
--- a/jdk/test/java/beans/EventHandler/Test6788531.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/beans/EventHandler/Test6788531.java	Wed Jul 05 17:04:26 2017 +0200
@@ -36,7 +36,7 @@
     public static void main(String[] args) throws Exception {
         JButton button = new JButton("hi");
         button.addActionListener(EventHandler.create(ActionListener.class, new Private(), "run"));
-        button.addActionListener(EventHandler.create(ActionListener.class, new PrivateGeneric(), "run", "generic"));
+        button.addActionListener(EventHandler.create(ActionListener.class, new PrivateGeneric(), "run", "actionCommand"));
         button.doClick();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test5102804.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5102804
+ * @summary Tests memory leak
+ * @author Sergey Malenkov
+ */
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class Test5102804 {
+    private static final String BEAN_NAME = "Test5102804$Example";
+    private static final String BEAN_INFO_NAME = BEAN_NAME + "BeanInfo";
+
+    public static void main(String[] args) {
+        if (!isCollectible(getReference()))
+            throw new Error("Reference is not collected");
+    }
+
+    private static Reference getReference() {
+        try {
+            ClassLoader loader = new Loader();
+            Class type = Class.forName(BEAN_NAME, true, loader);
+            if (!type.getClassLoader().equals(loader)) {
+                throw new Error("Wrong class loader");
+            }
+            BeanInfo info = Introspector.getBeanInfo(type);
+            if (0 != info.getDefaultPropertyIndex()) {
+                throw new Error("Wrong bean info found");
+            }
+            return new WeakReference<Class>(type);
+        }
+        catch (IntrospectionException exception) {
+            throw new Error("Introspection Error", exception);
+        }
+        catch (ClassNotFoundException exception) {
+            throw new Error("Class Not Found", exception);
+        }
+    }
+
+    private static boolean isCollectible(Reference reference) {
+        int[] array = new int[10];
+        while (true) {
+            try {
+                array = new int[array.length + array.length / 3];
+            }
+            catch (OutOfMemoryError error) {
+                return null == reference.get();
+            }
+        }
+    }
+
+    /**
+     * Custom class loader to load the Example class by itself.
+     * Could also load it from a different code source, but this is easier to set up.
+     */
+    private static final class Loader extends URLClassLoader {
+        Loader() {
+            super(new URL[] {
+                    Test5102804.class.getProtectionDomain().getCodeSource().getLocation()
+            });
+        }
+
+        @Override
+        protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+            Class c = findLoadedClass(name);
+            if (c == null) {
+                if (BEAN_NAME.equals(name) || BEAN_INFO_NAME.equals(name)) {
+                    c = findClass(name);
+                }
+                else try {
+                    c = getParent().loadClass(name);
+                }
+                catch (ClassNotFoundException exception) {
+                    c = findClass(name);
+                }
+            }
+            if (resolve) {
+                resolveClass(c);
+            }
+            return c;
+        }
+    }
+
+    /**
+     * A simple bean to load from the Loader class, not main class loader.
+     */
+    public static final class Example {
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    /**
+     * The BeanInfo for the Example class.
+     * It is also loaded from the Loader class.
+     */
+    public static final class ExampleBeanInfo extends SimpleBeanInfo {
+        @Override
+        public int getDefaultPropertyIndex() {
+            return 0;
+        }
+
+        @Override
+        public PropertyDescriptor[] getPropertyDescriptors() {
+            try {
+                return new PropertyDescriptor[] {
+                        new PropertyDescriptor("value", Class.forName(BEAN_NAME))
+                };
+            }
+            catch (ClassNotFoundException exception) {
+                return null;
+            }
+            catch (IntrospectionException exception) {
+                return null;
+            }
+        }
+    }
+}
--- a/jdk/test/java/beans/XMLEncoder/6329581/Test6329581.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/beans/XMLEncoder/6329581/Test6329581.java	Wed Jul 05 17:04:26 2017 +0200
@@ -33,43 +33,70 @@
 import java.beans.XMLEncoder;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
 import java.net.URL;
 import java.net.URLClassLoader;
 
-public class Test6329581 implements ExceptionListener {
+public class Test6329581 extends URLClassLoader implements ExceptionListener {
+    public static final class Bean {
+    }
 
     public static void main(String[] args) throws Exception {
-        ExceptionListener listener = new Test6329581();
-        // write bean to byte array
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        XMLEncoder encoder = new XMLEncoder(out);
-        encoder.setExceptionListener(listener);
-        encoder.writeObject(getClassLoader("beans.jar").loadClass("test.Bean").newInstance());
-        encoder.close();
-        // read bean from byte array
-        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-        XMLDecoder decoder = new XMLDecoder(in, null, listener, getClassLoader("beans.jar"));
-        Object object = decoder.readObject();
-        decoder.close();
+        new Test6329581().decode(new Test6329581().encode(Bean.class.getName()));
+    }
 
-        if (!object.getClass().getClassLoader().getClass().equals(URLClassLoader.class)) {
-            throw new Error("bean is loaded with unexpected class loader");
-        }
+    private Test6329581() {
+        super(new URL[] {
+                Test6329581.class.getProtectionDomain().getCodeSource().getLocation()
+        });
     }
 
-    private static ClassLoader getClassLoader(String name) throws Exception {
-        StringBuilder sb = new StringBuilder(256);
-        sb.append("file:");
-        sb.append(System.getProperty("test.src", "."));
-        sb.append(File.separatorChar);
-        sb.append(name);
-
-        URL[] url = { new URL(sb.toString()) };
-        return new URLClassLoader(url);
+    @Override
+    protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+        Class c = findLoadedClass(name);
+        if (c == null) {
+            if (Bean.class.getName().equals(name)) {
+                c = findClass(name);
+            }
+            else try {
+                c = getParent().loadClass(name);
+            }
+            catch (ClassNotFoundException exception) {
+                c = findClass(name);
+            }
+        }
+        if (resolve) {
+            resolveClass(c);
+        }
+        return c;
     }
 
     public void exceptionThrown(Exception exception) {
         throw new Error("unexpected exception", exception);
     }
+
+    private void validate(Object object) {
+        if (!object.getClass().getClassLoader().equals(this)) {
+            throw new Error("Bean is loaded with unexpected class loader");
+        }
+    }
+
+    private byte[] encode(String name) throws Exception {
+        Object object = loadClass(name).newInstance();
+        validate(object);
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+        XMLEncoder encoder = new XMLEncoder(out);
+        encoder.setExceptionListener(this);
+        encoder.writeObject(object);
+        encoder.close();
+        return out.toByteArray();
+    }
+
+    private Object decode(byte[] array) {
+        ByteArrayInputStream in = new ByteArrayInputStream(array);
+        XMLDecoder decoder = new XMLDecoder(in, null, this, this);
+        Object object = decoder.readObject();
+        validate(object);
+        decoder.close();
+        return object;
+    }
 }
--- a/jdk/test/java/io/Serializable/enum/array/Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/array/Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @bug 4838379
  * @summary Verify that serialization of enum constant arrays functions
  *          properly.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
  */
 
 import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/badResolve/Write.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/badResolve/Write.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,10 +26,10 @@
  * @summary Verify that enum classes present in a serialization stream cannot
  *          be resolved by the receiver to non-enum classes, and vice-versa.
  *
- * @compile -source 1.5 Write.java
+ * @compile Write.java
  * @run main Write
  * @clean Write
- * @compile -source 1.5 Read.java
+ * @compile Read.java
  * @run main Read
  * @clean Read
  */
--- a/jdk/test/java/io/Serializable/enum/basic/Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/basic/Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @bug 4838379
  * @summary Verify that basic serialization of non-specialized enum constants
  *          functions properly.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
  */
 
 import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/classObject/Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/classObject/Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @bug 4838379
  * @summary Verify that serialization of Class objects for enum types works
  *          properly.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
  */
 
 import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/constantSubclasses/Write.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/constantSubclasses/Write.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,10 +26,10 @@
  * @summary Verify that serialization of enum constants that are instances of
  *          constant-specific subclasses functions properly.
  *
- * @compile -source 1.5 Write.java
+ * @compile Write.java
  * @run main Write
  * @clean Write
- * @compile -source 1.5 Read.java
+ * @compile Read.java
  * @run main Read
  * @clean Read
  */
--- a/jdk/test/java/io/Serializable/enum/ignoreSerializationFields/Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/ignoreSerializationFields/Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @bug 4838379
  * @summary Verify that serialVersionUID and serialPersistentFields
  *          declarations made by enum types and constants are ignored.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
  */
 
 import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/ignoreSerializationMethods/Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/ignoreSerializationMethods/Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @bug 4838379
  * @summary Verify that custom serialization methods defined by enum types are
  *          not invoked during serialization or deserialization.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
  */
 
 import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/mismatchedTypecode/Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/mismatchedTypecode/Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @summary Verify that TC_OBJECT followed by a class descriptor for an enum
  *          class results in an InvalidClassException, as does TC_ENUM followed
  *          by a class descriptor for a non-enum class.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
  */
 
 import java.io.*;
--- a/jdk/test/java/io/Serializable/enum/missingConstant/Write.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/missingConstant/Write.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,10 +26,10 @@
  * @summary Verify that deserialization of an enum constant that does not exist
  *          on the receiving side results in an InvalidObjectException.
  *
- * @compile -source 1.5 Write.java
+ * @compile Write.java
  * @run main Write
  * @clean Write
- * @compile -source 1.5 Read.java
+ * @compile Read.java
  * @run main Read
  * @clean Read
  */
--- a/jdk/test/java/io/Serializable/enum/unshared/Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/io/Serializable/enum/unshared/Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @bug 4838379
  * @summary Verify that unshared write and read operations work properly with
  *          enum constants.
- *
- * @compile -source 1.5 Test.java
- * @run main Test
  */
 
 import java.io.*;
--- a/jdk/test/java/lang/Boolean/MakeBooleanComparable.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Boolean/MakeBooleanComparable.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4329937
  * @summary Basic test for making Boolean implement Comparable
  * @author  Josh Bloch
- *
- * @compile -source 1.5 MakeBooleanComparable.java
- * @run main MakeBooleanComparable
  */
 
 import java.util.*;
--- a/jdk/test/java/lang/Class/Cast.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Class/Cast.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @test
  * @bug 4881275
  * @summary (reflect) Class.cast() - typesafe cast desired
- *
- * @compile -source 1.5 Cast.java
- * @run main Cast
  */
 
 public class Cast {
--- a/jdk/test/java/lang/Class/IsEnum.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Class/IsEnum.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4891872 4989735 4990789 5020490
  * @summary Check isEnum() method
  * @author Joseph D. Darcy
- * @compile -source 1.5 IsEnum.java
- * @run main IsEnum
  */
 
 import java.lang.annotation.*;
--- a/jdk/test/java/lang/Class/asSubclass/BasicUnit.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Class/asSubclass/BasicUnit.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,7 @@
  * @summary please add a typesafe cast for Class<?> types
  * @author gafter
  *
- * @compile -Xlint:unchecked -Werror -source 1.5 BasicUnit.java
+ * @compile -Xlint:unchecked -Werror BasicUnit.java
  * @run main BasicUnit
  */
 
--- a/jdk/test/java/lang/ClassLoader/Assert.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/ClassLoader/Assert.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -47,7 +47,7 @@
 cp -R ${TESTSRC}/package1 .
 cp -R ${TESTSRC}/package2 .
 
-${TESTJAVA}/bin/javac -source 1.4 Assert.java 
+${TESTJAVA}/bin/javac Assert.java 
 
 ${TESTJAVA}/bin/java Assert
 
--- a/jdk/test/java/lang/Integer/BitTwiddle.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Integer/BitTwiddle.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4495754
  * @summary Basic test for int bit twiddling
  * @author  Josh Bloch
- *
- * @compile -source 1.5 BitTwiddle.java
- * @run main BitTwiddle
  */
 
 import java.util.Random;
--- a/jdk/test/java/lang/Long/BitTwiddle.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Long/BitTwiddle.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4495754
  * @summary Basic test for long bit twiddling
  * @author  Josh Bloch
- *
- * @compile -source 1.5 BitTwiddle.java
- * @run main BitTwiddle
  */
 
 import java.util.Random;
--- a/jdk/test/java/lang/Math/Atan2Tests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Math/Atan2Tests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,8 +25,6 @@
  * @test
  * @bug 4984407
  * @summary Tests for {Math, StrictMath}.atan2
- * @compile -source 1.5 Atan2Tests.java
- * @run main Atan2Tests
  * @author Joseph D. Darcy
  */
 
--- a/jdk/test/java/lang/Math/IeeeRecommendedTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Math/IeeeRecommendedTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4860891 4826732 4780454 4939441 4826652
  * @summary Tests for IEEE 754[R] recommended functions and similar methods
  * @author Joseph D. Darcy
- * @compile -source 1.5 IeeeRecommendedTests.java
- * @run main IeeeRecommendedTests
  */
 
 import sun.misc.FpUtils;
--- a/jdk/test/java/lang/Math/PowTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Math/PowTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,8 +25,6 @@
  * @test
  * @bug 4984407 5033578
  * @summary Tests for {Math, StrictMath}.pow
- * @compile -source 1.5 PowTests.java
- * @run main PowTests
  * @author Joseph D. Darcy
  */
 
--- a/jdk/test/java/lang/Math/TanTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Math/TanTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,8 +25,6 @@
  * @test
  * @bug 5033578
  * @summary Tests for {Math, StrictMath}.tan
- * @compile -source 1.5 TanTests.java
- * @run main TanTests
  * @author Joseph D. Darcy
  */
 
--- a/jdk/test/java/lang/Runtime/exec/WinCommand.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Runtime/exec/WinCommand.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,9 +25,6 @@
  * @bug 5006520
  * @summary Check many different ways to run Windows programs
  * @author Martin Buchholz
- *
- * @compile -source 1.5 WinCommand.java
- * @run main WinCommand
  */
 
 import java.io.*;
--- a/jdk/test/java/lang/Thread/GenerifyStackTraces.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Thread/GenerifyStackTraces.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4919105
  * @summary Generified basic unit test of Thread.getAllStackTraces()
  * @author  Mandy Chung
- *
- * @compile -source 1.5 GenerifyStackTraces.java
- * @run main GenerifyStackTraces
  */
 
 import java.util.*;
--- a/jdk/test/java/lang/Thread/UncaughtExceptions.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/Thread/UncaughtExceptions.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -121,7 +121,7 @@
 }
 EOJAVA
 
-    Sys "$javac" "-source" "1.5" "Seppuku.java"
+    Sys "$javac" "Seppuku.java"
     CheckCommandResults "$expectedRC" "$expectedOut" "$expectedErr" \
 	"$java" "Seppuku"
     Cleanup
--- a/jdk/test/java/lang/annotation/UnitTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/annotation/UnitTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug     4906359 4963461 4965058 4965039 4986770
  * @summary Unit test for annotation reading
  * @author  Josh Bloch
- * @compile -source 1.5 UnitTest.java
- * @run main UnitTest
  */
 
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
--- a/jdk/test/java/lang/annotation/package-info.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/annotation/package-info.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Package annotations
  * @author gafter
  *
- * @compile -source 1.5 package-info.java PackageMain.java
+ * @compile package-info.java PackageMain.java
  * @run main PackageMain
  */
 
--- a/jdk/test/java/lang/management/CompositeData/MemoryNotifInfoCompositeData.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/CompositeData/MemoryNotifInfoCompositeData.java	Wed Jul 05 17:04:26 2017 +0200
@@ -29,7 +29,7 @@
  *          the input CompositeData is invalid.
  * @author  Mandy Chung
  *
- * @compile -source 1.5 OpenTypeConverter.java
+ * @compile OpenTypeConverter.java
  * @build MemoryNotifInfoCompositeData
  * @run main MemoryNotifInfoCompositeData
  */
--- a/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/CompositeData/ThreadInfoCompositeData.java	Wed Jul 05 17:04:26 2017 +0200
@@ -29,7 +29,7 @@
  *          the input CompositeData is invalid.
  * @author  Mandy Chung
  *
- * @compile -source 1.5 OpenTypeConverter.java
+ * @compile OpenTypeConverter.java
  * @build ThreadInfoCompositeData
  * @run main ThreadInfoCompositeData
  */
--- a/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/ManagementFactory/MXBeanProxyTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     5024531
  * @summary Basic Test for ManagementFactory.newPlatformMXBean().
  * @author  Mandy Chung
- *
- * @compile -source 1.5 MXBeanProxyTest.java
- * @run main MXBeanProxyTest
  */
 import javax.management.*;
 import java.lang.management.ClassLoadingMXBean;
--- a/jdk/test/java/lang/management/ManagementFactory/PlatformMBeanServerTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/ManagementFactory/PlatformMBeanServerTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4947536
  * @summary Basic unit test of ManagementFactory.getPlatformMBeanServer()
  * @author  Mandy Chung
- *
- * @compile -source 1.5 PlatformMBeanServerTest.java
- * @run main PlatformMBeanServerTest
  */
 
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyExceptions.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyExceptions.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,9 +27,6 @@
  * @summary Test type mapping of the platform MXBean proxy
  *          returned from Management.newPlatformMXBeanProxy().
  * @author  Mandy Chung
- *
- * @compile -source 1.5 ProxyExceptions.java
- * @run main ProxyExceptions
  */
 import java.lang.management.*;
 import javax.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/ManagementFactory/ProxyTypeMapping.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,7 +28,7 @@
  *          returned from Management.newPlatformMXBeanProxy().
  * @author  Mandy Chung
  *
- * @compile -source 1.5 ProxyTypeMapping.java
+ * @compile ProxyTypeMapping.java
  * @run main/othervm -verbose:gc ProxyTypeMapping
  */
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/ManagementFactory/ValidateOpenTypes.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,7 +28,7 @@
  *          MBeanServer.
  * @author  Mandy Chung
  *
- * @compile -source 1.5 ValidateOpenTypes.java
+ * @compile ValidateOpenTypes.java
  * @run main/othervm -verbose:gc ValidateOpenTypes
  */
 import java.lang.management.*;
--- a/jdk/test/java/lang/management/RuntimeMXBean/GetSystemProperties.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/RuntimeMXBean/GetSystemProperties.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4990512
  * @summary Basic Test for RuntimeMXBean.getSystemProperties().
  * @author  Mandy Chung
- *
- * @compile -source 1.5 GetSystemProperties.java
- * @run main GetSystemProperties
  */
 
 import java.lang.management.ManagementFactory;
--- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,7 @@
 # @summary 
 # @author  Mandy Chung
 #
-# @run compile -source 1.5 InputArgument.java
+# @run compile InputArgument.java
 # @run shell TestInputArgument.sh
 #
 
--- a/jdk/test/java/lang/reflect/Constructor/GenericStringTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Constructor/GenericStringTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 5033583 6316717 6470106
  * @summary Check toGenericString() and toString() methods
  * @author Joseph D. Darcy
- * @compile -source 1.5 GenericStringTest.java
- * @run main GenericStringTest
  */
 
 import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Field/GenericStringTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Field/GenericStringTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 5033583
  * @summary Check toGenericString() method
  * @author Joseph D. Darcy
- * @compile -source 1.5 GenericStringTest.java
- * @run main GenericStringTest
  */
 
 import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Generics/StringsAndBounds.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Generics/StringsAndBounds.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 5015676 4987888 4997464
  * @summary Testing upper bounds and availability of toString methods
  * @author Joseph D. Darcy
- * @compile -source 1.5 StringsAndBounds.java
- * @run main StringsAndBounds
  */
 
 import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Generics/TestC1.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Generics/TestC1.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
 * @bug 4891872
 * @summary Some tests for the generic core reflection api.
 * @author Gilad Bracha
-* @compile -source 1.5 TestC1.java
+* @compile TestC1.java
 * @run main/othervm -ea TestC1
 */
 
--- a/jdk/test/java/lang/reflect/Generics/TestC2.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Generics/TestC2.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
 * @bug 4891872
 * @summary Some tests for the generic core reflection api.
 * @author Gilad Bracha
-* @compile -source 1.5 TestC2.java
+* @compile TestC2.java
 * @run main/othervm -ea TestC2
 */
 
--- a/jdk/test/java/lang/reflect/Generics/TestN1.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Generics/TestN1.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
 * @bug 4891872
 * @summary Some tests for the generic core reflection api.
 * @author Gilad Bracha
-* @compile -source 1.5 TestN1.java
+* @compile TestN1.java
 * @run main/othervm -ea TestN1
 */
 
--- a/jdk/test/java/lang/reflect/Generics/exceptionCauseTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Generics/exceptionCauseTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4981727
  * @summary
  * @author Joseph D. Darcy
- * @compile -source 1.5 exceptionCauseTest.java
- * @run main exceptionCauseTest
  */
 
 import java.io.PrintStream;
--- a/jdk/test/java/lang/reflect/Generics/getAnnotationTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Generics/getAnnotationTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4979440
  * @summary Test for signature parsing corner case
  * @author Joseph D. Darcy
- * @compile -source 1.5 getAnnotationTest.java
- * @run main getAnnotationTest
  */
 
 import java.lang.reflect.*;
--- a/jdk/test/java/lang/reflect/Method/Equals.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Method/Equals.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,7 @@
  * @summary Generic framework to test Method.equals.
  *
  * @clean A
- * @compile -source 1.5 Equals.java
+ * @compile Equals.java
  * @run main Equals
  */
 
--- a/jdk/test/java/lang/reflect/Method/GenericStringTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/lang/reflect/Method/GenericStringTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 5033583 6316717 6470106
  * @summary Check toGenericString() and toString() methods
  * @author Joseph D. Darcy
- * @compile -source 1.5 GenericStringTest.java
- * @run main GenericStringTest
  */
 
 import java.lang.reflect.*;
--- a/jdk/test/java/math/BigDecimal/DivideTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/math/BigDecimal/DivideTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4851776 4907265 6177836 6876282
  * @summary Some tests for the divide methods.
  * @author Joseph D. Darcy
- * @compile -source 1.5 DivideTests.java
- * @run main DivideTests
  */
 
 import java.math.*;
--- a/jdk/test/java/math/BigDecimal/IntegralDivisionTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/math/BigDecimal/IntegralDivisionTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,8 +25,6 @@
  * @bug 4904082 4917089 6337226
  * @summary Tests that integral division and related methods return the proper result and scale.
  * @author Joseph D. Darcy
- * @compile -source 1.5 IntegralDivisionTests.java
- * @run main IntegralDivisionTests
  */
 import java.math.*;
 public class IntegralDivisionTests {
--- a/jdk/test/java/math/BigDecimal/PowTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/math/BigDecimal/PowTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4916097
  * @summary Some exponent over/undeflow tests for the pow method
  * @author Joseph D. Darcy
- * @compile -source 1.5 PowTests.java
- * @run main PowTests
  */
 
 import java.math.*;
--- a/jdk/test/java/math/BigDecimal/ToPlainStringTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/math/BigDecimal/ToPlainStringTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4984872
  * @summary Basic tests of toPlainString method
  * @author Joseph D. Darcy
- * @compile -source 1.5 ToPlainStringTests.java
- * @run main ToPlainStringTests
  */
 
 import java.math.*;
--- a/jdk/test/java/math/BigDecimal/ZeroScalingTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/math/BigDecimal/ZeroScalingTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4902952 4905407 4916149
  * @summary Tests that the scale of zero is propagated properly and has the proper effect.
  * @author Joseph D. Darcy
- * @compile -source 1.5 ZeroScalingTests.java
- * @run main ZeroScalingTests
  */
 
 import java.math.*;
--- a/jdk/test/java/math/RoundingMode/RoundingModeTests.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/math/RoundingMode/RoundingModeTests.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,8 +26,6 @@
  * @bug 4851776 4891522 4905335
  * @summary Basic tests for the RoundingMode class.
  * @author Joseph D. Darcy
- * @compile -source 1.5 RoundingModeTests.java
- * @run main RoundingModeTests
  */
 
 import java.math.RoundingMode;
--- a/jdk/test/java/net/CookieHandler/TestHttpCookie.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/net/CookieHandler/TestHttpCookie.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,7 +24,7 @@
 /**
  * @test
  * @summary Unit test for java.net.HttpCookie
- * @bug 6244040 6277796 6277801 6277808 6294071 6692802 6790677
+ * @bug 6244040 6277796 6277801 6277808 6294071 6692802 6790677 6901170
  * @author Edward Wang
  */
 
@@ -335,6 +335,9 @@
         // bug 6277801
         test("set-cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT; path=\"/acme\"")
         .n("CUSTOMER").v("WILE_E_COYOTE").p("/").ver(0);
+
+        // bug 6901170
+        test("set-cookie: CUSTOMER=WILE_E_COYOTE; version='1'").ver(1);
     }
 
     static void misc() {
--- a/jdk/test/java/net/ProxySelector/ProxyTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/net/ProxySelector/ProxyTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,7 +27,7 @@
  * @summary HTTP client: Improve proxy server configuration and selection
  * @library ../../../sun/net/www/httptest/
  * @build ClosedChannelList HttpServer HttpTransaction HttpCallback
- * @compile -source 1.5 ProxyTest.java
+ * @compile ProxyTest.java
  * @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 ProxyTest
  */
 
--- a/jdk/test/java/net/URL/PerConnectionProxy.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/net/URL/PerConnectionProxy.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,7 +26,7 @@
  * @summary Needs per connection proxy support for URLs
  * @library ../../../sun/net/www/httptest/
  * @build ClosedChannelList HttpServer HttpTransaction HttpCallback
- * @compile -source 1.5 PerConnectionProxy.java
+ * @compile PerConnectionProxy.java
  * @run main/othervm -Dhttp.proxyHost=inexistant -Dhttp.proxyPort=8080 PerConnectionProxy
  */
 
--- a/jdk/test/java/security/cert/PKIXBuilderParameters/InvalidParameters.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/security/cert/PKIXBuilderParameters/InvalidParameters.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,7 +24,7 @@
 /**
  * @test
  * @test 4422738
- * @compile -source 1.4 -target 1.4 InvalidParameters.java
+ * @compile -source 1.4 InvalidParameters.java
  * @run main InvalidParameters
  * @summary Make sure PKIXBuilderParameters(Set) detects invalid
  *          parameters and throws correct exceptions
--- a/jdk/test/java/security/cert/PKIXParameters/InvalidParameters.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/security/cert/PKIXParameters/InvalidParameters.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,7 +24,7 @@
 /**
  * @test
  * @test 4422738
- * @compile -source 1.4 -target 1.4 InvalidParameters.java
+ * @compile -source 1.4 InvalidParameters.java
  * @run main InvalidParameters
  * @summary Make sure PKIXParameters(Set) and setTrustAnchors() detects invalid
  *          parameters and throws correct exceptions
--- a/jdk/test/java/util/AbstractList/CheckForComodification.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/AbstractList/CheckForComodification.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,8 +28,6 @@
  * @author  Josh Bloch
  *
  * @ignore Bug fix temporarily removed as it uncovered other bugs (4992226)
- * @compile -source 1.5 CheckForComodification.java
- * @run main CheckForComodification
  */
 
 import java.util.*;
--- a/jdk/test/java/util/Collections/AddAll.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/Collections/AddAll.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4822887
  * @summary Basic test for Collections.addAll
  * @author  Josh Bloch
- *
- * @compile -source 1.5 AddAll.java
- * @run main AddAll
  */
 
 import java.util.*;
--- a/jdk/test/java/util/Collections/Disjoint.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/Collections/Disjoint.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4339792
  * @summary Basic test for Collections.disjoint
  * @author  Josh Bloch
- *
- * @compile -source 1.5 Disjoint.java
- * @run main Disjoint
  */
 
 import java.util.*;
--- a/jdk/test/java/util/Collections/Frequency.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/Collections/Frequency.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4193200
  * @summary Basic test for Collections.frequency
  * @author  Josh Bloch
- *
- * @compile -source 1.5 Frequency.java
- * @run main Frequency
  */
 
 import java.util.*;
--- a/jdk/test/java/util/EnumMap/EnumMapBash.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/EnumMap/EnumMapBash.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,9 +27,6 @@
  * @summary Unit test for EnumMap
  * @author  Josh Bloch
  * @author  Yo Yo Ma
- *
- * @compile -source 1.5 EnumMapBash.java
- * @run main EnumMapBash
  */
 
 import java.util.*;
--- a/jdk/test/java/util/EnumSet/AllOf.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/EnumSet/AllOf.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4946090
  * @summary AllOf static factory is broken in Regular and Jumbo enum set
  * @author  Josh Bloch
- *
- * @compile -source 1.5 AllOf.java
- * @run main AllOf
  */
 
 import java.util.*;
--- a/jdk/test/java/util/EnumSet/ComplementOf.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/EnumSet/ComplementOf.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4946096
  * @summary ComplementOf static factory is broken in Regular and Jumbo enum set
  * @author  Josh Bloch
- *
- * @compile -source 1.5 ComplementOf.java
- * @run main ComplementOf
  */
 
 import java.util.*;
--- a/jdk/test/java/util/EnumSet/EnumSetBash.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/EnumSet/EnumSetBash.java	Wed Jul 05 17:04:26 2017 +0200
@@ -28,9 +28,6 @@
  * @author  Josh Bloch
  * @author  Neal Gafter
  * @author  Yo Ma Ma
- *
- * @compile -source 1.5 EnumSetBash.java
- * @run main EnumSetBash
  */
 
 import java.util.*;
--- a/jdk/test/java/util/EnumSet/JumboRange.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/EnumSet/JumboRange.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4958003
  * @summary Range static factory fails to compute size in Jumbo enum set
  * @author  Josh Bloch
- *
- * @compile -source 1.5 JumboRange.java
- * @run main JumboRange
  */
 
 import java.util.*;
--- a/jdk/test/java/util/EnumSet/Range.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/EnumSet/Range.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4952736
  * @summary Range static factory is broken in Regular and Jumbo enum set
  * @author  Josh Bloch
- *
- * @compile -source 1.5 Range.java
- * @run main Range
  */
 
 import java.util.*;
--- a/jdk/test/java/util/Formattable/StockName.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/Formattable/StockName.java	Wed Jul 05 17:04:26 2017 +0200
@@ -21,11 +21,9 @@
  * have any questions.
  */
 
-/**
+/*
  * @test
  * @bug 4965770 4992540 5030716
- * @compile -source 1.5 StockName.java
- * @run main StockName
  */
 
 import java.nio.CharBuffer;
--- a/jdk/test/java/util/Formatter/Basic-X.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1712 +0,0 @@
-/*
- * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/* Type-specific source code for unit test
- *
- * Regenerate the BasicX classes via genBasic.sh whenever this file changes.
- * We check in the generated source files so that the test tree can be used
- * independently of the rest of the source tree.
- */
-
-#warn This file is preprocessed before being compiled
-
-import java.io.*;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.DateFormatSymbols;
-import java.util.*;
-#if[double]
-import sun.misc.FpUtils;
-import sun.misc.DoubleConsts;
-#end[double]
-
-import static java.util.Calendar.*;
-#if[datetime]
-import static java.util.SimpleTimeZone.*;
-import java.util.regex.Pattern;
-#end[datetime]
-
-public class Basic$Type$ extends Basic {
-
-    private static void test(String fs, String exp, Object ... args) {
-        Formatter f = new Formatter(new StringBuilder(), Locale.US);
-        f.format(fs, args);
-        ck(fs, exp, f.toString());
-    }
-
-    private static void test(Locale l, String fs, String exp, Object ... args)
-    {
-        Formatter f = new Formatter(new StringBuilder(), l);
-        f.format(fs, args);
-        ck(fs, exp, f.toString());
-    }
-
-    private static void test(String fs, Object ... args) {
-        Formatter f = new Formatter(new StringBuilder(), Locale.US);
-        f.format(fs, args);
-        ck(fs, "fail", f.toString());
-    }
-
-    private static void test(String fs) {
-        Formatter f = new Formatter(new StringBuilder(), Locale.US);
-        f.format(fs, "fail");
-        ck(fs, "fail", f.toString());
-    }
-
-    private static void testSysOut(String fs, String exp, Object ... args) {
-        FileOutputStream fos = null;
-        FileInputStream fis = null;
-        try {
-            PrintStream saveOut = System.out;
-            fos = new FileOutputStream("testSysOut");
-            System.setOut(new PrintStream(fos));
-            System.out.format(Locale.US, fs, args);
-            fos.close();
-
-            fis = new FileInputStream("testSysOut");
-            byte [] ba = new byte[exp.length()];
-            int len = fis.read(ba);
-            String got = new String(ba);
-            if (len != ba.length)
-                fail(fs, exp, got);
-            ck(fs, exp, got);
-
-            System.setOut(saveOut);
-        } catch (FileNotFoundException ex) {
-            fail(fs, ex.getClass());
-        } catch (IOException ex) {
-            fail(fs, ex.getClass());
-        } finally {
-            try {
-                if (fos != null)
-                    fos.close();
-                if (fis != null)
-                    fis.close();
-            } catch (IOException ex) {
-                fail(fs, ex.getClass());
-            }
-        }
-    }
-
-    private static void tryCatch(String fs, Class<?> ex) {
-        boolean caught = false;
-        try {
-            test(fs);
-        } catch (Throwable x) {
-            if (ex.isAssignableFrom(x.getClass()))
-                caught = true;
-        }
-        if (!caught)
-            fail(fs, ex);
-        else
-            pass();
-    }
-
-    private static void tryCatch(String fs, Class<?> ex, Object ... args) {
-        boolean caught = false;
-        try {
-            test(fs, args);
-        } catch (Throwable x) {
-            if (ex.isAssignableFrom(x.getClass()))
-                caught = true;
-        }
-        if (!caught)
-            fail(fs, ex);
-        else
-            pass();
-    }
-
-#if[datetime]
-    private static void testDateTime(String fs, String exp, Calendar c) {
-        testDateTime(fs, exp, c, true);
-    }
-
-    private static void testDateTime(String fs, String exp, Calendar c, boolean upper) {
-        //---------------------------------------------------------------------
-        // Date/Time conversions applicable to Calendar, Date, and long.
-        //---------------------------------------------------------------------
-
-        // Calendar
-        test(fs, exp, c);
-        test((Locale)null, fs, exp, c);
-        test(Locale.US, fs, exp, c);
-
-        // Date/long do not have timezone information so they will always use
-        // the default timezone.
-        String nexp = (fs.equals("%tZ") || fs.equals("%TZ")
-                       || fs.equals("%tc") || fs.equals("%Tc")
-                       ? exp.replace("PST", "GMT-08:00")
-                       : exp);
-
-        // Date (implemented via conversion to Calendar)
-        Date d = c.getTime();
-        test(fs, nexp, d);
-        test((Locale)null, fs, nexp, d);
-        test(Locale.US, fs, nexp, d);
-
-        // long (implemented via conversion to Calendar)
-        long l = c.getTimeInMillis();
-        test(fs, nexp, l);
-        test((Locale)null, fs, nexp, l);
-        test(Locale.US, fs, nexp, l);
-
-        if (upper)
-            // repeat all tests for upper case variant (%T)
-            testDateTime(Pattern.compile("t").matcher(fs).replaceFirst("T"),
-                         exp.toUpperCase(), c, false);
-    }
-
-    private static void testHours() {
-        for (int i = 0; i < 24; i++) {
-            // GregorianCalendar(int year, int month, int dayOfMonth,
-            //    int hourOfDay, int minute, int second);
-            Calendar c = new GregorianCalendar(1995, MAY, 23, i, 48, 34);
-
-            //-----------------------------------------------------------------
-            // DateTime.HOUR_OF_DAY - 'k' (0 - 23) -- like H
-            //-----------------------------------------------------------------
-            String exp = Integer.toString(i);
-            testDateTime("%tk", exp, c);
-
-            //-----------------------------------------------------------------
-            // DateTime.HOUR - 'l' (1 - 12) -- like I
-            //-----------------------------------------------------------------
-            int v = i % 12;
-            v = (v == 0 ? 12 : v);
-            String exp2 = Integer.toString(v);
-            testDateTime("%tl", exp2, c);
-
-            //-----------------------------------------------------------------
-            // DateTime.HOUR_OF_DAY_0 - 'H' (00 - 23) [zero padded]
-            //-----------------------------------------------------------------
-            if (exp.length() < 2) exp = "0" + exp;
-            testDateTime("%tH", exp, c);
-
-            //-----------------------------------------------------------------
-            // DateTime.HOUR_0 - 'I' (01 - 12)
-            //-----------------------------------------------------------------
-            if (exp2.length() < 2) exp2 = "0" + exp2;
-            testDateTime("%tI", exp2, c);
-
-            //-----------------------------------------------------------------
-            // DateTime.AM_PM - (am or pm)
-            //-----------------------------------------------------------------
-            testDateTime("%tp", (i <12 ? "am" : "pm"), c);
-        }
-    }
-#end[datetime]
-
-#if[dec]
-#if[prim]
-    private static $type$ negate($type$ v) {
-        return ($type$) -v;
-    }
-#end[prim]
-#end[dec]
-#if[Byte]
-    private static $type$ negate($type$ v) {
-        return new $type$((byte) -v.byteValue());
-    }
-#end[Byte]
-#if[Short]
-    private static $type$ negate($type$ v) {
-        return new $type$((short) -v.shortValue());
-    }
-#end[Short]
-#if[Integer]
-    private static $type$ negate($type$ v) {
-        return new $type$(-v.intValue());
-    }
-#end[Integer]
-#if[Long]
-    private static $type$ negate($type$ v) {
-        return new $type$(-v.longValue());
-    }
-#end[Long]
-
-#if[BigDecimal]
-    private static $type$ create(double v) {
-        return new $type$(v);
-    }
-
-    private static $type$ negate($type$ v) {
-        return v.negate();
-    }
-
-    private static $type$ mult($type$ v, double mul) {
-        return v.multiply(new $type$(mul));
-    }
-
-    private static $type$ recip($type$ v) {
-        return BigDecimal.ONE.divide(v);
-    }
-#end[BigDecimal]
-#if[float]
-    private static $type$ create(double v) {
-        return ($type$) v;
-    }
-
-    private static $type$ negate(double v) {
-        return ($type$) -v;
-    }
-
-    private static $type$ mult($type$ v, double mul) {
-        return v * ($type$) mul;
-    }
-
-    private static $type$ recip($type$ v) {
-        return 1.0f / v;
-    }
-#end[float]
-#if[Float]
-    private static $type$ create(double v) {
-        return new $type$(v);
-    }
-
-    private static $type$ negate($type$ v) {
-        return new $type$(-v.floatValue());
-    }
-
-    private static $type$ mult($type$ v, double mul) {
-        return new $type$(v.floatValue() * (float) mul);
-    }
-
-    private static $type$ recip($type$ v) {
-        return new $type$(1.0f / v.floatValue());
-    }
-#end[Float]
-#if[double]
-    private static $type$ create(double v) {
-        return ($type$) v;
-    }
-
-
-    private static $type$ negate(double v) {
-        return -v;
-    }
-
-    private static $type$ mult($type$ v, double mul) {
-        return v * mul;
-    }
-
-    private static $type$ recip($type$ v) {
-        return 1.0 / v;
-    }
-#end[double]
-#if[Double]
-    private static $type$ create(double v) {
-        return new $type$(v);
-    }
-
-    private static $type$ negate($type$ v) {
-        return new $type$(-v.doubleValue());
-    }
-
-    private static $type$ mult($type$ v, double mul) {
-        return new $type$(v.doubleValue() * mul);
-    }
-
-    private static $type$ recip($type$ v) {
-        return new $type$(1.0 / v.doubleValue());
-    }
-#end[Double]
-
-    public static void test() {
-        TimeZone.setDefault(TimeZone.getTimeZone("GMT-0800"));
-
-        // Any characters not explicitly defined as conversions, date/time
-        // conversion suffixes, or flags are illegal and are reserved for
-        // future extensions.  Use of such a character in a format string will
-        // cause an UnknownFormatConversionException or
-        // UnknownFormatFlagsException to be thrown.
-        tryCatch("%q", UnknownFormatConversionException.class);
-        tryCatch("%t&", UnknownFormatConversionException.class);
-        tryCatch("%&d", UnknownFormatConversionException.class);
-        tryCatch("%^b", UnknownFormatConversionException.class);
-
-        //---------------------------------------------------------------------
-        // Formatter.java class javadoc examples
-        //---------------------------------------------------------------------
-        test(Locale.FRANCE, "e = %+10.4f", "e =    +2,7183", Math.E);
-        test("%4$2s %3$2s %2$2s %1$2s", " d  c  b  a", "a", "b", "c", "d");
-        test("Amount gained or lost since last statement: $ %,(.2f",
-             "Amount gained or lost since last statement: $ (6,217.58)",
-             (new BigDecimal("-6217.58")));
-        Calendar c = new GregorianCalendar(1969, JULY, 20, 16, 17, 0);
-        testSysOut("Local time: %tT", "Local time: 16:17:00", c);
-
-        test("Unable to open file '%1$s': %2$s",
-             "Unable to open file 'food': No such file or directory",
-             "food", "No such file or directory");
-        Calendar duke = new GregorianCalendar(1995, MAY, 23, 19, 48, 34);
-        duke.set(Calendar.MILLISECOND, 584);
-        test("Duke's Birthday: %1$tB %1$te, %1$tY",
-             "Duke's Birthday: May 23, 1995",
-             duke);
-        test("Duke's Birthday: %1$tB %1$te, %1$tY",
-             "Duke's Birthday: May 23, 1995",
-             duke.getTime());
-        test("Duke's Birthday: %1$tB %1$te, %1$tY",
-             "Duke's Birthday: May 23, 1995",
-             duke.getTimeInMillis());
-
-        test("%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s",
-             "d c b a d c b a", "a", "b", "c", "d");
-        test("%s %s %<s %<s", "a b b b", "a", "b", "c", "d");
-        test("%s %s %s %s", "a b c d", "a", "b", "c", "d");
-        test("%2$s %s %<s %s", "b a a b", "a", "b", "c", "d");
-
-        //---------------------------------------------------------------------
-        // %b
-        //
-        // General conversion applicable to any argument.
-        //---------------------------------------------------------------------
-        test("%b", "true", true);
-        test("%b", "false", false);
-        test("%B", "TRUE", true);
-        test("%B", "FALSE", false);
-        test("%b", "true", Boolean.TRUE);
-        test("%b", "false", Boolean.FALSE);
-        test("%B", "TRUE", Boolean.TRUE);
-        test("%B", "FALSE", Boolean.FALSE);
-        test("%14b", "          true", true);
-        test("%-14b", "true          ", true);
-        test("%5.1b", "    f", false);
-        test("%-5.1b", "f    ", false);
-
-        test("%b", "true", "foo");
-        test("%b", "false", (Object)null);
-
-        // Boolean.java hardcodes the Strings for "true" and "false", so no
-        // localization is possible.
-        test(Locale.FRANCE, "%b", "true", true);
-        test(Locale.FRANCE, "%b", "false", false);
-
-        // If you pass in a single array to a varargs method, the compiler
-        // uses it as the array of arguments rather than treating it as a
-        // single array-type argument.
-        test("%b", "false", (Object[])new String[2]);
-        test("%b", "true", new String[2], new String[2]);
-
-        int [] ia = { 1, 2, 3 };
-        test("%b", "true", ia);
-
-        //---------------------------------------------------------------------
-        // %b - errors
-        //---------------------------------------------------------------------
-        tryCatch("%#b", FormatFlagsConversionMismatchException.class);
-        tryCatch("%-b", MissingFormatWidthException.class);
-        // correct or side-effect of implementation?
-        tryCatch("%.b", UnknownFormatConversionException.class);
-        tryCatch("%,b", FormatFlagsConversionMismatchException.class);
-
-        //---------------------------------------------------------------------
-        // %c
-        //
-        // General conversion applicable to any argument.
-        //---------------------------------------------------------------------
-        test("%c", "i", 'i');
-        test("%C", "I", 'i');
-        test("%4c",  "   i", 'i');
-        test("%-4c", "i   ", 'i');
-        test("%4C",  "   I", 'i');
-        test("%-4C", "I   ", 'i');
-        test("%c", "i", new Character('i'));
-        test("%c", "H", (byte) 72);
-        test("%c", "i", (short) 105);
-        test("%c", "!", (int) 33);
-        test("%c", "\u007F", Byte.MAX_VALUE);
-        test("%c", new String(Character.toChars(Short.MAX_VALUE)),
-             Short.MAX_VALUE);
-        test("%c", "null", (Object) null);
-
-        //---------------------------------------------------------------------
-        // %c - errors
-        //---------------------------------------------------------------------
-        tryCatch("%c", IllegalFormatConversionException.class,
-                 Boolean.TRUE);
-        tryCatch("%c", IllegalFormatConversionException.class,
-                 (float) 0.1);
-        tryCatch("%c", IllegalFormatConversionException.class,
-                 new Object());
-        tryCatch("%c", IllegalFormatCodePointException.class,
-                 Byte.MIN_VALUE);
-        tryCatch("%c", IllegalFormatCodePointException.class,
-                 Short.MIN_VALUE);
-        tryCatch("%c", IllegalFormatCodePointException.class,
-                 Integer.MIN_VALUE);
-        tryCatch("%c", IllegalFormatCodePointException.class,
-                 Integer.MAX_VALUE);
-
-        tryCatch("%#c", FormatFlagsConversionMismatchException.class);
-        tryCatch("%,c", FormatFlagsConversionMismatchException.class);
-        tryCatch("%(c", FormatFlagsConversionMismatchException.class);
-        tryCatch("%$c", UnknownFormatConversionException.class);
-        tryCatch("%.2c", IllegalFormatPrecisionException.class);
-
-        //---------------------------------------------------------------------
-        // %s
-        //
-        // General conversion applicable to any argument.
-        //---------------------------------------------------------------------
-        test("%s", "Hello, Duke", "Hello, Duke");
-        test("%S", "HELLO, DUKE", "Hello, Duke");
-        test("%20S", "         HELLO, DUKE", "Hello, Duke");
-        test("%20s", "         Hello, Duke", "Hello, Duke");
-        test("%-20s", "Hello, Duke         ", "Hello, Duke");
-        test("%-20.5s", "Hello               ", "Hello, Duke");
-        test("%s", "null", (Object)null);
-
-        StringBuffer sb = new StringBuffer("foo bar");
-        test("%s", sb.toString(), sb);
-        test("%S", sb.toString().toUpperCase(), sb);
-
-        //---------------------------------------------------------------------
-        // %s - errors
-        //---------------------------------------------------------------------
-        tryCatch("%-s", MissingFormatWidthException.class);
-        tryCatch("%--s", DuplicateFormatFlagsException.class);
-        tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0);
-        tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
-        tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
-        tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
-
-        //---------------------------------------------------------------------
-        // %h
-        //
-        // General conversion applicable to any argument.
-        //---------------------------------------------------------------------
-        test("%h", Integer.toHexString("Hello, Duke".hashCode()),
-             "Hello, Duke");
-        test("%10h", "  ddf63471", "Hello, Duke");
-        test("%-10h", "ddf63471  ", "Hello, Duke");
-        test("%-10H", "DDF63471  ", "Hello, Duke");
-        test("%10h", "  402e0000", 15.0);
-        test("%10H", "  402E0000", 15.0);
-
-        //---------------------------------------------------------------------
-        // %h - errors
-        //---------------------------------------------------------------------
-        tryCatch("%#h", FormatFlagsConversionMismatchException.class);
-
-        //---------------------------------------------------------------------
-        // flag/conversion errors
-        //---------------------------------------------------------------------
-        tryCatch("%F", UnknownFormatConversionException.class);
-
-        tryCatch("%#g", FormatFlagsConversionMismatchException.class);
-
-#if[dec]
-
-#if[prim]
-        $type$ minByte = Byte.MIN_VALUE;   // -128
-#else[prim]
-        $type$ minByte = new $type$(Byte.MIN_VALUE);
-#end[prim]
-
-        //---------------------------------------------------------------------
-        // %d
-        //
-        // Numeric conversion applicable to byte, short, int, long, and
-        // BigInteger.
-        //---------------------------------------------------------------------
-        test("%d", "null", (Object)null);
-
-#if[byte]
-#if[prim]
-        //---------------------------------------------------------------------
-        // %d - byte
-        //---------------------------------------------------------------------
-        $type$ seventeen = ($type$) 17;
-        test("%d", "17", seventeen);
-        test("%,d", "17", seventeen);
-        test("%,d", "-17", negate(seventeen));
-        test("%(d", "17", seventeen);
-        test("%(d", "(17)", negate(seventeen));
-        test("% d", " 17", seventeen);
-        test("% d", "-17", negate(seventeen));
-        test("%+d", "+17", seventeen);
-        test("%+d", "-17", negate(seventeen));
-        test("%010d", "0000000017", seventeen);
-        test("%010d", "-000000017", negate(seventeen));
-        test("%(10d", "      (17)", negate(seventeen));
-        test("%-10d", "17        ", seventeen);
-        test("%-10d", "-17       ", negate(seventeen));
-#end[prim]
-#else[byte]
-#if[short]
-        //---------------------------------------------------------------------
-        // %d - short
-        //---------------------------------------------------------------------
-        $type$ oneToFive = ($type$) 12345;
-        test("%d", "12345", oneToFive);
-        test("%,d", "12,345", oneToFive);
-        test("%,d", "-12,345", negate(oneToFive));
-        test("%(d", "12345", oneToFive);
-        test("%(d", "(12345)", negate(oneToFive));
-        test("% d", " 12345", oneToFive);
-        test("% d", "-12345", negate(oneToFive));
-        test("%+d", "+12345", oneToFive);
-        test("%+d", "-12345", negate(oneToFive));
-        test("%010d", "0000012345", oneToFive);
-        test("%010d", "-000012345", negate(oneToFive));
-        test("%(10d", "   (12345)", negate(oneToFive));
-        test("%-10d", "12345     ", oneToFive);
-        test("%-10d", "-12345    ", negate(oneToFive));
-
-#else[short]
-#if[prim]
-        //---------------------------------------------------------------------
-        // %d - int and long
-        //---------------------------------------------------------------------
-        $type$ oneToSeven = ($type$) 1234567;
-        test("%d", "1234567", oneToSeven);
-        test("%,d", "1,234,567", oneToSeven);
-        test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", oneToSeven);
-        test("%,d", "-1,234,567", negate(oneToSeven));
-        test("%(d", "1234567", oneToSeven);
-        test("%(d", "(1234567)", negate(oneToSeven));
-        test("% d", " 1234567", oneToSeven);
-        test("% d", "-1234567", negate(oneToSeven));
-        test("%+d", "+1234567", oneToSeven);
-        test("%+d", "-1234567", negate(oneToSeven));
-        test("%010d", "0001234567", oneToSeven);
-        test("%010d", "-001234567", negate(oneToSeven));
-        test("%(10d", " (1234567)", negate(oneToSeven));
-        test("%-10d", "1234567   ", oneToSeven);
-        test("%-10d", "-1234567  ", negate(oneToSeven));
-#end[prim]
-#end[short]
-#end[byte]
-        //---------------------------------------------------------------------
-        // %d - errors
-        //---------------------------------------------------------------------
-        tryCatch("%#d", FormatFlagsConversionMismatchException.class);
-        tryCatch("%D", UnknownFormatConversionException.class);
-        tryCatch("%0d", MissingFormatWidthException.class);
-        tryCatch("%-d", MissingFormatWidthException.class);
-        tryCatch("%7.3d", IllegalFormatPrecisionException.class);
-
-        //---------------------------------------------------------------------
-        // %o
-        //
-        // Numeric conversion applicable to byte, short, int, long, and
-        // BigInteger.
-        //---------------------------------------------------------------------
-        test("%o", "null", (Object)null);
-
-#if[byte]
-        //---------------------------------------------------------------------
-        // %o - byte
-        //---------------------------------------------------------------------
-        test("%010o", "0000000200", minByte);
-        test("%-10o", "200       ", minByte);
-        test("%#10o", "      0200", minByte);
-#end[byte]
-#if[short]
-        //---------------------------------------------------------------------
-        // %o - short
-        //---------------------------------------------------------------------
-
-        test("%010o", "0000177600", minByte);
-        test("%-10o", "177600    ", minByte);
-        test("%#10o", "   0177600", minByte);
-#end[short]
-#if[int]
-        //---------------------------------------------------------------------
-        // %o - int
-        //---------------------------------------------------------------------
-        test("%014o", "00037777777600", minByte);
-        test("%-14o", "37777777600   ", minByte);
-        test("%#14o", "  037777777600", minByte);
-
-        $type$ oneToSevenOct = ($type$) 1234567;
-        test("%o", "4553207", oneToSevenOct);
-        test("%010o", "0004553207", oneToSevenOct);
-        test("%-10o", "4553207   ", oneToSevenOct);
-        test("%#10o", "  04553207", oneToSevenOct);
-#end[int]
-#if[long]
-        //---------------------------------------------------------------------
-        // %o - long
-        //---------------------------------------------------------------------
-        test("%024o", "001777777777777777777600", minByte);
-        test("%-24o", "1777777777777777777600  ", minByte);
-        test("%#24o", " 01777777777777777777600", minByte);
-
-        $type$ oneToSevenOct = ($type$) 1234567;
-        test("%o", "4553207", oneToSevenOct);
-        test("%010o", "0004553207", oneToSevenOct);
-        test("%-10o", "4553207   ", oneToSevenOct);
-        test("%#10o", "  04553207", oneToSevenOct);
-#end[long]
-
-        //---------------------------------------------------------------------
-        // %o - errors
-        //---------------------------------------------------------------------
-        tryCatch("%(o", FormatFlagsConversionMismatchException.class,
-                 minByte);
-        tryCatch("%+o", FormatFlagsConversionMismatchException.class,
-                 minByte);
-        tryCatch("% o", FormatFlagsConversionMismatchException.class,
-                 minByte);
-        tryCatch("%0o", MissingFormatWidthException.class);
-        tryCatch("%-o", MissingFormatWidthException.class);
-        tryCatch("%,o", FormatFlagsConversionMismatchException.class);
-        tryCatch("%O", UnknownFormatConversionException.class);
-
-        //---------------------------------------------------------------------
-        // %x
-        //
-        // Numeric conversion applicable to byte, short, int, long, and
-        // BigInteger.
-        //---------------------------------------------------------------------
-        test("%x", "null", (Object)null);
-
-#if[byte]
-        //---------------------------------------------------------------------
-        // %x - byte
-        //---------------------------------------------------------------------
-        test("%010x", "0000000080", minByte);
-        test("%-10x", "80        ", minByte);
-        test("%#10x", "      0x80", minByte);
-        test("%0#10x","0x00000080", minByte);
-        test("%#10X", "      0X80", minByte);
-        test("%X", "80", minByte);
-#end[byte]
-#if[short]
-        //---------------------------------------------------------------------
-        // %x - short
-        //---------------------------------------------------------------------
-        test("%010x", "000000ff80", minByte);
-        test("%-10x", "ff80      ", minByte);
-        test("%#10x", "    0xff80", minByte);
-        test("%0#10x","0x0000ff80", minByte);
-        test("%#10X", "    0XFF80", minByte);
-        test("%X", "FF80", minByte);
-#end[short]
-#if[int]
-        //---------------------------------------------------------------------
-        // %x - int
-        //---------------------------------------------------------------------
-        $type$ oneToSevenHex = ($type$)1234567;
-        test("%x", "null", (Object)null);
-        test("%x", "12d687", oneToSevenHex);
-        test("%010x", "000012d687", oneToSevenHex);
-        test("%-10x", "12d687    ", oneToSevenHex);
-        test("%#10x", "  0x12d687", oneToSevenHex);
-        test("%#10X", "  0X12D687",oneToSevenHex);
-        test("%X", "12D687", oneToSevenHex);
-
-        test("%010x", "00ffffff80", minByte);
-        test("%-10x", "ffffff80  ", minByte);
-        test("%#10x", "0xffffff80", minByte);
-        test("%0#12x","0x00ffffff80", minByte);
-        test("%#12X", "  0XFFFFFF80", minByte);
-        test("%X", "FFFFFF80", minByte);
-#end[int]
-#if[long]
-        //---------------------------------------------------------------------
-        // %x - long
-        //---------------------------------------------------------------------
-        $type$ oneToSevenHex = ($type$)1234567;
-        test("%x", "null", (Object)null);
-        test("%x", "12d687", oneToSevenHex);
-        test("%010x", "000012d687", oneToSevenHex);
-        test("%-10x", "12d687    ", oneToSevenHex);
-        test("%#10x", "  0x12d687", oneToSevenHex);
-        test("%#10X", "  0X12D687",oneToSevenHex);
-        test("%X", "12D687", oneToSevenHex);
-
-        test("%018x",    "00ffffffffffffff80", minByte);
-        test("%-18x",      "ffffffffffffff80  ", minByte);
-        test("%#20x",  "  0xffffffffffffff80", minByte);
-        test("%0#20x", "0x00ffffffffffffff80", minByte);
-        test("%#20X", "  0XFFFFFFFFFFFFFF80", minByte);
-        test("%X",        "FFFFFFFFFFFFFF80", minByte);
-#end[long]
-        //---------------------------------------------------------------------
-        // %x - errors
-        //---------------------------------------------------------------------
-        tryCatch("%,x", FormatFlagsConversionMismatchException.class);
-        tryCatch("%0x", MissingFormatWidthException.class);
-        tryCatch("%-x", MissingFormatWidthException.class);
-
-#end[dec]
-
-#if[BigInteger]
-        //---------------------------------------------------------------------
-        // BigInteger - errors
-        //---------------------------------------------------------------------
-        tryCatch("%f", IllegalFormatConversionException.class,
-                 new BigInteger("1"));
-
-        //---------------------------------------------------------------------
-        // %d - BigInteger
-        //---------------------------------------------------------------------
-        test("%d", "null", (Object)null);
-        test("%d", "1234567", new BigInteger("1234567", 10));
-        test("%,d", "1,234,567", new BigInteger("1234567", 10));
-        test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", new BigInteger("1234567", 10));
-        test("%,d", "-1,234,567", new BigInteger("-1234567", 10));
-        test("%(d", "1234567", new BigInteger("1234567", 10));
-        test("%(d", "(1234567)", new BigInteger("-1234567", 10));
-        test("% d", " 1234567", new BigInteger("1234567", 10));
-        test("% d", "-1234567", new BigInteger("-1234567", 10));
-        test("%+d", "+1234567", new BigInteger("1234567", 10));
-        test("%+d", "-1234567", new BigInteger("-1234567", 10));
-        test("%010d", "0001234567", new BigInteger("1234567", 10));
-        test("%010d", "-001234567", new BigInteger("-1234567", 10));
-        test("%(10d", " (1234567)", new BigInteger("-1234567", 10));
-        test("%+d", "+1234567", new BigInteger("1234567", 10));
-        test("%+d", "-1234567", new BigInteger("-1234567", 10));
-        test("%-10d", "1234567   ", new BigInteger("1234567", 10));
-        test("%-10d", "-1234567  ", new BigInteger("-1234567", 10));
-
-        //---------------------------------------------------------------------
-        // %o - BigInteger
-        //---------------------------------------------------------------------
-        test("%o", "null", (Object)null);
-        test("%o", "1234567", new BigInteger("1234567", 8));
-        test("%(o", "1234567", new BigInteger("1234567", 8));
-        test("%(o", "(1234567)", new BigInteger("-1234567", 8));
-        test("% o", " 1234567", new BigInteger("1234567", 8));
-        test("% o", "-1234567", new BigInteger("-1234567", 8));
-        test("%+o", "+1234567", new BigInteger("1234567", 8));
-        test("%+o", "-1234567", new BigInteger("-1234567", 8));
-        test("%010o", "0001234567", new BigInteger("1234567", 8));
-        test("%010o", "-001234567", new BigInteger("-1234567", 8));
-        test("%(10o", " (1234567)", new BigInteger("-1234567", 8));
-        test("%+o", "+1234567", new BigInteger("1234567", 8));
-        test("%+o", "-1234567", new BigInteger("-1234567", 8));
-        test("%-10o", "1234567   ", new BigInteger("1234567", 8));
-        test("%-10o", "-1234567  ", new BigInteger("-1234567", 8));
-        test("%#10o", "  01234567", new BigInteger("1234567", 8));
-        test("%#10o", " -01234567", new BigInteger("-1234567", 8));
-
-        //---------------------------------------------------------------------
-        // %x - BigInteger
-        //---------------------------------------------------------------------
-        test("%x", "null", (Object)null);
-        test("%x", "1234567", new BigInteger("1234567", 16));
-        test("%(x", "1234567", new BigInteger("1234567", 16));
-        test("%(x", "(1234567)", new BigInteger("-1234567", 16));
-        test("% x", " 1234567", new BigInteger("1234567", 16));
-        test("% x", "-1234567", new BigInteger("-1234567", 16));
-        test("%+x", "+1234567", new BigInteger("1234567", 16));
-        test("%+x", "-1234567", new BigInteger("-1234567", 16));
-        test("%010x", "0001234567", new BigInteger("1234567", 16));
-        test("%010x", "-001234567", new BigInteger("-1234567", 16));
-        test("%(10x", " (1234567)", new BigInteger("-1234567", 16));
-        test("%+x", "+1234567", new BigInteger("1234567", 16));
-        test("%+x", "-1234567", new BigInteger("-1234567", 16));
-        test("%-10x", "1234567   ", new BigInteger("1234567", 16));
-        test("%-10x", "-1234567  ", new BigInteger("-1234567", 16));
-        test("%#10x", " 0x1234567", new BigInteger("1234567", 16));
-        test("%#10x", "-0x1234567", new BigInteger("-1234567", 16));
-        test("%#10X", " 0X1234567", new BigInteger("1234567", 16));
-        test("%#10X", "-0X1234567", new BigInteger("-1234567", 16));
-        test("%X", "1234567A", new BigInteger("1234567a", 16));
-        test("%X", "-1234567A", new BigInteger("-1234567a", 16));
-#end[BigInteger]
-
-#if[fp]
-#if[BigDecimal]
-        //---------------------------------------------------------------------
-        // %s - BigDecimal
-        //---------------------------------------------------------------------
-        $type$ one = BigDecimal.ONE;
-        $type$ ten = BigDecimal.TEN;
-        $type$ pi  = new $type$(Math.PI);
-        $type$ piToThe300 = pi.pow(300);
-
-        test("%s", "3.141592653589793115997963468544185161590576171875", pi);
-#end[BigDecimal]
-#if[float]
-        //---------------------------------------------------------------------
-        // %s - float
-        //---------------------------------------------------------------------
-        $type$ one = 1.0f;
-        $type$ ten = 10.0f;
-        $type$ pi  = (float) Math.PI;
-
-        test("%s", "3.1415927", pi);
-#end[float]
-#if[Float]
-        //---------------------------------------------------------------------
-        // %s - Float
-        //---------------------------------------------------------------------
-        $type$ one = new $type$(1.0f);
-        $type$ ten = new $type$(10.0f);
-        $type$ pi  = new $type$(Math.PI);
-
-        test("%s", "3.1415927", pi);
-#end[Float]
-#if[double]
-        //---------------------------------------------------------------------
-        // %s - double
-        //---------------------------------------------------------------------
-        $type$ one = 1.0;
-        $type$ ten = 10.0;
-        $type$ pi  = Math.PI;
-
-        test("%s", "3.141592653589793", pi);
-#end[double]
-#if[Double]
-        //---------------------------------------------------------------------
-        // %s - Double
-        //---------------------------------------------------------------------
-        $type$ one = new $type$(1.0);
-        $type$ ten = new $type$(10.0);
-        $type$ pi  = new $type$(Math.PI);
-
-        test("%s", "3.141592653589793", pi);
-#end[Double]
-
-        //---------------------------------------------------------------------
-        // flag/conversion errors
-        //---------------------------------------------------------------------
-        tryCatch("%d", IllegalFormatConversionException.class, one);
-        tryCatch("%,.4e", FormatFlagsConversionMismatchException.class, one);
-
-        //---------------------------------------------------------------------
-        // %e
-        //
-        // Floating-point conversions applicable to float, double, and
-        // BigDecimal.
-        //---------------------------------------------------------------------
-        test("%e", "null", (Object)null);
-
-        //---------------------------------------------------------------------
-        // %e - float and double
-        //---------------------------------------------------------------------
-        // double PI = 3.141 592 653 589 793 238 46;
-        test("%e", "3.141593e+00", pi);
-        test("%.0e", "1e+01", ten);
-        test("%#.0e", "1.e+01", ten);
-        test("%E", "3.141593E+00", pi);
-        test("%10.3e", " 3.142e+00", pi);
-        test("%10.3e", "-3.142e+00", negate(pi));
-        test("%010.3e", "03.142e+00", pi);
-        test("%010.3e", "-3.142e+00", negate(pi));
-        test("%-12.3e", "3.142e+00   ", pi);
-        test("%-12.3e", "-3.142e+00  ", negate(pi));
-        test("%.3e", "3.142e+00", pi);
-        test("%.3e", "-3.142e+00", negate(pi));
-        test("%.3e", "3.142e+06", mult(pi, 1000000.0));
-        test("%.3e", "-3.142e+06", mult(pi, -1000000.0));
-
-        test(Locale.FRANCE, "%e", "3,141593e+00", pi);
-
-        // double PI^300
-        //    = 13962455701329742638131355433930076081862072808 ... e+149
-#if[BigDecimal]
-        //---------------------------------------------------------------------
-        // %e - BigDecimal
-        //---------------------------------------------------------------------
-        test("%.3e", "1.396e+149", piToThe300);
-        test("%.3e", "-1.396e+149", piToThe300.negate());
-        test("%.3e", "1.000e-100", recip(ten.pow(100)));
-        test("%.3e", "-1.000e-100", negate(recip(ten.pow(100))));
-
-        test("%3.0e", "1e-06", new BigDecimal("0.000001"));
-        test("%3.0e", "1e-05", new BigDecimal("0.00001"));
-        test("%3.0e", "1e-04", new BigDecimal("0.0001"));
-        test("%3.0e", "1e-03", new BigDecimal("0.001"));
-        test("%3.0e", "1e-02", new BigDecimal("0.01"));
-        test("%3.0e", "1e-01", new BigDecimal("0.1"));
-        test("%3.0e", "9e-01", new BigDecimal("0.9"));
-        test("%3.1e", "9.0e-01", new BigDecimal("0.9"));
-        test("%3.0e", "1e+00", new BigDecimal("1.00"));
-        test("%3.0e", "1e+01", new BigDecimal("10.00"));
-        test("%3.0e", "1e+02", new BigDecimal("99.19"));
-        test("%3.1e", "9.9e+01", new BigDecimal("99.19"));
-        test("%3.0e", "1e+02", new BigDecimal("99.99"));
-        test("%3.0e", "1e+02", new BigDecimal("100.00"));
-        test("%#3.0e", "1.e+03",    new BigDecimal("1000.00"));
-        test("%3.0e", "1e+04",     new BigDecimal("10000.00"));
-        test("%3.0e", "1e+05",    new BigDecimal("100000.00"));
-        test("%3.0e", "1e+06",   new BigDecimal("1000000.00"));
-        test("%3.0e", "1e+07",  new BigDecimal("10000000.00"));
-        test("%3.0e", "1e+08", new BigDecimal("100000000.00"));
-#end[BigDecimal]
-
-        test("%10.3e", " 1.000e+00", one);
-        test("%+.3e", "+3.142e+00", pi);
-        test("%+.3e", "-3.142e+00", negate(pi));
-        test("% .3e", " 3.142e+00", pi);
-        test("% .3e", "-3.142e+00", negate(pi));
-        test("%#.0e", "3.e+00", create(3.0));
-        test("%#.0e", "-3.e+00", create(-3.0));
-        test("%.0e", "3e+00", create(3.0));
-        test("%.0e", "-3e+00", create(-3.0));
-
-        test("%(.4e", "3.1416e+06", mult(pi, 1000000.0));
-        test("%(.4e", "(3.1416e+06)", mult(pi, -1000000.0));
-
-        //---------------------------------------------------------------------
-        // %e - boundary problems
-        //---------------------------------------------------------------------
-        test("%3.0e", "1e-06", 0.000001);
-        test("%3.0e", "1e-05", 0.00001);
-        test("%3.0e", "1e-04", 0.0001);
-        test("%3.0e", "1e-03", 0.001);
-        test("%3.0e", "1e-02", 0.01);
-        test("%3.0e", "1e-01", 0.1);
-        test("%3.0e", "9e-01", 0.9);
-        test("%3.1e", "9.0e-01", 0.9);
-        test("%3.0e", "1e+00", 1.00);
-        test("%3.0e", "1e+01", 10.00);
-        test("%3.0e", "1e+02", 99.19);
-        test("%3.1e", "9.9e+01", 99.19);
-        test("%3.0e", "1e+02", 99.99);
-        test("%3.0e", "1e+02", 100.00);
-        test("%#3.0e", "1.e+03",     1000.00);
-        test("%3.0e", "1e+04",     10000.00);
-        test("%3.0e", "1e+05",    100000.00);
-        test("%3.0e", "1e+06",   1000000.00);
-        test("%3.0e", "1e+07",  10000000.00);
-        test("%3.0e", "1e+08", 100000000.00);
-
-        //---------------------------------------------------------------------
-        // %f
-        //
-        // Floating-point conversions applicable to float, double, and
-        // BigDecimal.
-        //---------------------------------------------------------------------
-        test("%f", "null", (Object)null);
-        test("%f", "3.141593", pi);
-        test(Locale.FRANCE, "%f", "3,141593", pi);
-        test("%10.3f", "     3.142", pi);
-        test("%10.3f", "    -3.142", negate(pi));
-        test("%010.3f", "000003.142", pi);
-        test("%010.3f", "-00003.142", negate(pi));
-        test("%-10.3f", "3.142     ", pi);
-        test("%-10.3f", "-3.142    ", negate(pi));
-        test("%.3f", "3.142", pi);
-        test("%.3f", "-3.142", negate(pi));
-        test("%+.3f", "+3.142", pi);
-        test("%+.3f", "-3.142", negate(pi));
-        test("% .3f", " 3.142", pi);
-        test("% .3f", "-3.142", negate(pi));
-        test("%#.0f", "3.", create(3.0));
-        test("%#.0f", "-3.", create(-3.0));
-        test("%.0f", "3", create(3.0));
-        test("%.0f", "-3", create(-3.0));
-        test("%.3f", "10.000", ten);
-        test("%.3f", "1.000", one);
-        test("%10.3f", "     1.000", one);
-
-        //---------------------------------------------------------------------
-        // %f - boundary problems
-        //---------------------------------------------------------------------
-        test("%3.0f", "  0", 0.000001);
-        test("%3.0f", "  0", 0.00001);
-        test("%3.0f", "  0", 0.0001);
-        test("%3.0f", "  0", 0.001);
-        test("%3.0f", "  0", 0.01);
-        test("%3.0f", "  0", 0.1);
-        test("%3.0f", "  1", 0.9);
-        test("%3.1f", "0.9", 0.9);
-        test("%3.0f", "  1", 1.00);
-        test("%3.0f", " 10", 10.00);
-        test("%3.0f", " 99", 99.19);
-        test("%3.1f", "99.2", 99.19);
-        test("%3.0f", "100", 99.99);
-        test("%3.0f", "100", 100.00);
-        test("%#3.0f", "1000.",     1000.00);
-        test("%3.0f", "10000",     10000.00);
-        test("%3.0f", "100000",    100000.00);
-        test("%3.0f", "1000000",   1000000.00);
-        test("%3.0f", "10000000",  10000000.00);
-        test("%3.0f", "100000000", 100000000.00);
-#if[BigDecimal]
-        //---------------------------------------------------------------------
-        // %f - BigDecimal
-        //---------------------------------------------------------------------
-        test("%4.0f", "  99", new BigDecimal("99.19"));
-        test("%4.1f", "99.2", new BigDecimal("99.19"));
-
-        BigDecimal val = new BigDecimal("99.95");
-        test("%4.0f", " 100", val);
-        test("%#4.0f", "100.", val);
-        test("%4.1f", "100.0", val);
-        test("%4.2f", "99.95", val);
-        test("%4.3f", "99.950", val);
-
-        val = new BigDecimal(".99");
-        test("%4.1f", " 1.0", val);
-        test("%4.2f", "0.99", val);
-        test("%4.3f", "0.990", val);
-
-        // #6476425
-        val = new BigDecimal("0.00001");
-        test("%.0f", "0", val);
-        test("%.1f", "0.0", val);
-        test("%.2f", "0.00", val);
-        test("%.3f", "0.000", val);
-        test("%.4f", "0.0000", val);
-        test("%.5f", "0.00001", val);
-
-        val = new BigDecimal("1.00001");
-        test("%.0f", "1", val);
-        test("%.1f", "1.0", val);
-        test("%.2f", "1.00", val);
-        test("%.3f", "1.000", val);
-        test("%.4f", "1.0000", val);
-        test("%.5f", "1.00001", val);
-
-        val = new BigDecimal("1.23456");
-        test("%.0f", "1", val);
-        test("%.1f", "1.2", val);
-        test("%.2f", "1.23", val);
-        test("%.3f", "1.235", val);
-        test("%.4f", "1.2346", val);
-        test("%.5f", "1.23456", val);
-        test("%.6f", "1.234560", val);
-
-        val = new BigDecimal("9.99999");
-        test("%.0f", "10", val);
-        test("%.1f", "10.0", val);
-        test("%.2f", "10.00", val);
-        test("%.3f", "10.000", val);
-        test("%.4f", "10.0000", val);
-        test("%.5f", "9.99999", val);
-        test("%.6f", "9.999990", val);
-
-
-        val = new BigDecimal("1.99999");
-        test("%.0f", "2", val);
-        test("%.1f", "2.0", val);
-        test("%.2f", "2.00", val);
-        test("%.3f", "2.000", val);
-        test("%.4f", "2.0000", val);
-        test("%.5f", "1.99999", val);
-        test("%.6f", "1.999990", val);
-
-#end[BigDecimal]
-
-#if[float]
-        //---------------------------------------------------------------------
-        // %f - float
-        //---------------------------------------------------------------------
-        // Float can not accurately store 1e6 * PI.
-        test("%.3f", "3141.593", mult(pi, 1000.0));
-        test("%.3f", "-3141.593", mult(pi, -1000.0));
-
-        test("%,.2f", "3,141.59", mult(pi, 1000.0));
-        test(Locale.FRANCE, "%,.2f", "3\u00a0141,59", mult(pi, 1000.0));
-        test("%,.2f", "-3,141.59", mult(pi, -1000.0));
-        test("%(.2f", "3141.59", mult(pi, 1000.0));
-        test("%(.2f", "(3141.59)", mult(pi, -1000.0));
-        test("%(,.2f", "3,141.59", mult(pi, 1000.0));
-        test("%(,.2f", "(3,141.59)", mult(pi, -1000.0));
-
-#else[float]
-#if[!Float]
-        //---------------------------------------------------------------------
-        // %f - float, double, Double, BigDecimal
-        //---------------------------------------------------------------------
-        test("%.3f", "3141592.654", mult(pi, 1000000.0));
-        test("%.3f", "-3141592.654", mult(pi, -1000000.0));
-        test("%,.4f", "3,141,592.6536", mult(pi, 1000000.0));
-        test(Locale.FRANCE, "%,.4f", "3\u00a0141\u00a0592,6536", mult(pi, 1000000.0));
-        test("%,.4f", "-3,141,592.6536", mult(pi, -1000000.0));
-        test("%(.4f", "3141592.6536", mult(pi, 1000000.0));
-        test("%(.4f", "(3141592.6536)", mult(pi, -1000000.0));
-        test("%(,.4f", "3,141,592.6536", mult(pi, 1000000.0));
-        test("%(,.4f", "(3,141,592.6536)", mult(pi, -1000000.0));
-#end[!Float]
-#end[float]
-
-
-        //---------------------------------------------------------------------
-        // %g
-        //
-        // Floating-point conversions applicable to float, double, and
-        // BigDecimal.
-        //---------------------------------------------------------------------
-        test("%g", "null", (Object)null);
-        test("%g", "3.14159", pi);
-        test(Locale.FRANCE, "%g", "3,14159", pi);
-        test("%.0g", "1e+01", ten);
-        test("%G", "3.14159", pi);
-        test("%10.3g", "      3.14", pi);
-        test("%10.3g", "     -3.14", negate(pi));
-        test("%010.3g", "0000003.14", pi);
-        test("%010.3g", "-000003.14", negate(pi));
-        test("%-12.3g", "3.14        ", pi);
-        test("%-12.3g", "-3.14       ", negate(pi));
-        test("%.3g", "3.14", pi);
-        test("%.3g", "-3.14", negate(pi));
-        test("%.3g", "3.14e+08", mult(pi, 100000000.0));
-        test("%.3g", "-3.14e+08", mult(pi, -100000000.0));
-
-        test("%.3g", "1.00e-05", recip(create(100000.0)));
-        test("%.3g", "-1.00e-05", recip(create(-100000.0)));
-        test("%.0g", "-1e-05", recip(create(-100000.0)));
-        test("%.0g", "1e+05", create(100000.0));
-        test("%.3G", "1.00E-05", recip(create(100000.0)));
-        test("%.3G", "-1.00E-05", recip(create(-100000.0)));
-
-        test("%3.0g", "1e-06", 0.000001);
-        test("%3.0g", "1e-05", 0.00001);
-        test("%3.0g", "1e-05", 0.0000099);
-        test("%3.1g", "1e-05", 0.0000099);
-        test("%3.2g", "9.9e-06", 0.0000099);
-        test("%3.0g", "0.0001", 0.0001);
-        test("%3.0g", "9e-05",  0.00009);
-        test("%3.0g", "0.0001", 0.000099);
-        test("%3.1g", "0.0001", 0.000099);
-        test("%3.2g", "9.9e-05", 0.000099);
-        test("%3.0g", "0.001", 0.001);
-        test("%3.0g", "0.001", 0.00099);
-        test("%3.1g", "0.001", 0.00099);
-        test("%3.2g", "0.00099", 0.00099);
-        test("%3.3g", "0.00100", 0.001);
-        test("%3.4g", "0.001000", 0.001);
-        test("%3.0g", "0.01", 0.01);
-        test("%3.0g", "0.1", 0.1);
-        test("%3.0g", "0.9", 0.9);
-        test("%3.1g", "0.9", 0.9);
-        test("%3.0g", "  1", 1.00);
-        test("%3.2g", " 10", 10.00);
-        test("%3.0g", "1e+01", 10.00);
-        test("%3.0g", "1e+02", 99.19);
-        test("%3.1g", "1e+02", 99.19);
-        test("%3.2g", " 99", 99.19);
-        test("%3.0g", "1e+02", 99.9);
-        test("%3.1g", "1e+02", 99.9);
-        test("%3.2g", "1.0e+02", 99.9);
-        test("%3.0g", "1e+02", 99.99);
-        test("%3.0g", "1e+02", 100.00);
-        test("%3.0g", "1e+03", 999.9);
-        test("%3.1g", "1e+03", 999.9);
-        test("%3.2g", "1.0e+03", 999.9);
-        test("%3.3g", "1.00e+03", 999.9);
-        test("%3.4g", "999.9", 999.9);
-        test("%3.4g", "1000", 999.99);
-        test("%3.0g", "1e+03", 1000.00);
-        test("%3.0g", "1e+04",     10000.00);
-        test("%3.0g", "1e+05",    100000.00);
-        test("%3.0g", "1e+06",   1000000.00);
-        test("%3.0g", "1e+07",  10000000.00);
-        test("%3.9g", "100000000",  100000000.00);
-        test("%3.10g", "100000000.0", 100000000.00);
-
-        tryCatch("%#3.0g", FormatFlagsConversionMismatchException.class, 1000.00);
-
-        // double PI^300
-        //    = 13962455701329742638131355433930076081862072808 ... e+149
-#if[BigDecimal]
-        //---------------------------------------------------------------------
-        // %g - BigDecimal
-        //---------------------------------------------------------------------
-        test("%.3g", "1.40e+149", piToThe300);
-        test("%.3g", "-1.40e+149", piToThe300.negate());
-        test(Locale.FRANCE, "%.3g", "-1,40e+149", piToThe300.negate());
-        test("%.3g", "1.00e-100", recip(ten.pow(100)));
-        test("%.3g", "-1.00e-100", negate(recip(ten.pow(100))));
-
-        test("%3.0g", "1e-06", new BigDecimal("0.000001"));
-        test("%3.0g", "1e-05", new BigDecimal("0.00001"));
-        test("%3.0g", "0.0001", new BigDecimal("0.0001"));
-        test("%3.0g", "0.001", new BigDecimal("0.001"));
-        test("%3.3g", "0.00100", new BigDecimal("0.001"));
-        test("%3.4g", "0.001000", new BigDecimal("0.001"));
-        test("%3.0g", "0.01", new BigDecimal("0.01"));
-        test("%3.0g", "0.1", new BigDecimal("0.1"));
-        test("%3.0g", "0.9", new BigDecimal("0.9"));
-        test("%3.1g", "0.9", new BigDecimal("0.9"));
-        test("%3.0g", "  1", new BigDecimal("1.00"));
-        test("%3.2g", " 10", new BigDecimal("10.00"));
-        test("%3.0g", "1e+01", new BigDecimal("10.00"));
-        test("%3.0g", "1e+02", new BigDecimal("99.19"));
-        test("%3.1g", "1e+02", new BigDecimal("99.19"));
-        test("%3.2g", " 99", new BigDecimal("99.19"));
-        test("%3.0g", "1e+02", new BigDecimal("99.99"));
-        test("%3.0g", "1e+02", new BigDecimal("100.00"));
-        test("%3.0g", "1e+03", new BigDecimal("1000.00"));
-        test("%3.0g", "1e+04",      new BigDecimal("10000.00"));
-        test("%3.0g", "1e+05",      new BigDecimal("100000.00"));
-        test("%3.0g", "1e+06",      new BigDecimal("1000000.00"));
-        test("%3.0g", "1e+07",      new BigDecimal("10000000.00"));
-        test("%3.9g", "100000000",  new BigDecimal("100000000.00"));
-        test("%3.10g", "100000000.0", new BigDecimal("100000000.00"));
-#end[BigDecimal]
-
-        test("%.3g", "10.0", ten);
-        test("%.3g", "1.00", one);
-        test("%10.3g", "      1.00", one);
-        test("%+10.3g", "     +3.14", pi);
-        test("%+10.3g", "     -3.14", negate(pi));
-        test("% .3g", " 3.14", pi);
-        test("% .3g", "-3.14", negate(pi));
-        test("%.0g", "3", create(3.0));
-        test("%.0g", "-3", create(-3.0));
-
-        test("%(.4g", "3.142e+08", mult(pi, 100000000.0));
-        test("%(.4g", "(3.142e+08)", mult(pi, -100000000.0));
-
-#if[float]
-        // Float can not accurately store 1e6 * PI.
-        test("%,.6g", "3,141.59", mult(pi, 1000.0));
-        test("%(,.6g", "(3,141.59)", mult(pi, -1000.0));
-#else[float]
-#if[!Float]
-        test("%,.11g", "3,141,592.6536", mult(pi, 1000000.0));
-        test("%(,.11g", "(3,141,592.6536)", mult(pi, -1000000.0));
-#end[!Float]
-#end[float]
-
-#if[double]
-        //---------------------------------------------------------------------
-        // %a
-        //
-        // Floating-point conversions applicable to float, double, and
-        // BigDecimal.
-        //---------------------------------------------------------------------
-        test("%a", "null", (Object)null);
-        test("%.11a", "0x0.00000000000p0", 0.0);
-        test(Locale.FRANCE, "%.11a", "0x0.00000000000p0", 0.0); // no localization
-        test("%.1a", "0x0.0p0", 0.0);
-        test("%.11a", "-0x0.00000000000p0", -0.0);
-        test("%.1a", "-0x0.0p0", -0.0);
-        test("%.11a", "0x1.00000000000p0", 1.0);
-        test("%.1a", "0x1.0p0", 1.0);
-        test("%.11a", "-0x1.00000000000p0", -1.0);
-        test("%.1a", "-0x1.0p0", -1.0);
-        test("%.11a", "0x1.80000000000p1", 3.0);
-        test("%.1a", "0x1.8p1", 3.0);
-        test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
-        test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
-        test("%.11a", "0x1.00000000000p-1022",
-             FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
-        test("%.1a", "0x1.0p-1022",
-             FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
-        test("%.11a", "0x1.ffffffffffep-1023",
-             Double.parseDouble("0x0.fffffffffffp-1022"));
-        test("%.1a", "0x1.0p-1022",
-             Double.parseDouble("0x0.fffffffffffp-1022"));
-        test("%.30a", "0x0.000000000000100000000000000000p-1022", Double.MIN_VALUE);
-        test("%.13a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
-        test("%.11a", "0x1.00000000000p-1074", Double.MIN_VALUE);
-        test("%.1a", "0x1.0p-1074", Double.MIN_VALUE);
-
-        test("%.11a", "0x1.08000000000p-1069",
-             Double.MIN_VALUE + Double.MIN_VALUE*32);
-        test("%.1a", "0x1.0p-1069",
-             Double.MIN_VALUE + Double.MIN_VALUE*32);
-        test("%.30a", "0x1.fffffffffffff00000000000000000p1023", Double.MAX_VALUE);
-        test("%.13a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
-        test("%.11a", "0x1.00000000000p1024", Double.MAX_VALUE);
-        test("%.1a", "0x1.0p1024", Double.MAX_VALUE);
-        test("%.11a", "0x1.18000000000p0", Double.parseDouble("0x1.18p0"));
-        test("%.1a", "0x1.2p0", Double.parseDouble("0x1.18p0"));
-
-        test("%.11a", "0x1.18000000000p0",
-             Double.parseDouble("0x1.180000000001p0"));
-        test("%.1a", "0x1.2p0",
-             Double.parseDouble("0x1.180000000001p0"));
-        test("%.11a", "0x1.28000000000p0", Double.parseDouble("0x1.28p0"));
-        test("%.1a", "0x1.2p0", Double.parseDouble("0x1.28p0"));
-
-        test("%.11a", "0x1.28000000000p0",
-             Double.parseDouble("0x1.280000000001p0"));
-        test("%.1a", "0x1.3p0", Double.parseDouble("0x1.280000000001p0"));
-#end[double]
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - Boundaries
-        //---------------------------------------------------------------------
-#if[float]
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - NaN
-        //---------------------------------------------------------------------
-        test("%f", "NaN", Float.NaN);
-        // s
-        test("%+f", "NaN", Float.NaN);
-//      test("%F", "NAN", Float.NaN);
-        test("%e", "NaN", Float.NaN);
-        test("%+e", "NaN", Float.NaN);
-        test("%E", "NAN", Float.NaN);
-        test("%g", "NaN", Float.NaN);
-        test("%+g", "NaN", Float.NaN);
-        test("%G", "NAN", Float.NaN);
-        test("%a", "NaN", Float.NaN);
-        test("%+a", "NaN", Float.NaN);
-        test("%A", "NAN", Float.NaN);
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - +0.0
-        //---------------------------------------------------------------------
-        test("%f", "0.000000", +0.0);
-        test("%+f", "+0.000000", +0.0);
-        test("% f", " 0.000000", +0.0);
-//      test("%F", "0.000000", +0.0);
-        test("%e", "0.000000e+00", 0e0);
-        test("%e", "0.000000e+00", +0.0);
-        test("%+e", "+0.000000e+00", +0.0);
-        test("% e", " 0.000000e+00", +0.0);
-        test("%E", "0.000000E+00", 0e0);
-        test("%E", "0.000000E+00", +0.0);
-        test("%+E", "+0.000000E+00", +0.0);
-        test("% E", " 0.000000E+00", +0.0);
-        test("%g", "0.00000", +0.0);
-        test("%+g", "+0.00000", +0.0);
-        test("% g", " 0.00000", +0.0);
-        test("%G", "0.00000", +0.0);
-        test("% G", " 0.00000", +0.0);
-        test("%a", "0x0.0p0", +0.0);
-        test("%+a", "+0x0.0p0", +0.0);
-        test("% a", " 0x0.0p0", +0.0);
-        test("%A", "0X0.0P0", +0.0);
-        test("% A", " 0X0.0P0", +0.0);
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - -0.0
-        //---------------------------------------------------------------------
-        test("%f", "-0.000000", -0.0);
-        test("%+f", "-0.000000", -0.0);
-//      test("%F", "-0.000000", -0.0);
-        test("%e", "-0.000000e+00", -0.0);
-        test("%+e", "-0.000000e+00", -0.0);
-        test("%E", "-0.000000E+00", -0.0);
-        test("%+E", "-0.000000E+00", -0.0);
-        test("%g", "-0.00000", -0.0);
-        test("%+g", "-0.00000", -0.0);
-        test("%G", "-0.00000", -0.0);
-        test("%a", "-0x0.0p0", -0.0);
-        test("%+a", "-0x0.0p0", -0.0);
-        test("%+A", "-0X0.0P0", -0.0);
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - +Infinity
-        //---------------------------------------------------------------------
-        test("%f", "Infinity", Float.POSITIVE_INFINITY);
-        test("%+f", "+Infinity", Float.POSITIVE_INFINITY);
-        test("% f", " Infinity", Float.POSITIVE_INFINITY);
-//      test("%F", "INFINITY", Float.POSITIVE_INFINITY);
-        test("%e", "Infinity", Float.POSITIVE_INFINITY);
-        test("%+e", "+Infinity", Float.POSITIVE_INFINITY);
-        test("% e", " Infinity", Float.POSITIVE_INFINITY);
-        test("%E", "INFINITY", Float.POSITIVE_INFINITY);
-        test("%+E", "+INFINITY", Float.POSITIVE_INFINITY);
-        test("% E", " INFINITY", Float.POSITIVE_INFINITY);
-        test("%g", "Infinity", Float.POSITIVE_INFINITY);
-        test("%+g", "+Infinity", Float.POSITIVE_INFINITY);
-        test("%G", "INFINITY", Float.POSITIVE_INFINITY);
-        test("% G", " INFINITY", Float.POSITIVE_INFINITY);
-        test("%+G", "+INFINITY", Float.POSITIVE_INFINITY);
-        test("%a", "Infinity", Float.POSITIVE_INFINITY);
-        test("%+a", "+Infinity", Float.POSITIVE_INFINITY);
-        test("% a", " Infinity", Float.POSITIVE_INFINITY);
-        test("%A", "INFINITY", Float.POSITIVE_INFINITY);
-        test("%+A", "+INFINITY", Float.POSITIVE_INFINITY);
-        test("% A", " INFINITY", Float.POSITIVE_INFINITY);
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - -Infinity
-        //---------------------------------------------------------------------
-        test("%f", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%+f", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%(f", "(Infinity)", Float.NEGATIVE_INFINITY);
-//      test("%F", "-INFINITY", Float.NEGATIVE_INFINITY);
-        test("%e", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%+e", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%E", "-INFINITY", Float.NEGATIVE_INFINITY);
-        test("%+E", "-INFINITY", Float.NEGATIVE_INFINITY);
-        test("%g", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%+g", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%G", "-INFINITY", Float.NEGATIVE_INFINITY);
-        test("%+G", "-INFINITY", Float.NEGATIVE_INFINITY);
-        test("%a", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%+a", "-Infinity", Float.NEGATIVE_INFINITY);
-        test("%A", "-INFINITY", Float.NEGATIVE_INFINITY);
-        test("%+A", "-INFINITY", Float.NEGATIVE_INFINITY);
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - Float.MIN_VALUE
-        //---------------------------------------------------------------------
-        test("%f", "0.000000", Float.MIN_VALUE);
-        test("%,f", "0.000000", Float.MIN_VALUE);
-        test("%(f", "(0.000000)", -Float.MIN_VALUE);
-        test("%30.0f",  "                             0", Float.MIN_VALUE);
-        test("%30.5f",  "                       0.00000", Float.MIN_VALUE);
-        test("%30.13f", "               0.0000000000000", Float.MIN_VALUE);
-        test("%30.20f", "        0.00000000000000000000", Float.MIN_VALUE);
-        test("%e", "1.401298e-45", Float.MIN_VALUE);
-        test("%E", "1.401298E-45", Float.MIN_VALUE);
-        test("%(.1e", "1.4e-45", Float.MIN_VALUE);
-        test("%(E", "(1.401298E-45)", -Float.MIN_VALUE);
-        test("%30.5e",  "                   1.40130e-45", Float.MIN_VALUE);
-        test("%30.13e", "           1.4012984643248e-45", Float.MIN_VALUE);
-        test("%30.20e", "    1.40129846432481700000e-45", Float.MIN_VALUE);
-        test("%g", "1.40130e-45", Float.MIN_VALUE);
-        test("%G", "1.40130E-45", Float.MIN_VALUE);
-        test("%(g", "1.40130e-45", Float.MIN_VALUE);
-        test("%,g", "1.40130e-45", Float.MIN_VALUE);
-        test("%(G", "(1.40130E-45)", -Float.MIN_VALUE);
-        test("%30.5g",  "                    1.4013e-45", Float.MIN_VALUE);
-        test("%30.13g", "            1.401298464325e-45", Float.MIN_VALUE);
-        test("%30.20g", "     1.4012984643248170000e-45", Float.MIN_VALUE);
-        test("%a", "0x1.0p-149", Float.MIN_VALUE);
-        test("%A", "0X1.0P-149", Float.MIN_VALUE);
-        test("%20a", "          0x1.0p-149", Float.MIN_VALUE);
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - Float.MAX_VALUE
-        //---------------------------------------------------------------------
-        test("%f", "340282346638528860000000000000000000000.000000", Float.MAX_VALUE);
-        test("%,f","340,282,346,638,528,860,000,000,000,000,000,000,000.000000",
-             Float.MAX_VALUE);
-        test("%(f", "(340282346638528860000000000000000000000.000000)", -Float.MAX_VALUE);
-        test("%60.5f",  "               340282346638528860000000000000000000000.00000",
-             Float.MAX_VALUE);
-        test("%60.13f", "       340282346638528860000000000000000000000.0000000000000",
-             Float.MAX_VALUE);
-        test("%61.20f", " 340282346638528860000000000000000000000.00000000000000000000",
-             Float.MAX_VALUE);
-        test("%e", "3.402823e+38", Float.MAX_VALUE);
-        test("%E", "3.402823E+38", Float.MAX_VALUE);
-        test("%(e", "3.402823e+38", Float.MAX_VALUE);
-        test("%(e", "(3.402823e+38)", -Float.MAX_VALUE);
-        test("%30.5e",  "                   3.40282e+38", Float.MAX_VALUE);
-        test("%30.13e", "           3.4028234663853e+38", Float.MAX_VALUE);
-        test("%30.20e", "    3.40282346638528860000e+38", Float.MAX_VALUE);
-        test("%g", "3.40282e+38", Float.MAX_VALUE);
-        test("%G", "3.40282E+38", Float.MAX_VALUE);
-        test("%,g", "3.40282e+38", Float.MAX_VALUE);
-        test("%(g", "(3.40282e+38)", -Float.MAX_VALUE);
-        test("%30.5g",  "                    3.4028e+38", Float.MAX_VALUE);
-        test("%30.13g", "            3.402823466385e+38", Float.MAX_VALUE);
-        test("%30.20G", "     3.4028234663852886000E+38", Float.MAX_VALUE);
-        test("%a", "0x1.fffffep127", Float.MAX_VALUE);
-        test("%A", "0X1.FFFFFEP127", Float.MAX_VALUE);
-        test("%20a","      0x1.fffffep127", Float.MAX_VALUE);
-
-#end[float]
-
-#if[double]
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - Double.MIN_VALUE
-        //---------------------------------------------------------------------
-        test("%f", "0.000000", Double.MIN_VALUE);
-        test("%,f", "0.000000", Double.MIN_VALUE);
-        test("%(f", "(0.000000)", -Double.MIN_VALUE);
-        test("%30.0f",  "                             0", Double.MIN_VALUE);
-        test("%30.5f",  "                       0.00000", Double.MIN_VALUE);
-        test("%30.13f", "               0.0000000000000", Double.MIN_VALUE);
-        test("%30.20f", "        0.00000000000000000000", Double.MIN_VALUE);
-        test("%30.350f","0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000490000000000000000000000000",
-             Double.MIN_VALUE);
-        test("%e", "4.900000e-324", Double.MIN_VALUE);
-        test("%E", "4.900000E-324", Double.MIN_VALUE);
-        test("%(.1e", "4.9e-324", Double.MIN_VALUE);
-        test("%(E", "(4.900000E-324)", -Double.MIN_VALUE);
-        test("%30.5e",  "                  4.90000e-324", Double.MIN_VALUE);
-        test("%30.13e", "          4.9000000000000e-324", Double.MIN_VALUE);
-        test("%30.20e", "   4.90000000000000000000e-324", Double.MIN_VALUE);
-        test("%g", "4.90000e-324", Double.MIN_VALUE);
-        test("%G", "4.90000E-324", Double.MIN_VALUE);
-        test("%(g", "4.90000e-324", Double.MIN_VALUE);
-        test("%,g", "4.90000e-324", Double.MIN_VALUE);
-        test("%30.5g",  "                   4.9000e-324", Double.MIN_VALUE);
-        test("%30.13g", "           4.900000000000e-324", Double.MIN_VALUE);
-        test("%30.20g", "    4.9000000000000000000e-324", Double.MIN_VALUE);
-        test("%a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
-        test("%A", "0X0.0000000000001P-1022", Double.MIN_VALUE);
-        test("%30a",    "       0x0.0000000000001p-1022", Double.MIN_VALUE);
-
-        //---------------------------------------------------------------------
-        // %f, %e, %g, %a - Double.MAX_VALUE
-        //---------------------------------------------------------------------
-        test("%f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000",
-             Double.MAX_VALUE);
-        test("%,f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000",
-             Double.MAX_VALUE);
-        test("%,(f", "(179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000)",
-             -Double.MAX_VALUE);
-        test("%,30.5f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000",
-             Double.MAX_VALUE);
-        test("%30.13f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000",
-             Double.MAX_VALUE);
-        test("%30.20f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000000",
-             Double.MAX_VALUE);
-        test("%e", "1.797693e+308", Double.MAX_VALUE);
-        test("%E", "1.797693E+308", Double.MAX_VALUE);
-        test("%(e", "1.797693e+308", Double.MAX_VALUE);
-        test("%(e", "(1.797693e+308)", -Double.MAX_VALUE);
-        test("%30.5e",  "                  1.79769e+308", Double.MAX_VALUE);
-        test("%30.13e", "          1.7976931348623e+308", Double.MAX_VALUE);
-        test("%30.20e", "   1.79769313486231570000e+308", Double.MAX_VALUE);
-        test("%g", "1.79769e+308", Double.MAX_VALUE);
-        test("%G", "1.79769E+308", Double.MAX_VALUE);
-        test("%,g", "1.79769e+308", Double.MAX_VALUE);
-        test("%(g", "(1.79769e+308)", -Double.MAX_VALUE);
-        test("%30.5g",  "                   1.7977e+308", Double.MAX_VALUE);
-        test("%30.13g", "           1.797693134862e+308", Double.MAX_VALUE);
-        test("%30.20g", "    1.7976931348623157000e+308", Double.MAX_VALUE);
-        test("%a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
-        test("%A", "0X1.FFFFFFFFFFFFFP1023", Double.MAX_VALUE);
-        test("%30a",    "        0x1.fffffffffffffp1023", Double.MAX_VALUE);
-#end[double]
-
-#end[fp]
-
-        //---------------------------------------------------------------------
-        // %t
-        //
-        // Date/Time conversions applicable to Calendar, Date, and long.
-        //---------------------------------------------------------------------
-        test("%tA", "null", (Object)null);
-        test("%TA", "NULL", (Object)null);
-
-        //---------------------------------------------------------------------
-        // %t - errors
-        //---------------------------------------------------------------------
-        tryCatch("%t", UnknownFormatConversionException.class);
-        tryCatch("%T", UnknownFormatConversionException.class);
-        tryCatch("%tP", UnknownFormatConversionException.class);
-        tryCatch("%TP", UnknownFormatConversionException.class);
-        tryCatch("%.5tB", IllegalFormatPrecisionException.class);
-        tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
-        tryCatch("%-tB", MissingFormatWidthException.class);
-
-#if[datetime]
-        //---------------------------------------------------------------------
-        // %t - create test Calendar
-        //---------------------------------------------------------------------
-
-        // Get the supported ids for GMT-08:00 (Pacific Standard Time)
-        String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
-        // Create a Pacific Standard Time time zone
-        SimpleTimeZone tz = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
-        // public GregorianCalendar(TimeZone zone, Locale aLocale);
-        Calendar c0 = new GregorianCalendar(tz, Locale.US);
-        // public final void set(int year, int month, int date,
-        //     int hourOfDay, int minute, int second);
-        c0.set(1995, MAY, 23, 19, 48, 34);
-        c0.set(Calendar.MILLISECOND, 584);
-
-        //---------------------------------------------------------------------
-        // %t - Minutes, {nano,milli}*seconds
-        //
-        // testDateTime() verifies the expected output for all applicable types
-        // (Calendar, Date, and long).  It also verifies output for "%t" and
-        // "%T". Thus it is sufficient to invoke that method once per
-        // conversion/expected output.
-        //---------------------------------------------------------------------
-        testDateTime("%tM", "48", c0);
-        testDateTime("%tN", "584000000", c0);
-        testDateTime("%tL", "584", c0);
-//      testDateTime("%tQ", "801283714584", c0);
-
-        testDateTime("%ts", String.valueOf(c0.getTimeInMillis() / 1000), c0);
-        testDateTime("%tS", "34", c0);
-        testDateTime("%tT", "19:48:34", c0);
-
-        //---------------------------------------------------------------------
-        // %t - Hours, morning/afternoon markers
-        //
-        // testHours() iterates through all twenty-four hours to verify
-        // numeric return value and morning/afternoon markers.
-        //---------------------------------------------------------------------
-        testHours();
-
-        //---------------------------------------------------------------------
-        // %t - Portions of date [ day, month, dates, weeks ]
-        //---------------------------------------------------------------------
-        testDateTime("%ta", "Tue", c0);
-        testDateTime("%tA", "Tuesday", c0);
-        testDateTime("%tb", "May", c0);
-        testDateTime("%tB", "May", c0);
-        testDateTime("%tC", "19", c0);
-        testDateTime("%td", "23", c0);
-        testDateTime("%te", "23", c0);
-        testDateTime("%th", "May", c0);
-        testDateTime("%tj", "143", c0);
-        testDateTime("%tm", "05", c0);
-        testDateTime("%ty", "95", c0);
-        testDateTime("%tY", "1995", c0);
-
-        //---------------------------------------------------------------------
-        // %t - TimeZone
-        //---------------------------------------------------------------------
-        testDateTime("%tz", "-0800", c0);
-        testDateTime("%tZ", "PST", c0);
-
-        //---------------------------------------------------------------------
-        // %tz should always adjust for DST
-        //---------------------------------------------------------------------
-        TimeZone dtz = TimeZone.getDefault();
-
-        // Artificial TimeZone based on PST with 3:15 DST always in effect
-        TimeZone atz = new SimpleTimeZone(-8 * 60 * 60 * 1000, "AlwaysDST",
-            JANUARY, 1, 0, 0, STANDARD_TIME,
-            // 24hrs - 1m = 60 * 60 * 1000 * 24 - 1
-            DECEMBER, 31, 0, 60 * 60 * 1000 * 24 - 1, STANDARD_TIME,
-            (int)(60 * 60 * 1000 * 3.25));
-        TimeZone.setDefault(atz);
-        testDateTime("%tz", "-0445", Calendar.getInstance(atz));
-
-        // Restore the TimeZone and verify
-        TimeZone.setDefault(dtz);
-        if (atz.hasSameRules(TimeZone.getDefault()))
-            throw new RuntimeException("Default TimeZone not restored");
-
-        //---------------------------------------------------------------------
-        // %t - Composites
-        //---------------------------------------------------------------------
-        testDateTime("%tr", "07:48:34 PM", c0);
-        testDateTime("%tR", "19:48", c0);
-        testDateTime("%tc", "Tue May 23 19:48:34 PST 1995", c0);
-        testDateTime("%tD", "05/23/95", c0);
-        testDateTime("%tF", "1995-05-23", c0);
-        testDateTime("%-12tF", "1995-05-23  ", c0);
-        testDateTime("%12tF", "  1995-05-23", c0);
-#end[datetime]
-
-        //---------------------------------------------------------------------
-        // %n
-        //---------------------------------------------------------------------
-        test("%n", System.getProperty("line.separator"), (Object)null);
-        test("%n", System.getProperty("line.separator"), "");
-
-        tryCatch("%,n", IllegalFormatFlagsException.class);
-        tryCatch("%.n", UnknownFormatConversionException.class);
-        tryCatch("%5.n", UnknownFormatConversionException.class);
-        tryCatch("%5n", IllegalFormatWidthException.class);
-        tryCatch("%.7n", IllegalFormatPrecisionException.class);
-        tryCatch("%<n", IllegalFormatFlagsException.class);
-
-        //---------------------------------------------------------------------
-        // %%
-        //---------------------------------------------------------------------
-        test("%%", "%", (Object)null);
-        test("%%", "%", "");
-        tryCatch("%%%", UnknownFormatConversionException.class);
-        // perhaps an IllegalFormatArgumentIndexException should be defined?
-        tryCatch("%<%", IllegalFormatFlagsException.class);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Formatter/Basic-X.java.template	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,1712 @@
+/*
+ * Copyright 2003-2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* Type-specific source code for unit test
+ *
+ * Regenerate the BasicX classes via genBasic.sh whenever this file changes.
+ * We check in the generated source files so that the test tree can be used
+ * independently of the rest of the source tree.
+ */
+
+#warn This file is preprocessed before being compiled
+
+import java.io.*;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.DateFormatSymbols;
+import java.util.*;
+#if[double]
+import sun.misc.FpUtils;
+import sun.misc.DoubleConsts;
+#end[double]
+
+import static java.util.Calendar.*;
+#if[datetime]
+import static java.util.SimpleTimeZone.*;
+import java.util.regex.Pattern;
+#end[datetime]
+
+public class Basic$Type$ extends Basic {
+
+    private static void test(String fs, String exp, Object ... args) {
+        Formatter f = new Formatter(new StringBuilder(), Locale.US);
+        f.format(fs, args);
+        ck(fs, exp, f.toString());
+    }
+
+    private static void test(Locale l, String fs, String exp, Object ... args)
+    {
+        Formatter f = new Formatter(new StringBuilder(), l);
+        f.format(fs, args);
+        ck(fs, exp, f.toString());
+    }
+
+    private static void test(String fs, Object ... args) {
+        Formatter f = new Formatter(new StringBuilder(), Locale.US);
+        f.format(fs, args);
+        ck(fs, "fail", f.toString());
+    }
+
+    private static void test(String fs) {
+        Formatter f = new Formatter(new StringBuilder(), Locale.US);
+        f.format(fs, "fail");
+        ck(fs, "fail", f.toString());
+    }
+
+    private static void testSysOut(String fs, String exp, Object ... args) {
+        FileOutputStream fos = null;
+        FileInputStream fis = null;
+        try {
+            PrintStream saveOut = System.out;
+            fos = new FileOutputStream("testSysOut");
+            System.setOut(new PrintStream(fos));
+            System.out.format(Locale.US, fs, args);
+            fos.close();
+
+            fis = new FileInputStream("testSysOut");
+            byte [] ba = new byte[exp.length()];
+            int len = fis.read(ba);
+            String got = new String(ba);
+            if (len != ba.length)
+                fail(fs, exp, got);
+            ck(fs, exp, got);
+
+            System.setOut(saveOut);
+        } catch (FileNotFoundException ex) {
+            fail(fs, ex.getClass());
+        } catch (IOException ex) {
+            fail(fs, ex.getClass());
+        } finally {
+            try {
+                if (fos != null)
+                    fos.close();
+                if (fis != null)
+                    fis.close();
+            } catch (IOException ex) {
+                fail(fs, ex.getClass());
+            }
+        }
+    }
+
+    private static void tryCatch(String fs, Class<?> ex) {
+        boolean caught = false;
+        try {
+            test(fs);
+        } catch (Throwable x) {
+            if (ex.isAssignableFrom(x.getClass()))
+                caught = true;
+        }
+        if (!caught)
+            fail(fs, ex);
+        else
+            pass();
+    }
+
+    private static void tryCatch(String fs, Class<?> ex, Object ... args) {
+        boolean caught = false;
+        try {
+            test(fs, args);
+        } catch (Throwable x) {
+            if (ex.isAssignableFrom(x.getClass()))
+                caught = true;
+        }
+        if (!caught)
+            fail(fs, ex);
+        else
+            pass();
+    }
+
+#if[datetime]
+    private static void testDateTime(String fs, String exp, Calendar c) {
+        testDateTime(fs, exp, c, true);
+    }
+
+    private static void testDateTime(String fs, String exp, Calendar c, boolean upper) {
+        //---------------------------------------------------------------------
+        // Date/Time conversions applicable to Calendar, Date, and long.
+        //---------------------------------------------------------------------
+
+        // Calendar
+        test(fs, exp, c);
+        test((Locale)null, fs, exp, c);
+        test(Locale.US, fs, exp, c);
+
+        // Date/long do not have timezone information so they will always use
+        // the default timezone.
+        String nexp = (fs.equals("%tZ") || fs.equals("%TZ")
+                       || fs.equals("%tc") || fs.equals("%Tc")
+                       ? exp.replace("PST", "GMT-08:00")
+                       : exp);
+
+        // Date (implemented via conversion to Calendar)
+        Date d = c.getTime();
+        test(fs, nexp, d);
+        test((Locale)null, fs, nexp, d);
+        test(Locale.US, fs, nexp, d);
+
+        // long (implemented via conversion to Calendar)
+        long l = c.getTimeInMillis();
+        test(fs, nexp, l);
+        test((Locale)null, fs, nexp, l);
+        test(Locale.US, fs, nexp, l);
+
+        if (upper)
+            // repeat all tests for upper case variant (%T)
+            testDateTime(Pattern.compile("t").matcher(fs).replaceFirst("T"),
+                         exp.toUpperCase(), c, false);
+    }
+
+    private static void testHours() {
+        for (int i = 0; i < 24; i++) {
+            // GregorianCalendar(int year, int month, int dayOfMonth,
+            //    int hourOfDay, int minute, int second);
+            Calendar c = new GregorianCalendar(1995, MAY, 23, i, 48, 34);
+
+            //-----------------------------------------------------------------
+            // DateTime.HOUR_OF_DAY - 'k' (0 - 23) -- like H
+            //-----------------------------------------------------------------
+            String exp = Integer.toString(i);
+            testDateTime("%tk", exp, c);
+
+            //-----------------------------------------------------------------
+            // DateTime.HOUR - 'l' (1 - 12) -- like I
+            //-----------------------------------------------------------------
+            int v = i % 12;
+            v = (v == 0 ? 12 : v);
+            String exp2 = Integer.toString(v);
+            testDateTime("%tl", exp2, c);
+
+            //-----------------------------------------------------------------
+            // DateTime.HOUR_OF_DAY_0 - 'H' (00 - 23) [zero padded]
+            //-----------------------------------------------------------------
+            if (exp.length() < 2) exp = "0" + exp;
+            testDateTime("%tH", exp, c);
+
+            //-----------------------------------------------------------------
+            // DateTime.HOUR_0 - 'I' (01 - 12)
+            //-----------------------------------------------------------------
+            if (exp2.length() < 2) exp2 = "0" + exp2;
+            testDateTime("%tI", exp2, c);
+
+            //-----------------------------------------------------------------
+            // DateTime.AM_PM - (am or pm)
+            //-----------------------------------------------------------------
+            testDateTime("%tp", (i <12 ? "am" : "pm"), c);
+        }
+    }
+#end[datetime]
+
+#if[dec]
+#if[prim]
+    private static $type$ negate($type$ v) {
+        return ($type$) -v;
+    }
+#end[prim]
+#end[dec]
+#if[Byte]
+    private static $type$ negate($type$ v) {
+        return new $type$((byte) -v.byteValue());
+    }
+#end[Byte]
+#if[Short]
+    private static $type$ negate($type$ v) {
+        return new $type$((short) -v.shortValue());
+    }
+#end[Short]
+#if[Integer]
+    private static $type$ negate($type$ v) {
+        return new $type$(-v.intValue());
+    }
+#end[Integer]
+#if[Long]
+    private static $type$ negate($type$ v) {
+        return new $type$(-v.longValue());
+    }
+#end[Long]
+
+#if[BigDecimal]
+    private static $type$ create(double v) {
+        return new $type$(v);
+    }
+
+    private static $type$ negate($type$ v) {
+        return v.negate();
+    }
+
+    private static $type$ mult($type$ v, double mul) {
+        return v.multiply(new $type$(mul));
+    }
+
+    private static $type$ recip($type$ v) {
+        return BigDecimal.ONE.divide(v);
+    }
+#end[BigDecimal]
+#if[float]
+    private static $type$ create(double v) {
+        return ($type$) v;
+    }
+
+    private static $type$ negate(double v) {
+        return ($type$) -v;
+    }
+
+    private static $type$ mult($type$ v, double mul) {
+        return v * ($type$) mul;
+    }
+
+    private static $type$ recip($type$ v) {
+        return 1.0f / v;
+    }
+#end[float]
+#if[Float]
+    private static $type$ create(double v) {
+        return new $type$(v);
+    }
+
+    private static $type$ negate($type$ v) {
+        return new $type$(-v.floatValue());
+    }
+
+    private static $type$ mult($type$ v, double mul) {
+        return new $type$(v.floatValue() * (float) mul);
+    }
+
+    private static $type$ recip($type$ v) {
+        return new $type$(1.0f / v.floatValue());
+    }
+#end[Float]
+#if[double]
+    private static $type$ create(double v) {
+        return ($type$) v;
+    }
+
+
+    private static $type$ negate(double v) {
+        return -v;
+    }
+
+    private static $type$ mult($type$ v, double mul) {
+        return v * mul;
+    }
+
+    private static $type$ recip($type$ v) {
+        return 1.0 / v;
+    }
+#end[double]
+#if[Double]
+    private static $type$ create(double v) {
+        return new $type$(v);
+    }
+
+    private static $type$ negate($type$ v) {
+        return new $type$(-v.doubleValue());
+    }
+
+    private static $type$ mult($type$ v, double mul) {
+        return new $type$(v.doubleValue() * mul);
+    }
+
+    private static $type$ recip($type$ v) {
+        return new $type$(1.0 / v.doubleValue());
+    }
+#end[Double]
+
+    public static void test() {
+        TimeZone.setDefault(TimeZone.getTimeZone("GMT-0800"));
+
+        // Any characters not explicitly defined as conversions, date/time
+        // conversion suffixes, or flags are illegal and are reserved for
+        // future extensions.  Use of such a character in a format string will
+        // cause an UnknownFormatConversionException or
+        // UnknownFormatFlagsException to be thrown.
+        tryCatch("%q", UnknownFormatConversionException.class);
+        tryCatch("%t&", UnknownFormatConversionException.class);
+        tryCatch("%&d", UnknownFormatConversionException.class);
+        tryCatch("%^b", UnknownFormatConversionException.class);
+
+        //---------------------------------------------------------------------
+        // Formatter.java class javadoc examples
+        //---------------------------------------------------------------------
+        test(Locale.FRANCE, "e = %+10.4f", "e =    +2,7183", Math.E);
+        test("%4$2s %3$2s %2$2s %1$2s", " d  c  b  a", "a", "b", "c", "d");
+        test("Amount gained or lost since last statement: $ %,(.2f",
+             "Amount gained or lost since last statement: $ (6,217.58)",
+             (new BigDecimal("-6217.58")));
+        Calendar c = new GregorianCalendar(1969, JULY, 20, 16, 17, 0);
+        testSysOut("Local time: %tT", "Local time: 16:17:00", c);
+
+        test("Unable to open file '%1$s': %2$s",
+             "Unable to open file 'food': No such file or directory",
+             "food", "No such file or directory");
+        Calendar duke = new GregorianCalendar(1995, MAY, 23, 19, 48, 34);
+        duke.set(Calendar.MILLISECOND, 584);
+        test("Duke's Birthday: %1$tB %1$te, %1$tY",
+             "Duke's Birthday: May 23, 1995",
+             duke);
+        test("Duke's Birthday: %1$tB %1$te, %1$tY",
+             "Duke's Birthday: May 23, 1995",
+             duke.getTime());
+        test("Duke's Birthday: %1$tB %1$te, %1$tY",
+             "Duke's Birthday: May 23, 1995",
+             duke.getTimeInMillis());
+
+        test("%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s",
+             "d c b a d c b a", "a", "b", "c", "d");
+        test("%s %s %<s %<s", "a b b b", "a", "b", "c", "d");
+        test("%s %s %s %s", "a b c d", "a", "b", "c", "d");
+        test("%2$s %s %<s %s", "b a a b", "a", "b", "c", "d");
+
+        //---------------------------------------------------------------------
+        // %b
+        //
+        // General conversion applicable to any argument.
+        //---------------------------------------------------------------------
+        test("%b", "true", true);
+        test("%b", "false", false);
+        test("%B", "TRUE", true);
+        test("%B", "FALSE", false);
+        test("%b", "true", Boolean.TRUE);
+        test("%b", "false", Boolean.FALSE);
+        test("%B", "TRUE", Boolean.TRUE);
+        test("%B", "FALSE", Boolean.FALSE);
+        test("%14b", "          true", true);
+        test("%-14b", "true          ", true);
+        test("%5.1b", "    f", false);
+        test("%-5.1b", "f    ", false);
+
+        test("%b", "true", "foo");
+        test("%b", "false", (Object)null);
+
+        // Boolean.java hardcodes the Strings for "true" and "false", so no
+        // localization is possible.
+        test(Locale.FRANCE, "%b", "true", true);
+        test(Locale.FRANCE, "%b", "false", false);
+
+        // If you pass in a single array to a varargs method, the compiler
+        // uses it as the array of arguments rather than treating it as a
+        // single array-type argument.
+        test("%b", "false", (Object[])new String[2]);
+        test("%b", "true", new String[2], new String[2]);
+
+        int [] ia = { 1, 2, 3 };
+        test("%b", "true", ia);
+
+        //---------------------------------------------------------------------
+        // %b - errors
+        //---------------------------------------------------------------------
+        tryCatch("%#b", FormatFlagsConversionMismatchException.class);
+        tryCatch("%-b", MissingFormatWidthException.class);
+        // correct or side-effect of implementation?
+        tryCatch("%.b", UnknownFormatConversionException.class);
+        tryCatch("%,b", FormatFlagsConversionMismatchException.class);
+
+        //---------------------------------------------------------------------
+        // %c
+        //
+        // General conversion applicable to any argument.
+        //---------------------------------------------------------------------
+        test("%c", "i", 'i');
+        test("%C", "I", 'i');
+        test("%4c",  "   i", 'i');
+        test("%-4c", "i   ", 'i');
+        test("%4C",  "   I", 'i');
+        test("%-4C", "I   ", 'i');
+        test("%c", "i", new Character('i'));
+        test("%c", "H", (byte) 72);
+        test("%c", "i", (short) 105);
+        test("%c", "!", (int) 33);
+        test("%c", "\u007F", Byte.MAX_VALUE);
+        test("%c", new String(Character.toChars(Short.MAX_VALUE)),
+             Short.MAX_VALUE);
+        test("%c", "null", (Object) null);
+
+        //---------------------------------------------------------------------
+        // %c - errors
+        //---------------------------------------------------------------------
+        tryCatch("%c", IllegalFormatConversionException.class,
+                 Boolean.TRUE);
+        tryCatch("%c", IllegalFormatConversionException.class,
+                 (float) 0.1);
+        tryCatch("%c", IllegalFormatConversionException.class,
+                 new Object());
+        tryCatch("%c", IllegalFormatCodePointException.class,
+                 Byte.MIN_VALUE);
+        tryCatch("%c", IllegalFormatCodePointException.class,
+                 Short.MIN_VALUE);
+        tryCatch("%c", IllegalFormatCodePointException.class,
+                 Integer.MIN_VALUE);
+        tryCatch("%c", IllegalFormatCodePointException.class,
+                 Integer.MAX_VALUE);
+
+        tryCatch("%#c", FormatFlagsConversionMismatchException.class);
+        tryCatch("%,c", FormatFlagsConversionMismatchException.class);
+        tryCatch("%(c", FormatFlagsConversionMismatchException.class);
+        tryCatch("%$c", UnknownFormatConversionException.class);
+        tryCatch("%.2c", IllegalFormatPrecisionException.class);
+
+        //---------------------------------------------------------------------
+        // %s
+        //
+        // General conversion applicable to any argument.
+        //---------------------------------------------------------------------
+        test("%s", "Hello, Duke", "Hello, Duke");
+        test("%S", "HELLO, DUKE", "Hello, Duke");
+        test("%20S", "         HELLO, DUKE", "Hello, Duke");
+        test("%20s", "         Hello, Duke", "Hello, Duke");
+        test("%-20s", "Hello, Duke         ", "Hello, Duke");
+        test("%-20.5s", "Hello               ", "Hello, Duke");
+        test("%s", "null", (Object)null);
+
+        StringBuffer sb = new StringBuffer("foo bar");
+        test("%s", sb.toString(), sb);
+        test("%S", sb.toString().toUpperCase(), sb);
+
+        //---------------------------------------------------------------------
+        // %s - errors
+        //---------------------------------------------------------------------
+        tryCatch("%-s", MissingFormatWidthException.class);
+        tryCatch("%--s", DuplicateFormatFlagsException.class);
+        tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0);
+        tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
+        tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
+        tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+
+        //---------------------------------------------------------------------
+        // %h
+        //
+        // General conversion applicable to any argument.
+        //---------------------------------------------------------------------
+        test("%h", Integer.toHexString("Hello, Duke".hashCode()),
+             "Hello, Duke");
+        test("%10h", "  ddf63471", "Hello, Duke");
+        test("%-10h", "ddf63471  ", "Hello, Duke");
+        test("%-10H", "DDF63471  ", "Hello, Duke");
+        test("%10h", "  402e0000", 15.0);
+        test("%10H", "  402E0000", 15.0);
+
+        //---------------------------------------------------------------------
+        // %h - errors
+        //---------------------------------------------------------------------
+        tryCatch("%#h", FormatFlagsConversionMismatchException.class);
+
+        //---------------------------------------------------------------------
+        // flag/conversion errors
+        //---------------------------------------------------------------------
+        tryCatch("%F", UnknownFormatConversionException.class);
+
+        tryCatch("%#g", FormatFlagsConversionMismatchException.class);
+
+#if[dec]
+
+#if[prim]
+        $type$ minByte = Byte.MIN_VALUE;   // -128
+#else[prim]
+        $type$ minByte = new $type$(Byte.MIN_VALUE);
+#end[prim]
+
+        //---------------------------------------------------------------------
+        // %d
+        //
+        // Numeric conversion applicable to byte, short, int, long, and
+        // BigInteger.
+        //---------------------------------------------------------------------
+        test("%d", "null", (Object)null);
+
+#if[byte]
+#if[prim]
+        //---------------------------------------------------------------------
+        // %d - byte
+        //---------------------------------------------------------------------
+        $type$ seventeen = ($type$) 17;
+        test("%d", "17", seventeen);
+        test("%,d", "17", seventeen);
+        test("%,d", "-17", negate(seventeen));
+        test("%(d", "17", seventeen);
+        test("%(d", "(17)", negate(seventeen));
+        test("% d", " 17", seventeen);
+        test("% d", "-17", negate(seventeen));
+        test("%+d", "+17", seventeen);
+        test("%+d", "-17", negate(seventeen));
+        test("%010d", "0000000017", seventeen);
+        test("%010d", "-000000017", negate(seventeen));
+        test("%(10d", "      (17)", negate(seventeen));
+        test("%-10d", "17        ", seventeen);
+        test("%-10d", "-17       ", negate(seventeen));
+#end[prim]
+#else[byte]
+#if[short]
+        //---------------------------------------------------------------------
+        // %d - short
+        //---------------------------------------------------------------------
+        $type$ oneToFive = ($type$) 12345;
+        test("%d", "12345", oneToFive);
+        test("%,d", "12,345", oneToFive);
+        test("%,d", "-12,345", negate(oneToFive));
+        test("%(d", "12345", oneToFive);
+        test("%(d", "(12345)", negate(oneToFive));
+        test("% d", " 12345", oneToFive);
+        test("% d", "-12345", negate(oneToFive));
+        test("%+d", "+12345", oneToFive);
+        test("%+d", "-12345", negate(oneToFive));
+        test("%010d", "0000012345", oneToFive);
+        test("%010d", "-000012345", negate(oneToFive));
+        test("%(10d", "   (12345)", negate(oneToFive));
+        test("%-10d", "12345     ", oneToFive);
+        test("%-10d", "-12345    ", negate(oneToFive));
+
+#else[short]
+#if[prim]
+        //---------------------------------------------------------------------
+        // %d - int and long
+        //---------------------------------------------------------------------
+        $type$ oneToSeven = ($type$) 1234567;
+        test("%d", "1234567", oneToSeven);
+        test("%,d", "1,234,567", oneToSeven);
+        test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", oneToSeven);
+        test("%,d", "-1,234,567", negate(oneToSeven));
+        test("%(d", "1234567", oneToSeven);
+        test("%(d", "(1234567)", negate(oneToSeven));
+        test("% d", " 1234567", oneToSeven);
+        test("% d", "-1234567", negate(oneToSeven));
+        test("%+d", "+1234567", oneToSeven);
+        test("%+d", "-1234567", negate(oneToSeven));
+        test("%010d", "0001234567", oneToSeven);
+        test("%010d", "-001234567", negate(oneToSeven));
+        test("%(10d", " (1234567)", negate(oneToSeven));
+        test("%-10d", "1234567   ", oneToSeven);
+        test("%-10d", "-1234567  ", negate(oneToSeven));
+#end[prim]
+#end[short]
+#end[byte]
+        //---------------------------------------------------------------------
+        // %d - errors
+        //---------------------------------------------------------------------
+        tryCatch("%#d", FormatFlagsConversionMismatchException.class);
+        tryCatch("%D", UnknownFormatConversionException.class);
+        tryCatch("%0d", MissingFormatWidthException.class);
+        tryCatch("%-d", MissingFormatWidthException.class);
+        tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+
+        //---------------------------------------------------------------------
+        // %o
+        //
+        // Numeric conversion applicable to byte, short, int, long, and
+        // BigInteger.
+        //---------------------------------------------------------------------
+        test("%o", "null", (Object)null);
+
+#if[byte]
+        //---------------------------------------------------------------------
+        // %o - byte
+        //---------------------------------------------------------------------
+        test("%010o", "0000000200", minByte);
+        test("%-10o", "200       ", minByte);
+        test("%#10o", "      0200", minByte);
+#end[byte]
+#if[short]
+        //---------------------------------------------------------------------
+        // %o - short
+        //---------------------------------------------------------------------
+
+        test("%010o", "0000177600", minByte);
+        test("%-10o", "177600    ", minByte);
+        test("%#10o", "   0177600", minByte);
+#end[short]
+#if[int]
+        //---------------------------------------------------------------------
+        // %o - int
+        //---------------------------------------------------------------------
+        test("%014o", "00037777777600", minByte);
+        test("%-14o", "37777777600   ", minByte);
+        test("%#14o", "  037777777600", minByte);
+
+        $type$ oneToSevenOct = ($type$) 1234567;
+        test("%o", "4553207", oneToSevenOct);
+        test("%010o", "0004553207", oneToSevenOct);
+        test("%-10o", "4553207   ", oneToSevenOct);
+        test("%#10o", "  04553207", oneToSevenOct);
+#end[int]
+#if[long]
+        //---------------------------------------------------------------------
+        // %o - long
+        //---------------------------------------------------------------------
+        test("%024o", "001777777777777777777600", minByte);
+        test("%-24o", "1777777777777777777600  ", minByte);
+        test("%#24o", " 01777777777777777777600", minByte);
+
+        $type$ oneToSevenOct = ($type$) 1234567;
+        test("%o", "4553207", oneToSevenOct);
+        test("%010o", "0004553207", oneToSevenOct);
+        test("%-10o", "4553207   ", oneToSevenOct);
+        test("%#10o", "  04553207", oneToSevenOct);
+#end[long]
+
+        //---------------------------------------------------------------------
+        // %o - errors
+        //---------------------------------------------------------------------
+        tryCatch("%(o", FormatFlagsConversionMismatchException.class,
+                 minByte);
+        tryCatch("%+o", FormatFlagsConversionMismatchException.class,
+                 minByte);
+        tryCatch("% o", FormatFlagsConversionMismatchException.class,
+                 minByte);
+        tryCatch("%0o", MissingFormatWidthException.class);
+        tryCatch("%-o", MissingFormatWidthException.class);
+        tryCatch("%,o", FormatFlagsConversionMismatchException.class);
+        tryCatch("%O", UnknownFormatConversionException.class);
+
+        //---------------------------------------------------------------------
+        // %x
+        //
+        // Numeric conversion applicable to byte, short, int, long, and
+        // BigInteger.
+        //---------------------------------------------------------------------
+        test("%x", "null", (Object)null);
+
+#if[byte]
+        //---------------------------------------------------------------------
+        // %x - byte
+        //---------------------------------------------------------------------
+        test("%010x", "0000000080", minByte);
+        test("%-10x", "80        ", minByte);
+        test("%#10x", "      0x80", minByte);
+        test("%0#10x","0x00000080", minByte);
+        test("%#10X", "      0X80", minByte);
+        test("%X", "80", minByte);
+#end[byte]
+#if[short]
+        //---------------------------------------------------------------------
+        // %x - short
+        //---------------------------------------------------------------------
+        test("%010x", "000000ff80", minByte);
+        test("%-10x", "ff80      ", minByte);
+        test("%#10x", "    0xff80", minByte);
+        test("%0#10x","0x0000ff80", minByte);
+        test("%#10X", "    0XFF80", minByte);
+        test("%X", "FF80", minByte);
+#end[short]
+#if[int]
+        //---------------------------------------------------------------------
+        // %x - int
+        //---------------------------------------------------------------------
+        $type$ oneToSevenHex = ($type$)1234567;
+        test("%x", "null", (Object)null);
+        test("%x", "12d687", oneToSevenHex);
+        test("%010x", "000012d687", oneToSevenHex);
+        test("%-10x", "12d687    ", oneToSevenHex);
+        test("%#10x", "  0x12d687", oneToSevenHex);
+        test("%#10X", "  0X12D687",oneToSevenHex);
+        test("%X", "12D687", oneToSevenHex);
+
+        test("%010x", "00ffffff80", minByte);
+        test("%-10x", "ffffff80  ", minByte);
+        test("%#10x", "0xffffff80", minByte);
+        test("%0#12x","0x00ffffff80", minByte);
+        test("%#12X", "  0XFFFFFF80", minByte);
+        test("%X", "FFFFFF80", minByte);
+#end[int]
+#if[long]
+        //---------------------------------------------------------------------
+        // %x - long
+        //---------------------------------------------------------------------
+        $type$ oneToSevenHex = ($type$)1234567;
+        test("%x", "null", (Object)null);
+        test("%x", "12d687", oneToSevenHex);
+        test("%010x", "000012d687", oneToSevenHex);
+        test("%-10x", "12d687    ", oneToSevenHex);
+        test("%#10x", "  0x12d687", oneToSevenHex);
+        test("%#10X", "  0X12D687",oneToSevenHex);
+        test("%X", "12D687", oneToSevenHex);
+
+        test("%018x",    "00ffffffffffffff80", minByte);
+        test("%-18x",      "ffffffffffffff80  ", minByte);
+        test("%#20x",  "  0xffffffffffffff80", minByte);
+        test("%0#20x", "0x00ffffffffffffff80", minByte);
+        test("%#20X", "  0XFFFFFFFFFFFFFF80", minByte);
+        test("%X",        "FFFFFFFFFFFFFF80", minByte);
+#end[long]
+        //---------------------------------------------------------------------
+        // %x - errors
+        //---------------------------------------------------------------------
+        tryCatch("%,x", FormatFlagsConversionMismatchException.class);
+        tryCatch("%0x", MissingFormatWidthException.class);
+        tryCatch("%-x", MissingFormatWidthException.class);
+
+#end[dec]
+
+#if[BigInteger]
+        //---------------------------------------------------------------------
+        // BigInteger - errors
+        //---------------------------------------------------------------------
+        tryCatch("%f", IllegalFormatConversionException.class,
+                 new BigInteger("1"));
+
+        //---------------------------------------------------------------------
+        // %d - BigInteger
+        //---------------------------------------------------------------------
+        test("%d", "null", (Object)null);
+        test("%d", "1234567", new BigInteger("1234567", 10));
+        test("%,d", "1,234,567", new BigInteger("1234567", 10));
+        test(Locale.FRANCE, "%,d", "1\u00a0234\u00a0567", new BigInteger("1234567", 10));
+        test("%,d", "-1,234,567", new BigInteger("-1234567", 10));
+        test("%(d", "1234567", new BigInteger("1234567", 10));
+        test("%(d", "(1234567)", new BigInteger("-1234567", 10));
+        test("% d", " 1234567", new BigInteger("1234567", 10));
+        test("% d", "-1234567", new BigInteger("-1234567", 10));
+        test("%+d", "+1234567", new BigInteger("1234567", 10));
+        test("%+d", "-1234567", new BigInteger("-1234567", 10));
+        test("%010d", "0001234567", new BigInteger("1234567", 10));
+        test("%010d", "-001234567", new BigInteger("-1234567", 10));
+        test("%(10d", " (1234567)", new BigInteger("-1234567", 10));
+        test("%+d", "+1234567", new BigInteger("1234567", 10));
+        test("%+d", "-1234567", new BigInteger("-1234567", 10));
+        test("%-10d", "1234567   ", new BigInteger("1234567", 10));
+        test("%-10d", "-1234567  ", new BigInteger("-1234567", 10));
+
+        //---------------------------------------------------------------------
+        // %o - BigInteger
+        //---------------------------------------------------------------------
+        test("%o", "null", (Object)null);
+        test("%o", "1234567", new BigInteger("1234567", 8));
+        test("%(o", "1234567", new BigInteger("1234567", 8));
+        test("%(o", "(1234567)", new BigInteger("-1234567", 8));
+        test("% o", " 1234567", new BigInteger("1234567", 8));
+        test("% o", "-1234567", new BigInteger("-1234567", 8));
+        test("%+o", "+1234567", new BigInteger("1234567", 8));
+        test("%+o", "-1234567", new BigInteger("-1234567", 8));
+        test("%010o", "0001234567", new BigInteger("1234567", 8));
+        test("%010o", "-001234567", new BigInteger("-1234567", 8));
+        test("%(10o", " (1234567)", new BigInteger("-1234567", 8));
+        test("%+o", "+1234567", new BigInteger("1234567", 8));
+        test("%+o", "-1234567", new BigInteger("-1234567", 8));
+        test("%-10o", "1234567   ", new BigInteger("1234567", 8));
+        test("%-10o", "-1234567  ", new BigInteger("-1234567", 8));
+        test("%#10o", "  01234567", new BigInteger("1234567", 8));
+        test("%#10o", " -01234567", new BigInteger("-1234567", 8));
+
+        //---------------------------------------------------------------------
+        // %x - BigInteger
+        //---------------------------------------------------------------------
+        test("%x", "null", (Object)null);
+        test("%x", "1234567", new BigInteger("1234567", 16));
+        test("%(x", "1234567", new BigInteger("1234567", 16));
+        test("%(x", "(1234567)", new BigInteger("-1234567", 16));
+        test("% x", " 1234567", new BigInteger("1234567", 16));
+        test("% x", "-1234567", new BigInteger("-1234567", 16));
+        test("%+x", "+1234567", new BigInteger("1234567", 16));
+        test("%+x", "-1234567", new BigInteger("-1234567", 16));
+        test("%010x", "0001234567", new BigInteger("1234567", 16));
+        test("%010x", "-001234567", new BigInteger("-1234567", 16));
+        test("%(10x", " (1234567)", new BigInteger("-1234567", 16));
+        test("%+x", "+1234567", new BigInteger("1234567", 16));
+        test("%+x", "-1234567", new BigInteger("-1234567", 16));
+        test("%-10x", "1234567   ", new BigInteger("1234567", 16));
+        test("%-10x", "-1234567  ", new BigInteger("-1234567", 16));
+        test("%#10x", " 0x1234567", new BigInteger("1234567", 16));
+        test("%#10x", "-0x1234567", new BigInteger("-1234567", 16));
+        test("%#10X", " 0X1234567", new BigInteger("1234567", 16));
+        test("%#10X", "-0X1234567", new BigInteger("-1234567", 16));
+        test("%X", "1234567A", new BigInteger("1234567a", 16));
+        test("%X", "-1234567A", new BigInteger("-1234567a", 16));
+#end[BigInteger]
+
+#if[fp]
+#if[BigDecimal]
+        //---------------------------------------------------------------------
+        // %s - BigDecimal
+        //---------------------------------------------------------------------
+        $type$ one = BigDecimal.ONE;
+        $type$ ten = BigDecimal.TEN;
+        $type$ pi  = new $type$(Math.PI);
+        $type$ piToThe300 = pi.pow(300);
+
+        test("%s", "3.141592653589793115997963468544185161590576171875", pi);
+#end[BigDecimal]
+#if[float]
+        //---------------------------------------------------------------------
+        // %s - float
+        //---------------------------------------------------------------------
+        $type$ one = 1.0f;
+        $type$ ten = 10.0f;
+        $type$ pi  = (float) Math.PI;
+
+        test("%s", "3.1415927", pi);
+#end[float]
+#if[Float]
+        //---------------------------------------------------------------------
+        // %s - Float
+        //---------------------------------------------------------------------
+        $type$ one = new $type$(1.0f);
+        $type$ ten = new $type$(10.0f);
+        $type$ pi  = new $type$(Math.PI);
+
+        test("%s", "3.1415927", pi);
+#end[Float]
+#if[double]
+        //---------------------------------------------------------------------
+        // %s - double
+        //---------------------------------------------------------------------
+        $type$ one = 1.0;
+        $type$ ten = 10.0;
+        $type$ pi  = Math.PI;
+
+        test("%s", "3.141592653589793", pi);
+#end[double]
+#if[Double]
+        //---------------------------------------------------------------------
+        // %s - Double
+        //---------------------------------------------------------------------
+        $type$ one = new $type$(1.0);
+        $type$ ten = new $type$(10.0);
+        $type$ pi  = new $type$(Math.PI);
+
+        test("%s", "3.141592653589793", pi);
+#end[Double]
+
+        //---------------------------------------------------------------------
+        // flag/conversion errors
+        //---------------------------------------------------------------------
+        tryCatch("%d", IllegalFormatConversionException.class, one);
+        tryCatch("%,.4e", FormatFlagsConversionMismatchException.class, one);
+
+        //---------------------------------------------------------------------
+        // %e
+        //
+        // Floating-point conversions applicable to float, double, and
+        // BigDecimal.
+        //---------------------------------------------------------------------
+        test("%e", "null", (Object)null);
+
+        //---------------------------------------------------------------------
+        // %e - float and double
+        //---------------------------------------------------------------------
+        // double PI = 3.141 592 653 589 793 238 46;
+        test("%e", "3.141593e+00", pi);
+        test("%.0e", "1e+01", ten);
+        test("%#.0e", "1.e+01", ten);
+        test("%E", "3.141593E+00", pi);
+        test("%10.3e", " 3.142e+00", pi);
+        test("%10.3e", "-3.142e+00", negate(pi));
+        test("%010.3e", "03.142e+00", pi);
+        test("%010.3e", "-3.142e+00", negate(pi));
+        test("%-12.3e", "3.142e+00   ", pi);
+        test("%-12.3e", "-3.142e+00  ", negate(pi));
+        test("%.3e", "3.142e+00", pi);
+        test("%.3e", "-3.142e+00", negate(pi));
+        test("%.3e", "3.142e+06", mult(pi, 1000000.0));
+        test("%.3e", "-3.142e+06", mult(pi, -1000000.0));
+
+        test(Locale.FRANCE, "%e", "3,141593e+00", pi);
+
+        // double PI^300
+        //    = 13962455701329742638131355433930076081862072808 ... e+149
+#if[BigDecimal]
+        //---------------------------------------------------------------------
+        // %e - BigDecimal
+        //---------------------------------------------------------------------
+        test("%.3e", "1.396e+149", piToThe300);
+        test("%.3e", "-1.396e+149", piToThe300.negate());
+        test("%.3e", "1.000e-100", recip(ten.pow(100)));
+        test("%.3e", "-1.000e-100", negate(recip(ten.pow(100))));
+
+        test("%3.0e", "1e-06", new BigDecimal("0.000001"));
+        test("%3.0e", "1e-05", new BigDecimal("0.00001"));
+        test("%3.0e", "1e-04", new BigDecimal("0.0001"));
+        test("%3.0e", "1e-03", new BigDecimal("0.001"));
+        test("%3.0e", "1e-02", new BigDecimal("0.01"));
+        test("%3.0e", "1e-01", new BigDecimal("0.1"));
+        test("%3.0e", "9e-01", new BigDecimal("0.9"));
+        test("%3.1e", "9.0e-01", new BigDecimal("0.9"));
+        test("%3.0e", "1e+00", new BigDecimal("1.00"));
+        test("%3.0e", "1e+01", new BigDecimal("10.00"));
+        test("%3.0e", "1e+02", new BigDecimal("99.19"));
+        test("%3.1e", "9.9e+01", new BigDecimal("99.19"));
+        test("%3.0e", "1e+02", new BigDecimal("99.99"));
+        test("%3.0e", "1e+02", new BigDecimal("100.00"));
+        test("%#3.0e", "1.e+03",    new BigDecimal("1000.00"));
+        test("%3.0e", "1e+04",     new BigDecimal("10000.00"));
+        test("%3.0e", "1e+05",    new BigDecimal("100000.00"));
+        test("%3.0e", "1e+06",   new BigDecimal("1000000.00"));
+        test("%3.0e", "1e+07",  new BigDecimal("10000000.00"));
+        test("%3.0e", "1e+08", new BigDecimal("100000000.00"));
+#end[BigDecimal]
+
+        test("%10.3e", " 1.000e+00", one);
+        test("%+.3e", "+3.142e+00", pi);
+        test("%+.3e", "-3.142e+00", negate(pi));
+        test("% .3e", " 3.142e+00", pi);
+        test("% .3e", "-3.142e+00", negate(pi));
+        test("%#.0e", "3.e+00", create(3.0));
+        test("%#.0e", "-3.e+00", create(-3.0));
+        test("%.0e", "3e+00", create(3.0));
+        test("%.0e", "-3e+00", create(-3.0));
+
+        test("%(.4e", "3.1416e+06", mult(pi, 1000000.0));
+        test("%(.4e", "(3.1416e+06)", mult(pi, -1000000.0));
+
+        //---------------------------------------------------------------------
+        // %e - boundary problems
+        //---------------------------------------------------------------------
+        test("%3.0e", "1e-06", 0.000001);
+        test("%3.0e", "1e-05", 0.00001);
+        test("%3.0e", "1e-04", 0.0001);
+        test("%3.0e", "1e-03", 0.001);
+        test("%3.0e", "1e-02", 0.01);
+        test("%3.0e", "1e-01", 0.1);
+        test("%3.0e", "9e-01", 0.9);
+        test("%3.1e", "9.0e-01", 0.9);
+        test("%3.0e", "1e+00", 1.00);
+        test("%3.0e", "1e+01", 10.00);
+        test("%3.0e", "1e+02", 99.19);
+        test("%3.1e", "9.9e+01", 99.19);
+        test("%3.0e", "1e+02", 99.99);
+        test("%3.0e", "1e+02", 100.00);
+        test("%#3.0e", "1.e+03",     1000.00);
+        test("%3.0e", "1e+04",     10000.00);
+        test("%3.0e", "1e+05",    100000.00);
+        test("%3.0e", "1e+06",   1000000.00);
+        test("%3.0e", "1e+07",  10000000.00);
+        test("%3.0e", "1e+08", 100000000.00);
+
+        //---------------------------------------------------------------------
+        // %f
+        //
+        // Floating-point conversions applicable to float, double, and
+        // BigDecimal.
+        //---------------------------------------------------------------------
+        test("%f", "null", (Object)null);
+        test("%f", "3.141593", pi);
+        test(Locale.FRANCE, "%f", "3,141593", pi);
+        test("%10.3f", "     3.142", pi);
+        test("%10.3f", "    -3.142", negate(pi));
+        test("%010.3f", "000003.142", pi);
+        test("%010.3f", "-00003.142", negate(pi));
+        test("%-10.3f", "3.142     ", pi);
+        test("%-10.3f", "-3.142    ", negate(pi));
+        test("%.3f", "3.142", pi);
+        test("%.3f", "-3.142", negate(pi));
+        test("%+.3f", "+3.142", pi);
+        test("%+.3f", "-3.142", negate(pi));
+        test("% .3f", " 3.142", pi);
+        test("% .3f", "-3.142", negate(pi));
+        test("%#.0f", "3.", create(3.0));
+        test("%#.0f", "-3.", create(-3.0));
+        test("%.0f", "3", create(3.0));
+        test("%.0f", "-3", create(-3.0));
+        test("%.3f", "10.000", ten);
+        test("%.3f", "1.000", one);
+        test("%10.3f", "     1.000", one);
+
+        //---------------------------------------------------------------------
+        // %f - boundary problems
+        //---------------------------------------------------------------------
+        test("%3.0f", "  0", 0.000001);
+        test("%3.0f", "  0", 0.00001);
+        test("%3.0f", "  0", 0.0001);
+        test("%3.0f", "  0", 0.001);
+        test("%3.0f", "  0", 0.01);
+        test("%3.0f", "  0", 0.1);
+        test("%3.0f", "  1", 0.9);
+        test("%3.1f", "0.9", 0.9);
+        test("%3.0f", "  1", 1.00);
+        test("%3.0f", " 10", 10.00);
+        test("%3.0f", " 99", 99.19);
+        test("%3.1f", "99.2", 99.19);
+        test("%3.0f", "100", 99.99);
+        test("%3.0f", "100", 100.00);
+        test("%#3.0f", "1000.",     1000.00);
+        test("%3.0f", "10000",     10000.00);
+        test("%3.0f", "100000",    100000.00);
+        test("%3.0f", "1000000",   1000000.00);
+        test("%3.0f", "10000000",  10000000.00);
+        test("%3.0f", "100000000", 100000000.00);
+#if[BigDecimal]
+        //---------------------------------------------------------------------
+        // %f - BigDecimal
+        //---------------------------------------------------------------------
+        test("%4.0f", "  99", new BigDecimal("99.19"));
+        test("%4.1f", "99.2", new BigDecimal("99.19"));
+
+        BigDecimal val = new BigDecimal("99.95");
+        test("%4.0f", " 100", val);
+        test("%#4.0f", "100.", val);
+        test("%4.1f", "100.0", val);
+        test("%4.2f", "99.95", val);
+        test("%4.3f", "99.950", val);
+
+        val = new BigDecimal(".99");
+        test("%4.1f", " 1.0", val);
+        test("%4.2f", "0.99", val);
+        test("%4.3f", "0.990", val);
+
+        // #6476425
+        val = new BigDecimal("0.00001");
+        test("%.0f", "0", val);
+        test("%.1f", "0.0", val);
+        test("%.2f", "0.00", val);
+        test("%.3f", "0.000", val);
+        test("%.4f", "0.0000", val);
+        test("%.5f", "0.00001", val);
+
+        val = new BigDecimal("1.00001");
+        test("%.0f", "1", val);
+        test("%.1f", "1.0", val);
+        test("%.2f", "1.00", val);
+        test("%.3f", "1.000", val);
+        test("%.4f", "1.0000", val);
+        test("%.5f", "1.00001", val);
+
+        val = new BigDecimal("1.23456");
+        test("%.0f", "1", val);
+        test("%.1f", "1.2", val);
+        test("%.2f", "1.23", val);
+        test("%.3f", "1.235", val);
+        test("%.4f", "1.2346", val);
+        test("%.5f", "1.23456", val);
+        test("%.6f", "1.234560", val);
+
+        val = new BigDecimal("9.99999");
+        test("%.0f", "10", val);
+        test("%.1f", "10.0", val);
+        test("%.2f", "10.00", val);
+        test("%.3f", "10.000", val);
+        test("%.4f", "10.0000", val);
+        test("%.5f", "9.99999", val);
+        test("%.6f", "9.999990", val);
+
+
+        val = new BigDecimal("1.99999");
+        test("%.0f", "2", val);
+        test("%.1f", "2.0", val);
+        test("%.2f", "2.00", val);
+        test("%.3f", "2.000", val);
+        test("%.4f", "2.0000", val);
+        test("%.5f", "1.99999", val);
+        test("%.6f", "1.999990", val);
+
+#end[BigDecimal]
+
+#if[float]
+        //---------------------------------------------------------------------
+        // %f - float
+        //---------------------------------------------------------------------
+        // Float can not accurately store 1e6 * PI.
+        test("%.3f", "3141.593", mult(pi, 1000.0));
+        test("%.3f", "-3141.593", mult(pi, -1000.0));
+
+        test("%,.2f", "3,141.59", mult(pi, 1000.0));
+        test(Locale.FRANCE, "%,.2f", "3\u00a0141,59", mult(pi, 1000.0));
+        test("%,.2f", "-3,141.59", mult(pi, -1000.0));
+        test("%(.2f", "3141.59", mult(pi, 1000.0));
+        test("%(.2f", "(3141.59)", mult(pi, -1000.0));
+        test("%(,.2f", "3,141.59", mult(pi, 1000.0));
+        test("%(,.2f", "(3,141.59)", mult(pi, -1000.0));
+
+#else[float]
+#if[!Float]
+        //---------------------------------------------------------------------
+        // %f - float, double, Double, BigDecimal
+        //---------------------------------------------------------------------
+        test("%.3f", "3141592.654", mult(pi, 1000000.0));
+        test("%.3f", "-3141592.654", mult(pi, -1000000.0));
+        test("%,.4f", "3,141,592.6536", mult(pi, 1000000.0));
+        test(Locale.FRANCE, "%,.4f", "3\u00a0141\u00a0592,6536", mult(pi, 1000000.0));
+        test("%,.4f", "-3,141,592.6536", mult(pi, -1000000.0));
+        test("%(.4f", "3141592.6536", mult(pi, 1000000.0));
+        test("%(.4f", "(3141592.6536)", mult(pi, -1000000.0));
+        test("%(,.4f", "3,141,592.6536", mult(pi, 1000000.0));
+        test("%(,.4f", "(3,141,592.6536)", mult(pi, -1000000.0));
+#end[!Float]
+#end[float]
+
+
+        //---------------------------------------------------------------------
+        // %g
+        //
+        // Floating-point conversions applicable to float, double, and
+        // BigDecimal.
+        //---------------------------------------------------------------------
+        test("%g", "null", (Object)null);
+        test("%g", "3.14159", pi);
+        test(Locale.FRANCE, "%g", "3,14159", pi);
+        test("%.0g", "1e+01", ten);
+        test("%G", "3.14159", pi);
+        test("%10.3g", "      3.14", pi);
+        test("%10.3g", "     -3.14", negate(pi));
+        test("%010.3g", "0000003.14", pi);
+        test("%010.3g", "-000003.14", negate(pi));
+        test("%-12.3g", "3.14        ", pi);
+        test("%-12.3g", "-3.14       ", negate(pi));
+        test("%.3g", "3.14", pi);
+        test("%.3g", "-3.14", negate(pi));
+        test("%.3g", "3.14e+08", mult(pi, 100000000.0));
+        test("%.3g", "-3.14e+08", mult(pi, -100000000.0));
+
+        test("%.3g", "1.00e-05", recip(create(100000.0)));
+        test("%.3g", "-1.00e-05", recip(create(-100000.0)));
+        test("%.0g", "-1e-05", recip(create(-100000.0)));
+        test("%.0g", "1e+05", create(100000.0));
+        test("%.3G", "1.00E-05", recip(create(100000.0)));
+        test("%.3G", "-1.00E-05", recip(create(-100000.0)));
+
+        test("%3.0g", "1e-06", 0.000001);
+        test("%3.0g", "1e-05", 0.00001);
+        test("%3.0g", "1e-05", 0.0000099);
+        test("%3.1g", "1e-05", 0.0000099);
+        test("%3.2g", "9.9e-06", 0.0000099);
+        test("%3.0g", "0.0001", 0.0001);
+        test("%3.0g", "9e-05",  0.00009);
+        test("%3.0g", "0.0001", 0.000099);
+        test("%3.1g", "0.0001", 0.000099);
+        test("%3.2g", "9.9e-05", 0.000099);
+        test("%3.0g", "0.001", 0.001);
+        test("%3.0g", "0.001", 0.00099);
+        test("%3.1g", "0.001", 0.00099);
+        test("%3.2g", "0.00099", 0.00099);
+        test("%3.3g", "0.00100", 0.001);
+        test("%3.4g", "0.001000", 0.001);
+        test("%3.0g", "0.01", 0.01);
+        test("%3.0g", "0.1", 0.1);
+        test("%3.0g", "0.9", 0.9);
+        test("%3.1g", "0.9", 0.9);
+        test("%3.0g", "  1", 1.00);
+        test("%3.2g", " 10", 10.00);
+        test("%3.0g", "1e+01", 10.00);
+        test("%3.0g", "1e+02", 99.19);
+        test("%3.1g", "1e+02", 99.19);
+        test("%3.2g", " 99", 99.19);
+        test("%3.0g", "1e+02", 99.9);
+        test("%3.1g", "1e+02", 99.9);
+        test("%3.2g", "1.0e+02", 99.9);
+        test("%3.0g", "1e+02", 99.99);
+        test("%3.0g", "1e+02", 100.00);
+        test("%3.0g", "1e+03", 999.9);
+        test("%3.1g", "1e+03", 999.9);
+        test("%3.2g", "1.0e+03", 999.9);
+        test("%3.3g", "1.00e+03", 999.9);
+        test("%3.4g", "999.9", 999.9);
+        test("%3.4g", "1000", 999.99);
+        test("%3.0g", "1e+03", 1000.00);
+        test("%3.0g", "1e+04",     10000.00);
+        test("%3.0g", "1e+05",    100000.00);
+        test("%3.0g", "1e+06",   1000000.00);
+        test("%3.0g", "1e+07",  10000000.00);
+        test("%3.9g", "100000000",  100000000.00);
+        test("%3.10g", "100000000.0", 100000000.00);
+
+        tryCatch("%#3.0g", FormatFlagsConversionMismatchException.class, 1000.00);
+
+        // double PI^300
+        //    = 13962455701329742638131355433930076081862072808 ... e+149
+#if[BigDecimal]
+        //---------------------------------------------------------------------
+        // %g - BigDecimal
+        //---------------------------------------------------------------------
+        test("%.3g", "1.40e+149", piToThe300);
+        test("%.3g", "-1.40e+149", piToThe300.negate());
+        test(Locale.FRANCE, "%.3g", "-1,40e+149", piToThe300.negate());
+        test("%.3g", "1.00e-100", recip(ten.pow(100)));
+        test("%.3g", "-1.00e-100", negate(recip(ten.pow(100))));
+
+        test("%3.0g", "1e-06", new BigDecimal("0.000001"));
+        test("%3.0g", "1e-05", new BigDecimal("0.00001"));
+        test("%3.0g", "0.0001", new BigDecimal("0.0001"));
+        test("%3.0g", "0.001", new BigDecimal("0.001"));
+        test("%3.3g", "0.00100", new BigDecimal("0.001"));
+        test("%3.4g", "0.001000", new BigDecimal("0.001"));
+        test("%3.0g", "0.01", new BigDecimal("0.01"));
+        test("%3.0g", "0.1", new BigDecimal("0.1"));
+        test("%3.0g", "0.9", new BigDecimal("0.9"));
+        test("%3.1g", "0.9", new BigDecimal("0.9"));
+        test("%3.0g", "  1", new BigDecimal("1.00"));
+        test("%3.2g", " 10", new BigDecimal("10.00"));
+        test("%3.0g", "1e+01", new BigDecimal("10.00"));
+        test("%3.0g", "1e+02", new BigDecimal("99.19"));
+        test("%3.1g", "1e+02", new BigDecimal("99.19"));
+        test("%3.2g", " 99", new BigDecimal("99.19"));
+        test("%3.0g", "1e+02", new BigDecimal("99.99"));
+        test("%3.0g", "1e+02", new BigDecimal("100.00"));
+        test("%3.0g", "1e+03", new BigDecimal("1000.00"));
+        test("%3.0g", "1e+04",      new BigDecimal("10000.00"));
+        test("%3.0g", "1e+05",      new BigDecimal("100000.00"));
+        test("%3.0g", "1e+06",      new BigDecimal("1000000.00"));
+        test("%3.0g", "1e+07",      new BigDecimal("10000000.00"));
+        test("%3.9g", "100000000",  new BigDecimal("100000000.00"));
+        test("%3.10g", "100000000.0", new BigDecimal("100000000.00"));
+#end[BigDecimal]
+
+        test("%.3g", "10.0", ten);
+        test("%.3g", "1.00", one);
+        test("%10.3g", "      1.00", one);
+        test("%+10.3g", "     +3.14", pi);
+        test("%+10.3g", "     -3.14", negate(pi));
+        test("% .3g", " 3.14", pi);
+        test("% .3g", "-3.14", negate(pi));
+        test("%.0g", "3", create(3.0));
+        test("%.0g", "-3", create(-3.0));
+
+        test("%(.4g", "3.142e+08", mult(pi, 100000000.0));
+        test("%(.4g", "(3.142e+08)", mult(pi, -100000000.0));
+
+#if[float]
+        // Float can not accurately store 1e6 * PI.
+        test("%,.6g", "3,141.59", mult(pi, 1000.0));
+        test("%(,.6g", "(3,141.59)", mult(pi, -1000.0));
+#else[float]
+#if[!Float]
+        test("%,.11g", "3,141,592.6536", mult(pi, 1000000.0));
+        test("%(,.11g", "(3,141,592.6536)", mult(pi, -1000000.0));
+#end[!Float]
+#end[float]
+
+#if[double]
+        //---------------------------------------------------------------------
+        // %a
+        //
+        // Floating-point conversions applicable to float, double, and
+        // BigDecimal.
+        //---------------------------------------------------------------------
+        test("%a", "null", (Object)null);
+        test("%.11a", "0x0.00000000000p0", 0.0);
+        test(Locale.FRANCE, "%.11a", "0x0.00000000000p0", 0.0); // no localization
+        test("%.1a", "0x0.0p0", 0.0);
+        test("%.11a", "-0x0.00000000000p0", -0.0);
+        test("%.1a", "-0x0.0p0", -0.0);
+        test("%.11a", "0x1.00000000000p0", 1.0);
+        test("%.1a", "0x1.0p0", 1.0);
+        test("%.11a", "-0x1.00000000000p0", -1.0);
+        test("%.1a", "-0x1.0p0", -1.0);
+        test("%.11a", "0x1.80000000000p1", 3.0);
+        test("%.1a", "0x1.8p1", 3.0);
+        test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
+        test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
+        test("%.11a", "0x1.00000000000p-1022",
+             FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+        test("%.1a", "0x1.0p-1022",
+             FpUtils.nextDown(DoubleConsts.MIN_NORMAL));
+        test("%.11a", "0x1.ffffffffffep-1023",
+             Double.parseDouble("0x0.fffffffffffp-1022"));
+        test("%.1a", "0x1.0p-1022",
+             Double.parseDouble("0x0.fffffffffffp-1022"));
+        test("%.30a", "0x0.000000000000100000000000000000p-1022", Double.MIN_VALUE);
+        test("%.13a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
+        test("%.11a", "0x1.00000000000p-1074", Double.MIN_VALUE);
+        test("%.1a", "0x1.0p-1074", Double.MIN_VALUE);
+
+        test("%.11a", "0x1.08000000000p-1069",
+             Double.MIN_VALUE + Double.MIN_VALUE*32);
+        test("%.1a", "0x1.0p-1069",
+             Double.MIN_VALUE + Double.MIN_VALUE*32);
+        test("%.30a", "0x1.fffffffffffff00000000000000000p1023", Double.MAX_VALUE);
+        test("%.13a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
+        test("%.11a", "0x1.00000000000p1024", Double.MAX_VALUE);
+        test("%.1a", "0x1.0p1024", Double.MAX_VALUE);
+        test("%.11a", "0x1.18000000000p0", Double.parseDouble("0x1.18p0"));
+        test("%.1a", "0x1.2p0", Double.parseDouble("0x1.18p0"));
+
+        test("%.11a", "0x1.18000000000p0",
+             Double.parseDouble("0x1.180000000001p0"));
+        test("%.1a", "0x1.2p0",
+             Double.parseDouble("0x1.180000000001p0"));
+        test("%.11a", "0x1.28000000000p0", Double.parseDouble("0x1.28p0"));
+        test("%.1a", "0x1.2p0", Double.parseDouble("0x1.28p0"));
+
+        test("%.11a", "0x1.28000000000p0",
+             Double.parseDouble("0x1.280000000001p0"));
+        test("%.1a", "0x1.3p0", Double.parseDouble("0x1.280000000001p0"));
+#end[double]
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - Boundaries
+        //---------------------------------------------------------------------
+#if[float]
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - NaN
+        //---------------------------------------------------------------------
+        test("%f", "NaN", Float.NaN);
+        // s
+        test("%+f", "NaN", Float.NaN);
+//      test("%F", "NAN", Float.NaN);
+        test("%e", "NaN", Float.NaN);
+        test("%+e", "NaN", Float.NaN);
+        test("%E", "NAN", Float.NaN);
+        test("%g", "NaN", Float.NaN);
+        test("%+g", "NaN", Float.NaN);
+        test("%G", "NAN", Float.NaN);
+        test("%a", "NaN", Float.NaN);
+        test("%+a", "NaN", Float.NaN);
+        test("%A", "NAN", Float.NaN);
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - +0.0
+        //---------------------------------------------------------------------
+        test("%f", "0.000000", +0.0);
+        test("%+f", "+0.000000", +0.0);
+        test("% f", " 0.000000", +0.0);
+//      test("%F", "0.000000", +0.0);
+        test("%e", "0.000000e+00", 0e0);
+        test("%e", "0.000000e+00", +0.0);
+        test("%+e", "+0.000000e+00", +0.0);
+        test("% e", " 0.000000e+00", +0.0);
+        test("%E", "0.000000E+00", 0e0);
+        test("%E", "0.000000E+00", +0.0);
+        test("%+E", "+0.000000E+00", +0.0);
+        test("% E", " 0.000000E+00", +0.0);
+        test("%g", "0.00000", +0.0);
+        test("%+g", "+0.00000", +0.0);
+        test("% g", " 0.00000", +0.0);
+        test("%G", "0.00000", +0.0);
+        test("% G", " 0.00000", +0.0);
+        test("%a", "0x0.0p0", +0.0);
+        test("%+a", "+0x0.0p0", +0.0);
+        test("% a", " 0x0.0p0", +0.0);
+        test("%A", "0X0.0P0", +0.0);
+        test("% A", " 0X0.0P0", +0.0);
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - -0.0
+        //---------------------------------------------------------------------
+        test("%f", "-0.000000", -0.0);
+        test("%+f", "-0.000000", -0.0);
+//      test("%F", "-0.000000", -0.0);
+        test("%e", "-0.000000e+00", -0.0);
+        test("%+e", "-0.000000e+00", -0.0);
+        test("%E", "-0.000000E+00", -0.0);
+        test("%+E", "-0.000000E+00", -0.0);
+        test("%g", "-0.00000", -0.0);
+        test("%+g", "-0.00000", -0.0);
+        test("%G", "-0.00000", -0.0);
+        test("%a", "-0x0.0p0", -0.0);
+        test("%+a", "-0x0.0p0", -0.0);
+        test("%+A", "-0X0.0P0", -0.0);
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - +Infinity
+        //---------------------------------------------------------------------
+        test("%f", "Infinity", Float.POSITIVE_INFINITY);
+        test("%+f", "+Infinity", Float.POSITIVE_INFINITY);
+        test("% f", " Infinity", Float.POSITIVE_INFINITY);
+//      test("%F", "INFINITY", Float.POSITIVE_INFINITY);
+        test("%e", "Infinity", Float.POSITIVE_INFINITY);
+        test("%+e", "+Infinity", Float.POSITIVE_INFINITY);
+        test("% e", " Infinity", Float.POSITIVE_INFINITY);
+        test("%E", "INFINITY", Float.POSITIVE_INFINITY);
+        test("%+E", "+INFINITY", Float.POSITIVE_INFINITY);
+        test("% E", " INFINITY", Float.POSITIVE_INFINITY);
+        test("%g", "Infinity", Float.POSITIVE_INFINITY);
+        test("%+g", "+Infinity", Float.POSITIVE_INFINITY);
+        test("%G", "INFINITY", Float.POSITIVE_INFINITY);
+        test("% G", " INFINITY", Float.POSITIVE_INFINITY);
+        test("%+G", "+INFINITY", Float.POSITIVE_INFINITY);
+        test("%a", "Infinity", Float.POSITIVE_INFINITY);
+        test("%+a", "+Infinity", Float.POSITIVE_INFINITY);
+        test("% a", " Infinity", Float.POSITIVE_INFINITY);
+        test("%A", "INFINITY", Float.POSITIVE_INFINITY);
+        test("%+A", "+INFINITY", Float.POSITIVE_INFINITY);
+        test("% A", " INFINITY", Float.POSITIVE_INFINITY);
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - -Infinity
+        //---------------------------------------------------------------------
+        test("%f", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%+f", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%(f", "(Infinity)", Float.NEGATIVE_INFINITY);
+//      test("%F", "-INFINITY", Float.NEGATIVE_INFINITY);
+        test("%e", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%+e", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%E", "-INFINITY", Float.NEGATIVE_INFINITY);
+        test("%+E", "-INFINITY", Float.NEGATIVE_INFINITY);
+        test("%g", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%+g", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%G", "-INFINITY", Float.NEGATIVE_INFINITY);
+        test("%+G", "-INFINITY", Float.NEGATIVE_INFINITY);
+        test("%a", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%+a", "-Infinity", Float.NEGATIVE_INFINITY);
+        test("%A", "-INFINITY", Float.NEGATIVE_INFINITY);
+        test("%+A", "-INFINITY", Float.NEGATIVE_INFINITY);
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - Float.MIN_VALUE
+        //---------------------------------------------------------------------
+        test("%f", "0.000000", Float.MIN_VALUE);
+        test("%,f", "0.000000", Float.MIN_VALUE);
+        test("%(f", "(0.000000)", -Float.MIN_VALUE);
+        test("%30.0f",  "                             0", Float.MIN_VALUE);
+        test("%30.5f",  "                       0.00000", Float.MIN_VALUE);
+        test("%30.13f", "               0.0000000000000", Float.MIN_VALUE);
+        test("%30.20f", "        0.00000000000000000000", Float.MIN_VALUE);
+        test("%e", "1.401298e-45", Float.MIN_VALUE);
+        test("%E", "1.401298E-45", Float.MIN_VALUE);
+        test("%(.1e", "1.4e-45", Float.MIN_VALUE);
+        test("%(E", "(1.401298E-45)", -Float.MIN_VALUE);
+        test("%30.5e",  "                   1.40130e-45", Float.MIN_VALUE);
+        test("%30.13e", "           1.4012984643248e-45", Float.MIN_VALUE);
+        test("%30.20e", "    1.40129846432481700000e-45", Float.MIN_VALUE);
+        test("%g", "1.40130e-45", Float.MIN_VALUE);
+        test("%G", "1.40130E-45", Float.MIN_VALUE);
+        test("%(g", "1.40130e-45", Float.MIN_VALUE);
+        test("%,g", "1.40130e-45", Float.MIN_VALUE);
+        test("%(G", "(1.40130E-45)", -Float.MIN_VALUE);
+        test("%30.5g",  "                    1.4013e-45", Float.MIN_VALUE);
+        test("%30.13g", "            1.401298464325e-45", Float.MIN_VALUE);
+        test("%30.20g", "     1.4012984643248170000e-45", Float.MIN_VALUE);
+        test("%a", "0x1.0p-149", Float.MIN_VALUE);
+        test("%A", "0X1.0P-149", Float.MIN_VALUE);
+        test("%20a", "          0x1.0p-149", Float.MIN_VALUE);
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - Float.MAX_VALUE
+        //---------------------------------------------------------------------
+        test("%f", "340282346638528860000000000000000000000.000000", Float.MAX_VALUE);
+        test("%,f","340,282,346,638,528,860,000,000,000,000,000,000,000.000000",
+             Float.MAX_VALUE);
+        test("%(f", "(340282346638528860000000000000000000000.000000)", -Float.MAX_VALUE);
+        test("%60.5f",  "               340282346638528860000000000000000000000.00000",
+             Float.MAX_VALUE);
+        test("%60.13f", "       340282346638528860000000000000000000000.0000000000000",
+             Float.MAX_VALUE);
+        test("%61.20f", " 340282346638528860000000000000000000000.00000000000000000000",
+             Float.MAX_VALUE);
+        test("%e", "3.402823e+38", Float.MAX_VALUE);
+        test("%E", "3.402823E+38", Float.MAX_VALUE);
+        test("%(e", "3.402823e+38", Float.MAX_VALUE);
+        test("%(e", "(3.402823e+38)", -Float.MAX_VALUE);
+        test("%30.5e",  "                   3.40282e+38", Float.MAX_VALUE);
+        test("%30.13e", "           3.4028234663853e+38", Float.MAX_VALUE);
+        test("%30.20e", "    3.40282346638528860000e+38", Float.MAX_VALUE);
+        test("%g", "3.40282e+38", Float.MAX_VALUE);
+        test("%G", "3.40282E+38", Float.MAX_VALUE);
+        test("%,g", "3.40282e+38", Float.MAX_VALUE);
+        test("%(g", "(3.40282e+38)", -Float.MAX_VALUE);
+        test("%30.5g",  "                    3.4028e+38", Float.MAX_VALUE);
+        test("%30.13g", "            3.402823466385e+38", Float.MAX_VALUE);
+        test("%30.20G", "     3.4028234663852886000E+38", Float.MAX_VALUE);
+        test("%a", "0x1.fffffep127", Float.MAX_VALUE);
+        test("%A", "0X1.FFFFFEP127", Float.MAX_VALUE);
+        test("%20a","      0x1.fffffep127", Float.MAX_VALUE);
+
+#end[float]
+
+#if[double]
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - Double.MIN_VALUE
+        //---------------------------------------------------------------------
+        test("%f", "0.000000", Double.MIN_VALUE);
+        test("%,f", "0.000000", Double.MIN_VALUE);
+        test("%(f", "(0.000000)", -Double.MIN_VALUE);
+        test("%30.0f",  "                             0", Double.MIN_VALUE);
+        test("%30.5f",  "                       0.00000", Double.MIN_VALUE);
+        test("%30.13f", "               0.0000000000000", Double.MIN_VALUE);
+        test("%30.20f", "        0.00000000000000000000", Double.MIN_VALUE);
+        test("%30.350f","0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000490000000000000000000000000",
+             Double.MIN_VALUE);
+        test("%e", "4.900000e-324", Double.MIN_VALUE);
+        test("%E", "4.900000E-324", Double.MIN_VALUE);
+        test("%(.1e", "4.9e-324", Double.MIN_VALUE);
+        test("%(E", "(4.900000E-324)", -Double.MIN_VALUE);
+        test("%30.5e",  "                  4.90000e-324", Double.MIN_VALUE);
+        test("%30.13e", "          4.9000000000000e-324", Double.MIN_VALUE);
+        test("%30.20e", "   4.90000000000000000000e-324", Double.MIN_VALUE);
+        test("%g", "4.90000e-324", Double.MIN_VALUE);
+        test("%G", "4.90000E-324", Double.MIN_VALUE);
+        test("%(g", "4.90000e-324", Double.MIN_VALUE);
+        test("%,g", "4.90000e-324", Double.MIN_VALUE);
+        test("%30.5g",  "                   4.9000e-324", Double.MIN_VALUE);
+        test("%30.13g", "           4.900000000000e-324", Double.MIN_VALUE);
+        test("%30.20g", "    4.9000000000000000000e-324", Double.MIN_VALUE);
+        test("%a", "0x0.0000000000001p-1022", Double.MIN_VALUE);
+        test("%A", "0X0.0000000000001P-1022", Double.MIN_VALUE);
+        test("%30a",    "       0x0.0000000000001p-1022", Double.MIN_VALUE);
+
+        //---------------------------------------------------------------------
+        // %f, %e, %g, %a - Double.MAX_VALUE
+        //---------------------------------------------------------------------
+        test("%f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000",
+             Double.MAX_VALUE);
+        test("%,f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000",
+             Double.MAX_VALUE);
+        test("%,(f", "(179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.000000)",
+             -Double.MAX_VALUE);
+        test("%,30.5f", "179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000",
+             Double.MAX_VALUE);
+        test("%30.13f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000",
+             Double.MAX_VALUE);
+        test("%30.20f", "179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00000000000000000000",
+             Double.MAX_VALUE);
+        test("%e", "1.797693e+308", Double.MAX_VALUE);
+        test("%E", "1.797693E+308", Double.MAX_VALUE);
+        test("%(e", "1.797693e+308", Double.MAX_VALUE);
+        test("%(e", "(1.797693e+308)", -Double.MAX_VALUE);
+        test("%30.5e",  "                  1.79769e+308", Double.MAX_VALUE);
+        test("%30.13e", "          1.7976931348623e+308", Double.MAX_VALUE);
+        test("%30.20e", "   1.79769313486231570000e+308", Double.MAX_VALUE);
+        test("%g", "1.79769e+308", Double.MAX_VALUE);
+        test("%G", "1.79769E+308", Double.MAX_VALUE);
+        test("%,g", "1.79769e+308", Double.MAX_VALUE);
+        test("%(g", "(1.79769e+308)", -Double.MAX_VALUE);
+        test("%30.5g",  "                   1.7977e+308", Double.MAX_VALUE);
+        test("%30.13g", "           1.797693134862e+308", Double.MAX_VALUE);
+        test("%30.20g", "    1.7976931348623157000e+308", Double.MAX_VALUE);
+        test("%a", "0x1.fffffffffffffp1023", Double.MAX_VALUE);
+        test("%A", "0X1.FFFFFFFFFFFFFP1023", Double.MAX_VALUE);
+        test("%30a",    "        0x1.fffffffffffffp1023", Double.MAX_VALUE);
+#end[double]
+
+#end[fp]
+
+        //---------------------------------------------------------------------
+        // %t
+        //
+        // Date/Time conversions applicable to Calendar, Date, and long.
+        //---------------------------------------------------------------------
+        test("%tA", "null", (Object)null);
+        test("%TA", "NULL", (Object)null);
+
+        //---------------------------------------------------------------------
+        // %t - errors
+        //---------------------------------------------------------------------
+        tryCatch("%t", UnknownFormatConversionException.class);
+        tryCatch("%T", UnknownFormatConversionException.class);
+        tryCatch("%tP", UnknownFormatConversionException.class);
+        tryCatch("%TP", UnknownFormatConversionException.class);
+        tryCatch("%.5tB", IllegalFormatPrecisionException.class);
+        tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
+        tryCatch("%-tB", MissingFormatWidthException.class);
+
+#if[datetime]
+        //---------------------------------------------------------------------
+        // %t - create test Calendar
+        //---------------------------------------------------------------------
+
+        // Get the supported ids for GMT-08:00 (Pacific Standard Time)
+        String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
+        // Create a Pacific Standard Time time zone
+        SimpleTimeZone tz = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
+        // public GregorianCalendar(TimeZone zone, Locale aLocale);
+        Calendar c0 = new GregorianCalendar(tz, Locale.US);
+        // public final void set(int year, int month, int date,
+        //     int hourOfDay, int minute, int second);
+        c0.set(1995, MAY, 23, 19, 48, 34);
+        c0.set(Calendar.MILLISECOND, 584);
+
+        //---------------------------------------------------------------------
+        // %t - Minutes, {nano,milli}*seconds
+        //
+        // testDateTime() verifies the expected output for all applicable types
+        // (Calendar, Date, and long).  It also verifies output for "%t" and
+        // "%T". Thus it is sufficient to invoke that method once per
+        // conversion/expected output.
+        //---------------------------------------------------------------------
+        testDateTime("%tM", "48", c0);
+        testDateTime("%tN", "584000000", c0);
+        testDateTime("%tL", "584", c0);
+//      testDateTime("%tQ", "801283714584", c0);
+
+        testDateTime("%ts", String.valueOf(c0.getTimeInMillis() / 1000), c0);
+        testDateTime("%tS", "34", c0);
+        testDateTime("%tT", "19:48:34", c0);
+
+        //---------------------------------------------------------------------
+        // %t - Hours, morning/afternoon markers
+        //
+        // testHours() iterates through all twenty-four hours to verify
+        // numeric return value and morning/afternoon markers.
+        //---------------------------------------------------------------------
+        testHours();
+
+        //---------------------------------------------------------------------
+        // %t - Portions of date [ day, month, dates, weeks ]
+        //---------------------------------------------------------------------
+        testDateTime("%ta", "Tue", c0);
+        testDateTime("%tA", "Tuesday", c0);
+        testDateTime("%tb", "May", c0);
+        testDateTime("%tB", "May", c0);
+        testDateTime("%tC", "19", c0);
+        testDateTime("%td", "23", c0);
+        testDateTime("%te", "23", c0);
+        testDateTime("%th", "May", c0);
+        testDateTime("%tj", "143", c0);
+        testDateTime("%tm", "05", c0);
+        testDateTime("%ty", "95", c0);
+        testDateTime("%tY", "1995", c0);
+
+        //---------------------------------------------------------------------
+        // %t - TimeZone
+        //---------------------------------------------------------------------
+        testDateTime("%tz", "-0800", c0);
+        testDateTime("%tZ", "PST", c0);
+
+        //---------------------------------------------------------------------
+        // %tz should always adjust for DST
+        //---------------------------------------------------------------------
+        TimeZone dtz = TimeZone.getDefault();
+
+        // Artificial TimeZone based on PST with 3:15 DST always in effect
+        TimeZone atz = new SimpleTimeZone(-8 * 60 * 60 * 1000, "AlwaysDST",
+            JANUARY, 1, 0, 0, STANDARD_TIME,
+            // 24hrs - 1m = 60 * 60 * 1000 * 24 - 1
+            DECEMBER, 31, 0, 60 * 60 * 1000 * 24 - 1, STANDARD_TIME,
+            (int)(60 * 60 * 1000 * 3.25));
+        TimeZone.setDefault(atz);
+        testDateTime("%tz", "-0445", Calendar.getInstance(atz));
+
+        // Restore the TimeZone and verify
+        TimeZone.setDefault(dtz);
+        if (atz.hasSameRules(TimeZone.getDefault()))
+            throw new RuntimeException("Default TimeZone not restored");
+
+        //---------------------------------------------------------------------
+        // %t - Composites
+        //---------------------------------------------------------------------
+        testDateTime("%tr", "07:48:34 PM", c0);
+        testDateTime("%tR", "19:48", c0);
+        testDateTime("%tc", "Tue May 23 19:48:34 PST 1995", c0);
+        testDateTime("%tD", "05/23/95", c0);
+        testDateTime("%tF", "1995-05-23", c0);
+        testDateTime("%-12tF", "1995-05-23  ", c0);
+        testDateTime("%12tF", "  1995-05-23", c0);
+#end[datetime]
+
+        //---------------------------------------------------------------------
+        // %n
+        //---------------------------------------------------------------------
+        test("%n", System.getProperty("line.separator"), (Object)null);
+        test("%n", System.getProperty("line.separator"), "");
+
+        tryCatch("%,n", IllegalFormatFlagsException.class);
+        tryCatch("%.n", UnknownFormatConversionException.class);
+        tryCatch("%5.n", UnknownFormatConversionException.class);
+        tryCatch("%5n", IllegalFormatWidthException.class);
+        tryCatch("%.7n", IllegalFormatPrecisionException.class);
+        tryCatch("%<n", IllegalFormatFlagsException.class);
+
+        //---------------------------------------------------------------------
+        // %%
+        //---------------------------------------------------------------------
+        test("%%", "%", (Object)null);
+        test("%%", "%", "");
+        tryCatch("%%%", UnknownFormatConversionException.class);
+        // perhaps an IllegalFormatArgumentIndexException should be defined?
+        tryCatch("%<%", IllegalFormatFlagsException.class);
+    }
+}
--- a/jdk/test/java/util/Formatter/genBasic.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/Formatter/genBasic.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -27,10 +27,10 @@
 
 gen() {
 #  if [ $3 = "true" ]
-#  then $SPP -K$1 -Dtype=$1 -DType=$2 -Kprim<Basic-X.java >Basic$2.java
-#  else $SPP -K$1 -Dtype=$1 -DType=$2 -K$3 <Basic-X.java >Basic$2.java
+#  then $SPP -K$1 -Dtype=$1 -DType=$2 -Kprim<Basic-X.java.template >Basic$2.java
+#  else $SPP -K$1 -Dtype=$1 -DType=$2 -K$3 <Basic-X.java.template >Basic$2.java
 #  fi
-    java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java >Basic$2.java
+    java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -K$3 -K$4 -K$5 -K$6 <Basic-X.java.template >Basic$2.java
 }
 
 gen boolean Boolean       prim  ""  ""   ""
--- a/jdk/test/java/util/IdentityHashMap/ToString.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/IdentityHashMap/ToString.java	Wed Jul 05 17:04:26 2017 +0200
@@ -26,9 +26,6 @@
  * @bug     4973432
  * @summary Test that toString on entrySet Iterator/Entry behaves reasonably
  * @author  Josh Bloch
- *
- * @compile -source 1.5 ToString.java
- * @run main ToString
  */
 
 
--- a/jdk/test/java/util/Locale/Bug4175998Test.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/Locale/Bug4175998Test.java	Wed Jul 05 17:04:26 2017 +0200
@@ -23,7 +23,7 @@
 /*
     @test
     @summary test ISO639-2 language codes
-    @compile -encoding ascii -source 1.4 -target 1.4 Bug4175998Test.java
+    @compile -encoding ascii -source 5 Bug4175998Test.java
     @run main Bug4175998Test
     @bug 4175998
 */
--- a/jdk/test/java/util/UUID/UUIDTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/UUID/UUIDTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -23,8 +23,6 @@
 
 /* @test
  * @bug 4173528 5068772
- * @compile -source 1.4 -target 1.4 UUIDTest.java
- * @run main UUIDTest
  * @summary Unit tests for java.util.UUID
  */
 
--- a/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 CancelledProducerConsumerLoops.java
+ * @compile CancelledProducerConsumerLoops.java
  * @run main/timeout=7000 CancelledProducerConsumerLoops
  * @summary Checks for responsiveness of blocking queues to cancellation.
  * Runs under the assumption that ITERS computations require more than
--- a/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 MultipleProducersSingleConsumerLoops.java
+ * @compile MultipleProducersSingleConsumerLoops.java
  * @run main/timeout=3600 MultipleProducersSingleConsumerLoops
  * @summary  multiple producers and single consumer using blocking queues
  */
--- a/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 ProducerConsumerLoops.java
+ * @compile ProducerConsumerLoops.java
  * @run main/timeout=3600 ProducerConsumerLoops
  * @summary  multiple producers and consumers using blocking queues
  */
--- a/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 SingleProducerMultipleConsumerLoops.java
+ * @compile SingleProducerMultipleConsumerLoops.java
  * @run main/timeout=600 SingleProducerMultipleConsumerLoops
  * @summary  check ordering for blocking queues with 1 producer and multiple consumers
  */
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapCheck.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 MapCheck.java
+ * @compile MapCheck.java
  * @run main/timeout=240 MapCheck
  * @summary Times and checks basic map operations
  */
--- a/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 MapLoops.java
+ * @compile MapLoops.java
  * @run main/timeout=1600 MapLoops
  * @summary Exercise multithreaded maps, by default ConcurrentHashMap.
  * Multithreaded hash table test.  Each thread does a random walk
--- a/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/Exchanger/ExchangeLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 ExchangeLoops.java
+ * @compile ExchangeLoops.java
  * @run main/timeout=720 ExchangeLoops
  * @summary checks to make sure a pipeline of exchangers passes data.
  */
--- a/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4965960
- * @compile -source 1.5 ExecutorCompletionServiceLoops.java
+ * @compile ExecutorCompletionServiceLoops.java
  * @run main/timeout=3600 ExecutorCompletionServiceLoops
  * @summary  Exercise ExecutorCompletionServiceLoops
  */
--- a/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 CancelledFutureLoops.java
+ * @compile CancelledFutureLoops.java
  * @run main/timeout=2000 CancelledFutureLoops
  * @summary Checks for responsiveness of futures to cancellation.
  * Runs under the assumption that ITERS computations require more than
--- a/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/atomic/VMSupportsCS8.java	Wed Jul 05 17:04:26 2017 +0200
@@ -24,8 +24,6 @@
 /*
  * @test
  * @bug 4992443 4994819
- * @compile -source 1.5 VMSupportsCS8.java
- * @run main VMSupportsCS8
  * @summary Checks that the value of VMSupportsCS8 matches system properties.
  */
 
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 CancelledLockLoops.java
+ * @compile CancelledLockLoops.java
  * @run main/timeout=2800 CancelledLockLoops
  * @summary tests lockInterruptibly.
  * Checks for responsiveness of locks to interrupts. Runs under that
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 LockOncePerThreadLoops.java
+ * @compile LockOncePerThreadLoops.java
  * @run main/timeout=15000 LockOncePerThreadLoops
  * @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread
  */
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 SimpleReentrantLockLoops.java
+ * @compile SimpleReentrantLockLoops.java
  * @run main/timeout=4500 SimpleReentrantLockLoops
  * @summary multiple threads using a single lock
  */
--- a/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,8 +34,6 @@
 /*
  * @test
  * @bug 4486658 5031862
- * @compile -source 1.5 TimeoutLockLoops.java
- * @run main TimeoutLockLoops
  * @summary Checks for responsiveness of locks to timeouts.
  * Runs under the assumption that ITERS computations require more than
  * TIMEOUT msecs to complete, which seems to be a safe assumption for
--- a/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Wed Jul 05 17:04:26 2017 +0200
@@ -34,7 +34,7 @@
 /*
  * @test
  * @bug 4486658
- * @compile -source 1.5 MapLoops.java
+ * @compile MapLoops.java
  * @run main/timeout=4700 MapLoops
  * @summary Exercise multithreaded maps, by default ConcurrentHashMap.
  * Multithreaded hash table test.  Each thread does a random walk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/SoftChannel/NoteOverFlowTest2.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @summary Test SoftChannel overflow test 2 */
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.sound.midi.MidiChannel;
+import javax.sound.midi.Patch;
+import javax.sound.midi.VoiceStatus;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+
+import com.sun.media.sound.AudioSynthesizer;
+import com.sun.media.sound.SF2Instrument;
+import com.sun.media.sound.SF2InstrumentRegion;
+import com.sun.media.sound.SF2Layer;
+import com.sun.media.sound.SF2LayerRegion;
+import com.sun.media.sound.SF2Region;
+import com.sun.media.sound.SF2Sample;
+import com.sun.media.sound.SF2Soundbank;
+import com.sun.media.sound.SoftSynthesizer;
+
+public class NoteOverFlowTest2 {
+
+    public static void main(String[] args) throws Exception
+    {
+        // Create instance of the synthesizer with very low polyphony
+        AudioSynthesizer synth = new SoftSynthesizer();
+        AudioFormat format = new AudioFormat(44100, 16, 2, true, false);
+        Map<String, Object> p = new HashMap<String, Object>();
+        p.put("max polyphony", new Integer(5));
+        AudioInputStream stream = synth.openStream(format, p);
+
+        // Create instrument with too many regions (more than max polyphony)
+        SF2Soundbank sf2 = new SF2Soundbank();
+
+        SF2Sample sample = new SF2Sample(sf2);
+        sample.setName("test sample");
+        sample.setData(new byte[100]);
+        sample.setSampleRate(44100);
+        sample.setOriginalPitch(20);
+        sf2.addResource(sample);
+
+        SF2Layer layer = new SF2Layer(sf2);
+        layer.setName("test layer");
+        sf2.addResource(layer);
+
+        for (int i = 0; i < 100; i++) {
+            SF2LayerRegion region = new SF2LayerRegion();
+            region.setSample(sample);
+            layer.getRegions().add(region);
+        }
+
+        SF2Instrument ins = new SF2Instrument(sf2);
+        ins.setPatch(new Patch(0,0));
+        ins.setName("test instrument");
+        sf2.addInstrument(ins);
+
+        SF2InstrumentRegion insregion = new SF2InstrumentRegion();
+        insregion.setLayer(layer);
+        ins.getRegions().add(insregion);
+
+        // Load the test soundbank into the synthesizer
+        synth.unloadAllInstruments(synth.getDefaultSoundbank());
+        synth.loadAllInstruments(sf2);
+
+        // Send out one midi on message
+        MidiChannel ch1 = synth.getChannels()[0];
+        ch1.programChange(0);
+        ch1.noteOn(64, 64);
+
+        // Read 1 sec from stream
+        stream.skip(format.getFrameSize() * ((int)(format.getFrameRate() * 2)));
+
+        // Close the synthesizer after use
+        synth.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/SoftReceiver/GetMidiDevice.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ @summary Test SoftReceiver getMidiDevice method */
+
+import javax.sound.midi.Receiver;
+
+import com.sun.media.sound.AudioSynthesizer;
+import com.sun.media.sound.SoftReceiver;
+import com.sun.media.sound.SoftSynthesizer;
+
+public class GetMidiDevice {
+
+    public static void main(String[] args) throws Exception {
+
+        AudioSynthesizer synth = new SoftSynthesizer();
+        synth.openStream(null, null);
+        Receiver recv = synth.getReceiver();
+        if (((SoftReceiver) recv).getMidiDevice() != synth) {
+            throw new Exception("SoftReceiver.getMidiDevice() doesn't return "
+                    + "instance of the synthesizer");
+        }
+        synth.close();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sound/midi/Gervill/SoftSynthesizer/TestPreciseTimestampRendering.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * 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.  Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ @summary Test rendering when using precise timestamps */
+
+import java.util.Arrays;
+import java.util.Random;
+
+import javax.sound.midi.MidiChannel;
+import javax.sound.midi.Receiver;
+import javax.sound.midi.ShortMessage;
+import javax.sound.midi.Soundbank;
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+
+import com.sun.media.sound.AudioFloatConverter;
+import com.sun.media.sound.AudioSynthesizer;
+import com.sun.media.sound.ModelAbstractChannelMixer;
+import com.sun.media.sound.ModelChannelMixer;
+import com.sun.media.sound.SF2Instrument;
+import com.sun.media.sound.SF2InstrumentRegion;
+import com.sun.media.sound.SF2Layer;
+import com.sun.media.sound.SF2LayerRegion;
+import com.sun.media.sound.SF2Sample;
+import com.sun.media.sound.SF2Soundbank;
+import com.sun.media.sound.SimpleInstrument;
+import com.sun.media.sound.SimpleSoundbank;
+import com.sun.media.sound.SoftSynthesizer;
+
+public class TestPreciseTimestampRendering {
+
+    public static AudioFormat format = new AudioFormat(44100, 16, 1, true,
+            false);
+
+    public static SF2Soundbank createTestSoundbank() {
+        // Create impulse instrument
+        // used to measure timing of note-on playback
+        SF2Soundbank soundbank = new SF2Soundbank();
+        float[] data = new float[100];
+        Arrays.fill(data, 0);
+        data[0] = 1.0f;
+        byte[] bdata = new byte[data.length * format.getFrameSize()];
+        AudioFloatConverter.getConverter(format).toByteArray(data, bdata);
+
+        SF2Sample sample = new SF2Sample(soundbank);
+        sample.setName("Test Sample");
+        sample.setData(bdata);
+        sample.setSampleRate((long) format.getSampleRate());
+        sample.setOriginalPitch(69);
+        soundbank.addResource(sample);
+
+        SF2Layer layer = new SF2Layer(soundbank);
+        layer.setName("Test Layer");
+        soundbank.addResource(layer);
+        SF2LayerRegion region = new SF2LayerRegion();
+        region.setSample(sample);
+        layer.getRegions().add(region);
+
+        SF2Instrument ins = new SF2Instrument(soundbank);
+        ins.setName("Test Instrument");
+        soundbank.addInstrument(ins);
+        SF2InstrumentRegion insregion = new SF2InstrumentRegion();
+        insregion.setLayer(layer);
+        ins.getRegions().add(insregion);
+
+        return soundbank;
+    }
+
+    public static Soundbank createTestSoundbankWithChannelMixer() {
+        SF2Soundbank soundbank = createTestSoundbank();
+
+        SimpleSoundbank simplesoundbank = new SimpleSoundbank();
+        SimpleInstrument simpleinstrument = new SimpleInstrument() {
+
+            public ModelChannelMixer getChannelMixer(MidiChannel channel,
+                    AudioFormat format) {
+                return new ModelAbstractChannelMixer() {
+                    boolean active = true;
+
+                    public boolean process(float[][] buffer, int offset, int len) {
+                        for (int i = 0; i < buffer.length; i++) {
+                            float[] cbuffer = buffer[i];
+                            for (int j = 0; j < cbuffer.length; j++) {
+                                cbuffer[j] = -cbuffer[j];
+                            }
+                        }
+                        return active;
+                    }
+
+                    public void stop() {
+                        active = false;
+                    }
+                };
+            }
+
+        };
+        simpleinstrument.add(soundbank.getInstruments()[0]);
+        simplesoundbank.addInstrument(simpleinstrument);
+
+        return simplesoundbank;
+    }
+
+    public static void main(String[] args) throws Exception {
+        test(createTestSoundbank());
+        test(createTestSoundbankWithChannelMixer());
+    }
+
+    public static void test(Soundbank soundbank) throws Exception {
+
+        // Create instance of synthesizer using the testing soundbank above
+        AudioSynthesizer synth = new SoftSynthesizer();
+        AudioInputStream stream = synth.openStream(format, null);
+        synth.unloadAllInstruments(synth.getDefaultSoundbank());
+        synth.loadAllInstruments(soundbank);
+        Receiver recv = synth.getReceiver();
+
+        // Set volume to max and turn reverb off
+        ShortMessage reverb_off = new ShortMessage();
+        reverb_off.setMessage(ShortMessage.CONTROL_CHANGE, 91, 0);
+        recv.send(reverb_off, -1);
+        ShortMessage full_volume = new ShortMessage();
+        full_volume.setMessage(ShortMessage.CONTROL_CHANGE, 7, 127);
+        recv.send(full_volume, -1);
+
+        Random random = new Random(3485934583945l);
+
+        // Create random timestamps
+        long[] test_timestamps = new long[30];
+        for (int i = 1; i < test_timestamps.length; i++) {
+            test_timestamps[i] = i * 44100
+                    + (int) (random.nextDouble() * 22050.0);
+        }
+
+        // Send midi note on message to synthesizer
+        for (int i = 0; i < test_timestamps.length; i++) {
+            ShortMessage midi_on = new ShortMessage();
+            midi_on.setMessage(ShortMessage.NOTE_ON, 69, 127);
+            recv.send(midi_on,
+                    (long) ((test_timestamps[i] / 44100.0) * 1000000.0));
+        }
+
+        // Measure timing from rendered audio
+        float[] fbuffer = new float[100];
+        byte[] buffer = new byte[fbuffer.length * format.getFrameSize()];
+        long firsts = -1;
+        int counter = 0;
+        long s = 0;
+        long max_jitter = 0;
+        outerloop: for (int k = 0; k < 10000000; k++) {
+            stream.read(buffer);
+            AudioFloatConverter.getConverter(format).toFloatArray(buffer,
+                    fbuffer);
+            for (int i = 0; i < fbuffer.length; i++) {
+                if (fbuffer[i] != 0) {
+                    if (firsts == -1)
+                        firsts = s;
+
+                    long measure_time = (s - firsts);
+                    long predicted_time = test_timestamps[counter];
+
+                    long jitter = Math.abs(measure_time - predicted_time);
+
+                    if (jitter > 10)
+                        max_jitter = jitter;
+
+                    counter++;
+                    if (counter == test_timestamps.length)
+                        break outerloop;
+                }
+                s++;
+            }
+        }
+        synth.close();
+
+        if (counter == 0)
+            throw new Exception("Nothing was measured!");
+
+        if (max_jitter != 0) {
+            throw new Exception("Jitter has occurred! "
+                    + "(max jitter = " + max_jitter + ")");
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JList/6823603/bug6823603.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6823603
+   @summary Generics: JList
+   @author Florian Brunner
+   @run main bug6823603
+ */
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+import java.util.Enumeration;
+import java.awt.*;
+import javax.swing.*;
+
+public class bug6823603 {
+
+    private static final String TEST_ELEMENT = "Test1";
+
+    /**
+     * @param args the command line arguments
+     */
+    @SuppressWarnings("unchecked")
+    public static void main(String[] args) {
+        testRawSignatures();
+        testGenericSignatures();
+
+        testGetSelectedValuesList(); // new method
+    }
+
+    @SuppressWarnings("unchecked")
+    private static void testRawSignatures() {
+        // Test JList
+        ListModel rawTestModel = new DefaultListModel();
+
+        new JList();
+        new JList(rawTestModel);
+        new JList(new Object[]{TEST_ELEMENT});
+        JList rawTestList = new JList(new Vector());
+        rawTestList.getPrototypeCellValue();
+        rawTestList.setPrototypeCellValue(TEST_ELEMENT);
+        rawTestList.getCellRenderer();
+        rawTestList.setCellRenderer(new DefaultListCellRenderer());
+        rawTestList.getModel();
+        rawTestList.setModel(rawTestModel);
+        rawTestList.setListData(new Object[]{TEST_ELEMENT});
+        rawTestList.setListData(new Vector());
+
+        @SuppressWarnings("deprecation")
+        Object[] selectedValues = rawTestList.getSelectedValues();
+        rawTestList.getSelectedValue();
+
+        // Test ListCellRenderer
+        ListCellRenderer rawTestCellRenderer = new DefaultListCellRenderer();
+        String testEntry = "Test";
+        @SuppressWarnings("unchecked")
+        JList rawJList = new JList(new Object[]{testEntry});
+
+        rawTestCellRenderer.getListCellRendererComponent(rawJList,
+                testEntry, 0, true, true);
+
+        // Test ListModel
+        DefaultListModel testModel = new DefaultListModel();
+        testModel.addElement(TEST_ELEMENT);
+        rawTestModel = testModel;
+        rawTestModel.getElementAt(0);
+
+        // Test DefaultListModel
+        DefaultListModel defaultListModel = new DefaultListModel();
+
+        defaultListModel.addElement(TEST_ELEMENT);
+        defaultListModel.getElementAt(0);
+        defaultListModel.elements();
+        defaultListModel.elementAt(0);
+        defaultListModel.firstElement();
+        defaultListModel.lastElement();
+
+        String testElement2 = "Test2";
+
+        defaultListModel.setElementAt(testElement2, 0);
+        defaultListModel.insertElementAt(TEST_ELEMENT, 0);
+        defaultListModel.get(0);
+        defaultListModel.set(0, testElement2);
+        defaultListModel.add(0, TEST_ELEMENT);
+        defaultListModel.remove(0);
+
+        // Test AbstractListModel
+        @SuppressWarnings("serial")
+        ListModel abstractListModel = new AbstractListModel() {
+            public int getSize() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+
+            public Object getElementAt(int index) {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+        };
+
+        // Test DefaultListCellRenderer
+        DefaultListCellRenderer cellRenderer = new DefaultListCellRenderer();
+
+        @SuppressWarnings("unchecked")
+        JList list = new JList(new Object[]{testEntry});
+
+        cellRenderer.getListCellRendererComponent(rawJList, testEntry, 0, true, true);
+    }
+
+    private static <E> void testGenericSignatures() {
+        // Test JList
+        ListModel<String> stringListModel = new DefaultListModel<String>();
+
+        new JList<String>();
+        new JList<String>(stringListModel);
+        new JList<String>(new String[]{TEST_ELEMENT});
+
+        JList<String> stringTestList = new JList<String>(new Vector<String>());
+
+        stringTestList.getPrototypeCellValue();
+        stringTestList.setPrototypeCellValue(TEST_ELEMENT);
+
+        ListCellRenderer<? super String> cellRenderer = stringTestList.getCellRenderer();
+
+        stringTestList.setCellRenderer(new DefaultListCellRenderer());
+
+        ListModel<String> model = stringTestList.getModel();
+
+        stringTestList.setModel(stringListModel);
+        stringTestList.setListData(new String[]{TEST_ELEMENT});
+        stringTestList.setListData(new Vector<String>());
+
+        @SuppressWarnings("deprecation")
+        Object[] selectedValues = stringTestList.getSelectedValues();
+
+        stringTestList.getSelectedValue();
+
+        // Test ListCellRenderer
+        ListCellRenderer<Object> stringTestCellRenderer =
+                new DefaultListCellRenderer();
+        String testEntry = "Test";
+        JList<String> stringJList = new JList<String>(new String[]{testEntry});
+
+        Component listCellRendererComponent2 =
+                stringTestCellRenderer.getListCellRendererComponent(stringJList,
+                testEntry, 0, true, true);
+
+        // Test ListModel
+        DefaultListModel<String> testModel = new DefaultListModel<String>();
+        testModel.addElement(TEST_ELEMENT);
+        stringListModel = testModel;
+
+        String element1 = stringListModel.getElementAt(0);
+
+        // Test DefaultListModel
+        DefaultListModel<String> stringTestModel = new DefaultListModel<String>();
+
+        stringTestModel.addElement(TEST_ELEMENT);
+        element1 = stringTestModel.getElementAt(0);
+        Enumeration<String> elements = stringTestModel.elements();
+        String element2 = stringTestModel.elementAt(0);
+        String firstElement = stringTestModel.firstElement();
+        String lastElement = stringTestModel.lastElement();
+
+        String testElement2 = "Test2";
+        stringTestModel.setElementAt(testElement2, 0);
+        stringTestModel.insertElementAt(TEST_ELEMENT, 0);
+        String element3 = stringTestModel.get(0);
+        String element4 = stringTestModel.set(0, testElement2);
+        stringTestModel.add(0, TEST_ELEMENT);
+        String removedElement = stringTestModel.remove(0);
+
+        // Test AbstractListModel
+        stringListModel = new AbstractListModel<String>() {
+
+            public int getSize() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+
+            public String getElementAt(int index) {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+        };
+
+        @SuppressWarnings("serial")
+        ListModel<E> genericTestModel = new AbstractListModel<E>() {
+
+            public int getSize() {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+
+            public E getElementAt(int index) {
+                throw new UnsupportedOperationException("Not supported yet.");
+            }
+        };
+
+        // Test DefaultListCellRenderer
+        cellRenderer = new DefaultListCellRenderer();
+
+        stringJList = new JList<String>(new String[]{testEntry});
+
+        listCellRendererComponent2 = cellRenderer.getListCellRendererComponent(stringJList, testEntry, 0, true, true);
+    }
+
+    private static void testGetSelectedValuesList() {
+        Vector<Integer> data = new Vector<Integer>();
+        for (int i = 0; i < 10; i++) {
+            data.add(i);
+        }
+        JList<Integer> list = new JList<Integer>(data);
+        list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
+        list.setSelectedIndices(new int[]{1, 2, 3, 5, 6, 8});
+
+        @SuppressWarnings("deprecation")
+        Object[] expectedSelectedValues = list.getSelectedValues();
+        List<Integer> selectedValuesList = list.getSelectedValuesList();
+        assertEquals(expectedSelectedValues, selectedValuesList.toArray());
+    }
+
+    private static void assertEquals(Object[] expectedArray,
+            Object[] actualArray) {
+        if (!Arrays.equals(expectedArray, actualArray)) {
+            throw new RuntimeException("Expected: " + Arrays.toString(
+                    expectedArray) + " but was: " + Arrays.toString(actualArray));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/Test6888156.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+   @bug 6888156
+   @summary Tests table column of class Icon.class with Synth LAF
+   @author Peter Zhelezniakov
+   @run main Test6888156
+*/
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import javax.swing.*;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableModel;
+
+public class Test6888156 {
+    private JTable table;
+    private Icon ICON = new Icon() {
+        @Override public int getIconWidth() {
+            return 24;
+        }
+
+        @Override public int getIconHeight() {
+            return 24;
+        }
+
+        @Override public void paintIcon(Component c, Graphics g, int w, int h) {
+        }
+    };
+
+    public Test6888156() {
+        TableModel model = new AbstractTableModel() {
+            @Override public int getRowCount() {
+                return 3;
+            }
+
+            @Override public int getColumnCount() {
+                return 2;
+            }
+
+            @Override public Object getValueAt(int rowIndex, int columnIndex) {
+                return (columnIndex == 1 ? ICON : 4);
+            }
+
+            @Override public Class<?> getColumnClass(int columnIndex) {
+                return (columnIndex == 1 ? Icon.class : int.class);
+            }
+        };
+        table = new JTable(model);
+    }
+
+    public void test(final LookAndFeel laf) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override public void run() {
+                try {
+                    UIManager.setLookAndFeel(laf);
+                } catch (UnsupportedLookAndFeelException e) {
+                    System.err.println(laf.getDescription() +
+                                       " is unsupported; continuing");
+                    return;
+                }
+                SwingUtilities.updateComponentTreeUI(table);
+                table.setSize(100, 100);
+                table.paint(
+                        new BufferedImage(100, 100, BufferedImage.OPAQUE).
+                            getGraphics());
+            }
+        });
+    }
+
+    public static void main(String[] args) throws Exception {
+        Test6888156 t = new Test6888156();
+        t.test(new javax.swing.plaf.nimbus.NimbusLookAndFeel());
+        t.test(new com.sun.java.swing.plaf.gtk.GTKLookAndFeel());
+    }
+}
\ No newline at end of file
--- a/jdk/test/sun/management/AgentCheckTest.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/management/AgentCheckTest.java	Wed Jul 05 17:04:26 2017 +0200
@@ -27,9 +27,6 @@
  *  @summary Localize log messages from the management agents
  *
  *  @author Tim Bell
- *
- *  @run compile -source 1.5 -g AgentCheckTest.java
- *  @run main AgentCheckTest
  */
 import sun.management.Agent;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/jgss/spnego/NoSpnegoAsDefMech.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6770883
+ * @summary Infinite loop if SPNEGO specified as sun.security.jgss.mechanism
+ */
+
+import org.ietf.jgss.*;
+import sun.security.jgss.*;
+
+public class NoSpnegoAsDefMech {
+
+    public static void main(String[] argv) throws Exception {
+        System.setProperty("sun.security.jgss.mechanism", GSSUtil.GSS_SPNEGO_MECH_OID.toString());
+        try {
+            GSSManager.getInstance().createName("service@host", GSSName.NT_HOSTBASED_SERVICE, new Oid("1.3.6.1.5.5.2"));
+        } catch (GSSException e) {
+            // This is OK, for example, krb5.conf is missing or other problems
+        }
+    }
+}
--- a/jdk/test/sun/security/krb5/auto/Context.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/security/krb5/auto/Context.java	Wed Jul 05 17:04:26 2017 +0200
@@ -72,7 +72,7 @@
 public class Context {
 
     private Subject s;
-    private GSSContext x;
+    private ExtendedGSSContext x;
     private boolean f;      // context established?
     private String name;
     private GSSCredential cred;     // see static method delegated().
@@ -147,8 +147,8 @@
             @Override
             public byte[] run(Context me, byte[] dummy) throws Exception {
                 GSSManager m = GSSManager.getInstance();
-                me.x = m.createContext(
-                        target.indexOf('@') < 0 ?
+                me.x = (ExtendedGSSContext)m.createContext(
+                          target.indexOf('@') < 0 ?
                             m.createName(target, null) :
                             m.createName(target, GSSName.NT_HOSTBASED_SERVICE),
                         mech,
@@ -170,7 +170,7 @@
             @Override
             public byte[] run(Context me, byte[] dummy) throws Exception {
                 GSSManager m = GSSManager.getInstance();
-                me.x = m.createContext(m.createCredential(
+                me.x = (ExtendedGSSContext)m.createContext(m.createCredential(
                         null,
                         GSSCredential.INDEFINITE_LIFETIME,
                         mech,
@@ -193,7 +193,7 @@
      *
      * @return the GSSContext object
      */
-    public GSSContext x() {
+    public ExtendedGSSContext x() {
         return x;
     }
 
@@ -255,6 +255,11 @@
             if (x.getSequenceDetState()) {
                 sb.append("seq det, ");
             }
+            if (x instanceof ExtendedGSSContext) {
+                if (((ExtendedGSSContext)x).getDelegPolicyState()) {
+                    sb.append("deleg policy, ");
+                }
+            }
             System.out.println("Context status of " + name + ": " + sb.toString());
             System.out.println(x.getSrcName() + " -> " + x.getTargName());
         } catch (Exception e) {
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Wed Jul 05 17:04:26 2017 +0200
@@ -63,6 +63,14 @@
  * settings after calling a KDC method, call <code>Config.refresh()</code> to
  * make sure your changes are reflected in the <code>Config</code> object.
  * </ol>
+ * System properties recognized:
+ * <ul>
+ * <li>test.kdc.save.ccache
+ * </ul>
+ * Support policies:
+ * <ul>
+ * <li>ok-as-delegate
+ * </ul>
  * Issues and TODOs:
  * <ol>
  * <li> Generates krb5.conf to be used on another machine, currently the kdc is
@@ -151,7 +159,7 @@
      * A standalone KDC server.
      */
     public static void main(String[] args) throws Exception {
-        KDC kdc = create("RABBIT.HOLE", "kdc.rabbit,hole", 0, false);
+        KDC kdc = create("RABBIT.HOLE", "kdc.rabbit.hole", 0, false);
         kdc.addPrincipal("dummy", "bogus".toCharArray());
         kdc.addPrincipal("foo", "bar".toCharArray());
         kdc.addPrincipalRandKey("krbtgt/RABBIT.HOLE");
@@ -426,14 +434,17 @@
      * @throws sun.security.krb5.KrbException when the principal is not inside
      *         the database.
      */
-    private char[] getPassword(PrincipalName p) throws KrbException {
+    private char[] getPassword(PrincipalName p, boolean server)
+            throws KrbException {
         String pn = p.toString();
         if (p.getRealmString() == null) {
             pn = pn + "@" + getRealm();
         }
         char[] pass = passwords.get(pn);
         if (pass == null) {
-            throw new KrbException(Krb5.KDC_ERR_C_PRINCIPAL_UNKNOWN);
+            throw new KrbException(server?
+                Krb5.KDC_ERR_S_PRINCIPAL_UNKNOWN:
+                Krb5.KDC_ERR_C_PRINCIPAL_UNKNOWN);
         }
         return pass;
     }
@@ -457,10 +468,12 @@
      * Returns the key for a given principal of the given encryption type
      * @param p the principal
      * @param etype the encryption type
+     * @param server looking for a server principal?
      * @return the key
      * @throws sun.security.krb5.KrbException for unknown/unsupported etype
      */
-    private EncryptionKey keyForUser(PrincipalName p, int etype) throws KrbException {
+    private EncryptionKey keyForUser(PrincipalName p, int etype, boolean server)
+            throws KrbException {
         try {
             // Do not call EncryptionKey.acquireSecretKeys(), otherwise
             // the krb5.conf config file would be loaded.
@@ -469,22 +482,71 @@
             Integer kvno = null;
             // For service whose password ending with a number, use it as kvno
             if (p.toString().indexOf('/') >= 0) {
-                char[] pass = getPassword(p);
+                char[] pass = getPassword(p, server);
                 if (Character.isDigit(pass[pass.length-1])) {
                     kvno = pass[pass.length-1] - '0';
                 }
             }
             return new EncryptionKey((byte[]) stringToKey.invoke(
-                    null, getPassword(p), getSalt(p), null, etype),
+                    null, getPassword(p, server), getSalt(p), null, etype),
                     etype, kvno);
         } catch (InvocationTargetException ex) {
             KrbException ke = (KrbException)ex.getCause();
             throw ke;
+        } catch (KrbException ke) {
+            throw ke;
         } catch (Exception e) {
             throw new RuntimeException(e);  // should not happen
         }
     }
 
+    private Map<String,String> policies = new HashMap<String,String>();
+
+    public void setPolicy(String rule, String value) {
+        if (value == null) {
+            policies.remove(rule);
+        } else {
+            policies.put(rule, value);
+        }
+    }
+    /**
+     * If the provided client/server pair matches a rule
+     *
+     * A system property named test.kdc.policy.RULE will be consulted.
+     * If it's unset, returns false. If its value is "", any pair is
+     * matched. Otherwise, it should contains the server name matched.
+     *
+     * TODO: client name is not used currently.
+     *
+     * @param c client name
+     * @param s server name
+     * @param rule rule name
+     * @return if a match is found
+     */
+    private boolean configMatch(String c, String s, String rule) {
+        String policy = policies.get(rule);
+        boolean result = false;
+        if (policy == null) {
+            result = false;
+        } else if (policy.length() == 0) {
+            result = true;
+        } else {
+            String[] names = policy.split("\\s+");
+            for (String name: names) {
+                if (name.equals(s)) {
+                    result = true;
+                    break;
+                }
+            }
+        }
+        if (result) {
+            System.out.printf(">>>> Policy match result (%s vs %s on %s) %b\n",
+                    c, s, rule, result);
+        }
+        return result;
+    }
+
+
     /**
      * Processes an incoming request and generates a response.
      * @param in the request
@@ -530,7 +592,7 @@
                         tkt = apReq.ticket;
                         etype = tkt.encPart.getEType();
                         tkt.sname.setRealm(tkt.realm);
-                        EncryptionKey kkey = keyForUser(tkt.sname, etype);
+                        EncryptionKey kkey = keyForUser(tkt.sname, etype, true);
                         byte[] bb = tkt.encPart.decrypt(kkey, KeyUsage.KU_TICKET);
                         DerInputStream derIn = new DerInputStream(bb);
                         DerValue der = derIn.getDerValue();
@@ -541,7 +603,7 @@
                     throw new KrbException(Krb5.KDC_ERR_PADATA_TYPE_NOSUPP);
                 }
             }
-            EncryptionKey skey = keyForUser(body.sname, etype);
+            EncryptionKey skey = keyForUser(body.sname, etype, true);
             if (skey == null) {
                 throw new KrbException(Krb5.KDC_ERR_SUMTYPE_NOSUPP); // TODO
             }
@@ -581,6 +643,10 @@
             if (body.kdcOptions.get(KDCOptions.ALLOW_POSTDATE)) {
                 bFlags[Krb5.TKT_OPTS_MAY_POSTDATE] = true;
             }
+
+            if (configMatch("", body.sname.getNameString(), "ok-as-delegate")) {
+                bFlags[Krb5.TKT_OPTS_DELEGATE] = true;
+            }
             bFlags[Krb5.TKT_OPTS_INITIAL] = true;
 
             TicketFlags tFlags = new TicketFlags(bFlags);
@@ -671,8 +737,8 @@
             eTypes = (int[])f.get(body);
             int eType = eTypes[0];
 
-            EncryptionKey ckey = keyForUser(body.cname, eType);
-            EncryptionKey skey = keyForUser(body.sname, eType);
+            EncryptionKey ckey = keyForUser(body.cname, eType, false);
+            EncryptionKey skey = keyForUser(body.sname, eType, true);
             if (ckey == null) {
                 throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
             }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/OkAsDelegate.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import com.sun.security.jgss.ExtendedGSSContext;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSException;
+import org.ietf.jgss.Oid;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+
+public class OkAsDelegate {
+
+    public static void main(String[] args)
+            throws Exception {
+        OkAsDelegate ok = new OkAsDelegate();
+        ok.go(
+                Boolean.valueOf(args[0]),   // FORWARDABLE in krb5.conf on?
+                Boolean.valueOf(args[1]),   // requestDelegState
+                Boolean.valueOf(args[2]),   // requestDelegPolicyState
+                Boolean.valueOf(args[3]),   // DelegState in response
+                Boolean.valueOf(args[4]),   // DelegPolicyState in response
+                Boolean.valueOf(args[5])    // getDelegCred OK?
+                );
+    }
+
+    void go(
+            boolean forwardable,
+            boolean requestDelegState,
+            boolean requestDelegPolicyState,
+            boolean delegState,
+            boolean delegPolicyState,
+            boolean delegated
+            ) throws Exception {
+        OneKDC kdc = new OneKDC(null);
+        kdc.setPolicy("ok-as-delegate",
+                System.getProperty("test.kdc.policy.ok-as-delegate"));
+        kdc.writeJAASConf();
+        if (!forwardable) {
+            // The default OneKDC always includes "forwardable = true"
+            // in krb5.conf, override it.
+            KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
+                    "default_keytab_name = " + OneKDC.KTAB);
+            Config.refresh();
+        }
+
+        Context c, s;
+        c = Context.fromJAAS("client");
+        s = Context.fromJAAS("server");
+
+        Oid mech = GSSUtil.GSS_KRB5_MECH_OID;
+        if (System.getProperty("test.spnego") != null) {
+            mech = GSSUtil.GSS_SPNEGO_MECH_OID;
+        }
+        c.startAsClient(OneKDC.SERVER, mech);
+        ExtendedGSSContext cx = (ExtendedGSSContext)c.x();
+        cx.requestCredDeleg(requestDelegState);
+        cx.requestDelegPolicy(requestDelegPolicyState);
+        s.startAsServer(mech);
+        ExtendedGSSContext sx = (ExtendedGSSContext)s.x();
+
+        Context.handshake(c, s);
+
+        if (cx.getCredDelegState() != delegState) {
+            throw new Exception("Initiator cred state error");
+        }
+        if (sx.getCredDelegState() != delegState) {
+            throw new Exception("Acceptor cred state error");
+        }
+        if (cx.getDelegPolicyState() != delegPolicyState) {
+            throw new Exception("Initiator cred policy state error");
+        }
+
+        GSSCredential cred = null;
+        try {
+            cred = s.x().getDelegCred();
+        } catch (GSSException e) {
+            // leave cred as null
+        }
+
+        if (delegated != (cred != null)) {
+            throw new Exception("get cred error");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/OkAsDelegateXRealm.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,156 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import com.sun.security.jgss.ExtendedGSSContext;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.security.Security;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import org.ietf.jgss.GSSContext;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSException;
+import org.ietf.jgss.GSSManager;
+import org.ietf.jgss.GSSName;
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+
+public class OkAsDelegateXRealm implements CallbackHandler {
+
+    /**
+     * @param args boolean if the program should succeed
+     */
+    public static void main(String[] args)
+            throws Exception {
+
+        // Create and start the KDCs. Here we have 3 realms: R1, R2 and R3.
+        // R1 is trusted by R2, and R2 trusted by R3.
+        KDC kdc1 = KDC.create("R1");
+        kdc1.setPolicy("ok-as-delegate",
+                System.getProperty("test.kdc.policy.ok-as-delegate"));
+        kdc1.addPrincipal("dummy", "bogus".toCharArray());
+        kdc1.addPrincipalRandKey("krbtgt/R1");
+        kdc1.addPrincipal("krbtgt/R2@R1", "r1->r2".toCharArray());
+
+        KDC kdc2 = KDC.create("R2");
+        kdc2.setPolicy("ok-as-delegate",
+                System.getProperty("test.kdc.policy.ok-as-delegate"));
+        kdc2.addPrincipalRandKey("krbtgt/R2");
+        kdc2.addPrincipal("krbtgt/R2@R1", "r1->r2".toCharArray());
+        kdc2.addPrincipal("krbtgt/R3@R2", "r2->r3".toCharArray());
+
+        KDC kdc3 = KDC.create("R3");
+        kdc3.setPolicy("ok-as-delegate",
+                System.getProperty("test.kdc.policy.ok-as-delegate"));
+        kdc3.addPrincipalRandKey("krbtgt/R3");
+        kdc3.addPrincipal("krbtgt/R3@R2", "r2->r3".toCharArray());
+        kdc3.addPrincipalRandKey("host/host.r3.local");
+
+        KDC.saveConfig("krb5-localkdc.conf", kdc1, kdc2, kdc3,
+                "forwardable=true",
+                "[capaths]",
+                "R1 = {",
+                "    R2 = .",
+                "    R3 = R2",
+                "}",
+                "[domain_realm]",
+                ".r3.local=R3"
+                );
+
+        System.setProperty("java.security.krb5.conf", "krb5-localkdc.conf");
+        kdc3.writeKtab("localkdc.ktab");
+
+        FileOutputStream fos = new FileOutputStream("jaas-localkdc.conf");
+
+        // Defines the client and server on R1 and R3 respectively.
+        fos.write(("com.sun.security.jgss.krb5.initiate {\n" +
+                "    com.sun.security.auth.module.Krb5LoginModule\n" +
+                "    required\n" +
+                "    principal=dummy\n" +
+                "    doNotPrompt=false\n" +
+                "    useTicketCache=false\n" +
+                "    ;\n};\n" +
+                "com.sun.security.jgss.krb5.accept {\n" +
+                "    com.sun.security.auth.module.Krb5LoginModule required\n" +
+                "    principal=\"host/host.r3.local@R3\"\n" +
+                "    useKeyTab=true\n" +
+                "    keyTab=localkdc.ktab\n" +
+                "    isInitiator=false\n" +
+                "    storeKey=true;\n};\n" +
+                "\n").getBytes());
+        fos.close();
+
+        Security.setProperty("auth.login.defaultCallbackHandler",
+                "OkAsDelegateXRealm");
+
+        System.setProperty("java.security.auth.login.config", "jaas-localkdc.conf");
+
+        new File("krb5-localkdc.conf").deleteOnExit();
+        new File("localkdc.ktab").deleteOnExit();
+        new File("jaas-localkdc.conf").deleteOnExit();
+        Config.refresh();
+
+        Context c = Context.fromJAAS("com.sun.security.jgss.krb5.initiate");
+        Context s = Context.fromJAAS("com.sun.security.jgss.krb5.accept");
+
+        // Test twice. The frist time the whole cross realm process is tried,
+        // the second time the cached service ticket is used. This is to make sure
+        // the behaviors are the same, especailly for the case when one of the
+        // cross-realm TGTs does not have OK-AS-DELEGATE on.
+
+        for (int i=0; i<2; i++) {
+            c.startAsClient("host@host.r3.local", GSSUtil.GSS_KRB5_MECH_OID);
+            s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
+            c.x().requestDelegPolicy(true);
+
+            Context.handshake(c, s);
+            boolean succeed = true;
+            try {
+                s.x().getDelegCred();
+            } catch (GSSException gsse) {
+                succeed = false;
+            }
+            if (succeed != Boolean.parseBoolean(args[0])) {
+                throw new Exception("Test fail at round #" + i);
+            }
+        }
+    }
+
+    @Override
+    public void handle(Callback[] callbacks)
+            throws IOException, UnsupportedCallbackException {
+        for (Callback callback : callbacks) {
+            if (callback instanceof NameCallback) {
+                ((NameCallback) callback).setName("dummy");
+            }
+            if (callback instanceof PasswordCallback) {
+                ((PasswordCallback) callback).setPassword("bogus".toCharArray());
+            }
+        }
+    }
+}
+
--- a/jdk/test/sun/security/krb5/auto/SSL.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/security/krb5/auto/SSL.java	Wed Jul 05 17:04:26 2017 +0200
@@ -36,33 +36,32 @@
 public class SSL {
 
     private static final String KRB5_CIPHER = "TLS_KRB5_WITH_3DES_EDE_CBC_SHA";
-    private static final int PORT = 4569;
     private static final int LOOP_LIMIT = 1;
     private static final char[] PASS = "secret".toCharArray();
     private static int loopCount = 0;
-
-    private static String SERVER;
+    private static volatile String server;
+    private static volatile int port;
 
     public static void main(String[] args) throws Exception {
 
         KDC kdc = KDC.create(OneKDC.REALM);
         // Run this after KDC, so our own DNS service can be started
         try {
-            SERVER = InetAddress.getLocalHost().getHostName();
+            server = InetAddress.getLocalHost().getHostName().toLowerCase();
         } catch (java.net.UnknownHostException e) {
-            SERVER = "localhost";
+            server = "localhost";
         }
 
         kdc.addPrincipal(OneKDC.USER, OneKDC.PASS);
         kdc.addPrincipalRandKey("krbtgt/" + OneKDC.REALM);
-        kdc.addPrincipal("host/" + SERVER, PASS);
+        kdc.addPrincipal("host/" + server, PASS);
         KDC.saveConfig(OneKDC.KRB5_CONF, kdc);
         System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF);
 
         final Context c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false);
-        final Context s = Context.fromUserPass("host/" + SERVER, PASS, true);
+        final Context s = Context.fromUserPass("host/" + server, PASS, true);
 
-        c.startAsClient("host/" + SERVER, GSSUtil.GSS_KRB5_MECH_OID);
+        c.startAsClient("host/" + server, GSSUtil.GSS_KRB5_MECH_OID);
         s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID);
 
         new Thread(new Runnable() {
@@ -87,7 +86,7 @@
         public byte[] run(Context s, byte[] input) throws Exception {
             SSLSocketFactory sslsf =
                 (SSLSocketFactory) SSLSocketFactory.getDefault();
-            SSLSocket sslSocket = (SSLSocket) sslsf.createSocket(SERVER, PORT);
+            SSLSocket sslSocket = (SSLSocket) sslsf.createSocket(server, port);
 
             // Enable only a KRB5 cipher suite.
             String enabledSuites[] = {KRB5_CIPHER};
@@ -124,7 +123,8 @@
             SSLServerSocketFactory sslssf =
                 (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
             SSLServerSocket sslServerSocket =
-                (SSLServerSocket) sslssf.createServerSocket(PORT);
+                (SSLServerSocket) sslssf.createServerSocket(0); // any port
+            port = sslServerSocket.getLocalPort();
 
             // Enable only a KRB5 cipher suite.
             String enabledSuites[] = {KRB5_CIPHER};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ok-as-delegate-xrealm.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,79 @@
+#
+# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+# @test
+# @bug 6853328
+# @summary Support OK-AS-DELEGATE flag
+# @run shell/timeout=600 ok-as-delegate-xrealm.sh
+#
+
+if [ "${TESTSRC}" = "" ] ; then
+  TESTSRC=`dirname $0`
+fi
+
+if [ "${TESTJAVA}" = "" ] ; then
+  JAVAC_CMD=`which javac`
+  TESTJAVA=`dirname $JAVAC_CMD`/..
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  Windows_* )
+    FS="\\"
+    SEP=";"
+    ;;
+  CYGWIN* )
+    FS="/"
+    SEP=";"
+    ;;
+  * )
+    FS="/"
+    SEP=":"
+    ;;
+esac
+
+${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . \
+    ${TESTSRC}${FS}OkAsDelegateXRealm.java \
+    ${TESTSRC}${FS}KDC.java \
+    ${TESTSRC}${FS}OneKDC.java \
+    ${TESTSRC}${FS}Action.java \
+    ${TESTSRC}${FS}Context.java \
+    || exit 10
+
+# Add $TESTSRC to classpath so that customized nameservice can be used
+J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}."
+
+# KDC no OK-AS-DELEGATE, fail
+$J OkAsDelegateXRealm false || exit 1
+
+# KDC set OK-AS-DELEGATE for all, succeed
+$J -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true || exit 2
+
+# KDC set OK-AS-DELEGATE for host/host.r3.local only, fail
+$J -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local OkAsDelegateXRealm false || exit 3
+
+# KDC set OK-AS-DELEGATE for all, succeed
+$J "-Dtest.kdc.policy.ok-as-delegate=host/host.r3.local krbtgt/R2 krbtgt/R3" OkAsDelegateXRealm true || exit 4
+
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/ok-as-delegate.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,118 @@
+#
+# Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+# CA 95054 USA or visit www.sun.com if you need additional information or
+# have any questions.
+#
+
+# @test
+# @bug 6853328
+# @summary Support OK-AS-DELEGATE flag
+# @run shell/timeout=600 ok-as-delegate.sh
+#
+
+if [ "${TESTSRC}" = "" ] ; then
+  TESTSRC=`dirname $0`
+fi
+
+if [ "${TESTJAVA}" = "" ] ; then
+  JAVAC_CMD=`which javac`
+  TESTJAVA=`dirname $JAVAC_CMD`/..
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+  Windows_* )
+    FS="\\"
+    SEP=";"
+    ;;
+  CYGWIN* )
+    FS="/"
+    SEP=";"
+    ;;
+  * )
+    FS="/"
+    SEP=":"
+    ;;
+esac
+
+${TESTJAVA}${FS}bin${FS}javac -XDignore.symbol.file -d . \
+    ${TESTSRC}${FS}OkAsDelegate.java \
+    ${TESTSRC}${FS}KDC.java \
+    ${TESTSRC}${FS}OneKDC.java \
+    ${TESTSRC}${FS}Action.java \
+    ${TESTSRC}${FS}Context.java \
+    || exit 10
+
+# Testing Kerberos 5
+
+# Add $TESTSRC to classpath so that customized nameservice can be used
+J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. OkAsDelegate"
+JOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
+
+# FORWARDABLE ticket not allowed, always fail
+$J false true true false false false || exit 1
+
+# Service ticket no OK-AS-DELEGATE
+
+# Request nothing, gain nothing
+$J true false false false false false || exit 2
+# Request deleg policy, gain nothing
+$J true false true false false false || exit 3
+# Request deleg, granted
+$J true true false true false true || exit 4
+# Request deleg and deleg policy, granted, with info not by policy
+$J true true true true false true || exit 5
+
+# Service ticket has OK-AS-DELEGATE
+
+# Request deleg policy, granted
+$JOK true false true true true true || exit 6
+# Request deleg and deleg policy, granted, with info by policy
+$JOK true true true true true true || exit 7
+
+# Testing SPNEGO
+
+# Add $TESTSRC to classpath so that customized nameservice can be used
+J="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego OkAsDelegate"
+JOK="${TESTJAVA}${FS}bin${FS}java -cp $TESTSRC${SEP}. -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate"
+
+# FORWARDABLE ticket not allowed, always fail
+$J false true true false false false || exit 11
+
+# Service ticket no OK-AS-DELEGATE
+
+# Request nothing, gain nothing
+$J true false false false false false || exit 12
+# Request deleg policy, gain nothing
+$J true false true false false false || exit 13
+# Request deleg, granted
+$J true true false true false true || exit 14
+# Request deleg and deleg policy, granted, with info not by policy
+$J true true true true false true || exit 15
+
+# Service ticket has OK-AS-DELEGATE
+
+# Request deleg policy, granted
+$JOK true false true true true true || exit 16
+# Request deleg and deleg policy, granted, with info by policy
+$JOK true true true true true true || exit 17
+
+exit 0
--- a/jdk/test/sun/security/util/Oid/S11N.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/security/util/Oid/S11N.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -99,7 +99,7 @@
 
 # the test code
 
-${TESTJAVA}${FS}bin${FS}javac -source 1.3 -target 1.3 -d . ${TESTSRC}${FS}SerialTest.java || exit 10
+${TESTJAVA}${FS}bin${FS}javac -d . ${TESTSRC}${FS}SerialTest.java || exit 10
 
 OLDJAVA="
     /java/re/j2se/1.6.0/latest/binaries/${PF}
--- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh	Wed Jul 05 17:04:26 2017 +0200
@@ -98,7 +98,7 @@
 set -vx
 #
 #Compile.  jconsole.jar is required on the classpath.
-${TESTJAVA}/bin/javac -source 1.5 -d "${TESTCLASSES}" ${CP} -g \
+${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
                          "${TESTSRC}"/"${TARGETCLASS}".java
 #
 #Run the test class, again with the classpath we need:
--- a/jdk/test/sun/tools/jhat/HatRun.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/tools/jhat/HatRun.java	Wed Jul 05 17:04:26 2017 +0200
@@ -186,11 +186,13 @@
          */
         int nvm_options = 0;
         if ( vm_options != null ) nvm_options = vm_options.length;
-        String cmd[]     = new String[1 + (d64?1:0) + 5 + nvm_options];
+        String cmd[]     = new String[1 + (d64?1:0) + 7 + nvm_options];
         int i,j;
 
         i = 0;
         cmd[i++] = java;
+        cmd[i++] = "-cp";
+        cmd[i++] = cdir;
         cmd[i++] = "-Dtest.classes=" + cdir;
         if ( d64 ) {
             cmd[i++] = "-d64";
--- a/jdk/test/sun/tools/native2ascii/NativeErrors.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/sun/tools/native2ascii/NativeErrors.java	Wed Jul 05 17:04:26 2017 +0200
@@ -59,15 +59,28 @@
         in = new BufferedReader(new InputStreamReader(p.getInputStream()));
         checkResult(in, "err.bad.arg");
 
-        command = getComString("test123");
+        File f0 = new File(System.getProperty("test.src", "."), "test123");
+        String path0 = f0.getPath();
+        if ( f0.exists() ) {
+            throw new Error("Input file should not exist: " + path0);
+        }
+
+        command = getComString(path0);
         p = Runtime.getRuntime().exec(command);
         in = new BufferedReader(new InputStreamReader(p.getInputStream()));
         checkResult(in, "err.cannot.read");
 
         File f1 = new File(System.getProperty("test.src", "."), "test1");
-        File f2 = new File(System.getProperty("test.src", "."), "test2");
+        File f2 = File.createTempFile("test2", ".tmp");
         String path1 = f1.getPath();
         String path2 = f2.getPath();
+        if ( !f1.exists() ) {
+            throw new Error("Missing input file: " + path1);
+        }
+        if ( !f2.setWritable(false) ) {
+            throw new Error("Output file cannot be made read only: " + path2);
+        }
+        f2.deleteOnExit();
 
         command = getComString(path1, path2);
         p = Runtime.getRuntime().exec(command);
@@ -80,7 +93,9 @@
                                                            throws Exception {
         String errorReceived;
         errorReceived = in.readLine();
+        assert errorReceived != null : "First readline cannot be null";
         errorExpected = rsrc.getString(errorExpected);
+        assert errorExpected != null : "Expected message cannot be null";
         StringBuffer error = new StringBuffer(errorExpected);
         int start = errorExpected.indexOf("{0}");
         if (start >= 0) {
@@ -128,6 +143,7 @@
             f = new File(path);
             if (!f.exists())
                 throw new RuntimeException("Cannot find native2ascii at "+path);
+            System.out.println("Using native2ascii at "+path);
         }
         return path;
     }
--- a/jdk/test/sun/tools/native2ascii/test2	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-This file exists as a non-writable placeholder for NativeErrors.java
--- a/jdk/test/tools/launcher/Arrrghs.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/tools/launcher/Arrrghs.java	Wed Jul 05 17:04:26 2017 +0200
@@ -25,7 +25,7 @@
  * @test
  * @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881
  * @summary Argument parsing validation.
- * @compile Arrrghs.java TestHelper.java
+ * @compile -XDignore.symbol.file Arrrghs.java TestHelper.java
  * @run main Arrrghs
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/ExecutionEnvironment.java	Wed Jul 05 17:04:26 2017 +0200
@@ -0,0 +1,358 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4780570 4731671 6354700 6367077 6670965 4882974
+ * @summary Checks for LD_LIBRARY_PATH and execution  on *nixes
+ * @compile -XDignore.symbol.file ExecutionEnvironment.java TestHelper.java
+ * @run main ExecutionEnvironment
+ */
+
+/*
+ * This test tests for various things as follows:
+ * Ensures that:
+ *   1. uneccessary execs do not occur
+ *   2. the environment is pristine,  users environment variable wrt.
+ *      LD_LIBRARY_PATH if set are not modified in any way.
+ *   3. the correct vm is chosen with -server and -client options
+ *   4. the VM on Solaris correctly interprets the LD_LIBRARY_PATH32
+ *      and LD_LIBRARY_PATH64 variables if set by the user, ie.
+ *      i. on 32 bit systems:
+ *         a. if LD_LIBRARY_PATH32 is set it will override LD_LIBRARY_PATH
+ *         b. LD_LIBRARY_PATH64 is ignored if set
+ *      ii. on 64 bit systems:
+ *            a. if LD_LIBRARY_PATH64 is set it will override LD_LIBRARY_PATH
+ *            b. LD_LIBRARY_PATH32 is ignored if set
+ *   5. no extra symlink exists on Solaris ie.
+ *      jre/lib/$arch/libjvm.so -> client/libjvm.so
+ * TODO:
+ *      a. perhaps we need to add a test to audit all environment variables are
+ *         in pristine condition after the launch, there may be a few that the
+ *         launcher may add as implementation details.
+ *      b. add a pldd for solaris to ensure only one libjvm.so is linked
+ */
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+public class ExecutionEnvironment {
+    static final String LD_LIBRARY_PATH    = "LD_LIBRARY_PATH";
+    static final String LD_LIBRARY_PATH_32 = LD_LIBRARY_PATH + "_32";
+    static final String LD_LIBRARY_PATH_64 = LD_LIBRARY_PATH + "_64";
+
+    // Note: these paths need not exist on the filesytem
+    static final String LD_LIBRARY_PATH_VALUE    = "/Bridge/On/The/River/Kwai";
+    static final String LD_LIBRARY_PATH_32_VALUE = "/Lawrence/Of/Arabia";
+    static final String LD_LIBRARY_PATH_64_VALUE = "/A/Passage/To/India";
+
+    static final String JLDEBUG_KEY = "_JAVA_LAUNCHER_DEBUG";
+    static final String EXPECTED_MARKER = "TRACER_MARKER:About to EXEC";
+
+    static final String[] LD_PATH_STRINGS = {
+        LD_LIBRARY_PATH + "=" + LD_LIBRARY_PATH_VALUE,
+        LD_LIBRARY_PATH_32 + "=" + LD_LIBRARY_PATH_32_VALUE,
+        LD_LIBRARY_PATH_64 + "=" + LD_LIBRARY_PATH_64_VALUE
+    };
+
+    static final File testJarFile = new File("EcoFriendly.jar");
+
+    static int errors = 0;
+    static int passes = 0;
+
+    private static void createTestJar() {
+        try {
+            List<String> codeList = new ArrayList<String>();
+            codeList.add("static void printValue(String name, boolean property) {\n");
+            codeList.add("    String value = (property) ? System.getProperty(name) : System.getenv(name);\n");
+            codeList.add("    System.out.println(name + \"=\" + value);\n");
+            codeList.add("}\n");
+            codeList.add("public static void main(String... args) {\n");
+            codeList.add("    System.out.println(\"Execute test:\");\n");
+            codeList.add("    printValue(\"os.name\", true);\n");
+            codeList.add("    printValue(\"os.arch\", true);\n");
+            codeList.add("    printValue(\"os.version\", true);\n");
+            codeList.add("    printValue(\"sun.arch.data.model\", true);\n");
+            codeList.add("    printValue(\"java.library.path\", true);\n");
+            codeList.add("    printValue(\"" + LD_LIBRARY_PATH + "\", false);\n");
+            codeList.add("    printValue(\"" + LD_LIBRARY_PATH_32 + "\", false);\n");
+            codeList.add("    printValue(\"" + LD_LIBRARY_PATH_64 + "\", false);\n");
+            codeList.add("}\n");
+            String[] clist = new String[codeList.size()];
+            TestHelper.createJar(testJarFile, codeList.toArray(clist));
+        } catch (FileNotFoundException fnfe) {
+            throw new RuntimeException(fnfe);
+        }
+    }
+
+    /*
+     * tests if the launcher pollutes the LD_LIBRARY_PATH variables ie. there
+     * should not be any new variables or pollution/mutations of any kind, the
+     * environment should be pristine.
+     */
+    private static void ensureEcoFriendly() {
+        TestHelper.TestResult tr = null;
+
+        Map<String, String> env = new HashMap<String, String>();
+        for (String x : LD_PATH_STRINGS) {
+            String pairs[] = x.split("=");
+            env.put(pairs[0], pairs[1]);
+        }
+
+        tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
+                testJarFile.getAbsolutePath());
+
+        if (!tr.isNotZeroOutput()) {
+            throw new RuntimeException("Error: No output at all. Did the test execute ?");
+        }
+
+        for (String x : LD_PATH_STRINGS) {
+            if (!tr.contains(x)) {
+                System.out.println("FAIL: did not get <" + x + ">");
+                System.out.println(tr);
+                errors++;
+            } else {
+                passes++;
+            }
+        }
+    }
+
+    /*
+     * ensures that there are no execs as long as we are in the same
+     * data model
+     */
+    static void ensureNoExec() {
+        Map<String, String> env = new HashMap<String, String>();
+        env.put(JLDEBUG_KEY, "true");
+        TestHelper.TestResult tr =
+                TestHelper.doExec(env, TestHelper.javaCmd, "-version");
+        if (tr.testOutput.contains(EXPECTED_MARKER)) {
+            System.out.println("FAIL: EnsureNoExecs: found expected warning <" +
+                    EXPECTED_MARKER +
+                    "> the process execing ?");
+            errors++;
+        } else {
+            passes++;
+        }
+        return;
+    }
+
+    /*
+     * This test ensures that LD_LIBRARY_PATH* values are interpreted by the VM
+     * and the expected java.library.path behaviour.
+     * For Generic platforms (All *nixes):
+     *    * All LD_LIBRARY_PATH variable should be on java.library.path
+     * For Solaris 32-bit
+     *    * The LD_LIBRARY_PATH_32 should override LD_LIBRARY_PATH if specified
+     * For Solaris 64-bit
+     *    * The LD_LIBRARY_PATH_64 should override LD_LIBRARY_PATH if specified
+     */
+
+    static void verifyJavaLibraryPath() {
+        TestHelper.TestResult tr = null;
+
+        Map<String, String> env = new HashMap<String, String>();
+
+
+        if (TestHelper.isLinux) {
+            for (String x : LD_PATH_STRINGS) {
+                String pairs[] = x.split("=");
+                env.put(pairs[0], pairs[1]);
+            }
+
+            tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
+                    testJarFile.getAbsolutePath());
+            verifyJavaLibraryPathGeneric(tr);
+        } else {
+            // no override
+            env.clear();
+            env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
+            tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
+                    testJarFile.getAbsolutePath());
+            verifyJavaLibraryPathGeneric(tr);
+
+            env.clear();
+            for (String x : LD_PATH_STRINGS) {
+                String pairs[] = x.split("=");
+                env.put(pairs[0], pairs[1]);
+            }
+
+            // verify the override occurs, since we know the invocation always
+            // uses by default is 32-bit, therefore we also set the test
+            // expectation to be the same.
+            tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
+                    testJarFile.getAbsolutePath());
+            verifyJavaLibraryPathOverride(tr, true);
+
+            // try changing the model from 32 to 64 bit
+            if (TestHelper.java64Cmd != null && TestHelper.is32Bit) {
+                // verify the override occurs
+                env.clear();
+                for (String x : LD_PATH_STRINGS) {
+                    String pairs[] = x.split("=");
+                    env.put(pairs[0], pairs[1]);
+                }
+                tr = TestHelper.doExec(env, TestHelper.javaCmd, "-d64", "-jar",
+                    testJarFile.getAbsolutePath());
+                verifyJavaLibraryPathOverride(tr, false);
+
+                // no override
+                env.clear();
+                env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
+                tr = TestHelper.doExec(env, TestHelper.javaCmd, "-jar",
+                        testJarFile.getAbsolutePath());
+                verifyJavaLibraryPathGeneric(tr);
+            }
+
+            // try changing the model from 64 to 32 bit
+            if (TestHelper.java64Cmd != null && TestHelper.is64Bit) {
+                // verify the override occurs
+                env.clear();
+                for (String x : LD_PATH_STRINGS) {
+                    String pairs[] = x.split("=");
+                    env.put(pairs[0], pairs[1]);
+                }
+                tr = TestHelper.doExec(env, TestHelper.java64Cmd, "-d32", "-jar",
+                    testJarFile.getAbsolutePath());
+                verifyJavaLibraryPathOverride(tr, true);
+
+                // no override
+                env.clear();
+                env.put(LD_LIBRARY_PATH, LD_LIBRARY_PATH_VALUE);
+                tr = TestHelper.doExec(env, TestHelper.java64Cmd, "-d32", "-jar",
+                        testJarFile.getAbsolutePath());
+                verifyJavaLibraryPathGeneric(tr);
+            }
+        }
+    }
+
+    private static void verifyJavaLibraryPathGeneric(TestHelper.TestResult tr) {
+        if (!tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
+            System.out.print("FAIL: verifyJavaLibraryPath: ");
+            System.out.println(" java.library.path does not contain " +
+                    LD_LIBRARY_PATH_VALUE);
+            System.out.println(tr);
+            errors++;
+        } else {
+            passes++;
+        }
+    }
+
+    private static void verifyJavaLibraryPathOverride(TestHelper.TestResult tr,
+            boolean is32Bit) {
+        // make sure the 32/64 bit value exists
+        if (!tr.matches("java.library.path=.*" +
+                (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE) + ".*")) {
+            System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
+            System.out.println(" java.library.path does not contain " +
+                    (is32Bit ? LD_LIBRARY_PATH_32_VALUE : LD_LIBRARY_PATH_64_VALUE));
+            System.out.println(tr);
+            errors++;
+        } else {
+            passes++;
+        }
+        // make sure the generic value is absent
+        if (tr.matches("java.library.path=.*" + LD_LIBRARY_PATH_VALUE + ".*")) {
+            System.out.print("FAIL: verifyJavaLibraryPathOverride: ");
+            System.out.println(" java.library.path contains " +
+                    LD_LIBRARY_PATH_VALUE);
+            System.out.println(tr);
+            errors++;
+        } else {
+            passes++;
+        }
+    }
+
+    /*
+     * ensures we have indeed exec'ed the correct vm of choice, all VMs support
+     * -server, however 32-bit VMs support -client and -server.
+     */
+    static void verifyVmSelection() {
+
+        TestHelper.TestResult tr = null;
+
+        if (TestHelper.is32Bit) {
+            tr = TestHelper.doExec(TestHelper.javaCmd, "-client", "-version");
+            if (!tr.matches("Java.*Client VM.*")) {
+                System.out.println("FAIL: the expected vm -client did launch");
+                System.out.println(tr);
+                errors++;
+            } else {
+                passes++;
+            }
+        }
+        tr = TestHelper.doExec(TestHelper.javaCmd, "-server", "-version");
+        if (!tr.matches("Java.*Server VM.*")) {
+            System.out.println("FAIL: the expected vm -server did launch");
+            System.out.println(tr);
+            errors++;
+        } else {
+            passes++;
+        }
+    }
+
+    /*
+     * checks to see there is no extra libjvm.so than needed
+     */
+    static void verifyNoSymLink() {
+        if (TestHelper.is64Bit) {
+            return;
+        }
+
+        File symLink = null;
+        String libPathPrefix = TestHelper.isSDK ? "jre/lib" : "/lib";
+        symLink = new File(TestHelper.JAVAHOME, libPathPrefix +
+                TestHelper.getJreArch() + "/libjvm.so");
+        if (symLink.exists()) {
+            System.out.println("FAIL: The symlink exists " +
+                    symLink.getAbsolutePath());
+            errors++;
+        } else {
+            passes++;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+        if (TestHelper.isWindows) {
+            System.out.println("Warning: noop on windows");
+            return;
+        }
+        // create our test jar first
+        createTestJar();
+        ensureNoExec();
+        verifyVmSelection();
+        ensureEcoFriendly();
+        verifyJavaLibraryPath();
+        verifyNoSymLink();
+        if (errors > 0) {
+            throw new Exception("ExecutionEnvironment: FAIL: with " +
+                    errors + " errors and passes " + passes );
+        } else {
+            System.out.println("ExecutionEnvironment: PASS " + passes);
+        }
+    }
+}
--- a/jdk/test/tools/launcher/SolarisDataModel.sh	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-# CA 95054 USA or visit www.sun.com if you need additional information or
-# have any questions.
-
-# @test
-# @bug 4780570
-# @run shell SolarisDataModel.sh
-# @summary Verify Solaris SPARC -d32 and -d64 options work with preset LD_LIBRARY_PATH
-# @author Joseph D. Darcy
-
-# Test to see if presetting LD_LIBRARY_PATH affects the treatment of
-# -d32 and -d64 options; also checks that -d<n> options result in the
-# desired data model.
-
-# If the test is not being run on a Solaris SPARC box SPARC the test
-# succeeds immediately.
-
-OS=`uname -s`;
-
-case "$OS" in
-	SunOS )
-		# ARCH should be sparc or i386
-		ARCH=`uname -p`
-		case "$ARCH" in 
-			sparc)
-			PATHSEP=":"
-			;;
-
-			* )
-			echo "Non-SPARC Solaris environment; test vacuously succeeds."
-			exit 0
-		esac
-	;;
-
-	* )
-	echo "Not a Solaris SPARC environment; test vacuously succeeds."
-	exit 0;
-	;;
-esac
-
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-
-JAVAC="$TESTJAVA/bin/javac"
-
-# Create our little Java tests on the fly
-( printf "public class GetDataModel {"
-  printf "   public static void main(String argv[]) {"
-  printf "      System.out.println(System.getProperty(\"sun.arch.data.model\", \"none\"));"
-  printf "   }"
-  printf "}"
-) > GetDataModel.java
-
-$JAVAC  GetDataModel.java
-
-( printf "public class GetLdLibraryPath {"
-  printf "   public static void main(String argv[]) {"
-  printf "      System.out.println(System.getProperty(\"java.library.path\"));"
-  printf "   }"
-  printf "}"
-) > GetLdLibraryPath.java
-
-$JAVAC  GetLdLibraryPath.java
-
-
-
-# All preconditions are met; run the tests
-
-
-# Construct path to 32-bit Java executable
-JAVA="$TESTJAVA/bin/java -classpath $TESTCLASSES${PATHSEP}."
-
-
-# Construct path to 64-bit Java executable, might not exist
-JAVA64="$TESTJAVA/bin/sparcv9/java -classpath $TESTCLASSES${PATHSEP}."
-JAVA64FILE="$TESTJAVA/bin/sparcv9/java"
-
-
-# java -d32 tests
-
-LD_LIBRARY_PATH=""
-export LD_LIBRARY_PATH
-
-DM=`$JAVA -d32 GetDataModel`
-case "$DM" in
-        32 )
-        ;;
-
-        * )
-	echo "The combination \"java -d32\" failed."
-	echo $DM
-        exit 1
-esac
-
-# Rerun test with LD_LIBRARY_PATH preset
-LD_LIBRARY_PATH=`$JAVA GetLdLibraryPath`;
-DM=`$JAVA -d32 GetDataModel`
-case "$DM" in
-        32 )
-        ;;
-
-        * )
-	echo "The combination \"java -d32\" failed with preset LD_LIBRARY_PATH."
-	echo $DM
-        exit 1
-esac
-
-# Reset LD_LIBRARY_PATH
-LD_LIBRARY_PATH=
-
-
-# Test for 64-bit executable
-
-if [ -f $JAVA64FILE ]; then
-
-	DM=`$JAVA -d64 GetDataModel`
-	case "$DM" in
-        	64 )
-        	;;
-
-        	* )
-		echo "The combination \"java -d64\" failed."
-        	exit 1
-	esac
-
-	DM=`$JAVA64 -d32 GetDataModel`
-	case "$DM" in
-        	32 )
-        	;;
-
-        	* )
-		echo "The combination \"sparcv9/java -d32\" failed."
-        	exit 1
-	esac
-
-	DM=`$JAVA64 -d64 GetDataModel`
-	case "$DM" in
-        	64 )
-        	;;
-
-        	* )
-		echo "The combination \"sparcv9/java -d64\" failed."
-        	exit 1
-	esac
-
-	# Rerun tests with LD_LIBRARY_PATH preset
-	LD_LIBRARY_PATH=`$JAVA GetLdLibraryPath`;
-	echo "Presetting LD_LIBRARY_PATH"
-
-	DM=`$JAVA -d64 GetDataModel`
-	case "$DM" in
-        	64 )
-        	;;
-
-        	* )
-		echo "The combination \"java -d64\" failed with preset LD_LIBRARY_PATH."
-        	exit 1
-	esac
-
-	DM=`$JAVA64 -d32 GetDataModel`
-	case "$DM" in
-        	32 )
-        	;;
-
-        	* )
-		echo "The combination \"sparcv9/java -d32\" failed with preset LD_LIBRARY_PATH."
-        	exit 1
-	esac
-
-	DM=`$JAVA64 -d64 GetDataModel`
-	case "$DM" in
-        	64 )
-        	;;
-
-        	* )
-		echo "The combination \"sparcv9/java -d64\" failed with preset LD_LIBRARY_PATH."
-        	exit 1
-	esac
-
-else
-  echo "Warning: no 64-bit components found; only java -d32 tests have been run."
-fi
-exit 0;
--- a/jdk/test/tools/launcher/SolarisRunpath.sh	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-# CA 95054 USA or visit www.sun.com if you need additional information or
-# have any questions.
-
-
-# @test
-# @bug 4731671
-# @build libraryCaller
-# @run shell SolarisRunpath.sh
-# @summary Verify that Solaris LD_LIBRARY_PATH rules are followed
-# @author Joseph D. Darcy
-
-# The launcher has been updated to properly take account of Solaris
-# LD_LIBRARY_PATH rules when constructing the runpath for the Java
-# executable.  That is, data model dependent LD_LIBRARY_PATH variables
-# are tested for and override LD_LIBRARY_PATH if present.  The current
-# launcher design relies on LD_LIBRARY_PATH settings to ensure the
-# proper jre/jdk libraries are opening during program execution.  In
-# the future, this dependence might be removed by having the vm
-# explicitly dlopen the needed files.  If that change occurs, this
-# test will be harmless but no long relevant.
-
-# A more robust test for Solaris SPARC would set the different
-# LD_LIBRARY_PATH variables while also varying the -d[32|64] options
-# to make sure the LD_LIBRARY_PATH of the *target* data model were
-# being respected.  That is "java -d64" should use the 64-bit
-# LD_LIBRARY_PATH while "java -d32" should use the 32-bit
-# LD_LIBRARY_PATH regardless of the data model of the "java" binary.
-# However, by default builds do not contain both 32 and 64 bit
-# components so such a test would often not be applicable.
-
-
-# If the test is not being run on a Solaris box, SPARC or x86, the
-# test succeeds immediately.
-
-OS=`uname -s`;
-
-case "$OS" in
-	SunOS )
-	PATHSEP=":"
-	;;
-
-	* )
-	echo "Not a Solaris environment; test vacuously succeeds."
-	exit 0;
-	;;
-esac
-
-# Verify directory context variables are set
-if [ "${TESTJAVA}" = "" ]
-then
-  echo "TESTJAVA not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-if [ "${TESTSRC}" = "" ]
-then
-  echo "TESTSRC not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-
-if [ "${TESTCLASSES}" = "" ]
-then
-  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
-  exit 1
-fi
-
-# Construct paths to default Java executables
-JAVAC="$TESTJAVA/bin/javac"
-
-
-# Create our little Java test on the fly
-( printf "public class GetDataModel {"
-  printf "   public static void main(String argv[]) {"
-  printf "      System.out.println(System.getProperty(\"sun.arch.data.model\", \"none\"));"
-  printf "   }"
-  printf "}"
-) > GetDataModel.java
-
-$JAVAC GetDataModel.java
-
-
-# ARCH should be sparc or i386
-ARCH=`uname -p`
-case "$ARCH" in 
-	sparc | i386 )
-	;;
-
-	* )
-	echo "Unrecognized architecture; test fails."
-	exit 1
-esac
-
-# The following construction may not work as desired in a
-# 64-bit build.
-JAVA="$TESTJAVA/bin/java -classpath $TESTCLASSES${PATHSEP}."
-
-# Determine data model
-DM=`$JAVA GetDataModel`
-
-# verify DM is 32 or 64
-case "$DM" in 
-	32 )
-	ODM=64;
-	;;
-	
-	64 )
-	ODM=32;
-	;;
-
-	* )
-	echo "Unknown data model \"$DM\"; test fails."
-	exit 1
-esac
-
-# -------------------- Test 1 --------------------
-
-LD_LIBRARY_PATH=$TESTSRC/lib/$ARCH/lib$DM
-export LD_LIBRARY_PATH
-unset LD_LIBRARY_PATH_32
-unset LD_LIBRARY_PATH_64
-	
-# With plain LD_LIBRARY_PATH, result should always be 0
-RESULT=`$JAVA libraryCaller`
-if [ "${RESULT}" != "0" ]; 
-then
-	echo "Not using LD_LIBRARY_PATH; test fails."
-	exit 1
-fi
-
-# The following two tests sets both data model dependent
-# LD_LIBRARY_PATH variables individually.
-
-# -------------------- Test 2 --------------------
-
-# Set opposite data model variable; should return same result
-# as plain LD_LIBRARY_PATH.
-
-if [ "${DM}" = "32"  ]; then
-	LD_LIBRARY_PATH_64=$TESTSRC/lib/$ARCH/lib$DM/lib$DM
-	export LD_LIBRARY_PATH_64
-else
-	LD_LIBRARY_PATH_32=$TESTSRC/lib/$ARCH/lib$DM/lib$DM
-	export LD_LIBRARY_PATH_32
-fi
-
-RESULT=`$JAVA libraryCaller`
-if [ "${RESULT}" != "0" ]; 
-then
-	echo "Using LD_LIBRARY_PATH_$ODM for $DM binary;"
-	echo "test fails."
-	exit 1
-fi
-
-unset LD_LIBRARY_PATH_32
-unset LD_LIBRARY_PATH_64
-
-# -------------------- Test 3 --------------------
-
-# Set appropriate data model variable; result should match
-# data model.
-if [ "${DM}" = "32"  ]; then
-	LD_LIBRARY_PATH_32=$TESTSRC/lib/$ARCH/lib$DM/lib$DM
-	export LD_LIBRARY_PATH_32
-else
-	LD_LIBRARY_PATH_64=$TESTSRC/lib/$ARCH/lib$DM/lib$DM
-	export LD_LIBRARY_PATH_64
-fi
-
-RESULT=`$JAVA libraryCaller`
-if [ "${RESULT}" != "$DM" ]; 
-then
-	echo "Data model dependent LD_LIBRARY_PATH_$DM"
-	echo "not overriding LD_LIBRARY_PATH; test fails."
-	exit 1
-fi
-
-unset LD_LIBRARY_PATH
-unset LD_LIBRARY_PATH_32
-unset LD_LIBRARY_PATH_64
-
-# -------------------- Test 4 --------------------
-
-# Have only data model dependent LD_LIBRARY_PATH set; result
-# should match data model.
-
-if [ "${DM}" = "32"  ]; then
-	LD_LIBRARY_PATH_32=$TESTSRC/lib/$ARCH/lib$DM/lib$DM
-	export LD_LIBRARY_PATH_32
-else
-	LD_LIBRARY_PATH_64=$TESTSRC/lib/$ARCH/lib$DM/lib$DM
-	export LD_LIBRARY_PATH_64
-fi
-
-RESULT=`$JAVA libraryCaller`
-if [ "${RESULT}" != "$DM" ]; 
-then
-	echo "Not using data-model dependent LD_LIBRARY_PATH; test fails."
-	exit 1
-fi
-
-# All tests have passed
-exit 0
--- a/jdk/test/tools/launcher/TestHelper.java	Wed Dec 16 23:39:39 2009 -0800
+++ b/jdk/test/tools/launcher/TestHelper.java	Wed Jul 05 17:04:26 2017 +0200
@@ -39,18 +39,36 @@
  */
 public enum TestHelper {
     INSTANCE;
-    static final String JAVAHOME = System.getProperty("java.home", ".");
+    static final String JAVAHOME = System.getProperty("java.home");
     static final boolean isSDK = JAVAHOME.endsWith("jre");
     static final String javaCmd;
+    static final String java64Cmd;
     static final String javacCmd;
     static final JavaCompiler compiler;
 
-    static final boolean debug = Boolean.getBoolean("Arrrghs.Debug");
+    static final boolean debug = Boolean.getBoolean("TestHelper.Debug");
     static final boolean isWindows =
             System.getProperty("os.name", "unknown").startsWith("Windows");
+    static final boolean is64Bit =
+            System.getProperty("sun.arch.data.model").equals("64");
+    static final boolean is32Bit =
+            System.getProperty("sun.arch.data.model").equals("32");
+    static final boolean isSolaris =
+            System.getProperty("os.name", "unknown").startsWith("SunOS");
+    static final boolean isLinux =
+            System.getProperty("os.name", "unknown").startsWith("Linux");
+    static final boolean isDualMode = isSolaris;
+    static final boolean isSparc = System.getProperty("os.arch").startsWith("sparc");
+
     static int testExitValue = 0;
 
     static {
+        if (is64Bit && is32Bit) {
+            throw new RuntimeException("arch model cannot be both 32 and 64 bit");
+        }
+        if (!is64Bit && !is32Bit) {
+            throw new RuntimeException("arch model is not 32 or 64 bit ?");
+        }
         compiler = ToolProvider.getSystemJavaCompiler();
         File binDir = (isSDK) ? new File((new File(JAVAHOME)).getParentFile(), "bin")
             : new File(JAVAHOME, "bin");
@@ -69,6 +87,33 @@
         if (!javacCmdFile.canExecute()) {
             throw new RuntimeException("java <" + javacCmd + "> must exist");
         }
+        if (isSolaris) {
+            File sparc64BinDir = new File(binDir,isSparc ? "sparcv9" : "amd64");
+            File java64CmdFile= new File(sparc64BinDir, "java");
+            if (java64CmdFile.exists() && java64CmdFile.canExecute()) {
+                java64Cmd = java64CmdFile.getAbsolutePath();
+            } else {
+                java64Cmd = null;
+            }
+        } else {
+            java64Cmd = null;
+        }
+    }
+
+    /*
+     * usually the jre/lib/arch-name is the same as os.arch, except for x86.
+     */
+    static String getJreArch() {
+        String arch = System.getProperty("os.arch");
+        return arch.equals("x86") ? "i386" : arch;
+    }
+
+    /*
+     * A convenience method to create a jar with jar file name and defs
+     */
+    static void createJar(File jarName, String... mainDefs)
+            throws FileNotFoundException{
+        createJar(null, jarName, new File("Foo"), mainDefs);
     }
 
     /*
@@ -123,16 +168,23 @@
         }
     }
 
+    static TestResult doExec(String...cmds) {
+        return doExec(null, cmds);
+    }
+
     /*
      * A method which executes a java cmd and returns the results in a container
      */
-    static TestResult doExec(String...cmds) {
+    static TestResult doExec(Map<String, String> envToSet, String...cmds) {
         String cmdStr = "";
         for (String x : cmds) {
             cmdStr = cmdStr.concat(x + " ");
         }
         ProcessBuilder pb = new ProcessBuilder(cmds);
         Map<String, String> env = pb.environment();
+        if (envToSet != null) {
+            env.putAll(envToSet);
+        }
         BufferedReader rdr = null;
         try {
             List<String> outputList = new ArrayList<String>();
@@ -163,21 +215,25 @@
         List<String> testOutput;
 
         public TestResult(String str, int rv, List<String> oList) {
-            status = new StringBuilder(str);
+            status = new StringBuilder("Executed command: " + str + "\n");
             exitValue = rv;
             testOutput = oList;
         }
 
+        void appendStatus(String x) {
+            status = status.append("  " + x + "\n");
+        }
+
         void checkNegative() {
             if (exitValue == 0) {
-                status = status.append("  Error: test must not return 0 exit value");
+                appendStatus("Error: test must not return 0 exit value");
                 testExitValue++;
             }
         }
 
         void checkPositive() {
             if (exitValue != 0) {
-                status = status.append("  Error: test did not return 0 exit value");
+                appendStatus("Error: test did not return 0 exit value");
                 testExitValue++;
             }
         }
@@ -188,7 +244,7 @@
 
         boolean isZeroOutput() {
             if (!testOutput.isEmpty()) {
-                status = status.append("  Error: No message from cmd please");
+                appendStatus("Error: No message from cmd please");
                 testExitValue++;
                 return false;
             }
@@ -197,19 +253,20 @@
 
         boolean isNotZeroOutput() {
             if (testOutput.isEmpty()) {
-                status = status.append("  Error: Missing message");
+                appendStatus("Error: Missing message");
                 testExitValue++;
                 return false;
             }
             return true;
         }
 
+        @Override
         public String toString() {
-            if (debug) {
-                for (String x : testOutput) {
-                    status = status.append(x + "\n");
-                }
+            status = status.append("++++Test Output Begin++++\n");
+            for (String x : testOutput) {
+                appendStatus(x);
             }
+            status = status.append("++++Test Output End++++\n");
             return status.toString();
         }
 
@@ -219,7 +276,18 @@
                     return true;
                 }
             }
-            status = status.append("   Error: string <" + str + "> not found ");
+            appendStatus("Error: string <" + str + "> not found");
+            testExitValue++;
+            return false;
+        }
+
+        boolean matches(String stringToMatch) {
+          for (String x : testOutput) {
+                if (x.matches(stringToMatch)) {
+                    return true;
+                }
+            }
+            appendStatus("Error: string <" + stringToMatch + "> not found");
             testExitValue++;
             return false;
         }
--- a/jdk/test/tools/launcher/libraryCaller.c	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/*
- *
- *
- * Indictly used by SolarisRunpath.sh; this file is used to generate
- * the shared objects:
- *
- * ./lib/sparc/lib32/liblibrary.so
- * ./lib/sparc/lib32/lib32/liblibrary.so
- *
- * ./lib/sparc/lib64/liblibrary.so
- * ./lib/sparc/lib64/lib64/liblibrary.so
- *
- * ./lib/i386/lib32/liblibrary.so
- * ./lib/i386/lib32/lib32/liblibrary.so
- *
- * The function defined below returns either 0 or the size of an
- * integer in the data model used to compile the file (32 for ILP; 64
- * for LP).  The libraries in ./lib/$ARCH/lib$DM return 0; those in
- * ./lib/$ARCH/lib$DM/lib$DM return 32 or 64.
- */
-
-
-#include <jni.h>
-#include "libraryCaller.h"
-
-#ifndef RETURN_VALUE
-#define RETURN_VALUE 0
-#endif
-
-JNIEXPORT jint JNICALL Java_libraryCaller_number
-(JNIEnv *je, jclass jc) {
-  return RETURN_VALUE;
-}
--- a/jdk/test/tools/launcher/libraryCaller.h	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-/* DO NOT EDIT THIS FILE - it is machine generated */
-
-#include <jni.h>
-/* Header for class libraryCaller */
-
-#ifndef _Included_libraryCaller
-#define _Included_libraryCaller
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class:     libraryCaller
- * Method:    number
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL Java_libraryCaller_number
-  (JNIEnv *, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- a/jdk/test/tools/launcher/libraryCaller.java	Wed Dec 16 23:39:39 2009 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-
-/*
- *
- *
- * Used by SolarisRunpath.sh to help test if the launcher fully
- * respects Solaris LD_LIBRARY_PATH semantics.  The ./lib directory is
- * structured so that the results of the dynamically linked number
- * method varies depending on the value the data model dependent
- * LD_LIBRARY_PATH variable.
- */
-
-
-
-class libraryCaller {
-    static {
-        System.loadLibrary("library");
-    }
-    static native int number();
-
-    public static void main(String argv[]) {
-        System.out.println(number());
-    }
-}
--- a/make/Defs-internal.gmk	Wed Dec 16 23:39:39 2009 -0800
+++ b/make/Defs-internal.gmk	Wed Jul 05 17:04:26 2017 +0200
@@ -227,6 +227,35 @@
   SKIP_FASTDEBUG_BUILD=false
 endif
 
+# Select javadoc setting GENERATE_DOCS
+ifndef NO_DOCS
+  # Default value (we want javadoc run)
+  GENERATE_DOCS=true
+  # No DOCS build when JDK_UPDATE_VERSION set
+  ifdef JDK_UPDATE_VERSION
+    GENERATE_DOCS=false
+  endif
+  # If langtools, corba, jaxp, and jaxws are not being built, 
+  #   a full jdk javadoc is not possible
+  ifneq ($(BUILD_LANGTOOLS), true)
+    GENERATE_DOCS=false
+  endif
+  ifneq ($(BUILD_CORBA), true)
+    GENERATE_DOCS=false
+  endif
+  ifneq ($(BUILD_JAXP), true)
+    GENERATE_DOCS=false
+  endif
+  ifneq ($(BUILD_JAXWS), true)
+    GENERATE_DOCS=false
+  endif
+  ifeq ($(GENERATE_DOCS),false)
+    NO_DOCS=true
+  endif
+else
+  GENERATE_DOCS=false
+endif
+
 # Output directory for hotspot build
 HOTSPOT_DIR = $(ABS_OUTPUTDIR)/hotspot
 
--- a/make/jdk-rules.gmk	Wed Dec 16 23:39:39 2009 -0800
+++ b/make/jdk-rules.gmk	Wed Jul 05 17:04:26 2017 +0200
@@ -30,43 +30,20 @@
 JDK_JAVA_EXE = $(OUTPUTDIR)/bin/java$(EXE_SUFFIX)
 
 # NO_IMAGES may be set in conjunction with DEV_ONLY
-ifdef NO_IMAGES
-  IMAGES_TARGET =
-else
-  IMAGES_TARGET = images
-endif
-
-# No DOCS build when JDK_UPDATE_VERSION set
-ifdef JDK_UPDATE_VERSION
-  DOCS_TARGET =
-else
-  DOCS_TARGET = docs
-endif
-
-# NO_DOCS may be set in conjunction with DEV_ONLY
-ifdef NO_DOCS
-  DOCS_TARGET =
+IMAGES_TARGET = images
+ifdef DEV_ONLY
+  ifdef NO_IMAGES
+    IMAGES_TARGET =
+  endif
 endif
 
-# If langtools not being built, full jdk javadoc is not possible
-ifneq ($(BUILD_LANGTOOLS), true)
-  DOCS_TARGET =
-endif
-ifneq ($(BUILD_CORBA), true)
-  DOCS_TARGET =
-endif
-ifneq ($(BUILD_JAXP), true)
+# GENERATE_DOCS determines if we ask for the docs target
+DOCS_TARGET = docs
+ifeq ($(GENERATE_DOCS),false)
   DOCS_TARGET =
 endif
-ifneq ($(BUILD_JAXWS), true)
-  DOCS_TARGET =
-endif
-
-ifndef DEV_ONLY
-  JDK_BUILD_TARGETS = sanity all $(DOCS_TARGET) images
-else
-  JDK_BUILD_TARGETS = sanity all $(IMAGES_TARGET)
-endif
+  
+JDK_BUILD_TARGETS = sanity all $(DOCS_TARGET) $(IMAGES_TARGET)
 
 JDK_CLOBBER_TARGETS = clobber
 
--- a/make/sanity-rules.gmk	Wed Dec 16 23:39:39 2009 -0800
+++ b/make/sanity-rules.gmk	Wed Jul 05 17:04:26 2017 +0200
@@ -204,13 +204,9 @@
 	   "" >> $(WARNING_FILE)
   endif
 endif
-ifndef OPENJDK
-  ifdef NO_DOCS
-	@$(ECHO) "WARNING: Your build environment has the variable NO_DOCS\n" \
-	   "        defined. This will result in a development-only\n" \
-	   "        build of the JDK, lacking the documentation.\n" \
+ifeq ($(GENERATE_DOCS),false)
+	@$(ECHO) "WARNING: This build does not include running javadoc.\n" \
 	   "" >> $(WARNING_FILE)
-  endif
 endif
 ifdef NO_IMAGES
 	@$(ECHO) "WARNING: Your build environment has the variable NO_IMAGES\n" \
@@ -355,4 +351,4 @@
 .PHONY: sanity settings pre-sanity insane \
 	post-sanity post-sanity-hotspot post-sanity-jdk \
 	post-sanity-install post-sanity-deploy \
-	alt_bootdir bootdir
+	alt_bootdir bootdir environment