Merge
authorduke
Wed, 05 Jul 2017 19:42:29 +0200
changeset 24614 95a387d538e7
parent 24613 dbec02c24c7a (current diff)
parent 24600 c84491c8dcc6 (diff)
child 24615 74eb0778e4f2
Merge
hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java
hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java
hotspot/src/share/vm/libadt/port.cpp
hotspot/src/share/vm/libadt/port.hpp
hotspot/test/runtime/7110720/Test7110720.sh
hotspot/test/runtime/SharedArchiveFile/CdsWriteError.java
hotspot/test/testlibrary/com/oracle/java/testlibrary/DynamicVMOptionChecker.java
hotspot/test/testlibrary/com/oracle/java/testlibrary/TestDynamicVMOption.java
jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc
jaxp/src/com/sun/org/apache/xalan/internal/xsltc/javax.xml.transform.TransformerFactory
jaxp/src/com/sun/org/apache/xerces/internal/dom/org.apache.xerces.dom.DOMImplementationSourceImpl
jaxp/src/com/sun/org/apache/xerces/internal/dom/org.w3c.dom.DOMImplementationSourceList
jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/javax.xml.datatype.DatatypeFactory
jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.DocumentBuilderFactory
jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.SAXParserFactory
jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/javax.xml.validation.SchemaFactory
jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.DTDConfiguration
jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XML11Configuration
jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XMLParserConfiguration
jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.xml.sax.driver
jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLEventFactory
jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLInputFactory
jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLOutputFactory
jaxp/src/org/xml/sax/COPYING
jaxp/src/org/xml/sax/COPYING.txt
jaxws/src/share/jaxws_classes/com/sun/tools/etc/META-INF/services/com.sun.xml.internal.ws.spi.db.BindingContextFactory
jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/gen/config/config.rng
jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.rng
jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/binding.rng
jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng
jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/CompactSyntax.jj
jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/pacakge-info.java
jdk/src/share/classes/com/sun/pept/Delegate.java
jdk/src/share/classes/com/sun/pept/encoding/Decoder.java
jdk/src/share/classes/com/sun/pept/encoding/Encoder.java
jdk/src/share/classes/com/sun/pept/ept/Acceptor.java
jdk/src/share/classes/com/sun/pept/ept/ContactInfo.java
jdk/src/share/classes/com/sun/pept/ept/ContactInfoList.java
jdk/src/share/classes/com/sun/pept/ept/ContactInfoListIterator.java
jdk/src/share/classes/com/sun/pept/ept/EPTFactory.java
jdk/src/share/classes/com/sun/pept/ept/MessageInfo.java
jdk/src/share/classes/com/sun/pept/presentation/MessageStruct.java
jdk/src/share/classes/com/sun/pept/presentation/Stub.java
jdk/src/share/classes/com/sun/pept/presentation/TargetFinder.java
jdk/src/share/classes/com/sun/pept/presentation/Tie.java
jdk/src/share/classes/com/sun/pept/protocol/Interceptors.java
jdk/src/share/classes/com/sun/pept/protocol/MessageDispatcher.java
jdk/src/share/classes/com/sun/pept/transport/Connection.java
jdk/src/share/classes/com/sun/tools/hat/MANIFEST.mf
jdk/src/share/classes/com/sun/tools/hat/README.txt
jdk/src/share/classes/com/sun/tools/hat/build.xml
jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
jdk/src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine
jdk/src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider
jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine
jdk/src/share/classes/sun/misc/ThreadGroupUtils.java
jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine
jdk/src/solaris/native/sun/awt/awt_Plugin.c
jdk/src/solaris/native/sun/awt/awt_Plugin.h
--- a/.hgtags-top-repo	Tue May 27 16:39:05 2014 -0600
+++ b/.hgtags-top-repo	Wed Jul 05 19:42:29 2017 +0200
@@ -256,3 +256,4 @@
 ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11
 59f6350295f9681fe5956d8bc889bf341914c6cb jdk9-b12
 5800456add07e1a68170a229fb5e27376f8875e5 jdk9-b13
+4e3aa9723e9972623e3dafc321b368e7db7e9b3b jdk9-b14
--- a/README	Tue May 27 16:39:05 2014 -0600
+++ b/README	Wed Jul 05 19:42:29 2017 +0200
@@ -1,15 +1,15 @@
 README:
   This file should be located at the top of the OpenJDK Mercurial root
   repository. A full OpenJDK repository set (forest) should also include
-  the following 6 nested repositories:
-    "jdk", "hotspot", "langtools", "corba", "jaxws"  and "jaxp".
+  the following 7 nested repositories:
+    "jdk", "hotspot", "langtools", "nashorn", "corba", "jaxws"  and "jaxp".
 
   The root repository can be obtained with something like:
-    hg clone http://hg.openjdk.java.net/jdk8/jdk8 openjdk8
+    hg clone http://hg.openjdk.java.net/jdk9/jdk9 openjdk9
   
   You can run the get_source.sh script located in the root repository to get
   the other needed repositories:
-    cd openjdk8 && sh ./get_source.sh
+    cd openjdk9 && sh ./get_source.sh
 
   People unfamiliar with Mercurial should read the first few chapters of
   the Mercurial book: http://hgbook.red-bean.com/read/
@@ -19,9 +19,9 @@
 Simple Build Instructions:
   
   0. Get the necessary system software/packages installed on your system, see
-     http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
+     http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html
 
-  1. If you don't have a jdk7u7 or newer jdk, download and install it from
+  1. If you don't have a jdk8 or newer jdk, download and install it from
      http://java.sun.com/javase/downloads/index.jsp
      Add the /bin directory of this installation to your PATH environment
      variable.
@@ -37,4 +37,4 @@
 is 3.81 or newer. Note that on Solaris, GNU make is called "gmake".
 
 Complete details are available in the file:
-     http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
+     http://hg.openjdk.java.net/jdk9/jdk9/raw-file/tip/README-builds.html
--- a/common/autoconf/generated-configure.sh	Tue May 27 16:39:05 2014 -0600
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 19:42:29 2017 +0200
@@ -656,6 +656,9 @@
 USE_EXTERNAL_LIBPNG
 PNG_LIBS
 PNG_CFLAGS
+USE_EXTERNAL_LCMS
+LCMS_LIBS
+LCMS_CFLAGS
 USE_EXTERNAL_LIBGIF
 USE_EXTERNAL_LIBJPEG
 ALSA_LIBS
@@ -1079,6 +1082,7 @@
 with_alsa_include
 with_alsa_lib
 with_giflib
+with_lcms
 with_libpng
 with_zlib
 with_stdc__lib
@@ -1192,6 +1196,8 @@
 FREETYPE_LIBS
 ALSA_CFLAGS
 ALSA_LIBS
+LCMS_CFLAGS
+LCMS_LIBS
 PNG_CFLAGS
 PNG_LIBS
 LIBFFI_CFLAGS
@@ -1934,6 +1940,8 @@
   --with-alsa-lib         specify directory for the alsa library
   --with-giflib           use giflib from build system or OpenJDK source
                           (system, bundled) [bundled]
+  --with-lcms             use lcms2 from build system or OpenJDK source
+                          (system, bundled) [bundled]
   --with-libpng           use libpng from build system or OpenJDK source
                           (system, bundled) [bundled]
   --with-zlib             use zlib from build system or OpenJDK source
@@ -2060,6 +2068,8 @@
               linker flags for FREETYPE, overriding pkg-config
   ALSA_CFLAGS C compiler flags for ALSA, overriding pkg-config
   ALSA_LIBS   linker flags for ALSA, overriding pkg-config
+  LCMS_CFLAGS C compiler flags for LCMS, overriding pkg-config
+  LCMS_LIBS   linker flags for LCMS, overriding pkg-config
   PNG_CFLAGS  C compiler flags for PNG, overriding pkg-config
   PNG_LIBS    linker flags for PNG, overriding pkg-config
   LIBFFI_CFLAGS
@@ -47309,6 +47319,115 @@
 
   ###############################################################################
   #
+  # Check for the lcms2 library
+  #
+
+
+# Check whether --with-lcms was given.
+if test "${with_lcms+set}" = set; then :
+  withval=$with_lcms;
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for which lcms to use" >&5
+$as_echo_n "checking for which lcms to use... " >&6; }
+
+  DEFAULT_LCMS=bundled
+
+  #
+  # If user didn't specify, use DEFAULT_LCMS
+  #
+  if test "x${with_lcms}" = "x"; then
+      with_lcms=${DEFAULT_LCMS}
+  fi
+
+  if test "x${with_lcms}" = "xbundled"; then
+    USE_EXTERNAL_LCMS=false
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: bundled" >&5
+$as_echo "bundled" >&6; }
+  elif test "x${with_lcms}" = "xsystem"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: system" >&5
+$as_echo "system" >&6; }
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LCMS" >&5
+$as_echo_n "checking for LCMS... " >&6; }
+
+if test -n "$LCMS_CFLAGS"; then
+    pkg_cv_LCMS_CFLAGS="$LCMS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LCMS_CFLAGS=`$PKG_CONFIG --cflags "lcms2" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$LCMS_LIBS"; then
+    pkg_cv_LCMS_LIBS="$LCMS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lcms2\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "lcms2") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_LCMS_LIBS=`$PKG_CONFIG --libs "lcms2" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        LCMS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "lcms2" 2>&1`
+        else
+	        LCMS_PKG_ERRORS=`$PKG_CONFIG --print-errors "lcms2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$LCMS_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                LCMS_FOUND=no
+elif test $pkg_failed = untried; then
+	LCMS_FOUND=no
+else
+	LCMS_CFLAGS=$pkg_cv_LCMS_CFLAGS
+	LCMS_LIBS=$pkg_cv_LCMS_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	LCMS_FOUND=yes
+fi
+    if test "x${LCMS_FOUND}" = "xyes"; then
+      USE_EXTERNAL_LCMS=true
+    else
+      as_fn_error $? "--with-lcms=system specified, but no lcms found!" "$LINENO" 5
+    fi
+  else
+    as_fn_error $? "Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'" "$LINENO" 5
+  fi
+
+
+
+  ###############################################################################
+  #
   # Check for the png library
   #
 
--- a/common/autoconf/libraries.m4	Tue May 27 16:39:05 2014 -0600
+++ b/common/autoconf/libraries.m4	Wed Jul 05 19:42:29 2017 +0200
@@ -666,6 +666,42 @@
 
   ###############################################################################
   #
+  # Check for the lcms2 library
+  #
+
+  AC_ARG_WITH(lcms, [AS_HELP_STRING([--with-lcms],
+  	[use lcms2 from build system or OpenJDK source (system, bundled) @<:@bundled@:>@])])
+
+  AC_MSG_CHECKING([for which lcms to use])
+
+  DEFAULT_LCMS=bundled
+
+  #
+  # If user didn't specify, use DEFAULT_LCMS
+  #
+  if test "x${with_lcms}" = "x"; then
+      with_lcms=${DEFAULT_LCMS}
+  fi
+
+  if test "x${with_lcms}" = "xbundled"; then
+    USE_EXTERNAL_LCMS=false
+    AC_MSG_RESULT([bundled])
+  elif test "x${with_lcms}" = "xsystem"; then
+    AC_MSG_RESULT([system])
+    PKG_CHECK_MODULES([LCMS], [lcms2], [LCMS_FOUND=yes], [LCMS_FOUND=no])
+    if test "x${LCMS_FOUND}" = "xyes"; then
+      USE_EXTERNAL_LCMS=true
+    else
+      AC_MSG_ERROR([--with-lcms=system specified, but no lcms found!])
+    fi
+  else
+    AC_MSG_ERROR([Invalid value for --with-lcms: ${with_lcms}, use 'system' or 'bundled'])
+  fi
+
+  AC_SUBST(USE_EXTERNAL_LCMS)
+
+  ###############################################################################
+  #
   # Check for the png library
   #
 
--- a/common/autoconf/spec.gmk.in	Tue May 27 16:39:05 2014 -0600
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 19:42:29 2017 +0200
@@ -652,6 +652,10 @@
 # Libraries
 #
 
+USE_EXTERNAL_LCMS:=@USE_EXTERNAL_LCMS@
+LCMS_CFLAGS:=@LCMS_CFLAGS@
+LCMS_LIBS:=@LCMS_LIBS@
+
 USE_EXTERNAL_LIBPNG:=@USE_EXTERNAL_LIBPNG@
 PNG_LIBS:=@PNG_LIBS@
 PNG_CFLAGS:=@PNG_CFLAGS@
--- a/corba/.hgtags	Tue May 27 16:39:05 2014 -0600
+++ b/corba/.hgtags	Wed Jul 05 19:42:29 2017 +0200
@@ -256,3 +256,4 @@
 77ea0a2503582a28e4e66be7239a49a0d1dd313f jdk9-b11
 e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12
 088eec4c36f4d7f250fcd19c4969bf698e3d2cdc jdk9-b13
+a2b82f863ba95a596da555a4c1b871c404863e7e jdk9-b14
--- a/hotspot/.hgtags	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/.hgtags	Wed Jul 05 19:42:29 2017 +0200
@@ -416,3 +416,4 @@
 783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
 1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12
 456ad9c99133803d4e1433124c85a6fd141b9ac9 jdk9-b13
+bd333491bb6c012d7b606939406d0fa9a5ac7ffd jdk9-b14
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java	Wed Jul 05 19:42:29 2017 +0200
@@ -64,7 +64,11 @@
   }
 
   public Compile compilerData() {
-    return new Compile(compilerDataField.getValue(this.getAddress()));
+    Address addr = compilerDataField.getValue(this.getAddress());
+    if (addr == null) {
+      return null;
+    }
+    return new Compile(addr);
   }
 
   public ciObjectFactory factory() {
@@ -94,10 +98,7 @@
     Method method = task.method();
     int entryBci = task.osrBci();
     int compLevel = task.compLevel();
-    Klass holder = method.getMethodHolder();
-    out.print("compile " + holder.getName().asString() + " " +
-              OopUtilities.escapeString(method.getName().asString()) + " " +
-              method.getSignature().asString() + " " +
+    out.print("compile " + method.nameAsAscii() + " " +
               entryBci + " " + compLevel);
     Compile compiler = compilerData();
     if (compiler != null) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java	Wed Jul 05 19:42:29 2017 +0200
@@ -55,4 +55,9 @@
   public ciKlass(Address addr) {
     super(addr);
   }
+
+  public void printValueOn(PrintStream tty) {
+    Klass k = (Klass)getMetadata();
+    k.printValueOn(tty);
+  }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java	Wed Jul 05 19:42:29 2017 +0200
@@ -90,17 +90,23 @@
   }
 
   public void dumpReplayData(PrintStream out) {
-      Method method = (Method)getMetadata();
-      NMethod nm = method.getNativeMethod();
-      Klass holder = method.getMethodHolder();
-      out.println("ciMethod " +
-                  holder.getName().asString() + " " +
-                  OopUtilities.escapeString(method.getName().asString()) + " " +
-                  method.getSignature().asString() + " " +
-                  method.getInvocationCount() + " " +
-                  method.getBackedgeCount() + " " +
-                  interpreterInvocationCount() + " " +
-                  interpreterThrowoutCount() + " " +
-                  instructionsSize());
+    Method method = (Method)getMetadata();
+    NMethod nm = method.getNativeMethod();
+    out.println("ciMethod " +
+                nameAsAscii() + " " +
+                method.getInvocationCount() + " " +
+                method.getBackedgeCount() + " " +
+                interpreterInvocationCount() + " " +
+                interpreterThrowoutCount() + " " +
+                instructionsSize());
+  }
+
+  public void printValueOn(PrintStream tty) {
+    tty.print("ciMethod " + method().getName().asString() + method().getSignature().asString() + "@" + getAddress());
+  }
+
+  public String nameAsAscii() {
+    Method method = (Method)getMetadata();
+    return method.nameAsAscii();
   }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -31,7 +31,7 @@
 import sun.jvm.hotspot.oops.*;
 import sun.jvm.hotspot.types.*;
 
-public class ciMethodData extends ciMetadata {
+public class ciMethodData extends ciMetadata implements MethodDataInterface<ciKlass,ciMethod> {
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -54,7 +54,9 @@
     extraDataSizeField = new CIntField(type.getCIntegerField("_extra_data_size"), 0);
     dataSizeField = new CIntField(type.getCIntegerField("_data_size"), 0);
     stateField = new CIntField(type.getCIntegerField("_state"), 0);
-    sizeofMethodDataOopDesc = (int)db.lookupType("MethodData").getSize();;
+    Type typeMethodData = db.lookupType("MethodData");
+    sizeofMethodDataOopDesc = (int)typeMethodData.getSize();
+    parametersTypeDataDi = new CIntField(typeMethodData.getCIntegerField("_parameters_type_data_di"), 0);
   }
 
   private static AddressField origField;
@@ -69,11 +71,28 @@
   private static CIntField dataSizeField;
   private static CIntField stateField;
   private static int sizeofMethodDataOopDesc;
+  private static CIntField parametersTypeDataDi;
 
   public ciMethodData(Address addr) {
     super(addr);
   }
 
+  public ciKlass getKlassAtAddress(Address addr) {
+    return (ciKlass)ciObjectFactory.getMetadata(addr);
+  }
+
+  public ciMethod getMethodAtAddress(Address addr) {
+    return (ciMethod)ciObjectFactory.getMetadata(addr);
+  }
+
+  public void printKlassValueOn(ciKlass klass, PrintStream st) {
+    klass.printValueOn(st);
+  }
+
+  public void printMethodValueOn(ciMethod method, PrintStream st) {
+    method.printValueOn(st);
+  }
+
   private byte[] fetchDataAt(Address base, long size) {
     byte[] result = new byte[(int)size];
     for (int i = 0; i < size; i++) {
@@ -110,6 +129,10 @@
     return (int)dataSizeField.getValue(getAddress());
   }
 
+  int extraDataSize() {
+    return (int)extraDataSizeField.getValue(getAddress());
+  }
+
   int state() {
     return (int)stateField.getValue(getAddress());
   }
@@ -122,6 +145,16 @@
     return dataIndex >= dataSize();
   }
 
+  ParametersTypeData<ciKlass,ciMethod> parametersTypeData() {
+    Address base = getAddress().addOffsetTo(origField.getOffset());
+    int di = (int)parametersTypeDataDi.getValue(base);
+    if (di == -1) {
+      return null;
+    }
+    DataLayout dataLayout = new DataLayout(dataField.getValue(getAddress()), di);
+    return new ParametersTypeData<ciKlass,ciMethod>(this, dataLayout);
+  }
+
   ProfileData dataAt(int dataIndex) {
     if (outOfBounds(dataIndex)) {
       return null;
@@ -139,15 +172,21 @@
     case DataLayout.jumpDataTag:
       return new JumpData(dataLayout);
     case DataLayout.receiverTypeDataTag:
-      return new ciReceiverTypeData(dataLayout);
+      return new ReceiverTypeData<ciKlass,ciMethod>(this, dataLayout);
     case DataLayout.virtualCallDataTag:
-      return new ciVirtualCallData(dataLayout);
+      return new VirtualCallData<ciKlass,ciMethod>(this, dataLayout);
     case DataLayout.retDataTag:
       return new RetData(dataLayout);
     case DataLayout.branchDataTag:
       return new BranchData(dataLayout);
     case DataLayout.multiBranchDataTag:
       return new MultiBranchData(dataLayout);
+    case DataLayout.callTypeDataTag:
+      return new CallTypeData<ciKlass,ciMethod>(this, dataLayout);
+    case DataLayout.virtualCallTypeDataTag:
+      return new VirtualCallTypeData<ciKlass,ciMethod>(this, dataLayout);
+    case DataLayout.parametersTypeDataTag:
+      return new ParametersTypeData<ciKlass,ciMethod>(this, dataLayout);
     }
   }
 
@@ -164,7 +203,23 @@
   }
   boolean isValid(ProfileData current) { return current != null; }
 
+  DataLayout limitDataPosition() {
+    return new DataLayout(dataField.getValue(getAddress()), dataSize());
+  }
+  DataLayout extraDataBase() {
+    return limitDataPosition();
+  }
+  DataLayout extraDataLimit() {
+    return new DataLayout(dataField.getValue(getAddress()), dataSize() + extraDataSize());
+  }
+  DataLayout nextExtra(DataLayout dataLayout) {
+    return new DataLayout(dataField.getValue(getAddress()), dataLayout.dp() + DataLayout.computeSizeInBytes(MethodData.extraNbCells(dataLayout)));
+  }
+
   public void printDataOn(PrintStream st) {
+    if (parametersTypeData() != null) {
+      parametersTypeData().printDataOn(st);
+    }
     ProfileData data = firstData();
     for ( ; isValid(data); data = nextData(data)) {
       st.print(dpToDi(data.dp()));
@@ -172,16 +227,96 @@
       // st->fillTo(6);
       data.printDataOn(st);
     }
+    st.println("--- Extra data:");
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+    for (;; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+        continue;
+      case DataLayout.bitDataTag:
+        data = new BitData(dp);
+        break;
+      case DataLayout.speculativeTrapDataTag:
+        data = new SpeculativeTrapData<ciKlass,ciMethod>(this, dp);
+        break;
+      case DataLayout.argInfoDataTag:
+        data = new ArgInfoData(dp);
+        dp = end; // ArgInfoData is at the end of extra data section.
+        break;
+      default:
+        throw new InternalError("unexpected tag " +  dp.tag());
+      }
+      st.print(dpToDi(data.dp()));
+      st.print(" ");
+      data.printDataOn(st);
+      if (dp == end) return;
+    }
+  }
+
+  int dumpReplayDataTypeHelper(PrintStream out, int round, int count, int index, ProfileData pdata, ciKlass k) {
+    if (k != null) {
+      if (round == 0) count++;
+      else out.print(" " + ((pdata.dp() + pdata.cellOffset(index)) / MethodData.cellSize) + " " + k.name());
+    }
+    return count;
+  }
+
+  int dumpReplayDataReceiverTypeHelper(PrintStream out, int round, int count, ReceiverTypeData<ciKlass,ciMethod> vdata) {
+    for (int i = 0; i < vdata.rowLimit(); i++) {
+      ciKlass k = vdata.receiver(i);
+      count = dumpReplayDataTypeHelper(out, round, count, vdata.receiverCellIndex(i), vdata, k);
+    }
+    return count;
+  }
+
+  int dumpReplayDataCallTypeHelper(PrintStream out, int round, int count, CallTypeDataInterface<ciKlass> callTypeData) {
+    if (callTypeData.hasArguments()) {
+      for (int i = 0; i < callTypeData.numberOfArguments(); i++) {
+        count = dumpReplayDataTypeHelper(out, round, count, callTypeData.argumentTypeIndex(i), (ProfileData)callTypeData, callTypeData.argumentType(i));
+      }
+    }
+    if (callTypeData.hasReturn()) {
+      count = dumpReplayDataTypeHelper(out, round, count, callTypeData.returnTypeIndex(), (ProfileData)callTypeData, callTypeData.returnType());
+    }
+    return count;
+  }
+
+  int dumpReplayDataExtraDataHelper(PrintStream out, int round, int count) {
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+
+    for (;dp != end; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+      case DataLayout.argInfoDataTag:
+        return count;
+      case DataLayout.bitDataTag:
+        break;
+      case DataLayout.speculativeTrapDataTag: {
+        SpeculativeTrapData<ciKlass,ciMethod> data = new SpeculativeTrapData<ciKlass,ciMethod>(this, dp);
+        ciMethod m = data.method();
+        if (m != null) {
+          if (round == 0) {
+            count++;
+          } else {
+            out.print(" " +  (dpToDi(data.dp() + data.cellOffset(SpeculativeTrapData.methodIndex())) / MethodData.cellSize) + " " +  m.nameAsAscii());
+          }
+        }
+        break;
+      }
+      default:
+        throw new InternalError("bad tag "  + dp.tag());
+      }
+    }
+    return count;
   }
 
   public void dumpReplayData(PrintStream out) {
     MethodData mdo = (MethodData)getMetadata();
     Method method = mdo.getMethod();
-    Klass holder = method.getMethodHolder();
     out.print("ciMethodData " +
-              holder.getName().asString() + " " +
-              OopUtilities.escapeString(method.getName().asString()) + " " +
-              method.getSignature().asString() + " " +
+              method.nameAsAscii() + " " +
               state() + " " + currentMileage());
     byte[] orig = orig();
     out.print(" orig " + orig.length);
@@ -195,30 +330,28 @@
       out.print(" 0x" + Long.toHexString(data[i]));
     }
     int count = 0;
+    ParametersTypeData<ciKlass,ciMethod> parameters = parametersTypeData();
     for (int round = 0; round < 2; round++) {
       if (round == 1) out.print(" oops " + count);
       ProfileData pdata = firstData();
       for ( ; isValid(pdata); pdata = nextData(pdata)) {
-        if (pdata instanceof ciReceiverTypeData) {
-          ciReceiverTypeData vdata = (ciReceiverTypeData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            ciKlass k = vdata.receiverAt(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize) + " " + k.name());
-            }
-          }
-        } else if (pdata instanceof ciVirtualCallData) {
-          ciVirtualCallData vdata = (ciVirtualCallData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            ciKlass k = vdata.receiverAt(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize + " " + k.name()));
-            }
-          }
+        if (pdata instanceof ReceiverTypeData) {
+          count = dumpReplayDataReceiverTypeHelper(out, round, count, (ReceiverTypeData<ciKlass,ciMethod>)pdata);
+        }
+        if (pdata instanceof CallTypeDataInterface) {
+          count = dumpReplayDataCallTypeHelper(out, round, count, (CallTypeDataInterface<ciKlass>)pdata);
         }
       }
+      if (parameters != null) {
+        for (int i = 0; i < parameters.numberOfParameters(); i++) {
+          count = dumpReplayDataTypeHelper(out, round, count, ParametersTypeData.typeIndex(i), parameters, parameters.type(i));
+        }
+      }
+    }
+    count = 0;
+    for (int round = 0; round < 2; round++) {
+      if (round == 1) out.print(" methods " + count);
+      count = dumpReplayDataExtraDataHelper(out, round, count);
     }
     out.println();
   }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.ci;
-
-import java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.types.*;
-
-public class ciReceiverTypeData extends ReceiverTypeData {
-  public ciReceiverTypeData(DataLayout data) {
-    super(data);
-  }
-
-  public Klass receiver(int row) {
-      throw new InternalError("should not call");
-  }
-
-  public ciKlass receiverAt(int row) {
-    //assert((uint)row < rowLimit(), "oob");
-    ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row)));
-    if (recv != null && !(recv instanceof ciKlass)) {
-      System.err.println(recv);
-    }
-    //assert(recv == NULL || recv->isKlass(), "wrong type");
-    return (ciKlass)recv;
-  }
-
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.ci;
-
-import java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.types.*;
-
-public class ciVirtualCallData extends VirtualCallData {
-  public ciVirtualCallData(DataLayout data) {
-    super(data);
-  }
-
-  public Klass receiver(int row) {
-      throw new InternalError("should not call");
-  }
-
-  public ciKlass receiverAt(int row) {
-    //assert((uint)row < rowLimit(), "oob");
-    ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row)));
-    if (recv != null && !(recv instanceof ciKlass)) {
-      System.err.println(recv);
-    }
-    //assert(recv == NULL || recv->isKlass(), "wrong type");
-    return (ciKlass)recv;
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArgInfoData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class ArgInfoData extends ArrayData {
+
+  public ArgInfoData(DataLayout layout) {
+    super(layout);
+  }
+
+  int numberOfArgs() {
+    return arrayLen();
+  }
+
+  int argModified(int arg) {
+    return arrayUintAt(arg);
+  }
+
+  public void printDataOn(PrintStream st) {
+    printShared(st, "ArgInfoData");
+    int nargs = numberOfArgs();
+    for (int i = 0; i < nargs; i++) {
+      st.print("  0x" + Integer.toHexString(argModified(i)));
+    }
+    st.println();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// CallTypeData
+//
+// A CallTypeData is used to access profiling information about a non
+// virtual call for which we collect type information about arguments
+// and return value.
+public class CallTypeData<K,M> extends CounterData implements CallTypeDataInterface<K> {
+  final TypeStackSlotEntries<K,M> args;
+  final ReturnTypeEntry<K,M> ret;
+
+  int cellCountGlobalOffset() {
+    return CounterData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset();
+  }
+
+  int cellCountNoHeader() {
+    return uintAt(cellCountGlobalOffset());
+  }
+
+  public CallTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(layout);
+    args = new TypeStackSlotEntries<K,M>(methodData, this, CounterData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments());
+    ret = new ReturnTypeEntry<K,M>(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount());
+  }
+
+  static int staticCellCount() {
+    return -1;
+  }
+
+  public int cellCount() {
+    return CounterData.staticCellCount() +
+      TypeEntriesAtCall.headerCellCount() +
+      intAt(cellCountGlobalOffset());
+  }
+
+  public int numberOfArguments() {
+    return cellCountNoHeader() / TypeStackSlotEntries.perArgCount();
+  }
+
+  public boolean hasArguments() {
+    return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount();
+  }
+
+  public K argumentType(int i) {
+    return args.type(i);
+  }
+
+  public boolean hasReturn() {
+    return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0;
+  }
+
+  public K returnType() {
+    return ret.type();
+  }
+
+  public int argumentTypeIndex(int i) {
+    return args.typeIndex(i);
+  }
+
+  public int returnTypeIndex() {
+    return ret.typeIndex();
+  }
+
+  public void printDataOn(PrintStream st) {
+    super.printDataOn(st);
+    if (hasArguments()) {
+      tab(st);
+      st.print("argument types");
+      args.printDataOn(st);
+    }
+    if (hasReturn()) {
+      tab(st);
+      st.print("return type");
+      ret.printDataOn(st);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeDataInterface.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+public interface CallTypeDataInterface<K> {
+  int numberOfArguments();
+  boolean hasArguments();
+  K argumentType(int i);
+  boolean hasReturn();
+  K returnType();
+  int argumentTypeIndex(int i);
+  int returnTypeIndex();
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java	Wed Jul 05 19:42:29 2017 +0200
@@ -41,6 +41,11 @@
   public static final int retDataTag = 6;
   public static final int branchDataTag = 7;
   public static final int multiBranchDataTag = 8;
+  public static final int argInfoDataTag = 9;
+  public static final int callTypeDataTag = 10;
+  public static final int virtualCallTypeDataTag = 11;
+  public static final int parametersTypeDataTag = 12;
+  public static final int speculativeTrapDataTag = 13;
 
   // The _struct._flags word is formatted as [trapState:4 | flags:4].
   // The trap state breaks down further as [recompile:1 | reason:3].
@@ -61,8 +66,6 @@
 
   private int offset;
 
-  private boolean handlized;
-
   public DataLayout(MethodData d, int o) {
     data = d.getAddress();
     offset = o;
@@ -71,7 +74,6 @@
   public DataLayout(Address d, int o) {
     data = d;
     offset = o;
-    handlized = true;
   }
 
   public int dp() { return offset; }
@@ -90,12 +92,7 @@
   }
 
   public Address addressAt(int index) {
-    OopHandle handle;
-    if (handlized) {
-      return data.getAddressAt(offset + cellOffset(index));
-    } else {
-      return data.getOopHandleAt(offset + cellOffset(index));
-    }
+    return data.getAddressAt(offset + cellOffset(index));
   }
 
   // Every data layout begins with a header.  This header
@@ -128,7 +125,7 @@
     return 1;
   }
 
-  static int computeSizeInBytes(int cellCount) {
+  static public int computeSizeInBytes(int cellCount) {
     return headerSizeInBytes() + cellCount * MethodData.cellSize;
   }
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Wed Jul 05 19:42:29 2017 +0200
@@ -354,9 +354,7 @@
       }
       Klass holder = getMethodHolder();
       out.println("ciMethod " +
-                  holder.getName().asString() + " " +
-                  OopUtilities.escapeString(getName().asString()) + " " +
-                  getSignature().asString() + " " +
+                  nameAsAscii() + " " +
                   getInvocationCount() + " " +
                   getBackedgeCount() + " " +
                   interpreterInvocationCount() + " " +
@@ -371,4 +369,10 @@
   public int interpreterInvocationCount() {
     return getMethodCounters().interpreterInvocationCount();
   }
+
+  public String nameAsAscii() {
+    return getMethodHolder().getName().asString() + " " +
+      OopUtilities.escapeString(getName().asString()) + " " +
+      getSignature().asString();
+  }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -33,7 +33,7 @@
 
 // A MethodData provides interpreter profiling information
 
-public class MethodData extends Metadata {
+public class MethodData extends Metadata implements MethodDataInterface<Klass,Method> {
   static int TypeProfileWidth = 2;
   static int BciProfileWidth = 2;
   static int CompileThreshold;
@@ -152,6 +152,8 @@
     dataSize     = new CIntField(type.getCIntegerField("_data_size"), 0);
     data         = type.getAddressField("_data[0]");
 
+    parametersTypeDataDi = new CIntField(type.getCIntegerField("_parameters_type_data_di"), 0);
+
     sizeofMethodDataOopDesc = (int)type.getSize();;
 
     Reason_many            = db.lookupIntConstant("Deoptimization::Reason_many").intValue();
@@ -191,6 +193,22 @@
     super(addr);
   }
 
+  public Klass getKlassAtAddress(Address addr) {
+    return (Klass)Metadata.instantiateWrapperFor(addr);
+  }
+
+  public Method getMethodAtAddress(Address addr) {
+    return (Method)Metadata.instantiateWrapperFor(addr);
+  }
+
+  public void printKlassValueOn(Klass klass, PrintStream st) {
+    klass.printValueOn(st);
+  }
+
+  public void printMethodValueOn(Method method, PrintStream st) {
+    method.printValueOn(st);
+  }
+
   public boolean isMethodData()        { return true; }
 
   private static long baseOffset;
@@ -198,7 +216,7 @@
   private static MetadataField  method;
   private static CIntField dataSize;
   private static AddressField data;
-
+  private static CIntField parametersTypeDataDi;
   public static int sizeofMethodDataOopDesc;
   public static int cellSize;
 
@@ -225,6 +243,27 @@
     }
   }
 
+  int sizeInBytes() {
+    if (size == null) {
+      return 0;
+    } else {
+      return (int)size.getValue(getAddress());
+    }
+  }
+
+  int size() {
+    return (int)Oop.alignObjectSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord());
+  }
+
+  ParametersTypeData<Klass,Method> parametersTypeData() {
+    int di = (int)parametersTypeDataDi.getValue(getAddress());
+    if (di == -1) {
+      return null;
+    }
+    DataLayout dataLayout = new DataLayout(this, di + (int)data.getOffset());
+    return new ParametersTypeData<Klass,Method>(this, dataLayout);
+  }
+
   boolean outOfBounds(int dataIndex) {
     return dataIndex >= dataSize();
   }
@@ -246,15 +285,21 @@
     case DataLayout.jumpDataTag:
       return new JumpData(dataLayout);
     case DataLayout.receiverTypeDataTag:
-      return new ReceiverTypeData(dataLayout);
+      return new ReceiverTypeData<Klass,Method>(this, dataLayout);
     case DataLayout.virtualCallDataTag:
-      return new VirtualCallData(dataLayout);
+      return new VirtualCallData<Klass,Method>(this, dataLayout);
     case DataLayout.retDataTag:
       return new RetData(dataLayout);
     case DataLayout.branchDataTag:
       return new BranchData(dataLayout);
     case DataLayout.multiBranchDataTag:
       return new MultiBranchData(dataLayout);
+    case DataLayout.callTypeDataTag:
+      return new CallTypeData<Klass,Method>(this, dataLayout);
+    case DataLayout.virtualCallTypeDataTag:
+      return new VirtualCallTypeData<Klass,Method>(this, dataLayout);
+    case DataLayout.parametersTypeDataTag:
+      return new ParametersTypeData<Klass,Method>(this, dataLayout);
     }
   }
 
@@ -272,7 +317,42 @@
   }
   boolean isValid(ProfileData current) { return current != null; }
 
+  DataLayout limitDataPosition() {
+    return new DataLayout(this, dataSize() + (int)data.getOffset());
+  }
+
+  DataLayout extraDataBase() {
+    return limitDataPosition();
+  }
+
+  DataLayout extraDataLimit() {
+    return new DataLayout(this, sizeInBytes());
+  }
+
+  static public int extraNbCells(DataLayout dataLayout) {
+    int nbCells = 0;
+    switch(dataLayout.tag()) {
+    case DataLayout.bitDataTag:
+    case DataLayout.noTag:
+      nbCells = BitData.staticCellCount();
+      break;
+    case DataLayout.speculativeTrapDataTag:
+      nbCells = SpeculativeTrapData.staticCellCount();
+      break;
+    default:
+      throw new InternalError("unexpected tag " +  dataLayout.tag());
+    }
+    return nbCells;
+  }
+
+  DataLayout nextExtra(DataLayout dataLayout) {
+    return new DataLayout(this, dataLayout.dp() + DataLayout.computeSizeInBytes(extraNbCells(dataLayout)));
+  }
+
   public void printDataOn(PrintStream st) {
+    if (parametersTypeData() != null) {
+      parametersTypeData().printDataOn(st);
+    }
     ProfileData data = firstData();
     for ( ; isValid(data); data = nextData(data)) {
       st.print(dpToDi(data.dp()));
@@ -280,6 +360,31 @@
       // st->fillTo(6);
       data.printDataOn(st);
     }
+    st.println("--- Extra data:");
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+    for (;; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+        continue;
+      case DataLayout.bitDataTag:
+        data = new BitData(dp);
+        break;
+      case DataLayout.speculativeTrapDataTag:
+        data = new SpeculativeTrapData<Klass,Method>(this, dp);
+        break;
+      case DataLayout.argInfoDataTag:
+        data = new ArgInfoData(dp);
+        dp = end; // ArgInfoData is at the end of extra data section.
+        break;
+      default:
+        throw new InternalError("unexpected tag " +  dp.tag());
+      }
+      st.print(dpToDi(data.dp()));
+      st.print(" ");
+      data.printDataOn(st);
+      if (dp == end) return;
+    }
   }
 
   private byte[] fetchDataAt(Address base, long offset, long size) {
@@ -332,14 +437,71 @@
     return 20000;
   }
 
+  int dumpReplayDataTypeHelper(PrintStream out, int round, int count, int index, ProfileData pdata, Klass k) {
+    if (k != null) {
+      if (round == 0) count++;
+      else out.print(" " +
+                     (dpToDi(pdata.dp() +
+                             pdata.cellOffset(index)) / cellSize) + " " +
+                     k.getName().asString());
+    }
+    return count;
+  }
+
+  int dumpReplayDataReceiverTypeHelper(PrintStream out, int round, int count, ReceiverTypeData<Klass,Method> vdata) {
+    for (int i = 0; i < vdata.rowLimit(); i++) {
+      Klass k = vdata.receiver(i);
+      count = dumpReplayDataTypeHelper(out, round, count, vdata.receiverCellIndex(i), vdata, k);
+    }
+    return count;
+  }
+
+  int dumpReplayDataCallTypeHelper(PrintStream out, int round, int count, CallTypeDataInterface<Klass> callTypeData) {
+    if (callTypeData.hasArguments()) {
+      for (int i = 0; i < callTypeData.numberOfArguments(); i++) {
+        count = dumpReplayDataTypeHelper(out, round, count, callTypeData.argumentTypeIndex(i), (ProfileData)callTypeData, callTypeData.argumentType(i));
+      }
+    }
+    if (callTypeData.hasReturn()) {
+      count = dumpReplayDataTypeHelper(out, round, count, callTypeData.returnTypeIndex(), (ProfileData)callTypeData, callTypeData.returnType());
+    }
+    return count;
+  }
+
+  int dumpReplayDataExtraDataHelper(PrintStream out, int round, int count) {
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+
+    for (;dp != end; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+      case DataLayout.argInfoDataTag:
+        return count;
+      case DataLayout.bitDataTag:
+        break;
+      case DataLayout.speculativeTrapDataTag: {
+        SpeculativeTrapData<Klass,Method> data = new SpeculativeTrapData<Klass,Method>(this, dp);
+        Method m = data.method();
+        if (m != null) {
+          if (round == 0) {
+            count++;
+          } else {
+            out.print(" " +  (dpToDi(data.dp() + data.cellOffset(SpeculativeTrapData.methodIndex())) / cellSize) + " " +  m.nameAsAscii());
+          }
+        }
+        break;
+      }
+      default:
+        throw new InternalError("bad tag "  + dp.tag());
+      }
+    }
+    return count;
+  }
+
   public void dumpReplayData(PrintStream out) {
     Method method = getMethod();
-    Klass holder = method.getMethodHolder();
-    out.print("ciMethodData " +
-              holder.getName().asString() + " " +
-              OopUtilities.escapeString(method.getName().asString()) + " " +
-              method.getSignature().asString() + " " +
-              "2" + " " +
+    out.print("ciMethodData " + method.nameAsAscii()
+              + " " + "2" + " " +
               currentMileage());
     byte[] orig = orig();
     out.print(" orig " + orig.length);
@@ -353,36 +515,28 @@
       out.print(" 0x" + Long.toHexString(data[i]));
     }
     int count = 0;
+    ParametersTypeData<Klass,Method> parameters = parametersTypeData();
     for (int round = 0; round < 2; round++) {
       if (round == 1) out.print(" oops " + count);
       ProfileData pdata = firstData();
       for ( ; isValid(pdata); pdata = nextData(pdata)) {
         if (pdata instanceof ReceiverTypeData) {
-          ReceiverTypeData vdata = (ReceiverTypeData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            Klass k = vdata.receiver(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " +
-                             (dpToDi(vdata.dp() +
-                              vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " +
-                             k.getName().asString());
-            }
-          }
-        } else if (pdata instanceof VirtualCallData) {
-          VirtualCallData vdata = (VirtualCallData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            Klass k = vdata.receiver(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " +
-                             (dpToDi(vdata.dp() +
-                              vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " +
-                             k.getName().asString());
-            }
-          }
+          count = dumpReplayDataReceiverTypeHelper(out, round, count, (ReceiverTypeData<Klass,Method>)pdata);
+        }
+        if (pdata instanceof CallTypeDataInterface) {
+          count = dumpReplayDataCallTypeHelper(out, round, count, (CallTypeDataInterface<Klass>)pdata);
         }
       }
+      if (parameters != null) {
+        for (int i = 0; i < parameters.numberOfParameters(); i++) {
+          count = dumpReplayDataTypeHelper(out, round, count, ParametersTypeData.typeIndex(i), parameters, parameters.type(i));
+        }
+      }
+    }
+    count = 0;
+    for (int round = 0; round < 2; round++) {
+      if (round == 1) out.print(" methods " + count);
+      count = dumpReplayDataExtraDataHelper(out, round, count);
     }
     out.println();
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MethodDataInterface.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public interface MethodDataInterface<K, M> {
+  K getKlassAtAddress(Address addr);
+  M getMethodAtAddress(Address addr);
+  void printKlassValueOn(K klass, PrintStream st);
+  void printMethodValueOn(M klass, PrintStream st);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ParametersTypeData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// ParametersTypeData
+//
+// A ParametersTypeData is used to access profiling information about
+// types of parameters to a method
+public class ParametersTypeData<K,M> extends ArrayData {
+  final TypeStackSlotEntries<K,M> parameters;
+
+  static int stackSlotLocalOffset(int i) {
+    return arrayStartOffSet + TypeStackSlotEntries.stackSlotLocalOffset(i);
+  }
+
+  static int typeLocalOffset(int i) {
+    return arrayStartOffSet + TypeStackSlotEntries.typeLocalOffset(i);
+  }
+
+  public ParametersTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(layout);
+    parameters = new TypeStackSlotEntries<K,M>(methodData, this, 1, numberOfParameters());
+  }
+
+  public int numberOfParameters() {
+    return arrayLen() / TypeStackSlotEntries.perArgCount();
+  }
+
+  int stackSlot(int i) {
+    return parameters.stackSlot(i);
+  }
+
+  public K type(int i) {
+    return parameters.type(i);
+  }
+
+  static public int typeIndex(int i) {
+    return typeLocalOffset(i);
+  }
+
+  public void printDataOn(PrintStream st) {
+    st.print("parameter types");
+    parameters.printDataOn(st);
+  }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -37,13 +37,15 @@
 // dynamic type check.  It consists of a counter which counts the total times
 // that the check is reached, and a series of (Klass, count) pairs
 // which are used to store a type profile for the receiver of the check.
-public class ReceiverTypeData extends CounterData {
+public class ReceiverTypeData<K,M> extends CounterData {
   static final int   receiver0Offset = counterCellCount;
   static final int     count0Offset = receiver0Offset + 1;
   static final int     receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset;
+  final MethodDataInterface<K,M> methodData;
 
-  public ReceiverTypeData(DataLayout layout) {
+  public ReceiverTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
     super(layout);
+    this.methodData = methodData;
     //assert(layout.tag() == DataLayout.receiverTypeDataTag ||
     //       layout.tag() == DataLayout.virtualCallDataTag, "wrong type");
   }
@@ -73,14 +75,14 @@
   // gc; it does not assert the receiver is a klass.  During compaction of the
   // perm gen, the klass may already have moved, so the isKlass() predicate
   // would fail.  The 'normal' version should be used whenever possible.
-  Klass receiverUnchecked(int row) {
+  K receiverUnchecked(int row) {
     //assert(row < rowLimit(), "oob");
     Address recv = addressAt(receiverCellIndex(row));
-    return (Klass)Metadata.instantiateWrapperFor(recv);
+    return methodData.getKlassAtAddress(recv);
   }
 
-  public Klass receiver(int row) {
-    Klass recv = receiverUnchecked(row);
+  public K receiver(int row) {
+    K recv = receiverUnchecked(row);
     //assert(recv == NULL || ((oop)recv).isKlass(), "wrong type");
     return recv;
   }
@@ -111,7 +113,7 @@
     for (row = 0; row < rowLimit(); row++) {
       if (receiver(row) != null) {
         tab(st);
-        receiver(row).printValueOn(st);
+        methodData.printKlassValueOn(receiver(row), st);
         st.println("(" + receiverCount(row) + ")");
       }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ReturnTypeEntry.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Type entry used for return from a call. A single cell to record the
+// type.
+public class ReturnTypeEntry<K,M> extends TypeEntries<K,M> {
+  static final int cellCount = 1;
+
+  ReturnTypeEntry(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff) {
+    super(methodData, pd, baseOff);
+  }
+
+  K type() {
+    return validKlass(baseOff);
+  }
+
+  static int staticCellCount() {
+    return cellCount;
+  }
+
+  int typeIndex() {
+    return baseOff;
+  }
+
+  void printDataOn(PrintStream st) {
+    pd.tab(st);
+    printKlass(st, baseOff);
+    st.println();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/SpeculativeTrapData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// SpeculativeTrapData
+//
+// A SpeculativeTrapData is used to record traps due to type
+// speculation. It records the root of the compilation.
+public class SpeculativeTrapData<K, M> extends ProfileData {
+  static final int speculativeTrapMethod = 0;
+  static final int speculativeTrapCellCount = 1;
+  final MethodDataInterface<K, M> methodData;
+
+  public SpeculativeTrapData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(layout);
+    this.methodData = methodData;
+  }
+
+  static int staticCellCount() {
+    return speculativeTrapCellCount;
+  }
+
+  public int cellCount() {
+    return staticCellCount();
+  }
+
+  public M method() {
+    return methodData.getMethodAtAddress(addressAt(speculativeTrapMethod));
+  }
+
+  static public int methodIndex() {
+    return speculativeTrapMethod;
+  }
+
+  public void printDataOn(PrintStream st) {
+    printShared(st, "SpeculativeTrapData");
+    tab(st);
+    methodData.printMethodValueOn(method(), st);
+    st.println();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntries.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Entries in a ProfileData object to record types: it can either be
+// none (no profile), unknown (conflicting profile data) or a klass if
+// a single one is seen. Whether a null reference was seen is also
+// recorded. No counter is associated with the type and a single type
+// is tracked (unlike VirtualCallData).
+public abstract class TypeEntries<K,M> {
+  static final int nullSeen = 1;
+  static final int typeMask = ~nullSeen;
+  static final int typeUnknown = 2;
+  static final int statusBits = nullSeen | typeUnknown;
+  static final int typeKlassMask = ~statusBits;
+
+  final ProfileData pd;
+  final int baseOff;
+  final MethodDataInterface<K,M> methodData;
+
+  boolean wasNullSeen(int index) {
+    int v = pd.intptrAt(index);
+    return (v & nullSeen) != 0;
+  }
+
+  boolean isTypeUnknown(int index) {
+    int v = pd.intptrAt(index);
+    return (v & typeUnknown) != 0;
+  }
+
+  boolean isTypeNone(int index) {
+    int v = pd.intptrAt(index);
+    return (v & typeMask) == 0;
+  }
+
+  K validKlass(int index) {
+    if (!isTypeNone(index) &&
+        !isTypeUnknown(index)) {
+      return methodData.getKlassAtAddress(pd.addressAt(index).andWithMask(typeKlassMask));
+    } else {
+      return null;
+    }
+  }
+
+  void printKlass(PrintStream st, int index) {
+    if (isTypeNone(index)) {
+      st.print("none");
+    } else if (isTypeUnknown(index)) {
+      st.print("unknown");
+    } else {
+      methodData.printKlassValueOn(validKlass(index), st);
+    }
+    if (wasNullSeen(index)) {
+      st.print(" (null seen)");
+    }
+  }
+
+  TypeEntries(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff) {
+    this.pd = pd;
+    this.baseOff = baseOff;
+    this.methodData = methodData;
+  }
+
+  long intptrAt(int index) {
+    return pd.intptrAt(index);
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntriesAtCall.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Entries to collect type information at a call: contains arguments
+// (TypeStackSlotEntries), a return type (ReturnTypeEntry) and a
+// number of cells.
+public abstract class TypeEntriesAtCall {
+
+  static int stackSlotLocalOffset(int i) {
+    return headerCellCount() + TypeStackSlotEntries.stackSlotLocalOffset(i);
+  }
+
+  static int argumentTypeLocalOffset(int i) {
+    return headerCellCount() + TypeStackSlotEntries.typeLocalOffset(i);
+  }
+
+  static int headerCellCount() {
+    return 1;
+  }
+
+  static int cellCountLocalOffset() {
+    return 0;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeStackSlotEntries.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Type entries used for arguments passed at a call and parameters on
+// method entry. 2 cells per entry: one for the type encoded as in
+// TypeEntries and one initialized with the stack slot where the
+// profiled object is to be found so that the interpreter can locate
+// it quickly.
+public class TypeStackSlotEntries<K,M> extends TypeEntries<K,M> {
+  static final int stackSlotEntry = 0;
+  static final int typeEntry = 1;
+  static final int perArgCellCount = 2;
+
+  int stackSlotOffset(int i) {
+    return baseOff + stackSlotLocalOffset(i);
+  }
+
+  final int numberOfEntries;
+
+  int typeOffsetInCells(int i) {
+    return baseOff + typeLocalOffset(i);
+  }
+
+  TypeStackSlotEntries(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff, int nbEntries) {
+    super(methodData, pd, baseOff);
+    numberOfEntries = nbEntries;
+  }
+
+  static int stackSlotLocalOffset(int i) {
+    return i * perArgCellCount + stackSlotEntry;
+  }
+
+  static int typeLocalOffset(int i) {
+    return i * perArgCellCount + typeEntry;
+  }
+
+  int stackSlot(int i) {
+    return pd.uintAt(stackSlotOffset(i));
+  }
+
+  K type(int i) {
+    return validKlass(typeOffsetInCells(i));
+  }
+
+  static int perArgCount() {
+    return perArgCellCount;
+  }
+
+  int typeIndex(int i) {
+    return typeOffsetInCells(i);
+  }
+
+  void printDataOn(PrintStream st) {
+    for (int i = 0; i < numberOfEntries; i++) {
+      pd.tab(st);
+      st.print(i + ": stack(" + stackSlot(i)+ ") ");
+      printKlass(st, typeOffsetInCells(i));
+      st.println();
+    }
+  }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -35,9 +35,9 @@
 //
 // A VirtualCallData is used to access profiling information about a
 // call.  For now, it has nothing more than a ReceiverTypeData.
-public class VirtualCallData extends ReceiverTypeData {
-  public VirtualCallData(DataLayout layout) {
-    super(layout);
+public class VirtualCallData<K,M> extends ReceiverTypeData<K,M> {
+  public VirtualCallData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(methodData, layout);
     //assert(layout.tag() == DataLayout.virtualCallDataTag, "wrong type");
   }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallTypeData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// VirtualCallTypeData
+//
+// A VirtualCallTypeData is used to access profiling information about
+// a virtual call for which we collect type information about
+// arguments and return value.
+public class VirtualCallTypeData<K,M> extends VirtualCallData implements CallTypeDataInterface<K> {
+  final TypeStackSlotEntries<K,M> args;
+  final ReturnTypeEntry<K,M> ret;
+
+  int cellCountGlobalOffset() {
+    return VirtualCallData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset();
+  }
+
+  int cellCountNoHeader() {
+    return uintAt(cellCountGlobalOffset());
+  }
+
+  public VirtualCallTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(methodData, layout);
+    args = new TypeStackSlotEntries<K,M>(methodData, this, VirtualCallData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments());
+    ret = new ReturnTypeEntry<K,M>(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount());
+  }
+
+  static int staticCellCount() {
+    return -1;
+  }
+
+  public int cellCount() {
+    return VirtualCallData.staticCellCount() +
+      TypeEntriesAtCall.headerCellCount() +
+      intAt(cellCountGlobalOffset());
+  }
+
+  public int numberOfArguments() {
+    return cellCountNoHeader() / TypeStackSlotEntries.perArgCount();
+  }
+
+  public boolean hasArguments() {
+    return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount();
+  }
+
+  public K argumentType(int i) {
+    return args.type(i);
+  }
+
+  public boolean hasReturn() {
+    return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0;
+  }
+
+  public K returnType() {
+    return ret.type();
+  }
+
+  public int argumentTypeIndex(int i) {
+    return args.typeIndex(i);
+  }
+
+  public int returnTypeIndex() {
+    return ret.typeIndex();
+  }
+
+  public void printDataOn(PrintStream st) {
+    super.printDataOn(st);
+    if (hasArguments()) {
+      tab(st);
+      st.print("argument types");
+      args.printDataOn(st);
+    }
+    if (hasReturn()) {
+      tab(st);
+      st.print("return type");
+      ret.printDataOn(st);
+    }
+  }
+};
--- a/hotspot/make/aix/makefiles/vm.make	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/make/aix/makefiles/vm.make	Wed Jul 05 19:42:29 2017 +0200
@@ -136,8 +136,6 @@
 JVM      = jvm
 LIBJVM   = lib$(JVM).so
 
-CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
 
--- a/hotspot/make/bsd/makefiles/vm.make	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/make/bsd/makefiles/vm.make	Wed Jul 05 19:42:29 2017 +0200
@@ -146,9 +146,6 @@
 ifeq ($(OS_VENDOR), Darwin)
   LIBJVM   = lib$(JVM).dylib
   CFLAGS  += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-  ifeq (${VERSION}, $(filter ${VERSION}, debug fastdebug))
-    CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-  endif
 
   LIBJVM_DEBUGINFO   = lib$(JVM).dylib.dSYM
   LIBJVM_DIZ         = lib$(JVM).diz
--- a/hotspot/make/excludeSrc.make	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/make/excludeSrc.make	Wed Jul 05 19:42:29 2017 +0200
@@ -77,30 +77,40 @@
       CXXFLAGS += -DINCLUDE_ALL_GCS=0
       CFLAGS += -DINCLUDE_ALL_GCS=0
 
-      Src_Files_EXCLUDE += \
-	cmsAdaptiveSizePolicy.cpp cmsCollectorPolicy.cpp \
-	cmsGCAdaptivePolicyCounters.cpp cmsLockVerifier.cpp compactibleFreeListSpace.cpp \
-	concurrentMarkSweepGeneration.cpp concurrentMarkSweepThread.cpp \
-	freeChunk.cpp adaptiveFreeList.cpp promotionInfo.cpp vmCMSOperations.cpp \
-	collectionSetChooser.cpp concurrentG1Refine.cpp concurrentG1RefineThread.cpp \
-	concurrentMark.cpp concurrentMarkThread.cpp dirtyCardQueue.cpp g1AllocRegion.cpp \
-	g1BlockOffsetTable.cpp g1CardCounts.cpp g1CollectedHeap.cpp g1CollectorPolicy.cpp \
-	g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \
-	g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp g1OopClosures.cpp \
-	g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1StringDedup.cpp g1StringDedupStat.cpp \
-	g1StringDedupTable.cpp g1StringDedupThread.cpp g1StringDedupQueue.cpp g1_globals.cpp heapRegion.cpp \
-	g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \
-	ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp g1CodeCacheRemSet.cpp \
-	adjoiningGenerations.cpp adjoiningVirtualSpaces.cpp asPSOldGen.cpp asPSYoungGen.cpp \
-	cardTableExtension.cpp gcTaskManager.cpp gcTaskThread.cpp objectStartArray.cpp \
-	parallelScavengeHeap.cpp parMarkBitMap.cpp pcTasks.cpp psAdaptiveSizePolicy.cpp \
-	psCompactionManager.cpp psGCAdaptivePolicyCounters.cpp psGenerationCounters.cpp \
-	psMarkSweep.cpp psMarkSweepDecorator.cpp psMemoryPool.cpp psOldGen.cpp \
-	psParallelCompact.cpp psPromotionLAB.cpp psPromotionManager.cpp psScavenge.cpp \
-	psTasks.cpp psVirtualspace.cpp psYoungGen.cpp vmPSOperations.cpp asParNewGeneration.cpp \
-	parCardTableModRefBS.cpp parGCAllocBuffer.cpp parNewGeneration.cpp mutableSpace.cpp \
-	gSpaceCounters.cpp allocationStats.cpp spaceCounters.cpp gcAdaptivePolicyCounters.cpp \
-	mutableNUMASpace.cpp immutableSpace.cpp yieldingWorkGroup.cpp hSpaceCounters.cpp
+      gc_impl := $(GAMMADIR)/src/share/vm/gc_implementation
+      gc_exclude :=							\
+	$(notdir $(wildcard $(gc_impl)/concurrentMarkSweep/*.cpp))	\
+	$(notdir $(wildcard $(gc_impl)/g1/*.cpp))			\
+	$(notdir $(wildcard $(gc_impl)/parallelScavenge/*.cpp))		\
+	$(notdir $(wildcard $(gc_impl)/parNew/*.cpp))
+      Src_Files_EXCLUDE += $(gc_exclude)
+
+      # Exclude everything in $(gc_impl)/shared except the files listed
+      # in $(gc_shared_keep).
+      gc_shared_all := $(notdir $(wildcard $(gc_impl)/shared/*.cpp))
+      gc_shared_keep :=							\
+	adaptiveSizePolicy.cpp						\
+	ageTable.cpp							\
+	collectorCounters.cpp						\
+	cSpaceCounters.cpp						\
+	gcPolicyCounters.cpp						\
+	gcStats.cpp							\
+	gcTimer.cpp							\
+	gcTrace.cpp							\
+	gcTraceSend.cpp							\
+	gcTraceTime.cpp							\
+	gcUtil.cpp							\
+	generationCounters.cpp						\
+	markSweep.cpp							\
+	objectCountEventSender.cpp					\
+	spaceDecorator.cpp						\
+	vmGCOperations.cpp
+      Src_Files_EXCLUDE += $(filter-out $(gc_shared_keep),$(gc_shared_all))
+
+      # src/share/vm/services
+      Src_Files_EXCLUDE +=						\
+	g1MemoryPool.cpp						\
+	psMemoryPool.cpp
 endif
 
 ifeq ($(INCLUDE_NMT), false)
--- a/hotspot/make/windows/projectfiles/common/Makefile	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/make/windows/projectfiles/common/Makefile	Wed Jul 05 19:42:29 2017 +0200
@@ -93,7 +93,7 @@
 !if "$(HOTSPOT_RELEASE_VERSION)" != ""
 HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
 !else
-HOTSPOT_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
+HOTSPOT_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 !endif
 # Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set,
 # and if it is not see if we have the src/closed directory
@@ -105,9 +105,18 @@
 !else
 HOTSPOT_VM_DISTRO="\\\"OpenJDK\\\""
 !endif
+!if "$(JDK_BUILD_NUMBER)" != ""
+JDK_BUILD_NUMBER="\\\"$(JDK_BUILD_NUMBER)\\\""
+!else
+JDK_BUILD_NUMBER="\\\"00\\\""
+!endif
 !endif
 
-ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO)
+JDK_MAJOR_VERSION="\\\"$(JDK_MAJOR_VER)\\\""
+JDK_MINOR_VERSION="\\\"$(JDK_MINOR_VER)\\\""
+JDK_MICRO_VERSION="\\\"$(JDK_MICRO_VER)\\\""
+
+ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) -define JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) -define JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) -define JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER)
 ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
 
 $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
--- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -41,7 +41,6 @@
 define_pd_global(bool, ProfileInterpreter,           true);
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            140000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         3);
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -149,7 +149,7 @@
 }
 
 void VM_Version::print_features() {
-  tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), get_cache_line_size());
+  tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), (int) get_cache_line_size());
 }
 
 #ifdef COMPILER2
--- a/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -414,6 +414,7 @@
 
 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
+  __ set(_trap_request, G4);
   __ call(Runtime1::entry_for(Runtime1::deoptimize_id), relocInfo::runtime_call_type);
   __ delayed()->nop();
   ce->add_call_info_here(_info);
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -781,7 +781,7 @@
       {
         __ set_info("deoptimize", dont_gc_arguments);
         OopMap* oop_map = save_live_registers(sasm);
-        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
+        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), G4);
         oop_maps = new OopMapSet();
         oop_maps->add_gc_map(call_offset, oop_map);
         restore_live_registers(sasm);
--- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -40,7 +40,6 @@
 define_pd_global(bool, UseOnStackReplacement,        true );
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             1000 ); // Design center runs on 1.3.1
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     1400 );
 define_pd_global(bool, UseTLAB,                      true );
--- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -44,7 +44,6 @@
 #endif // CC_INTERP
 define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            140000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         4);
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -3653,9 +3653,9 @@
     const Register len_reg = I4; // cipher length
     const Register keylen = I5;  // reg for storing expanded key array length
 
-    // save cipher len before save_frame, to return in the end
-    __ mov(O4, L0);
     __ save_frame(0);
+    // save cipher len to return in the end
+    __ mov(len_reg, L0);
 
     // read expanded key length
     __ ldsw(Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)), keylen, 0);
@@ -3778,9 +3778,9 @@
     // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stf(FloatRegisterImpl::D, F60, rvec, 0);
     __ stf(FloatRegisterImpl::D, F62, rvec, 8);
-    __ restore();
-    __ retl();
-    __ delayed()->mov(L0, O0);
+    __ mov(L0, I0);
+    __ ret();
+    __ delayed()->restore();
 
     __ align(OptoLoopAlignment);
     __ BIND(L_cbcenc192);
@@ -3869,9 +3869,9 @@
     // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stf(FloatRegisterImpl::D, F60, rvec, 0);
     __ stf(FloatRegisterImpl::D, F62, rvec, 8);
-    __ restore();
-    __ retl();
-    __ delayed()->mov(L0, O0);
+    __ mov(L0, I0);
+    __ ret();
+    __ delayed()->restore();
 
     __ align(OptoLoopAlignment);
     __ BIND(L_cbcenc256);
@@ -3962,9 +3962,9 @@
     // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stf(FloatRegisterImpl::D, F60, rvec, 0);
     __ stf(FloatRegisterImpl::D, F62, rvec, 8);
-    __ restore();
-    __ retl();
-    __ delayed()->mov(L0, O0);
+    __ mov(L0, I0);
+    __ ret();
+    __ delayed()->restore();
 
     return start;
   }
@@ -3992,9 +3992,9 @@
     const Register original_key = I5;  // original key array only required during decryption
     const Register keylen = L6;  // reg for storing expanded key array length
 
-    // save cipher len before save_frame, to return in the end
-    __ mov(O4, L0);
     __ save_frame(0); //args are read from I* registers since we save the frame in the beginning
+    // save cipher len to return in the end
+    __ mov(len_reg, L7);
 
     // load original key from SunJCE expanded decryption key
     // Since we load original key buffer starting first element, 8-byte alignment is guaranteed
@@ -4568,10 +4568,9 @@
     // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stx(L0, rvec, 0);
     __ stx(L1, rvec, 8);
-    __ restore();
-    __ mov(L0, O0);
-    __ retl();
-    __ delayed()->nop();
+    __ mov(L7, I0);
+    __ ret();
+    __ delayed()->restore();
 
     return start;
   }
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -318,22 +318,22 @@
           tty->print("BIS");
       }
       if (AllocatePrefetchLines > 1) {
-        tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
       } else {
-        tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
       }
     }
     if (PrefetchCopyIntervalInBytes > 0) {
-      tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
+      tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
     }
     if (PrefetchScanIntervalInBytes > 0) {
-      tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
+      tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
     }
     if (PrefetchFieldsAhead > 0) {
-      tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
+      tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
     }
     if (ContendedPaddingWidth > 0) {
-      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+      tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
     }
   }
 #endif // PRODUCT
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,11 +522,11 @@
     // these asserts are somewhat nonsensical
 #ifndef _LP64
     assert(which == imm_operand || which == disp32_operand,
-           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip));
+           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
 #else
     assert((which == call32_operand || which == imm_operand) && is_64bit ||
            which == narrow_oop_operand && !is_64bit,
-           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip));
+           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
 #endif // _LP64
     return ip;
 
--- a/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -430,6 +430,7 @@
 
 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
+  ce->store_parameter(_trap_request, 0);
   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::deoptimize_id)));
   ce->add_call_info_here(_info);
   DEBUG_ONLY(__ should_not_reach_here());
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
 
 #ifndef PRODUCT
         if (TraceFPURegisterUsage) {
-          tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->print_cr("");
+          tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->cr();
         }
 #endif
       }
--- a/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1468,9 +1468,10 @@
     case deoptimize_id:
       {
         StubFrame f(sasm, "deoptimize", dont_gc_arguments);
-        const int num_rt_args = 1;  // thread
+        const int num_rt_args = 2;  // thread, trap_request
         OopMap* oop_map = save_live_registers(sasm, num_rt_args);
-        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
+        f.load_argument(0, rax);
+        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), rax);
         oop_maps = new OopMapSet();
         oop_maps->add_gc_map(call_offset, oop_map);
         restore_live_registers(sasm);
--- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -41,7 +41,6 @@
 define_pd_global(bool, UseOnStackReplacement,        true );
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             1500 );
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     933  );
 define_pd_global(intx, FreqInlineSize,               325  );
--- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -45,7 +45,6 @@
 #endif // CC_INTERP
 define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         3);
--- a/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/compiledIC_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@
   if (TraceICs) {
     ResourceMark rm;
     tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
-                  instruction_address(),
+                  p2i(instruction_address()),
                   callee->name_and_sig_as_C_string());
   }
 
--- a/hotspot/src/cpu/x86/vm/frame_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,7 @@
 }
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Profiling/safepoint support
 
--- a/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/interpreter_x86_64.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
 
 #define __ _masm->
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 #ifdef _WIN64
 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@
 
 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 #ifdef ASSERT
 bool AbstractAssembler::pd_check_instruction_mark() { return true; }
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "memory/allocation.inline.hpp"
 #include "prims/methodHandles.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define __ _masm->
 
 #ifdef PRODUCT
--- a/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/nativeInst_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void NativeInstruction::wrote(int offset) {
   ICache::invalidate_word(addr_at(offset));
 }
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -925,16 +925,16 @@
   if (PrintMiscellaneous && Verbose) {
     tty->print_cr("Logical CPUs per core: %u",
                   logical_processors_per_package());
-    tty->print("UseSSE=%d",UseSSE);
+    tty->print("UseSSE=%d", (int) UseSSE);
     if (UseAVX > 0) {
-      tty->print("  UseAVX=%d",UseAVX);
+      tty->print("  UseAVX=%d", (int) UseAVX);
     }
     if (UseAES) {
       tty->print("  UseAES=1");
     }
 #ifdef COMPILER2
     if (MaxVectorSize > 0) {
-      tty->print("  MaxVectorSize=%d", MaxVectorSize);
+      tty->print("  MaxVectorSize=%d", (int) MaxVectorSize);
     }
 #endif
     tty->cr();
@@ -957,23 +957,23 @@
         }
       }
       if (AllocatePrefetchLines > 1) {
-        tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
       } else {
-        tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
       }
     }
 
     if (PrefetchCopyIntervalInBytes > 0) {
-      tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
+      tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
     }
     if (PrefetchScanIntervalInBytes > 0) {
-      tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
+      tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
     }
     if (PrefetchFieldsAhead > 0) {
-      tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
+      tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
     }
     if (ContendedPaddingWidth > 0) {
-      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+      tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
     }
   }
 #endif // !PRODUCT
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
 
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
-                  vtable_index, s->entry_point(),
+                  vtable_index, p2i(s->entry_point()),
                   (int)(s->code_end() - s->entry_point()),
                   (int)(s->code_end() - __ pc()));
   }
@@ -199,7 +199,7 @@
 
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
-                  itable_index, s->entry_point(),
+                  itable_index, p2i(s->entry_point()),
                   (int)(s->code_end() - s->entry_point()),
                   (int)(s->code_end() - __ pc()));
   }
--- a/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // machine-dependent part of VtableStubs: create VtableStub of correct size and
 // initialize its code
 
--- a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -43,7 +43,6 @@
 define_pd_global(intx,     Tier3CompileThreshold,        2500);
 define_pd_global(intx,     Tier4CompileThreshold,        4500);
 
-define_pd_global(intx,     BackEdgeThreshold,            100000);
 define_pd_global(intx,     Tier2BackEdgeThreshold,       100000);
 define_pd_global(intx,     Tier3BackEdgeThreshold,       100000);
 define_pd_global(intx,     Tier4BackEdgeThreshold,       100000);
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1871,7 +1871,7 @@
 // properties.
 
 // ShmBkBlock: base class for all blocks in the shared memory bookkeeping
-class ShmBkBlock {
+class ShmBkBlock : public CHeapObj<mtInternal> {
 
   ShmBkBlock* _next;
 
--- a/hotspot/src/os/aix/vm/porting_aix.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/aix/vm/porting_aix.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "asm/assembler.hpp"
+#include "memory/allocation.hpp"
 #include "loadlib_aix.hpp"
 #include "porting_aix.hpp"
 #include "utilities/debug.hpp"
@@ -67,7 +68,7 @@
 // a primitive string map. Should this turn out to be a performance
 // problem, a better hashmap has to be used.
 class fixed_strings {
-  struct node {
+  struct node : public CHeapObj<mtInternal> {
     char* v;
     node* next;
   };
--- a/hotspot/src/os/aix/vm/thread_aix.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/aix/vm/thread_aix.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -26,12 +26,9 @@
 #ifndef OS_AIX_VM_THREAD_AIX_INLINE_HPP
 #define OS_AIX_VM_THREAD_AIX_INLINE_HPP
 
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
 
-#include "prefetch_aix_ppc.inline.hpp"
-
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
 inline void ThreadLocalStorage::pd_invalidate_all() {} // nothing to do
--- a/hotspot/src/os/bsd/vm/decoder_machO.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/bsd/vm/decoder_machO.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
   struct symtab_command * symt = (struct symtab_command *)
     mach_find_command((struct mach_header_64 *)mach_base, LC_SYMTAB);
   if (symt == NULL) {
-    DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", mach_base));
+    DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", p2i(mach_base)));
     return false;
   }
   uint32_t off = symt->symoff;          /* symbol table offset (within this mach file) */
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -124,6 +124,9 @@
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 
 #define LARGEPAGES_BIT (1 << 6)
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ////////////////////////////////////////////////////////////////////////////////
 // global variables
 julong os::Bsd::_physical_memory = 0;
@@ -2394,7 +2397,6 @@
                         (!FLAG_IS_DEFAULT(UseLargePages) ||
                          !FLAG_IS_DEFAULT(LargePageSizeInBytes)
                         );
-  char msg[128];
 
   // Create a large shared memory region to attach to based on size.
   // Currently, size is the total size of the heap
@@ -2415,8 +2417,7 @@
      //            coalesce into large pages. Try to reserve large pages when
      //            the system is still "fresh".
      if (warn_on_failure) {
-       jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
-       warning(msg);
+       warning("Failed to reserve shared memory (errno = %d).", errno);
      }
      return NULL;
   }
@@ -2433,8 +2434,7 @@
 
   if ((intptr_t)addr == -1) {
      if (warn_on_failure) {
-       jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
-       warning(msg);
+       warning("Failed to attach shared memory (errno = %d).", err);
      }
      return NULL;
   }
@@ -3810,6 +3810,7 @@
   return true;
 }
 
+ATTRIBUTE_PRINTF(3, 0)
 int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
   return ::vsnprintf(buf, count, format, args);
 }
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -925,7 +925,7 @@
 
   if (PerfTraceMemOps) {
     tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
+               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
   }
 }
 
--- a/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/bsd/vm/thread_bsd.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -31,12 +31,6 @@
 
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "prefetch_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "prefetch_bsd_zero.inline.hpp"
-#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -102,6 +102,8 @@
 # include <inttypes.h>
 # include <sys/ioctl.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
 // getrusage() is prepared to handle the associated failure.
 #ifndef RUSAGE_THREAD
@@ -2138,7 +2140,7 @@
   // Print warning if unsafe chroot environment detected
   if (unsafe_chroot_detected) {
     st->print("WARNING!! ");
-    st->print_cr(unstable_chroot_error);
+    st->print_cr("%s", unstable_chroot_error);
   }
 
   os::Linux::print_libversion_info(st);
@@ -2199,8 +2201,8 @@
 void os::Linux::print_libversion_info(outputStream* st) {
   // libc, pthread
   st->print("libc:");
-  st->print(os::Linux::glibc_version()); st->print(" ");
-  st->print(os::Linux::libpthread_version()); st->print(" ");
+  st->print("%s ", os::Linux::glibc_version());
+  st->print("%s ", os::Linux::libpthread_version());
   if (os::Linux::is_LinuxThreads()) {
      st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
   }
@@ -3417,7 +3419,7 @@
      //            the system is still "fresh".
      if (warn_on_failure) {
        jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
-       warning(msg);
+       warning("%s", msg);
      }
      return NULL;
   }
@@ -3435,7 +3437,7 @@
   if ((intptr_t)addr == -1) {
      if (warn_on_failure) {
        jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
-       warning(msg);
+       warning("%s", msg);
      }
      return NULL;
   }
@@ -3455,7 +3457,7 @@
     char msg[128];
     jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: "
         PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error);
-    warning(msg);
+    warning("%s", msg);
   }
 }
 
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -931,7 +931,7 @@
 
   if (PerfTraceMemOps) {
     tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
+               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
   }
 }
 
--- a/hotspot/src/os/linux/vm/thread_linux.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/linux/vm/thread_linux.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -29,24 +29,8 @@
 #error "This file should only be included from thread.inline.hpp"
 #endif
 
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "prefetch_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "prefetch_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "prefetch_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "prefetch_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "prefetch_linux_ppc.inline.hpp"
-#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -36,6 +36,8 @@
 #include <pthread.h>
 #include <signal.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Todo: provide a os::get_max_process_id() or similar. Number of processes
 // may have been configured, can be read more accurately from proc fs etc.
 #ifndef MAX_PID
@@ -192,10 +194,10 @@
   st->print("uname:");
   struct utsname name;
   uname(&name);
-  st->print(name.sysname); st->print(" ");
-  st->print(name.release); st->print(" ");
-  st->print(name.version); st->print(" ");
-  st->print(name.machine);
+  st->print("%s ", name.sysname);
+  st->print("%s ", name.release);
+  st->print("%s ", name.version);
+  st->print("%s", name.machine);
   st->cr();
 }
 
@@ -682,7 +684,7 @@
 void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set) {
   char buf[NUM_IMPORTANT_SIGS + 1];
   os::Posix::describe_signal_set_short(set, buf, sizeof(buf));
-  st->print(buf);
+  st->print("%s", buf);
 }
 
 // Writes one-line description of a combination of sigaction.sa_flags into a user
@@ -742,7 +744,7 @@
 void os::Posix::print_sa_flags(outputStream* st, int flags) {
   char buffer[0x100];
   os::Posix::describe_sa_flags(flags, buffer, sizeof(buffer));
-  st->print(buffer);
+  st->print("%s", buffer);
 }
 
 // Helper function for os::Posix::print_siginfo_...():
--- a/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/solaris/vm/thread_solaris.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -30,15 +30,8 @@
 #endif
 
 #include "runtime/atomic.inline.hpp"
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "prefetch_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "prefetch_solaris_sparc.inline.hpp"
-#endif
 
 // Thread::current is "hot" it's called > 128K times in the 1st 500 msecs of
 // startup.
--- a/hotspot/src/os/windows/vm/os_windows.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/windows/vm/os_windows.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -5005,7 +5005,11 @@
     // wrong; at these points, eax contains the address of the offending block (I think).
     // To get to the exlicit error message(s) below, just continue twice.
     HANDLE heap = GetProcessHeap();
-    { HeapLock(heap);
+
+    // If we fail to lock the heap, then gflags.exe has been used
+    // or some other special heap flag has been set that prevents
+    // locking. We don't try to walk a heap we can't lock.
+    if (HeapLock(heap) != 0) {
       PROCESS_HEAP_ENTRY phe;
       phe.lpData = NULL;
       while (HeapWalk(heap, &phe) != 0) {
--- a/hotspot/src/os/windows/vm/thread_windows.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os/windows/vm/thread_windows.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -29,12 +29,8 @@
 #error "This file should only be included from thread.inline.hpp"
 #endif
 
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "prefetch_windows_x86.inline.hpp"
-#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -276,6 +276,8 @@
 # endif
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 address os::current_stack_pointer() {
 #if defined(__clang__) || defined(__llvm__)
   register void *esp;
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,8 @@
 #define SPELL_REG_FP "ebp"
 #endif // AMD64
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 address os::current_stack_pointer() {
 #ifdef SPARC_WORKS
   register void *esp;
--- a/hotspot/src/share/vm/adlc/adlc.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/adlc/adlc.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -30,12 +30,13 @@
 //
 
 // standard library constants
-#include "stdio.h"
-#include "stdlib.h"
 #include <iostream>
-#include "string.h"
-#include "ctype.h"
-#include "stdarg.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
 #include <sys/types.h>
 
 /* Make sure that we have the intptr_t and uintptr_t definitions */
--- a/hotspot/src/share/vm/adlc/adlparse.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/adlc/adlparse.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -64,8 +64,6 @@
 class PeepConstraint;
 class PeepReplace;
 
-// class ostream; // ostream is a typedef in some systems
-
 extern char *toUpper(const char *str);
 
 //---------------------------ADLParser-----------------------------------------
--- a/hotspot/src/share/vm/adlc/filebuff.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/adlc/filebuff.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,8 +25,6 @@
 // FILEBUFF.CPP - Routines for handling a parser file buffer
 #include "adlc.hpp"
 
-using namespace std;
-
 //------------------------------FileBuff---------------------------------------
 // Create a new parsing buffer
 FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(archDesc) {
--- a/hotspot/src/share/vm/adlc/filebuff.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/adlc/filebuff.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -26,9 +26,6 @@
 #define SHARE_VM_ADLC_FILEBUFF_HPP
 
 // FILEBUFF.HPP - Definitions for parser file buffering routines
-#include <iostream>
-
-using namespace std;
 
 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
 
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1322,7 +1322,7 @@
     OperandForm* oper = form->is_operand();
     if (oper != NULL && oper->is_bound_register()) {
       const RegDef* first = oper->get_RegClass()->find_first_elem();
-      fprintf(fp, "    st->print(\"%s\");\n", first->_regname);
+      fprintf(fp, "    st->print_raw(\"%s\");\n", first->_regname);
     } else {
       globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var);
     }
@@ -2530,7 +2530,7 @@
   case Form::idealP: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
   case Form::idealNKlass:
   case Form::idealN: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
-  case Form::idealL: fprintf(fp,"  st->print(\"#%%lld\", _c%d);\n", const_index); break;
+  case Form::idealL: fprintf(fp,"  st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break;
   case Form::idealF: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   case Form::idealD: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   default:
--- a/hotspot/src/share/vm/adlc/output_h.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/adlc/output_h.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -211,7 +211,7 @@
     const char *type = oper->ideal_type(globals);
     if (!strcmp(type, "ConI")) {
       if (i > 0) fprintf(fp,", ");
-      fprintf(fp,"  int32          _c%d;\n", i);
+      fprintf(fp,"  int32_t        _c%d;\n", i);
     }
     else if (!strcmp(type, "ConP")) {
       if (i > 0) fprintf(fp,", ");
@@ -307,7 +307,7 @@
     assert(num_consts == 1, "Bad component list detected.\n");
     switch( constant_type ) {
     case Form::idealI : {
-      fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i);
+      fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32_t c%d", i);
       break;
     }
     case Form::idealN :      { fprintf(fp,"const TypeNarrowOop *c%d", i); break; }
@@ -326,7 +326,7 @@
     while((comp = lst.iter()) != NULL) {
       if (!strcmp(comp->base_type(globals), "ConI")) {
         if (i > 0) fprintf(fp,", ");
-        fprintf(fp,"int32 c%d", i);
+        fprintf(fp,"int32_t c%d", i);
         i++;
       }
       else if (!strcmp(comp->base_type(globals), "ConP")) {
@@ -386,14 +386,14 @@
 static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) {
   assert(oper != NULL, "what");
   CondInterface* cond = oper->_interface->is_CondInterface();
-  fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print(\"%s\");\n",i,cond->_overflow_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print(\"%s\");\n",i,cond->_no_overflow_format);
+  fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print_raw(\"%s\");\n",i,cond->_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print_raw(\"%s\");\n",i,cond->_not_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print_raw(\"%s\");\n",i,cond->_less_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print_raw(\"%s\");\n",i,cond->_greater_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print_raw(\"%s\");\n",i,cond->_less_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print_raw(\"%s\");\n",i,cond->_greater_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print_raw(\"%s\");\n",i,cond->_overflow_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print_raw(\"%s\");\n",i,cond->_no_overflow_format);
 }
 
 // Output code that dumps constant values, increment "i" if type is constant
@@ -416,8 +416,8 @@
     ++i;
   }
   else if (!strcmp(ideal_type, "ConL")) {
-    fprintf(fp,"    st->print(\"#\" INT64_FORMAT, _c%d);\n", i);
-    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%d);\n", i);
+    fprintf(fp,"    st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%d);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "ConF")) {
@@ -429,7 +429,7 @@
   else if (!strcmp(ideal_type, "ConD")) {
     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
     fprintf(fp,"    jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i);
-    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%dl);\n", i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%dl);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "Bool")) {
@@ -471,7 +471,7 @@
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"  st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print_raw(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -542,7 +542,7 @@
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"  st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print_raw(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -669,7 +669,7 @@
       } else if( string == NameList::_signal2 ) // Raw program text
         fputs(inst._format->_strings.iter(), fp);
       else
-        fprintf(fp,"st->print(\"%s\");\n", string);
+        fprintf(fp,"st->print_raw(\"%s\");\n", string);
     } // Done with all format strings
   } // Done generating the user-defined portion of the format
 
@@ -696,13 +696,13 @@
     default:
       assert(0,"ShouldNotReachHere");
     }
-    fprintf(fp,  "  st->print_cr(\"\");\n" );
+    fprintf(fp,  "  st->cr();\n" );
     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
     fprintf(fp,  "  st->print(\"        # \");\n" );
     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   }
   else if(inst.is_ideal_safepoint()) {
-    fprintf(fp,  "  st->print(\"\");\n" );
+    fprintf(fp,  "  st->print_raw(\"\");\n" );
     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
     fprintf(fp,  "  st->print(\"        # \");\n" );
     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
--- a/hotspot/src/share/vm/asm/assembler.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/asm/assembler.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -119,7 +119,7 @@
   L.patch_instructions((MacroAssembler*)this);
 }
 
-void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
+void AbstractAssembler::generate_stack_overflow_check(int frame_size_in_bytes) {
   if (UseStackBanging) {
     // Each code entry causes one stack bang n pages down the stack where n
     // is configurable by StackShadowPages.  The setting depends on the maximum
@@ -134,7 +134,7 @@
     // is greater than a page.
 
     const int page_size = os::vm_page_size();
-    int bang_end = StackShadowPages*page_size;
+    int bang_end = StackShadowPages * page_size;
 
     // This is how far the previous frame's stack banging extended.
     const int bang_end_safe = bang_end;
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -988,7 +988,7 @@
   for (csize_t step; ptr < end(); ptr += step) {
     step = end() - ptr;
     if (step > jintSize * 4)  step = jintSize * 4;
-    tty->print(PTR_FORMAT ": ", ptr);
+    tty->print(INTPTR_FORMAT ": ", p2i(ptr));
     while (step > 0) {
       tty->print(" " PTR32_FORMAT, *(jint*)ptr);
       ptr += jintSize;
@@ -1098,7 +1098,7 @@
     while (c && c->offset() == offset) {
       stream->bol();
       stream->print("  ;; ");
-      stream->print_cr(c->string());
+      stream->print_cr("%s", c->string());
       c = c->next_comment();
     }
   }
@@ -1154,10 +1154,10 @@
 void CodeSection::print(const char* name) {
   csize_t locs_size = locs_end() - locs_start();
   tty->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)%s",
-                name, start(), end(), limit(), size(), capacity(),
+                name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity(),
                 is_frozen()? " [frozen]": "");
   tty->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d",
-                name, locs_start(), locs_end(), locs_limit(), locs_size, locs_capacity(), locs_point_off());
+                name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off());
   if (PrintRelocations) {
     RelocIterator iter(this);
     iter.print();
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -173,7 +173,7 @@
   bool allocates(address pc) const  { return pc >= _start && pc <  _limit; }
   bool allocates2(address pc) const { return pc >= _start && pc <= _limit; }
 
-  void    set_end(address pc)       { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " PTR_FORMAT " <= " PTR_FORMAT " <= " PTR_FORMAT, _start, pc, _limit)); _end = pc; }
+  void    set_end(address pc)       { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit))); _end = pc; }
   void    set_mark(address pc)      { assert(contains2(pc), "not in codeBuffer");
                                       _mark = pc; }
   void    set_mark_off(int offset)  { assert(contains2(offset+_start),"not in codeBuffer");
--- a/hotspot/src/share/vm/asm/register.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/asm/register.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,8 +118,8 @@
 ) {
   assert(
     a != b,
-    err_msg_res("registers must be different: a=%d, b=%d",
-                a, b)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "",
+                p2i(a), p2i(b))
   );
 }
 
@@ -132,8 +132,9 @@
   assert(
     a != b && a != c
            && b != c,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d",
-                a, b, c)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c))
   );
 }
 
@@ -148,8 +149,9 @@
     a != b && a != c && a != d
            && b != c && b != d
                      && c != d,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d",
-                a, b, c, d)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d))
   );
 }
 
@@ -166,8 +168,9 @@
            && b != c && b != d && b != e
                      && c != d && c != e
                                && d != e,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d",
-                a, b, c, d, e)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e))
   );
 }
 
@@ -186,8 +189,10 @@
                      && c != d && c != e && c != f
                                && d != e && d != f
                                          && e != f,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d",
-                a, b, c, d, e, f)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f))
   );
 }
 
@@ -208,8 +213,10 @@
                                && d != e && d != f && d != g
                                          && e != f && e != g
                                                    && f != g,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d",
-                a, b, c, d, e, f, g)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g))
   );
 }
 
@@ -232,8 +239,10 @@
                                          && e != f && e != g && e != h
                                                    && f != g && f != h
                                                              && g != h,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d",
-                a, b, c, d, e, f, g, h)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h))
   );
 }
 
@@ -258,8 +267,11 @@
                                                    && f != g && f != h && f != i
                                                              && g != h && g != i
                                                                        && h != i,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d, h=%d, i=%d",
-                a, b, c, d, e, f, g, h, i)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT
+                ", i=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i))
   );
 }
 
--- a/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 
   void inc_indent();
   void dec_indent();
-  void print(const char* format, ...);
+  void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   void print_begin(const char* tag);
   void print_end(const char* tag);
 
@@ -161,7 +161,7 @@
 
   print("name \"%s\"", method_name(_compilation->method(), true));
   print("method \"%s\"", method_name(_compilation->method()));
-  print("date "INT64_FORMAT, os::javaTimeMillis());
+  print("date "INT64_FORMAT, (int64_t) os::javaTimeMillis());
 
   print_end("compilation");
 }
--- a/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_CodeStubs.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -450,9 +450,11 @@
 class DeoptimizeStub : public CodeStub {
 private:
   CodeEmitInfo* _info;
+  jint _trap_request;
 
 public:
-  DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {}
+  DeoptimizeStub(CodeEmitInfo* info, Deoptimization::DeoptReason reason, Deoptimization::DeoptAction action) :
+    _info(new CodeEmitInfo(info)), _trap_request(Deoptimization::make_trap_request(reason, action)) {}
 
   virtual void emit_code(LIR_Assembler* e);
   virtual CodeEmitInfo* info() const           { return _info; }
--- a/hotspot/src/share/vm/c1/c1_Compilation.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -251,6 +251,10 @@
     return env()->comp_level() == CompLevel_full_profile &&
       C1UpdateMethodData && MethodData::profile_return();
   }
+  bool age_code() const {
+    return _method->profile_aging();
+  }
+
   // will compilation make optimistic assumptions that might lead to
   // deoptimization and that the runtime will account for?
   bool is_optimistic() const                             {
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,23 +134,23 @@
     if (value->is_null_object()) {
       output()->print("null");
     } else if (!value->is_loaded()) {
-      output()->print("<unloaded object " PTR_FORMAT ">", value);
+      output()->print("<unloaded object " INTPTR_FORMAT ">", p2i(value));
     } else {
-      output()->print("<object " PTR_FORMAT " klass=", value->constant_encoding());
+      output()->print("<object " INTPTR_FORMAT " klass=", p2i(value->constant_encoding()));
       print_klass(value->klass());
       output()->print(">");
     }
   } else if (type->as_InstanceConstant() != NULL) {
     ciInstance* value = type->as_InstanceConstant()->value();
     if (value->is_loaded()) {
-      output()->print("<instance " PTR_FORMAT " klass=", value->constant_encoding());
+      output()->print("<instance " INTPTR_FORMAT " klass=", p2i(value->constant_encoding()));
       print_klass(value->klass());
       output()->print(">");
     } else {
-      output()->print("<unloaded instance " PTR_FORMAT ">", value);
+      output()->print("<unloaded instance " INTPTR_FORMAT ">", p2i(value));
     }
   } else if (type->as_ArrayConstant() != NULL) {
-    output()->print("<array " PTR_FORMAT ">", type->as_ArrayConstant()->value()->constant_encoding());
+    output()->print("<array " INTPTR_FORMAT ">", p2i(type->as_ArrayConstant()->value()->constant_encoding()));
   } else if (type->as_ClassConstant() != NULL) {
     ciInstanceKlass* klass = type->as_ClassConstant()->value();
     if (!klass->is_loaded()) {
@@ -268,7 +268,7 @@
 
 
 void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) {
-  output()->print(name);
+  output()->print("%s", name);
   output()->print(".(");
 }
 
@@ -479,7 +479,7 @@
   if (x->declared_type()->is_klass())
     print_klass(x->declared_type()->as_klass());
   else
-    output()->print(type2name(x->declared_type()->basic_type()));
+    output()->print("%s", type2name(x->declared_type()->basic_type()));
 }
 
 
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1563,15 +1563,15 @@
   } else if (is_virtual()) {
     out->print("R%d", vreg_number());
   } else if (is_single_cpu()) {
-    out->print(as_register()->name());
+    out->print("%s", as_register()->name());
   } else if (is_double_cpu()) {
-    out->print(as_register_hi()->name());
-    out->print(as_register_lo()->name());
+    out->print("%s", as_register_hi()->name());
+    out->print("%s", as_register_lo()->name());
 #if defined(X86)
   } else if (is_single_xmm()) {
-    out->print(as_xmm_float_reg()->name());
+    out->print("%s", as_xmm_float_reg()->name());
   } else if (is_double_xmm()) {
-    out->print(as_xmm_double_reg()->name());
+    out->print("%s", as_xmm_double_reg()->name());
   } else if (is_single_fpu()) {
     out->print("fpu%d", fpu_regnr());
   } else if (is_double_fpu()) {
@@ -1583,9 +1583,9 @@
     out->print("d%d", fpu_regnrLo() >> 1);
 #else
   } else if (is_single_fpu()) {
-    out->print(as_float_reg()->name());
+    out->print("%s", as_float_reg()->name());
   } else if (is_double_fpu()) {
-    out->print(as_double_reg()->name());
+    out->print("%s", as_double_reg()->name());
 #endif
 
   } else if (is_illegal()) {
@@ -1611,9 +1611,9 @@
     case T_LONG:   out->print("lng:" JLONG_FORMAT, as_jlong()); break;
     case T_FLOAT:  out->print("flt:%f",   as_jfloat());         break;
     case T_DOUBLE: out->print("dbl:%f",   as_jdouble());        break;
-    case T_OBJECT: out->print("obj:0x%x", as_jobject());        break;
-    case T_METADATA: out->print("metadata:0x%x", as_metadata());break;
-    default:       out->print("%3d:0x%x",type(), as_jdouble()); break;
+    case T_OBJECT: out->print("obj:" INTPTR_FORMAT, p2i(as_jobject()));        break;
+    case T_METADATA: out->print("metadata:" INTPTR_FORMAT, p2i(as_metadata()));break;
+    default:       out->print("%3d:0x" UINT64_FORMAT_X, type(), (uint64_t)as_jlong()); break;
   }
 }
 
@@ -1629,7 +1629,7 @@
     case times_8: out->print(" * 8"); break;
     }
   }
-  out->print(" Disp: %d", _disp);
+  out->print(" Disp: " INTX_FORMAT, _disp);
 }
 
 // debug output of block header without InstructionPrinter
@@ -1703,7 +1703,7 @@
   } else {
     out->print("     ");
   }
-  out->print(name()); out->print(" ");
+  out->print("%s ", name());
   print_instr(out);
   if (info() != NULL) out->print(" [bci:%d]", info()->stack()->bci());
 #ifdef ASSERT
@@ -1833,7 +1833,7 @@
 // LIR_OpJavaCall
 void LIR_OpJavaCall::print_instr(outputStream* out) const {
   out->print("call: ");
-  out->print("[addr: 0x%x]", address());
+  out->print("[addr: " INTPTR_FORMAT "]", p2i(address()));
   if (receiver()->is_valid()) {
     out->print(" [recv: ");   receiver()->print(out);   out->print("]");
   }
@@ -1844,7 +1844,7 @@
 
 // LIR_OpLabel
 void LIR_OpLabel::print_instr(outputStream* out) const {
-  out->print("[label:0x%x]", _label);
+  out->print("[label:" INTPTR_FORMAT "]", p2i(_label));
 }
 
 // LIR_OpArrayCopy
@@ -1911,7 +1911,7 @@
 // LIR_Op1
 void LIR_OpRTCall::print_instr(outputStream* out) const {
   intx a = (intx)addr();
-  out->print(Runtime1::name_for_address(addr()));
+  out->print("%s", Runtime1::name_for_address(addr()));
   out->print(" ");
   tmp()->print(out);
 }
@@ -1934,10 +1934,10 @@
   } else if (stub() != NULL) {
     out->print("[");
     stub()->print_name(out);
-    out->print(": 0x%x]", stub());
+    out->print(": " INTPTR_FORMAT "]", p2i(stub()));
     if (stub()->info() != NULL) out->print(" [bci:%d]", stub()->info()->stack()->bci());
   } else {
-    out->print("[label:0x%x] ", label());
+    out->print("[label:" INTPTR_FORMAT "] ", p2i(label()));
   }
   if (ublock() != NULL) {
     out->print("unordered: [B%d] ", ublock()->block_id());
@@ -2004,7 +2004,7 @@
   tmp4()->print(out);                       out->print(" ");
   out->print("[hdr:%d]", header_size()); out->print(" ");
   out->print("[obj:%d]", object_size()); out->print(" ");
-  out->print("[lbl:0x%x]", stub()->entry());
+  out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 void LIR_OpRoundFP::print_instr(outputStream* out) const {
@@ -2037,7 +2037,7 @@
   tmp3()->print(out);                    out->print(" ");
   tmp4()->print(out);                    out->print(" ");
   out->print("[type:0x%x]", type());     out->print(" ");
-  out->print("[label:0x%x]", stub()->entry());
+  out->print("[label:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 
@@ -2074,7 +2074,7 @@
   if (_scratch->is_valid()) {
     _scratch->print(out);  out->print(" ");
   }
-  out->print("[lbl:0x%x]", stub()->entry());
+  out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 #ifdef ASSERT
@@ -2082,7 +2082,7 @@
   print_condition(out, condition()); out->print(" ");
   in_opr1()->print(out);             out->print(" ");
   in_opr2()->print(out);             out->print(", \"");
-  out->print(msg());                 out->print("\"");
+  out->print("%s", msg());          out->print("\"");
 }
 #endif
 
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -2782,7 +2782,10 @@
       __ lock_object(syncTempOpr(), obj, lock, new_register(T_OBJECT), slow_path, NULL);
     }
   }
-
+  if (compilation()->age_code()) {
+    CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, 0), NULL, false);
+    decrement_age(info);
+  }
   // increment invocation counters if needed
   if (!method()->is_accessor()) { // Accessors do not have MDOs, so no counting.
     profile_parameters(x);
@@ -3328,6 +3331,27 @@
   increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true);
 }
 
+void LIRGenerator::decrement_age(CodeEmitInfo* info) {
+  ciMethod* method = info->scope()->method();
+  MethodCounters* mc_adr = method->ensure_method_counters();
+  if (mc_adr != NULL) {
+    LIR_Opr mc = new_pointer_register();
+    __ move(LIR_OprFact::intptrConst(mc_adr), mc);
+    int offset = in_bytes(MethodCounters::nmethod_age_offset());
+    LIR_Address* counter = new LIR_Address(mc, offset, T_INT);
+    LIR_Opr result = new_register(T_INT);
+    __ load(counter, result);
+    __ sub(result, LIR_OprFact::intConst(1), result);
+    __ store(result, counter);
+    // DeoptimizeStub will reexecute from the current state in code info.
+    CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_tenured,
+                                         Deoptimization::Action_make_not_entrant);
+    __ cmp(lir_cond_lessEqual, result, LIR_OprFact::intConst(0));
+    __ branch(lir_cond_lessEqual, T_INT, deopt);
+  }
+}
+
+
 void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info,
                                                 ciMethod *method, int frequency,
                                                 int bci, bool backedge, bool notify) {
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -372,7 +372,7 @@
       increment_event_counter(info, bci, true);
     }
   }
-
+  void decrement_age(CodeEmitInfo* info);
   CodeEmitInfo* state_for(Instruction* x, ValueStack* state, bool ignore_xhandler = false);
   CodeEmitInfo* state_for(Instruction* x);
 
--- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,10 +62,10 @@
   _optimistic = ir->compilation()->is_optimistic();
 
   TRACE_RANGE_CHECK_ELIMINATION(
-    tty->print_cr("");
+    tty->cr();
     tty->print_cr("Range check elimination");
     ir->method()->print_name(tty);
-    tty->print_cr("");
+    tty->cr();
   );
 
   TRACE_RANGE_CHECK_ELIMINATION(
@@ -1024,7 +1024,7 @@
                                                          tty->print("i%d", phi->id());
                                                          tty->print(": ");
                                                          bound->print();
-                                                         tty->print_cr("");
+                                                         tty->cr();
                            );
                          }
                      });
@@ -1039,7 +1039,7 @@
                                             tty->print("i%d", instr->id());
                                             tty->print(": ");
                                             bound->print();
-                                            tty->print_cr("");
+                                            tty->cr();
               );
           }
         }
@@ -1400,7 +1400,7 @@
 
 // print
 void RangeCheckEliminator::Bound::print() {
-  tty->print("");
+  tty->print("%s", "");
   if (this->_lower_instr || this->_lower != min_jint) {
     if (this->_lower_instr) {
       tty->print("i%d", this->_lower_instr->id());
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -532,8 +532,8 @@
     if (TraceExceptions) {
       ttyLocker ttyl;
       ResourceMark rm;
-      tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " for thread 0x%x",
-                    exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, thread);
+      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "",
+                    exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
     }
     // for AbortVMOnException flag
     NOT_PRODUCT(Exceptions::debug_check_abort(exception));
@@ -563,7 +563,7 @@
     ttyLocker ttyl;
     ResourceMark rm;
     tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
-                  thread, continuation, pc);
+                  p2i(thread), p2i(continuation), p2i(pc));
   }
 
   return continuation;
@@ -685,19 +685,32 @@
 JRT_END
 
 // Cf. OptoRuntime::deoptimize_caller_frame
-JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread))
+JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread, jint trap_request))
   // Called from within the owner thread, so no need for safepoint
   RegisterMap reg_map(thread, false);
   frame stub_frame = thread->last_frame();
-  assert(stub_frame.is_runtime_frame(), "sanity check");
+  assert(stub_frame.is_runtime_frame(), "Sanity check");
   frame caller_frame = stub_frame.sender(&reg_map);
+  nmethod* nm = caller_frame.cb()->as_nmethod_or_null();
+  assert(nm != NULL, "Sanity check");
+  methodHandle method(thread, nm->method());
+  assert(nm == CodeCache::find_nmethod(caller_frame.pc()), "Should be the same");
+  Deoptimization::DeoptAction action = Deoptimization::trap_request_action(trap_request);
+  Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request);
 
-  // We are coming from a compiled method; check this is true.
-  assert(CodeCache::find_nmethod(caller_frame.pc()) != NULL, "sanity");
+  if (action == Deoptimization::Action_make_not_entrant) {
+    if (nm->make_not_entrant()) {
+      if (reason == Deoptimization::Reason_tenured) {
+        MethodData* trap_mdo = Deoptimization::get_method_data(thread, method, true /*create_if_missing*/);
+        if (trap_mdo != NULL) {
+          trap_mdo->inc_tenure_traps();
+        }
+      }
+    }
+  }
 
   // Deoptimize the caller frame.
   Deoptimization::deoptimize_frame(thread, caller_frame.id());
-
   // Return to the now deoptimized frame.
 JRT_END
 
@@ -988,8 +1001,8 @@
         address copy_buff = stub_location - *byte_skip - *byte_count;
         address being_initialized_entry = stub_location - *being_initialized_entry_offset;
         if (TracePatching) {
-          tty->print_cr(" Patching %s at bci %d at address 0x%x  (%s)", Bytecodes::name(code), bci,
-                        instr_pc, (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
+          tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT "  (%s)", Bytecodes::name(code), bci,
+                        p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
           nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
           assert(caller_code != NULL, "nmethod not found");
 
@@ -1448,7 +1461,7 @@
     methodHandle inlinee = methodHandle(vfst.method());
     inlinee->print_short_name(&ss1);
     m->print_short_name(&ss2);
-    tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc %x", ss1.as_string(), vfst.bci(), ss2.as_string(), caller_frame.pc());
+    tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc()));
   }
 
 
--- a/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -156,7 +156,7 @@
   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock);
   static void monitorexit (JavaThread* thread, BasicObjectLock* lock);
 
-  static void deoptimize(JavaThread* thread);
+  static void deoptimize(JavaThread* thread, jint trap_request);
 
   static int access_field_patching(JavaThread* thread);
   static int move_klass_patching(JavaThread* thread);
--- a/hotspot/src/share/vm/c1/c1_ValueType.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/c1/c1_ValueType.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@
   ValueType* join(ValueType* y) const;
 
   // debugging
-  void print(outputStream* s = tty)              { s->print(name()); }
+  void print(outputStream* s = tty)              { s->print("%s", name()); }
 };
 
 
--- a/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/bcEscapeAnalyzer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,6 +158,9 @@
 
 void BCEscapeAnalyzer::set_method_escape(ArgumentMap vars) {
   clear_bits(vars, _arg_local);
+  if (vars.contains_allocated()) {
+    _allocated_escapes = true;
+  }
 }
 
 void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars, bool merge) {
@@ -1287,10 +1290,10 @@
         tty->print_cr("class of method is not initialized.");
       else if (_level > MaxBCEAEstimateLevel)
         tty->print_cr("level (%d) exceeds MaxBCEAEstimateLevel (%d).",
-                      _level, MaxBCEAEstimateLevel);
+                      _level, (int) MaxBCEAEstimateLevel);
       else if (method()->code_size() > MaxBCEAEstimateSize)
-        tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize.",
-                      method()->code_size(), MaxBCEAEstimateSize);
+        tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize (%d).",
+                      method()->code_size(), (int) MaxBCEAEstimateSize);
       else
         ShouldNotReachHere();
     }
--- a/hotspot/src/share/vm/ci/ciConstant.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciConstant.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
     tty->print("%d", _value._int);
     break;
   case T_LONG:
-    tty->print(INT64_FORMAT, _value._long);
+    tty->print(INT64_FORMAT, (int64_t)(_value._long));
     break;
   case T_FLOAT:
     tty->print("%f", _value._float);
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1250,8 +1250,7 @@
       if (replay_data_file != NULL) {
         fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
         dump_replay_data(&replay_data_stream);
-        tty->print("# Compiler replay data is saved as: ");
-        tty->print_cr(buffer);
+        tty->print_cr("# Compiler replay data is saved as: %s", buffer);
       } else {
         tty->print_cr("# Can't open file to dump replay data.");
       }
@@ -1274,7 +1273,7 @@
         )
         replay_data_stream.flush();
         tty->print("# Compiler inline data is saved as: ");
-        tty->print_cr(buffer);
+        tty->print_cr("%s", buffer);
       } else {
         tty->print_cr("# Can't open file to dump inline data.");
       }
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -292,7 +292,7 @@
 // Implementation of the print method.
 void ciInstanceKlass::print_impl(outputStream* st) {
   ciKlass::print_impl(st);
-  GUARDED_VM_ENTRY(st->print(" loader=0x%x", (address)loader());)
+  GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));)
   if (is_loaded()) {
     st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=",
               bool_to_str(is_initialized()),
@@ -618,7 +618,7 @@
         case T_SHORT:   _out->print_cr("%d", mirror->short_field(fd->offset()));  break;
         case T_CHAR:    _out->print_cr("%d", mirror->char_field(fd->offset()));   break;
         case T_INT:     _out->print_cr("%d", mirror->int_field(fd->offset()));    break;
-        case T_LONG:    _out->print_cr(INT64_FORMAT, mirror->long_field(fd->offset()));   break;
+        case T_LONG:    _out->print_cr(INT64_FORMAT, (int64_t)(mirror->long_field(fd->offset())));   break;
         case T_FLOAT: {
           float f = mirror->float_field(fd->offset());
           _out->print_cr("%d", *(int*)&f);
@@ -626,7 +626,7 @@
         }
         case T_DOUBLE: {
           double d = mirror->double_field(fd->offset());
-          _out->print_cr(INT64_FORMAT, *(jlong*)&d);
+          _out->print_cr(INT64_FORMAT, *(int64_t*)&d);
           break;
         }
         case T_ARRAY: {
@@ -656,7 +656,7 @@
               _out->print_cr("\"");
             } else {
               const char* klass_name  = value->klass()->name()->as_quoted_ascii();
-              _out->print_cr(klass_name);
+              _out->print_cr("%s", klass_name);
             }
           } else {
             ShouldNotReachHere();
--- a/hotspot/src/share/vm/ci/ciMetadata.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciMetadata.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 void ciMetadata::print(outputStream* st) {
   st->print("<%s", type_string());
   GUARDED_VM_ENTRY(print_impl(st);)
-  st->print(" ident=%d address=0x%x>", ident(), (address)this);
+  st->print(" ident=%d address=" INTPTR_FORMAT ">", ident(), p2i((address)this));
 }
 
 
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -129,6 +129,7 @@
   constantPoolHandle cpool = h_m()->constants();
   _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
   _method_data = NULL;
+  _nmethod_age = h_m()->nmethod_age();
   // Take a snapshot of these values, so they will be commensurate with the MDO.
   if (ProfileInterpreter || TieredCompilation) {
     int invcnt = h_m()->interpreter_invocation_count();
@@ -1276,6 +1277,14 @@
 }
 
 // ------------------------------------------------------------------
+// ciMethod::profile_aging
+//
+// Should the method be compiled with an age counter?
+bool ciMethod::profile_aging() const {
+  return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) &&
+                          !MethodCounters::is_nmethod_age_unset(nmethod_age()));
+}
+// ------------------------------------------------------------------
 // ciMethod::print_codes
 //
 // Print the bytecodes for this method.
--- a/hotspot/src/share/vm/ci/ciMethod.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -68,6 +68,7 @@
   int _max_locals;
   vmIntrinsics::ID _intrinsic_id;
   int _handler_count;
+  int _nmethod_age;
   int _interpreter_invocation_count;
   int _interpreter_throwout_count;
   int _instructions_size;
@@ -168,6 +169,10 @@
   int interpreter_invocation_count() const       { check_is_loaded(); return _interpreter_invocation_count; }
   int interpreter_throwout_count() const         { check_is_loaded(); return _interpreter_throwout_count; }
   int size_of_parameters() const                 { check_is_loaded(); return _size_of_parameters; }
+  int nmethod_age() const                        { check_is_loaded(); return _nmethod_age; }
+
+  // Should the method be compiled with an age counter?
+  bool profile_aging() const;
 
   // Code size for inlining decisions.
   int code_size_for_inlining();
--- a/hotspot/src/share/vm/ci/ciMethodData.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciMethodData.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -177,7 +177,7 @@
 
 
 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
-  for (int i = 0; i < _number_of_entries; i++) {
+  for (int i = 0; i < number_of_entries(); i++) {
     intptr_t k = entries->type(i);
     TypeStackSlotEntries::set_type(i, translate_klass(k));
   }
@@ -242,7 +242,6 @@
 }
 
 ciProfileData* ciMethodData::bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots) {
-  // bci_to_extra_data(bci) ...
   DataLayout* dp  = data_layout_at(data_size());
   DataLayout* end = data_layout_at(data_size() + extra_data_size());
   two_free_slots = false;
@@ -506,6 +505,63 @@
   ciMetadata::print_impl(st);
 }
 
+void ciMethodData::dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k) {
+  if (k != NULL) {
+    if (round == 0) {
+      count++;
+    } else {
+      out->print(" %d %s", (int)(dp_to_di(pdata->dp() + in_bytes(offset)) / sizeof(intptr_t)), k->name()->as_quoted_ascii());
+    }
+  }
+}
+
+template<class T> void ciMethodData::dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* vdata) {
+  for (uint i = 0; i < vdata->row_limit(); i++) {
+    dump_replay_data_type_helper(out, round, count, vdata, vdata->receiver_offset(i), vdata->receiver(i));
+  }
+}
+
+template<class T> void ciMethodData::dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data) {
+  if (call_type_data->has_arguments()) {
+    for (int i = 0; i < call_type_data->number_of_arguments(); i++) {
+      dump_replay_data_type_helper(out, round, count, call_type_data, call_type_data->argument_type_offset(i), call_type_data->valid_argument_type(i));
+    }
+  }
+  if (call_type_data->has_return()) {
+    dump_replay_data_type_helper(out, round, count, call_type_data, call_type_data->return_type_offset(), call_type_data->valid_return_type());
+  }
+}
+
+void ciMethodData::dump_replay_data_extra_data_helper(outputStream* out, int round, int& count) {
+  DataLayout* dp  = data_layout_at(data_size());
+  DataLayout* end = data_layout_at(data_size() + extra_data_size());
+
+  for (;dp < end; dp = MethodData::next_extra(dp)) {
+    switch(dp->tag()) {
+    case DataLayout::no_tag:
+    case DataLayout::arg_info_data_tag:
+      return;
+    case DataLayout::bit_data_tag:
+      break;
+    case DataLayout::speculative_trap_data_tag: {
+      ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
+      ciMethod* m = data->method();
+      if (m != NULL) {
+        if (round == 0) {
+          count++;
+        } else {
+          out->print(" %d ", (int)(dp_to_di(((address)dp) + in_bytes(ciSpeculativeTrapData::method_offset())) / sizeof(intptr_t)));
+          m->dump_name_as_ascii(out);
+        }
+      }
+      break;
+    }
+    default:
+      fatal(err_msg("bad tag = %d", dp->tag()));
+    }
+  }
+}
+
 void ciMethodData::dump_replay_data(outputStream* out) {
   ResourceMark rm;
   MethodData* mdo = get_MethodData();
@@ -527,7 +583,7 @@
   }
 
   // dump the MDO data as raw data
-  int elements = data_size() / sizeof(intptr_t);
+  int elements = (data_size() + extra_data_size()) / sizeof(intptr_t);
   out->print(" data %d", elements);
   for (int i = 0; i < elements; i++) {
     // We could use INTPTR_FORMAT here but that's a zero justified
@@ -544,37 +600,35 @@
   // and emit pairs of offset and klass name so that they can be
   // reconstructed at runtime.  The first round counts the number of
   // oop references and the second actually emits them.
-  int count = 0;
-  for (int round = 0; round < 2; round++) {
+  ciParametersTypeData* parameters = parameters_type_data();
+  for (int count = 0, round = 0; round < 2; round++) {
     if (round == 1) out->print(" oops %d", count);
     ProfileData* pdata = first_data();
     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
-      if (pdata->is_ReceiverTypeData()) {
-        ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
-        for (uint i = 0; i < vdata->row_limit(); i++) {
-          ciKlass* k = vdata->receiver(i);
-          if (k != NULL) {
-            if (round == 0) {
-              count++;
-            } else {
-              out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
-            }
-          }
+      if (pdata->is_VirtualCallData()) {
+        ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
+        dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
+        if (pdata->is_VirtualCallTypeData()) {
+          ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
+          dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
         }
-      } else if (pdata->is_VirtualCallData()) {
-        ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
-        for (uint i = 0; i < vdata->row_limit(); i++) {
-          ciKlass* k = vdata->receiver(i);
-          if (k != NULL) {
-            if (round == 0) {
-              count++;
-            } else {
-              out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
-            }
-          }
-        }
+      } else if (pdata->is_ReceiverTypeData()) {
+        ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
+        dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
+      } else if (pdata->is_CallTypeData()) {
+          ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
+          dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
       }
     }
+    if (parameters != NULL) {
+      for (int i = 0; i < parameters->number_of_parameters(); i++) {
+        dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
+      }
+    }
+  }
+  for (int count = 0, round = 0; round < 2; round++) {
+    if (round == 1) out->print(" methods %d", count);
+    dump_replay_data_extra_data_helper(out, round, count);
   }
   out->cr();
 }
@@ -586,6 +640,10 @@
 
 void ciMethodData::print_data_on(outputStream* st) {
   ResourceMark rm;
+  ciParametersTypeData* parameters = parameters_type_data();
+  if (parameters != NULL) {
+    parameters->print_data_on(st);
+  }
   ciProfileData* data;
   for (data = first_data(); is_valid(data); data = next_data(data)) {
     st->print("%d", dp_to_di(data->dp()));
@@ -607,6 +665,9 @@
       data = new ciArgInfoData(dp);
       dp = end; // ArgInfoData is at the end of extra data section.
       break;
+    case DataLayout::speculative_trap_data_tag:
+      data = new ciSpeculativeTrapData(dp);
+      break;
     default:
       fatal(err_msg("unexpected tag %d", dp->tag()));
     }
@@ -631,7 +692,7 @@
 }
 
 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
-  for (int i = 0; i < _number_of_entries; i++) {
+  for (int i = 0; i < number_of_entries(); i++) {
     _pd->tab(st);
     st->print("%d: stack (%u) ", i, stack_slot(i));
     print_ciklass(st, type(i));
@@ -650,12 +711,12 @@
   print_shared(st, "ciCallTypeData", extra);
   if (has_arguments()) {
     tab(st, true);
-    st->print("argument types");
+    st->print_cr("argument types");
     args()->print_data_on(st);
   }
   if (has_return()) {
     tab(st, true);
-    st->print("return type");
+    st->print_cr("return type");
     ret()->print_data_on(st);
   }
 }
--- a/hotspot/src/share/vm/ci/ciMethodData.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciMethodData.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -45,7 +45,7 @@
 class ciCallTypeData;
 class ciVirtualCallTypeData;
 class ciParametersTypeData;
-class ciSpeculativeTrapData;;
+class ciSpeculativeTrapData;
 
 typedef ProfileData ciProfileData;
 
@@ -175,7 +175,7 @@
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -202,7 +202,7 @@
   }
   void translate_receiver_data_from(const ProfileData* data);
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
   void print_receiver_data_on(outputStream* st) const;
 #endif
 };
@@ -227,7 +227,7 @@
     rtd_super()->translate_receiver_data_from(data);
   }
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -289,7 +289,7 @@
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -338,7 +338,7 @@
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -349,15 +349,15 @@
   virtual void translate_from(const ProfileData* data);
 
   ciMethod* method() const {
-    return (ciMethod*)intptr_at(method_offset);
+    return (ciMethod*)intptr_at(speculative_trap_method);
   }
 
   void set_method(ciMethod* m) {
-    set_intptr_at(method_offset, (intptr_t)m);
+    set_intptr_at(speculative_trap_method, (intptr_t)m);
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -406,8 +406,8 @@
   // Coherent snapshot of original header.
   MethodData _orig;
 
-  // Dedicated area dedicated to parameters. Null if no parameter
-  // profiling for this method.
+  // Area dedicated to parameters. NULL if no parameter profiling for
+  // this method.
   DataLayout* _parameters;
 
   ciMethodData(MethodData* md);
@@ -467,6 +467,11 @@
   void load_extra_data();
   ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots);
 
+  void dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k);
+  template<class T> void dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data);
+  template<class T> void dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* call_type_data);
+  void dump_replay_data_extra_data_helper(outputStream* out, int round, int& count);
+
 public:
   bool is_method_data() const { return true; }
 
--- a/hotspot/src/share/vm/ci/ciObject.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciObject.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,9 +213,9 @@
 void ciObject::print(outputStream* st) {
   st->print("<%s", type_string());
   GUARDED_VM_ENTRY(print_impl(st);)
-  st->print(" ident=%d %s address=0x%x>", ident(),
+  st->print(" ident=%d %s address=" INTPTR_FORMAT ">", ident(),
         is_scavengable() ? "SCAVENGABLE" : "",
-        (address)this);
+        p2i((address)this));
 }
 
 // ------------------------------------------------------------------
--- a/hotspot/src/share/vm/ci/ciReplay.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -48,11 +48,14 @@
 
   intptr_t* _data;
   char*     _orig_data;
-  jobject*  _oops_handles;
-  int*      _oops_offsets;
+  Klass**   _classes;
+  Method**  _methods;
+  int*      _classes_offsets;
+  int*      _methods_offsets;
   int       _data_length;
   int       _orig_data_length;
-  int       _oops_length;
+  int       _classes_length;
+  int       _methods_length;
 } ciMethodDataRecord;
 
 typedef struct _ciMethodRecord {
@@ -565,7 +568,7 @@
     rec->_instructions_size = parse_int("instructions_size");
   }
 
-  // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length>
+  // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> # ... methods <length>
   void process_ciMethodData(TRAPS) {
     Method* method = parse_method(CHECK);
     if (had_error()) return;
@@ -602,21 +605,34 @@
     if (rec->_data == NULL) {
       return;
     }
-    if (!parse_tag_and_count("oops", rec->_oops_length)) {
+    if (!parse_tag_and_count("oops", rec->_classes_length)) {
       return;
     }
-    rec->_oops_handles = NEW_RESOURCE_ARRAY(jobject, rec->_oops_length);
-    rec->_oops_offsets = NEW_RESOURCE_ARRAY(int, rec->_oops_length);
-    for (int i = 0; i < rec->_oops_length; i++) {
+    rec->_classes = NEW_RESOURCE_ARRAY(Klass*, rec->_classes_length);
+    rec->_classes_offsets = NEW_RESOURCE_ARRAY(int, rec->_classes_length);
+    for (int i = 0; i < rec->_classes_length; i++) {
       int offset = parse_int("offset");
       if (had_error()) {
         return;
       }
       Klass* k = parse_klass(CHECK);
-      rec->_oops_offsets[i] = offset;
-      KlassHandle *kh = NEW_C_HEAP_OBJ(KlassHandle, mtCompiler);
-      ::new ((void*)kh) KlassHandle(THREAD, k);
-      rec->_oops_handles[i] = (jobject)kh;
+      rec->_classes_offsets[i] = offset;
+      rec->_classes[i] = k;
+    }
+
+    if (!parse_tag_and_count("methods", rec->_methods_length)) {
+      return;
+    }
+    rec->_methods = NEW_RESOURCE_ARRAY(Method*, rec->_methods_length);
+    rec->_methods_offsets = NEW_RESOURCE_ARRAY(int, rec->_methods_length);
+    for (int i = 0; i < rec->_methods_length; i++) {
+      int offset = parse_int("offset");
+      if (had_error()) {
+        return;
+      }
+      Method* m = parse_method(CHECK);
+      rec->_methods_offsets[i] = offset;
+      rec->_methods[i] = m;
     }
   }
 
@@ -1105,14 +1121,22 @@
     m->_state = rec->_state;
     m->_current_mileage = rec->_current_mileage;
     if (rec->_data_length != 0) {
-      assert(m->_data_size == rec->_data_length * (int)sizeof(rec->_data[0]), "must agree");
+      assert(m->_data_size + m->_extra_data_size == rec->_data_length * (int)sizeof(rec->_data[0]) ||
+             m->_data_size == rec->_data_length * (int)sizeof(rec->_data[0]), "must agree");
 
       // Write the correct ciObjects back into the profile data
       ciEnv* env = ciEnv::current();
-      for (int i = 0; i < rec->_oops_length; i++) {
-        KlassHandle *h = (KlassHandle *)rec->_oops_handles[i];
-        *(ciMetadata**)(rec->_data + rec->_oops_offsets[i]) =
-          env->get_metadata((*h)());
+      for (int i = 0; i < rec->_classes_length; i++) {
+        Klass *k = rec->_classes[i];
+        // In case this class pointer is is tagged, preserve the tag
+        // bits
+        rec->_data[rec->_classes_offsets[i]] =
+          ciTypeEntries::with_status(env->get_metadata(k)->as_klass(), rec->_data[rec->_classes_offsets[i]]);
+      }
+      for (int i = 0; i < rec->_methods_length; i++) {
+        Method *m = rec->_methods[i];
+        *(ciMetadata**)(rec->_data + rec->_methods_offsets[i]) =
+          env->get_metadata(m);
       }
       // Copy the updated profile data into place as intptr_ts
 #ifdef _LP64
--- a/hotspot/src/share/vm/ci/ciSignature.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciSignature.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,5 +148,5 @@
   print_signature();
  tty->print(" accessing_klass=");
   _accessing_klass->print();
-  tty->print(" address=0x%x>", (address)this);
+  tty->print(" address=" INTPTR_FORMAT ">", p2i((address)this));
 }
--- a/hotspot/src/share/vm/ci/ciType.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/ci/ciType.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
 // Print the name of this type
 void ciType::print_name_on(outputStream* st) {
   ResourceMark rm;
-  st->print(name());
+  st->print("%s", name());
 }
 
 
--- a/hotspot/src/share/vm/classfile/classFileError.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/classFileError.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,9 @@
 
 // Keep these in a separate file to prevent inlining
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+
 void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) {
     ResourceMark rm(THREAD);
     Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
@@ -53,6 +56,8 @@
                        msg, index, name, _class_name->as_C_string());
 }
 
+PRAGMA_DIAG_POP
+
 void StackMapStream::stackmap_format_error(const char* msg, TRAPS) {
   ResourceMark rm(THREAD);
   Exceptions::fthrow(
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -875,6 +875,7 @@
   int runtime_visible_type_annotations_length = 0;
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
+  bool runtime_invisible_annotations_exists = false;
   bool runtime_invisible_type_annotations_exists = false;
   while (attributes_count--) {
     cfs->guarantee_more(6, CHECK);  // attribute_name_index, attribute_length
@@ -920,6 +921,10 @@
         }
         generic_signature_index = cfs->get_u2(CHECK);
       } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes for field in class file %s", CHECK);
+        }
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -928,11 +933,18 @@
                           parsed_annotations,
                           CHECK);
         cfs->skip_u1(runtime_visible_annotations_length, CHECK);
-      } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes for field in class file %s", CHECK);
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(attribute_length, CHECK);
       } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) {
         if (runtime_visible_type_annotations != NULL) {
           classfile_parse_error(
@@ -2066,7 +2078,9 @@
   int runtime_visible_type_annotations_length = 0;
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
+  bool runtime_invisible_annotations_exists = false;
   bool runtime_invisible_type_annotations_exists = false;
+  bool runtime_invisible_parameter_annotations_exists = false;
   u1* annotation_default = NULL;
   int annotation_default_length = 0;
 
@@ -2295,6 +2309,10 @@
         cfs->guarantee_more(2, CHECK_(nullHandle));  // generic_signature_index
         generic_signature_index = cfs->get_u2_fast();
       } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
         runtime_visible_annotations_length = method_attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -2302,22 +2320,45 @@
             runtime_visible_annotations_length, &parsed_annotations,
             CHECK_(nullHandle));
         cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle));
-      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = method_attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = method_attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
       } else if (method_attribute_name == vmSymbols::tag_runtime_visible_parameter_annotations()) {
+        if (runtime_visible_parameter_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
         runtime_visible_parameter_annotations_length = method_attribute_length;
         runtime_visible_parameter_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_parameter_annotations != NULL, "null visible parameter annotations");
         cfs->skip_u1(runtime_visible_parameter_annotations_length, CHECK_(nullHandle));
-      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) {
-        runtime_invisible_parameter_annotations_length = method_attribute_length;
-        runtime_invisible_parameter_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations");
-        cfs->skip_u1(runtime_invisible_parameter_annotations_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) {
+        if (runtime_invisible_parameter_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
+        runtime_invisible_parameter_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_parameter_annotations_length = method_attribute_length;
+          runtime_invisible_parameter_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations");
+        }
+        cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
       } else if (method_attribute_name == vmSymbols::tag_annotation_default()) {
+        if (annotation_default != NULL) {
+          classfile_parse_error(
+            "Multiple AnnotationDefault attributes for method in class file %s",
+            CHECK_(nullHandle));
+        }
         annotation_default_length = method_attribute_length;
         annotation_default = cfs->get_u1_buffer();
         assert(annotation_default != NULL, "null annotation default");
@@ -2764,7 +2805,7 @@
                      "Short length on BootstrapMethods in class file %s",
                      CHECK);
 
-  guarantee_property(attribute_byte_length > sizeof(u2),
+  guarantee_property(attribute_byte_length >= sizeof(u2),
                      "Invalid BootstrapMethods attribute length %u in class file %s",
                      attribute_byte_length,
                      CHECK);
@@ -2846,6 +2887,8 @@
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
   bool runtime_invisible_type_annotations_exists = false;
+  bool runtime_invisible_annotations_exists = false;
+  bool parsed_source_debug_ext_annotations_exist = false;
   u1* inner_classes_attribute_start = NULL;
   u4  inner_classes_attribute_length = 0;
   u2  enclosing_method_class_index = 0;
@@ -2873,6 +2916,11 @@
       parse_classfile_sourcefile_attribute(CHECK);
     } else if (tag == vmSymbols::tag_source_debug_extension()) {
       // Check for SourceDebugExtension tag
+      if (parsed_source_debug_ext_annotations_exist) {
+          classfile_parse_error(
+            "Multiple SourceDebugExtension attributes in class file %s", CHECK);
+      }
+      parsed_source_debug_ext_annotations_exist = true;
       parse_classfile_source_debug_extension_attribute((int)attribute_length, CHECK);
     } else if (tag == vmSymbols::tag_inner_classes()) {
       // Check for InnerClasses tag
@@ -2909,6 +2957,10 @@
         }
         parse_classfile_signature_attribute(CHECK);
       } else if (tag == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes in class file %s", CHECK);
+        }
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -2917,11 +2969,18 @@
                           parsed_annotations,
                           CHECK);
         cfs->skip_u1(runtime_visible_annotations_length, CHECK);
-      } else if (PreserveAllAnnotations && tag == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes in class file %s", CHECK);
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(attribute_length, CHECK);
       } else if (tag == vmSymbols::tag_enclosing_method()) {
         if (parsed_enclosingmethod_attribute) {
           classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK);
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -312,7 +312,9 @@
     if (!b) { classfile_parse_error(msg, CHECK); }
   }
 
-  inline void assert_property(bool b, const char* msg, TRAPS) {
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+inline void assert_property(bool b, const char* msg, TRAPS) {
 #ifdef ASSERT
     if (!b) {
       ResourceMark rm(THREAD);
@@ -329,6 +331,7 @@
     }
 #endif
   }
+PRAGMA_DIAG_POP
 
   inline void check_property(bool property, const char* msg, int index, TRAPS) {
     if (_need_verify) {
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -343,7 +343,7 @@
   tty->print("[Meta index for %s=", entry->name());
   for (int i = 0; i < meta_packages.length(); i++) {
     if (i > 0) tty->print(" ");
-    tty->print(meta_packages.at(i));
+    tty->print("%s", meta_packages.at(i));
   }
   tty->print_cr("]");
 }
@@ -1299,7 +1299,7 @@
     e = e->next();
   }
   jlong end = os::javaTimeMillis();
-  tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, %d ms)",
+  tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, " JLONG_FORMAT " ms)",
                 _compile_the_world_class_counter, _compile_the_world_method_counter, (end - start));
   {
     // Print statistics as if before normal exit:
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -281,10 +281,10 @@
     ResourceMark rm;
     tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: "
                   PTR_FORMAT " loader: " PTR_FORMAT " %s",
-                  k,
+                  p2i(k),
                   k->external_name(),
-                  k->class_loader_data(),
-                  (void *)k->class_loader(),
+                  p2i(k->class_loader_data()),
+                  p2i((void *)k->class_loader()),
                   loader_name());
   }
 }
@@ -319,11 +319,11 @@
 
   if (TraceClassLoaderData) {
     ResourceMark rm;
-    tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this);
-    tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(),
+    tty->print("[ClassLoaderData: unload loader data " INTPTR_FORMAT, p2i(this));
+    tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()),
                loader_name());
     if (is_anonymous()) {
-      tty->print(" for anonymous class  "PTR_FORMAT " ", _klasses);
+      tty->print(" for anonymous class  " INTPTR_FORMAT " ", p2i(_klasses));
     }
     tty->print_cr("]");
   }
@@ -485,14 +485,14 @@
 void ClassLoaderData::dump(outputStream * const out) {
   ResourceMark rm;
   out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {",
-      this, (void *)class_loader(),
-      class_loader() != NULL ? class_loader()->klass() : NULL, loader_name());
+      p2i(this), p2i((void *)class_loader()),
+      p2i(class_loader() != NULL ? class_loader()->klass() : NULL), loader_name());
   if (claimed()) out->print(" claimed ");
   if (is_unloading()) out->print(" unloading ");
-  out->print(" handles " INTPTR_FORMAT, handles());
+  out->print(" handles " INTPTR_FORMAT, p2i(handles()));
   out->cr();
   if (metaspace_or_null() != NULL) {
-    out->print_cr("metaspace: " PTR_FORMAT, metaspace_or_null());
+    out->print_cr("metaspace: " INTPTR_FORMAT, p2i(metaspace_or_null()));
     metaspace_or_null()->dump(out);
   } else {
     out->print_cr("metaspace: NULL");
@@ -549,6 +549,8 @@
 ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
 ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
 
+bool ClassLoaderDataGraph::_should_purge = false;
+
 // Add a new class loader data node to the list.  Assign the newly created
 // ClassLoaderData into the java/lang/ClassLoader object as a hidden field
 ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRAPS) {
@@ -586,8 +588,8 @@
       if (TraceClassLoaderData) {
         ResourceMark rm;
         tty->print("[ClassLoaderData: ");
-        tty->print("create class loader data "PTR_FORMAT, cld);
-        tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(),
+        tty->print("create class loader data " INTPTR_FORMAT, p2i(cld));
+        tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
                    cld->loader_name());
         tty->print_cr("]");
       }
@@ -675,32 +677,6 @@
   return array;
 }
 
-// For profiling and hsfind() only.  Otherwise, this is unsafe (and slow).  This
-// is done lock free to avoid lock inversion problems.  It is safe because
-// new ClassLoaderData are added to the end of the CLDG, and only removed at
-// safepoint.  The _unloading list can be deallocated concurrently with CMS so
-// this doesn't look in metaspace for classes that have been unloaded.
-bool ClassLoaderDataGraph::contains(const void* x) {
-  if (DumpSharedSpaces) {
-    // There are only two metaspaces to worry about.
-    ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data();
-    return (ncld->ro_metaspace()->contains(x) || ncld->rw_metaspace()->contains(x));
-  }
-
-  if (UseSharedSpaces && MetaspaceShared::is_in_shared_space(x)) {
-    return true;
-  }
-
-  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) {
-      return true;
-    }
-  }
-
-  // Do not check unloading list because deallocation can be concurrent.
-  return false;
-}
-
 #ifndef PRODUCT
 bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
   for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
@@ -759,6 +735,7 @@
 }
 
 void ClassLoaderDataGraph::purge() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
   ClassLoaderData* list = _unloading;
   _unloading = NULL;
   ClassLoaderData* next = list;
@@ -847,7 +824,7 @@
   if (class_loader() == NULL) {
     out->print("NULL class_loader");
   } else {
-    out->print("class loader "PTR_FORMAT, this);
+    out->print("class loader " INTPTR_FORMAT, p2i(this));
     class_loader()->print_value_on(out);
   }
 }
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -66,6 +66,7 @@
   static ClassLoaderData* _unloading;
   // CMS support.
   static ClassLoaderData* _saved_head;
+  static bool _should_purge;
 
   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
   static void post_class_unload_events(void);
@@ -87,12 +88,20 @@
   static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
   static GrowableArray<ClassLoaderData*>* new_clds();
 
+  static void set_should_purge(bool b) { _should_purge = b; }
+  static void purge_if_needed() {
+    // Only purge the CLDG for CMS if concurrent sweep is complete.
+    if (_should_purge) {
+      purge();
+      // reset for next time.
+      set_should_purge(false);
+    }
+  }
+
   static void dump_on(outputStream * const out) PRODUCT_RETURN;
   static void dump() { dump_on(tty); }
   static void verify();
 
-  // expensive test for pointer in metaspace for debugging
-  static bool contains(const void* x);
 #ifndef PRODUCT
   static bool contains_loader_data(ClassLoaderData* loader_data);
 #endif
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -436,7 +436,7 @@
       _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();
       if (TraceDefaultMethods) {
         _exception_message->print_value_on(tty);
-        tty->print_cr("");
+        tty->cr();
       }
     }
   }
@@ -463,7 +463,7 @@
       if (_members.at(i).second == DISQUALIFIED) {
         str->print(" (disqualified)");
       }
-      str->print_cr("");
+      str->cr();
     }
 
     if (_selected_target != NULL) {
@@ -480,7 +480,7 @@
     if (!method_holder->is_interface()) {
       tty->print(" : in superclass");
     }
-    str->print_cr("");
+    str->cr();
   }
 
   void print_exception(outputStream* str, int indent) {
@@ -688,7 +688,7 @@
     for (int i = 0; i < slots->length(); ++i) {
       tty->indent();
       slots->at(i)->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
   }
 #endif // ndef PRODUCT
@@ -828,7 +828,7 @@
       streamIndentor si(tty, 2);
       tty->indent().print("Looking for default methods for slot ");
       slot->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
 #endif // ndef PRODUCT
 
@@ -946,7 +946,7 @@
       if (TraceDefaultMethods) {
         tty->print("for slot: ");
         slot->print_on(tty);
-        tty->print_cr("");
+        tty->cr();
         if (method->has_target()) {
           method->print_selected(tty, 1);
         } else if (method->throws_exception()) {
--- a/hotspot/src/share/vm/classfile/dictionary.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -31,6 +31,7 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/hashtable.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 DictionaryEntry*  Dictionary::_current_class_entry = NULL;
 int               Dictionary::_current_class_index =    0;
--- a/hotspot/src/share/vm/classfile/dictionary.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -379,7 +379,7 @@
     }
     if (method_type() != NULL) {
       if (printed)  st->print(" and ");
-      st->print(INTPTR_FORMAT, (void *)method_type());
+      st->print(INTPTR_FORMAT, p2i((void *)method_type()));
       printed = true;
     }
     st->print_cr(printed ? "" : "(empty)");
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/debugInfo.hpp"
 #include "code/pcDesc.hpp"
@@ -51,6 +51,8 @@
 #include "runtime/vframe.hpp"
 #include "utilities/preserveException.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define INJECTED_FIELD_COMPUTE_OFFSET(klass, name, signature, may_be_java)    \
   klass::_##name##_offset = JavaClasses::compute_injected_offset(JavaClasses::klass##_##name##_enum);
 
@@ -1490,7 +1492,7 @@
   while (h_throwable.not_null()) {
     objArrayHandle result (THREAD, objArrayOop(backtrace(h_throwable())));
     if (result.is_null()) {
-      st->print_cr(no_stack_trace_message());
+      st->print_cr("%s", no_stack_trace_message());
       return;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,533 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/altHashing.hpp"
+#include "classfile/javaClasses.hpp"
+#include "classfile/stringTable.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "gc_interface/collectedHeap.inline.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/filemap.hpp"
+#include "memory/gcLocker.inline.hpp"
+#include "oops/oop.inline.hpp"
+#include "oops/oop.inline2.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "utilities/hashtable.inline.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1StringDedup.hpp"
+#endif
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
+// the number of buckets a thread claims
+const int ClaimChunkSize = 32;
+
+#ifdef ASSERT
+class StableMemoryChecker : public StackObj {
+  enum { _bufsize = wordSize*4 };
+
+  address _region;
+  jint    _size;
+  u1      _save_buf[_bufsize];
+
+  int sample(u1* save_buf) {
+    if (_size <= _bufsize) {
+      memcpy(save_buf, _region, _size);
+      return _size;
+    } else {
+      // copy head and tail
+      memcpy(&save_buf[0],          _region,                      _bufsize/2);
+      memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2);
+      return (_bufsize/2)*2;
+    }
+  }
+
+ public:
+  StableMemoryChecker(const void* region, jint size) {
+    _region = (address) region;
+    _size   = size;
+    sample(_save_buf);
+  }
+
+  bool verify() {
+    u1 check_buf[sizeof(_save_buf)];
+    int check_size = sample(check_buf);
+    return (0 == memcmp(_save_buf, check_buf, check_size));
+  }
+
+  void set_region(const void* region) { _region = (address) region; }
+};
+#endif
+
+
+// --------------------------------------------------------------------------
+StringTable* StringTable::_the_table = NULL;
+
+bool StringTable::_needs_rehashing = false;
+
+volatile int StringTable::_parallel_claimed_idx = 0;
+
+// Pick hashing algorithm
+unsigned int StringTable::hash_string(const jchar* s, int len) {
+  return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) :
+                                    java_lang_String::hash_code(s, len);
+}
+
+oop StringTable::lookup(int index, jchar* name,
+                        int len, unsigned int hash) {
+  int count = 0;
+  for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
+    count++;
+    if (l->hash() == hash) {
+      if (java_lang_String::equals(l->literal(), name, len)) {
+        return l->literal();
+      }
+    }
+  }
+  // If the bucket size is too deep check if this hash code is insufficient.
+  if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
+    _needs_rehashing = check_rehash_table(count);
+  }
+  return NULL;
+}
+
+
+oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
+                           int len, unsigned int hashValue_arg, TRAPS) {
+
+  assert(java_lang_String::equals(string(), name, len),
+         "string must be properly initialized");
+  // Cannot hit a safepoint in this function because the "this" pointer can move.
+  No_Safepoint_Verifier nsv;
+
+  // Check if the symbol table has been rehashed, if so, need to recalculate
+  // the hash value and index before second lookup.
+  unsigned int hashValue;
+  int index;
+  if (use_alternate_hashcode()) {
+    hashValue = hash_string(name, len);
+    index = hash_to_index(hashValue);
+  } else {
+    hashValue = hashValue_arg;
+    index = index_arg;
+  }
+
+  // Since look-up was done lock-free, we need to check if another
+  // thread beat us in the race to insert the symbol.
+
+  oop test = lookup(index, name, len, hashValue); // calls lookup(u1*, int)
+  if (test != NULL) {
+    // Entry already added
+    return test;
+  }
+
+  HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
+  add_entry(index, entry);
+  return string();
+}
+
+
+oop StringTable::lookup(Symbol* symbol) {
+  ResourceMark rm;
+  int length;
+  jchar* chars = symbol->as_unicode(length);
+  return lookup(chars, length);
+}
+
+
+oop StringTable::lookup(jchar* name, int len) {
+  unsigned int hash = hash_string(name, len);
+  int index = the_table()->hash_to_index(hash);
+  return the_table()->lookup(index, name, len, hash);
+}
+
+
+oop StringTable::intern(Handle string_or_null, jchar* name,
+                        int len, TRAPS) {
+  unsigned int hashValue = hash_string(name, len);
+  int index = the_table()->hash_to_index(hashValue);
+  oop found_string = the_table()->lookup(index, name, len, hashValue);
+
+  // Found
+  if (found_string != NULL) return found_string;
+
+  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
+  assert(!Universe::heap()->is_in_reserved(name),
+         "proposed name of symbol must be stable");
+
+  Handle string;
+  // try to reuse the string if possible
+  if (!string_or_null.is_null()) {
+    string = string_or_null;
+  } else {
+    string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
+  }
+
+#if INCLUDE_ALL_GCS
+  if (G1StringDedup::is_enabled()) {
+    // Deduplicate the string before it is interned. Note that we should never
+    // deduplicate a string after it has been interned. Doing so will counteract
+    // compiler optimizations done on e.g. interned string literals.
+    G1StringDedup::deduplicate(string());
+  }
+#endif
+
+  // Grab the StringTable_lock before getting the_table() because it could
+  // change at safepoint.
+  MutexLocker ml(StringTable_lock, THREAD);
+
+  // Otherwise, add to symbol to table
+  return the_table()->basic_add(index, string, name, len,
+                                hashValue, CHECK_NULL);
+}
+
+oop StringTable::intern(Symbol* symbol, TRAPS) {
+  if (symbol == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length;
+  jchar* chars = symbol->as_unicode(length);
+  Handle string;
+  oop result = intern(string, chars, length, CHECK_NULL);
+  return result;
+}
+
+
+oop StringTable::intern(oop string, TRAPS)
+{
+  if (string == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length;
+  Handle h_string (THREAD, string);
+  jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL);
+  oop result = intern(h_string, chars, length, CHECK_NULL);
+  return result;
+}
+
+
+oop StringTable::intern(const char* utf8_string, TRAPS) {
+  if (utf8_string == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length = UTF8::unicode_length(utf8_string);
+  jchar* chars = NEW_RESOURCE_ARRAY(jchar, length);
+  UTF8::convert_to_unicode(utf8_string, chars, length);
+  Handle string;
+  oop result = intern(string, chars, length, CHECK_NULL);
+  return result;
+}
+
+void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
+  buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed);
+}
+
+void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
+  // Readers of the table are unlocked, so we should only be removing
+  // entries at a safepoint.
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+  const int limit = the_table()->table_size();
+
+  for (;;) {
+    // Grab next set of buckets to scan
+    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
+    if (start_idx >= limit) {
+      // End of table
+      break;
+    }
+
+    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
+    buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed);
+  }
+}
+
+void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
+  const int limit = the_table()->table_size();
+
+  assert(0 <= start_idx && start_idx <= limit,
+         err_msg("start_idx (%d) is out of bounds", start_idx));
+  assert(0 <= end_idx && end_idx <= limit,
+         err_msg("end_idx (%d) is out of bounds", end_idx));
+  assert(start_idx <= end_idx,
+         err_msg("Index ordering: start_idx=%d, end_idx=%d",
+                 start_idx, end_idx));
+
+  for (int i = start_idx; i < end_idx; i += 1) {
+    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
+    while (entry != NULL) {
+      assert(!entry->is_shared(), "CDS not used for the StringTable");
+
+      f->do_oop((oop*)entry->literal_addr());
+
+      entry = entry->next();
+    }
+  }
+}
+
+void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) {
+  const int limit = the_table()->table_size();
+
+  assert(0 <= start_idx && start_idx <= limit,
+         err_msg("start_idx (%d) is out of bounds", start_idx));
+  assert(0 <= end_idx && end_idx <= limit,
+         err_msg("end_idx (%d) is out of bounds", end_idx));
+  assert(start_idx <= end_idx,
+         err_msg("Index ordering: start_idx=%d, end_idx=%d",
+                 start_idx, end_idx));
+
+  for (int i = start_idx; i < end_idx; ++i) {
+    HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
+    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
+    while (entry != NULL) {
+      assert(!entry->is_shared(), "CDS not used for the StringTable");
+
+      if (is_alive->do_object_b(entry->literal())) {
+        if (f != NULL) {
+          f->do_oop((oop*)entry->literal_addr());
+        }
+        p = entry->next_addr();
+      } else {
+        *p = entry->next();
+        the_table()->free_entry(entry);
+        (*removed)++;
+      }
+      (*processed)++;
+      entry = *p;
+    }
+  }
+}
+
+void StringTable::oops_do(OopClosure* f) {
+  buckets_oops_do(f, 0, the_table()->table_size());
+}
+
+void StringTable::possibly_parallel_oops_do(OopClosure* f) {
+  const int limit = the_table()->table_size();
+
+  for (;;) {
+    // Grab next set of buckets to scan
+    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
+    if (start_idx >= limit) {
+      // End of table
+      break;
+    }
+
+    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
+    buckets_oops_do(f, start_idx, end_idx);
+  }
+}
+
+// This verification is part of Universe::verify() and needs to be quick.
+// See StringTable::verify_and_compare() below for exhaustive verification.
+void StringTable::verify() {
+  for (int i = 0; i < the_table()->table_size(); ++i) {
+    HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
+    for ( ; p != NULL; p = p->next()) {
+      oop s = p->literal();
+      guarantee(s != NULL, "interned string is NULL");
+      unsigned int h = java_lang_String::hash_string(s);
+      guarantee(p->hash() == h, "broken hash in string table entry");
+      guarantee(the_table()->hash_to_index(h) == i,
+                "wrong index in string table");
+    }
+  }
+}
+
+void StringTable::dump(outputStream* st) {
+  the_table()->dump_table(st, "StringTable");
+}
+
+StringTable::VerifyRetTypes StringTable::compare_entries(
+                                      int bkt1, int e_cnt1,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr1,
+                                      int bkt2, int e_cnt2,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr2) {
+  // These entries are sanity checked by verify_and_compare_entries()
+  // before this function is called.
+  oop str1 = e_ptr1->literal();
+  oop str2 = e_ptr2->literal();
+
+  if (str1 == str2) {
+    tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") "
+                  "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]",
+                  (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2);
+    return _verify_fail_continue;
+  }
+
+  if (java_lang_String::equals(str1, str2)) {
+    tty->print_cr("ERROR: identical String values in entry @ "
+                  "bucket[%d][%d] and entry @ bucket[%d][%d]",
+                  bkt1, e_cnt1, bkt2, e_cnt2);
+    return _verify_fail_continue;
+  }
+
+  return _verify_pass;
+}
+
+StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt,
+                                      HashtableEntry<oop, mtSymbol>* e_ptr,
+                                      StringTable::VerifyMesgModes mesg_mode) {
+
+  VerifyRetTypes ret = _verify_pass;  // be optimistic
+
+  oop str = e_ptr->literal();
+  if (str == NULL) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt,
+                    e_cnt);
+    }
+    // NULL oop means no more verifications are possible
+    return _verify_fail_done;
+  }
+
+  if (str->klass() != SystemDictionary::String_klass()) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]",
+                    bkt, e_cnt);
+    }
+    // not a String means no more verifications are possible
+    return _verify_fail_done;
+  }
+
+  unsigned int h = java_lang_String::hash_string(str);
+  if (e_ptr->hash() != h) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], "
+                    "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h);
+    }
+    ret = _verify_fail_continue;
+  }
+
+  if (the_table()->hash_to_index(h) != bkt) {
+    if (mesg_mode == _verify_with_mesgs) {
+      tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], "
+                    "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h,
+                    the_table()->hash_to_index(h));
+    }
+    ret = _verify_fail_continue;
+  }
+
+  return ret;
+}
+
+// See StringTable::verify() above for the quick verification that is
+// part of Universe::verify(). This verification is exhaustive and
+// reports on every issue that is found. StringTable::verify() only
+// reports on the first issue that is found.
+//
+// StringTable::verify_entry() checks:
+// - oop value != NULL (same as verify())
+// - oop value is a String
+// - hash(String) == hash in entry (same as verify())
+// - index for hash == index of entry (same as verify())
+//
+// StringTable::compare_entries() checks:
+// - oops are unique across all entries
+// - String values are unique across all entries
+//
+int StringTable::verify_and_compare_entries() {
+  assert(StringTable_lock->is_locked(), "sanity check");
+
+  int  fail_cnt = 0;
+
+  // first, verify all the entries individually:
+  for (int bkt = 0; bkt < the_table()->table_size(); bkt++) {
+    HashtableEntry<oop, mtSymbol>* e_ptr = the_table()->bucket(bkt);
+    for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) {
+      VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs);
+      if (ret != _verify_pass) {
+        fail_cnt++;
+      }
+    }
+  }
+
+  // Optimization: if the above check did not find any failures, then
+  // the comparison loop below does not need to call verify_entry()
+  // before calling compare_entries(). If there were failures, then we
+  // have to call verify_entry() to see if the entry can be passed to
+  // compare_entries() safely. When we call verify_entry() in the loop
+  // below, we do so quietly to void duplicate messages and we don't
+  // increment fail_cnt because the failures have already been counted.
+  bool need_entry_verify = (fail_cnt != 0);
+
+  // second, verify all entries relative to each other:
+  for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) {
+    HashtableEntry<oop, mtSymbol>* e_ptr1 = the_table()->bucket(bkt1);
+    for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) {
+      if (need_entry_verify) {
+        VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1,
+                                          _verify_quietly);
+        if (ret == _verify_fail_done) {
+          // cannot use the current entry to compare against other entries
+          continue;
+        }
+      }
+
+      for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) {
+        HashtableEntry<oop, mtSymbol>* e_ptr2 = the_table()->bucket(bkt2);
+        int e_cnt2;
+        for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) {
+          if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) {
+            // skip the entries up to and including the one that
+            // we're comparing against
+            continue;
+          }
+
+          if (need_entry_verify) {
+            VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2,
+                                              _verify_quietly);
+            if (ret == _verify_fail_done) {
+              // cannot compare against this entry
+              continue;
+            }
+          }
+
+          // compare two entries, report and count any failures:
+          if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2)
+              != _verify_pass) {
+            fail_cnt++;
+          }
+        }
+      }
+    }
+  }
+  return fail_cnt;
+}
+
+// Create a new table and using alternate hash code, populate the new table
+// with the existing strings.   Set flag to use the alternate hash code afterwards.
+void StringTable::rehash_table() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
+  // This should never happen with -Xshare:dump but it might in testing mode.
+  if (DumpSharedSpaces) return;
+  StringTable* new_table = new StringTable();
+
+  // Rehash the table
+  the_table()->move_to(new_table);
+
+  // Delete the table and buckets (entries are reused in new table).
+  delete _the_table;
+  // Don't check if we need rehashing until the table gets unbalanced again.
+  // Then rehash with a new global seed.
+  _needs_rehashing = false;
+  _the_table = new_table;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/classfile/stringTable.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_STRINGTABLE_HPP
+#define SHARE_VM_CLASSFILE_STRINGTABLE_HPP
+
+#include "memory/allocation.inline.hpp"
+#include "utilities/hashtable.hpp"
+
+class StringTable : public Hashtable<oop, mtSymbol> {
+  friend class VMStructs;
+  friend class Symbol;
+
+private:
+  // The string table
+  static StringTable* _the_table;
+
+  // Set if one bucket is out of balance due to hash algorithm deficiency
+  static bool _needs_rehashing;
+
+  // Claimed high water mark for parallel chunked scanning
+  static volatile int _parallel_claimed_idx;
+
+  static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
+  oop basic_add(int index, Handle string_or_null, jchar* name, int len,
+                unsigned int hashValue, TRAPS);
+
+  oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
+
+  // Apply the give oop closure to the entries to the buckets
+  // in the range [start_idx, end_idx).
+  static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
+  // Unlink or apply the give oop closure to the entries to the buckets
+  // in the range [start_idx, end_idx).
+  static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
+
+  StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize,
+                              sizeof (HashtableEntry<oop, mtSymbol>)) {}
+
+  StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
+    : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
+                     number_of_entries) {}
+public:
+  // The string table
+  static StringTable* the_table() { return _the_table; }
+
+  // Size of one bucket in the string table.  Used when checking for rollover.
+  static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
+
+  static void create_table() {
+    assert(_the_table == NULL, "One string table allowed.");
+    _the_table = new StringTable();
+  }
+
+  // GC support
+  //   Delete pointers to otherwise-unreachable objects.
+  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) {
+    int processed = 0;
+    int removed = 0;
+    unlink_or_oops_do(cl, f, &processed, &removed);
+  }
+  static void unlink(BoolObjectClosure* cl) {
+    int processed = 0;
+    int removed = 0;
+    unlink_or_oops_do(cl, NULL, &processed, &removed);
+  }
+  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
+  static void unlink(BoolObjectClosure* cl, int* processed, int* removed) {
+    unlink_or_oops_do(cl, NULL, processed, removed);
+  }
+  // Serially invoke "f->do_oop" on the locations of all oops in the table.
+  static void oops_do(OopClosure* f);
+
+  // Possibly parallel versions of the above
+  static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
+  static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) {
+    possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed);
+  }
+  static void possibly_parallel_oops_do(OopClosure* f);
+
+  // Hashing algorithm, used as the hash value used by the
+  //     StringTable for bucket selection and comparison (stored in the
+  //     HashtableEntry structures).  This is used in the String.intern() method.
+  static unsigned int hash_string(const jchar* s, int len);
+
+  // Internal test.
+  static void test_alt_hash() PRODUCT_RETURN;
+
+  // Probing
+  static oop lookup(Symbol* symbol);
+  static oop lookup(jchar* chars, int length);
+
+  // Interning
+  static oop intern(Symbol* symbol, TRAPS);
+  static oop intern(oop string, TRAPS);
+  static oop intern(const char *utf8_string, TRAPS);
+
+  // Debugging
+  static void verify();
+  static void dump(outputStream* st);
+
+  enum VerifyMesgModes {
+    _verify_quietly    = 0,
+    _verify_with_mesgs = 1
+  };
+
+  enum VerifyRetTypes {
+    _verify_pass          = 0,
+    _verify_fail_continue = 1,
+    _verify_fail_done     = 2
+  };
+
+  static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
+                                        HashtableEntry<oop, mtSymbol>* e_ptr1,
+                                        int bkt2, int e_cnt2,
+                                        HashtableEntry<oop, mtSymbol>* e_ptr2);
+  static VerifyRetTypes verify_entry(int bkt, int e_cnt,
+                                     HashtableEntry<oop, mtSymbol>* e_ptr,
+                                     VerifyMesgModes mesg_mode);
+  static int verify_and_compare_entries();
+
+  // Sharing
+  static void copy_buckets(char** top, char*end) {
+    the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end);
+  }
+  static void copy_table(char** top, char*end) {
+    the_table()->Hashtable<oop, mtSymbol>::copy_table(top, end);
+  }
+  static void reverse() {
+    the_table()->Hashtable<oop, mtSymbol>::reverse();
+  }
+
+  // Rehash the symbol table if it gets out of balance
+  static void rehash_table();
+  static bool needs_rehashing() { return _needs_rehashing; }
+
+  // Parallel chunked scanning
+  static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
+  static int parallel_claimed_index() { return _parallel_claimed_idx; }
+};
+#endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -35,12 +35,10 @@
 #include "oops/oop.inline2.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/g1StringDedup.hpp"
-#endif
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // --------------------------------------------------------------------------
-
 // the number of buckets a thread claims
 const int ClaimChunkSize = 32;
 
@@ -587,493 +585,3 @@
   }
 }
 #endif // PRODUCT
-
-// --------------------------------------------------------------------------
-
-#ifdef ASSERT
-class StableMemoryChecker : public StackObj {
-  enum { _bufsize = wordSize*4 };
-
-  address _region;
-  jint    _size;
-  u1      _save_buf[_bufsize];
-
-  int sample(u1* save_buf) {
-    if (_size <= _bufsize) {
-      memcpy(save_buf, _region, _size);
-      return _size;
-    } else {
-      // copy head and tail
-      memcpy(&save_buf[0],          _region,                      _bufsize/2);
-      memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2);
-      return (_bufsize/2)*2;
-    }
-  }
-
- public:
-  StableMemoryChecker(const void* region, jint size) {
-    _region = (address) region;
-    _size   = size;
-    sample(_save_buf);
-  }
-
-  bool verify() {
-    u1 check_buf[sizeof(_save_buf)];
-    int check_size = sample(check_buf);
-    return (0 == memcmp(_save_buf, check_buf, check_size));
-  }
-
-  void set_region(const void* region) { _region = (address) region; }
-};
-#endif
-
-
-// --------------------------------------------------------------------------
-StringTable* StringTable::_the_table = NULL;
-
-bool StringTable::_needs_rehashing = false;
-
-volatile int StringTable::_parallel_claimed_idx = 0;
-
-// Pick hashing algorithm
-unsigned int StringTable::hash_string(const jchar* s, int len) {
-  return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) :
-                                    java_lang_String::hash_code(s, len);
-}
-
-oop StringTable::lookup(int index, jchar* name,
-                        int len, unsigned int hash) {
-  int count = 0;
-  for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
-    count++;
-    if (l->hash() == hash) {
-      if (java_lang_String::equals(l->literal(), name, len)) {
-        return l->literal();
-      }
-    }
-  }
-  // If the bucket size is too deep check if this hash code is insufficient.
-  if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
-    _needs_rehashing = check_rehash_table(count);
-  }
-  return NULL;
-}
-
-
-oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
-                           int len, unsigned int hashValue_arg, TRAPS) {
-
-  assert(java_lang_String::equals(string(), name, len),
-         "string must be properly initialized");
-  // Cannot hit a safepoint in this function because the "this" pointer can move.
-  No_Safepoint_Verifier nsv;
-
-  // Check if the symbol table has been rehashed, if so, need to recalculate
-  // the hash value and index before second lookup.
-  unsigned int hashValue;
-  int index;
-  if (use_alternate_hashcode()) {
-    hashValue = hash_string(name, len);
-    index = hash_to_index(hashValue);
-  } else {
-    hashValue = hashValue_arg;
-    index = index_arg;
-  }
-
-  // Since look-up was done lock-free, we need to check if another
-  // thread beat us in the race to insert the symbol.
-
-  oop test = lookup(index, name, len, hashValue); // calls lookup(u1*, int)
-  if (test != NULL) {
-    // Entry already added
-    return test;
-  }
-
-  HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
-  add_entry(index, entry);
-  return string();
-}
-
-
-oop StringTable::lookup(Symbol* symbol) {
-  ResourceMark rm;
-  int length;
-  jchar* chars = symbol->as_unicode(length);
-  return lookup(chars, length);
-}
-
-
-oop StringTable::lookup(jchar* name, int len) {
-  unsigned int hash = hash_string(name, len);
-  int index = the_table()->hash_to_index(hash);
-  return the_table()->lookup(index, name, len, hash);
-}
-
-
-oop StringTable::intern(Handle string_or_null, jchar* name,
-                        int len, TRAPS) {
-  unsigned int hashValue = hash_string(name, len);
-  int index = the_table()->hash_to_index(hashValue);
-  oop found_string = the_table()->lookup(index, name, len, hashValue);
-
-  // Found
-  if (found_string != NULL) return found_string;
-
-  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
-  assert(!Universe::heap()->is_in_reserved(name),
-         "proposed name of symbol must be stable");
-
-  Handle string;
-  // try to reuse the string if possible
-  if (!string_or_null.is_null()) {
-    string = string_or_null;
-  } else {
-    string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
-  }
-
-#if INCLUDE_ALL_GCS
-  if (G1StringDedup::is_enabled()) {
-    // Deduplicate the string before it is interned. Note that we should never
-    // deduplicate a string after it has been interned. Doing so will counteract
-    // compiler optimizations done on e.g. interned string literals.
-    G1StringDedup::deduplicate(string());
-  }
-#endif
-
-  // Grab the StringTable_lock before getting the_table() because it could
-  // change at safepoint.
-  MutexLocker ml(StringTable_lock, THREAD);
-
-  // Otherwise, add to symbol to table
-  return the_table()->basic_add(index, string, name, len,
-                                hashValue, CHECK_NULL);
-}
-
-oop StringTable::intern(Symbol* symbol, TRAPS) {
-  if (symbol == NULL) return NULL;
-  ResourceMark rm(THREAD);
-  int length;
-  jchar* chars = symbol->as_unicode(length);
-  Handle string;
-  oop result = intern(string, chars, length, CHECK_NULL);
-  return result;
-}
-
-
-oop StringTable::intern(oop string, TRAPS)
-{
-  if (string == NULL) return NULL;
-  ResourceMark rm(THREAD);
-  int length;
-  Handle h_string (THREAD, string);
-  jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL);
-  oop result = intern(h_string, chars, length, CHECK_NULL);
-  return result;
-}
-
-
-oop StringTable::intern(const char* utf8_string, TRAPS) {
-  if (utf8_string == NULL) return NULL;
-  ResourceMark rm(THREAD);
-  int length = UTF8::unicode_length(utf8_string);
-  jchar* chars = NEW_RESOURCE_ARRAY(jchar, length);
-  UTF8::convert_to_unicode(utf8_string, chars, length);
-  Handle string;
-  oop result = intern(string, chars, length, CHECK_NULL);
-  return result;
-}
-
-void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
-  buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), processed, removed);
-}
-
-void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
-  // Readers of the table are unlocked, so we should only be removing
-  // entries at a safepoint.
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  const int limit = the_table()->table_size();
-
-  for (;;) {
-    // Grab next set of buckets to scan
-    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
-    if (start_idx >= limit) {
-      // End of table
-      break;
-    }
-
-    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
-    buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, processed, removed);
-  }
-}
-
-void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
-  const int limit = the_table()->table_size();
-
-  assert(0 <= start_idx && start_idx <= limit,
-         err_msg("start_idx (%d) is out of bounds", start_idx));
-  assert(0 <= end_idx && end_idx <= limit,
-         err_msg("end_idx (%d) is out of bounds", end_idx));
-  assert(start_idx <= end_idx,
-         err_msg("Index ordering: start_idx=%d, end_idx=%d",
-                 start_idx, end_idx));
-
-  for (int i = start_idx; i < end_idx; i += 1) {
-    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
-    while (entry != NULL) {
-      assert(!entry->is_shared(), "CDS not used for the StringTable");
-
-      f->do_oop((oop*)entry->literal_addr());
-
-      entry = entry->next();
-    }
-  }
-}
-
-void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed) {
-  const int limit = the_table()->table_size();
-
-  assert(0 <= start_idx && start_idx <= limit,
-         err_msg("start_idx (%d) is out of bounds", start_idx));
-  assert(0 <= end_idx && end_idx <= limit,
-         err_msg("end_idx (%d) is out of bounds", end_idx));
-  assert(start_idx <= end_idx,
-         err_msg("Index ordering: start_idx=%d, end_idx=%d",
-                 start_idx, end_idx));
-
-  for (int i = start_idx; i < end_idx; ++i) {
-    HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
-    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
-    while (entry != NULL) {
-      assert(!entry->is_shared(), "CDS not used for the StringTable");
-
-      if (is_alive->do_object_b(entry->literal())) {
-        if (f != NULL) {
-          f->do_oop((oop*)entry->literal_addr());
-        }
-        p = entry->next_addr();
-      } else {
-        *p = entry->next();
-        the_table()->free_entry(entry);
-        (*removed)++;
-      }
-      (*processed)++;
-      entry = *p;
-    }
-  }
-}
-
-void StringTable::oops_do(OopClosure* f) {
-  buckets_oops_do(f, 0, the_table()->table_size());
-}
-
-void StringTable::possibly_parallel_oops_do(OopClosure* f) {
-  const int limit = the_table()->table_size();
-
-  for (;;) {
-    // Grab next set of buckets to scan
-    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
-    if (start_idx >= limit) {
-      // End of table
-      break;
-    }
-
-    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
-    buckets_oops_do(f, start_idx, end_idx);
-  }
-}
-
-// This verification is part of Universe::verify() and needs to be quick.
-// See StringTable::verify_and_compare() below for exhaustive verification.
-void StringTable::verify() {
-  for (int i = 0; i < the_table()->table_size(); ++i) {
-    HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
-    for ( ; p != NULL; p = p->next()) {
-      oop s = p->literal();
-      guarantee(s != NULL, "interned string is NULL");
-      unsigned int h = java_lang_String::hash_string(s);
-      guarantee(p->hash() == h, "broken hash in string table entry");
-      guarantee(the_table()->hash_to_index(h) == i,
-                "wrong index in string table");
-    }
-  }
-}
-
-void StringTable::dump(outputStream* st) {
-  the_table()->dump_table(st, "StringTable");
-}
-
-StringTable::VerifyRetTypes StringTable::compare_entries(
-                                      int bkt1, int e_cnt1,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr1,
-                                      int bkt2, int e_cnt2,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr2) {
-  // These entries are sanity checked by verify_and_compare_entries()
-  // before this function is called.
-  oop str1 = e_ptr1->literal();
-  oop str2 = e_ptr2->literal();
-
-  if (str1 == str2) {
-    tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") "
-                  "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]",
-                  (void *)str1, bkt1, e_cnt1, bkt2, e_cnt2);
-    return _verify_fail_continue;
-  }
-
-  if (java_lang_String::equals(str1, str2)) {
-    tty->print_cr("ERROR: identical String values in entry @ "
-                  "bucket[%d][%d] and entry @ bucket[%d][%d]",
-                  bkt1, e_cnt1, bkt2, e_cnt2);
-    return _verify_fail_continue;
-  }
-
-  return _verify_pass;
-}
-
-StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr,
-                                      StringTable::VerifyMesgModes mesg_mode) {
-
-  VerifyRetTypes ret = _verify_pass;  // be optimistic
-
-  oop str = e_ptr->literal();
-  if (str == NULL) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt,
-                    e_cnt);
-    }
-    // NULL oop means no more verifications are possible
-    return _verify_fail_done;
-  }
-
-  if (str->klass() != SystemDictionary::String_klass()) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]",
-                    bkt, e_cnt);
-    }
-    // not a String means no more verifications are possible
-    return _verify_fail_done;
-  }
-
-  unsigned int h = java_lang_String::hash_string(str);
-  if (e_ptr->hash() != h) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], "
-                    "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h);
-    }
-    ret = _verify_fail_continue;
-  }
-
-  if (the_table()->hash_to_index(h) != bkt) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], "
-                    "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h,
-                    the_table()->hash_to_index(h));
-    }
-    ret = _verify_fail_continue;
-  }
-
-  return ret;
-}
-
-// See StringTable::verify() above for the quick verification that is
-// part of Universe::verify(). This verification is exhaustive and
-// reports on every issue that is found. StringTable::verify() only
-// reports on the first issue that is found.
-//
-// StringTable::verify_entry() checks:
-// - oop value != NULL (same as verify())
-// - oop value is a String
-// - hash(String) == hash in entry (same as verify())
-// - index for hash == index of entry (same as verify())
-//
-// StringTable::compare_entries() checks:
-// - oops are unique across all entries
-// - String values are unique across all entries
-//
-int StringTable::verify_and_compare_entries() {
-  assert(StringTable_lock->is_locked(), "sanity check");
-
-  int  fail_cnt = 0;
-
-  // first, verify all the entries individually:
-  for (int bkt = 0; bkt < the_table()->table_size(); bkt++) {
-    HashtableEntry<oop, mtSymbol>* e_ptr = the_table()->bucket(bkt);
-    for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) {
-      VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs);
-      if (ret != _verify_pass) {
-        fail_cnt++;
-      }
-    }
-  }
-
-  // Optimization: if the above check did not find any failures, then
-  // the comparison loop below does not need to call verify_entry()
-  // before calling compare_entries(). If there were failures, then we
-  // have to call verify_entry() to see if the entry can be passed to
-  // compare_entries() safely. When we call verify_entry() in the loop
-  // below, we do so quietly to void duplicate messages and we don't
-  // increment fail_cnt because the failures have already been counted.
-  bool need_entry_verify = (fail_cnt != 0);
-
-  // second, verify all entries relative to each other:
-  for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) {
-    HashtableEntry<oop, mtSymbol>* e_ptr1 = the_table()->bucket(bkt1);
-    for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) {
-      if (need_entry_verify) {
-        VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1,
-                                          _verify_quietly);
-        if (ret == _verify_fail_done) {
-          // cannot use the current entry to compare against other entries
-          continue;
-        }
-      }
-
-      for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) {
-        HashtableEntry<oop, mtSymbol>* e_ptr2 = the_table()->bucket(bkt2);
-        int e_cnt2;
-        for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) {
-          if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) {
-            // skip the entries up to and including the one that
-            // we're comparing against
-            continue;
-          }
-
-          if (need_entry_verify) {
-            VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2,
-                                              _verify_quietly);
-            if (ret == _verify_fail_done) {
-              // cannot compare against this entry
-              continue;
-            }
-          }
-
-          // compare two entries, report and count any failures:
-          if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2)
-              != _verify_pass) {
-            fail_cnt++;
-          }
-        }
-      }
-    }
-  }
-  return fail_cnt;
-}
-
-// Create a new table and using alternate hash code, populate the new table
-// with the existing strings.   Set flag to use the alternate hash code afterwards.
-void StringTable::rehash_table() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  // This should never happen with -Xshare:dump but it might in testing mode.
-  if (DumpSharedSpaces) return;
-  StringTable* new_table = new StringTable();
-
-  // Rehash the table
-  the_table()->move_to(new_table);
-
-  // Delete the table and buckets (entries are reused in new table).
-  delete _the_table;
-  // Don't check if we need rehashing until the table gets unbalanced again.
-  // Then rehash with a new global seed.
-  _needs_rehashing = false;
-  _the_table = new_table;
-}
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -42,7 +42,6 @@
 class BoolObjectClosure;
 class outputStream;
 
-
 // Class to hold a newly created or referenced Symbol* temporarily in scope.
 // new_symbol() and lookup() will create a Symbol* if not already in the
 // symbol table and add to the symbol's reference count.
@@ -252,134 +251,4 @@
   static int parallel_claimed_index()        { return _parallel_claimed_idx; }
 };
 
-class StringTable : public Hashtable<oop, mtSymbol> {
-  friend class VMStructs;
-
-private:
-  // The string table
-  static StringTable* _the_table;
-
-  // Set if one bucket is out of balance due to hash algorithm deficiency
-  static bool _needs_rehashing;
-
-  // Claimed high water mark for parallel chunked scanning
-  static volatile int _parallel_claimed_idx;
-
-  static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
-  oop basic_add(int index, Handle string_or_null, jchar* name, int len,
-                unsigned int hashValue, TRAPS);
-
-  oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
-
-  // Apply the give oop closure to the entries to the buckets
-  // in the range [start_idx, end_idx).
-  static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
-  // Unlink or apply the give oop closure to the entries to the buckets
-  // in the range [start_idx, end_idx).
-  static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, int* processed, int* removed);
-
-  StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize,
-                              sizeof (HashtableEntry<oop, mtSymbol>)) {}
-
-  StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
-    : Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
-                     number_of_entries) {}
-public:
-  // The string table
-  static StringTable* the_table() { return _the_table; }
-
-  // Size of one bucket in the string table.  Used when checking for rollover.
-  static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
-
-  static void create_table() {
-    assert(_the_table == NULL, "One string table allowed.");
-    _the_table = new StringTable();
-  }
-
-  // GC support
-  //   Delete pointers to otherwise-unreachable objects.
-  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) {
-    int processed = 0;
-    int removed = 0;
-    unlink_or_oops_do(cl, f, &processed, &removed);
-  }
-  static void unlink(BoolObjectClosure* cl) {
-    int processed = 0;
-    int removed = 0;
-    unlink_or_oops_do(cl, NULL, &processed, &removed);
-  }
-  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
-  static void unlink(BoolObjectClosure* cl, int* processed, int* removed) {
-    unlink_or_oops_do(cl, NULL, processed, removed);
-  }
-  // Serially invoke "f->do_oop" on the locations of all oops in the table.
-  static void oops_do(OopClosure* f);
-
-  // Possibly parallel versions of the above
-  static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
-  static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) {
-    possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed);
-  }
-  static void possibly_parallel_oops_do(OopClosure* f);
-
-  // Hashing algorithm, used as the hash value used by the
-  //     StringTable for bucket selection and comparison (stored in the
-  //     HashtableEntry structures).  This is used in the String.intern() method.
-  static unsigned int hash_string(const jchar* s, int len);
-
-  // Internal test.
-  static void test_alt_hash() PRODUCT_RETURN;
-
-  // Probing
-  static oop lookup(Symbol* symbol);
-  static oop lookup(jchar* chars, int length);
-
-  // Interning
-  static oop intern(Symbol* symbol, TRAPS);
-  static oop intern(oop string, TRAPS);
-  static oop intern(const char *utf8_string, TRAPS);
-
-  // Debugging
-  static void verify();
-  static void dump(outputStream* st);
-
-  enum VerifyMesgModes {
-    _verify_quietly    = 0,
-    _verify_with_mesgs = 1
-  };
-
-  enum VerifyRetTypes {
-    _verify_pass          = 0,
-    _verify_fail_continue = 1,
-    _verify_fail_done     = 2
-  };
-
-  static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
-                                        HashtableEntry<oop, mtSymbol>* e_ptr1,
-                                        int bkt2, int e_cnt2,
-                                        HashtableEntry<oop, mtSymbol>* e_ptr2);
-  static VerifyRetTypes verify_entry(int bkt, int e_cnt,
-                                     HashtableEntry<oop, mtSymbol>* e_ptr,
-                                     VerifyMesgModes mesg_mode);
-  static int verify_and_compare_entries();
-
-  // Sharing
-  static void copy_buckets(char** top, char*end) {
-    the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end);
-  }
-  static void copy_table(char** top, char*end) {
-    the_table()->Hashtable<oop, mtSymbol>::copy_table(top, end);
-  }
-  static void reverse() {
-    the_table()->Hashtable<oop, mtSymbol>::reverse();
-  }
-
-  // Rehash the symbol table if it gets out of balance
-  static void rehash_table();
-  static bool needs_rehashing() { return _needs_rehashing; }
-
-  // Parallel chunked scanning
-  static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
-  static int parallel_claimed_index() { return _parallel_claimed_idx; }
-};
 #endif // SHARE_VM_CLASSFILE_SYMBOLTABLE_HPP
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -29,6 +29,7 @@
 #include "classfile/loaderConstraints.hpp"
 #include "classfile/placeholders.hpp"
 #include "classfile/resolutionErrors.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "compiler/compileBroker.hpp"
@@ -603,7 +604,6 @@
 
   Ticks class_load_start_time = Ticks::now();
 
-  // UseNewReflection
   // Fix for 4474172; see evaluation for more details
   class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader()));
   ClassLoaderData *loader_data = register_loader(class_loader, CHECK_NULL);
@@ -897,7 +897,6 @@
                               Handle protection_domain,
                               TRAPS) {
 
-  // UseNewReflection
   // The result of this call should be consistent with the result
   // of the call to resolve_instance_class_or_null().
   // See evaluation 6790209 and 4474172 for more details.
@@ -2269,7 +2268,7 @@
       oop appendix = appendix_box->obj_at(0);
       if (TraceMethodHandles) {
     #ifndef PRODUCT
-        tty->print("Linked method="INTPTR_FORMAT": ", m);
+        tty->print("Linked method=" INTPTR_FORMAT ": ", p2i(m));
         m->print();
         if (appendix != NULL) { tty->print("appendix = "); appendix->print(); }
         tty->cr();
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -390,7 +390,7 @@
     return k;
   }
   static Klass* check_klass_Opt_Only_JDK14NewRef(Klass* k) {
-    assert(JDK_Version::is_gte_jdk14x_version() && UseNewReflection, "JDK 1.4 only");
+    assert(JDK_Version::is_gte_jdk14x_version(), "JDK 1.4 only");
     // despite the optional loading, if you use this it must be present:
     return check_klass(k);
   }
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -211,9 +211,9 @@
     // reflection implementation, not just those associated with
     // sun/reflect/SerializationConstructorAccessor.
     // NOTE: this is called too early in the bootstrapping process to be
-    // guarded by Universe::is_gte_jdk14x_version()/UseNewReflection.
+    // guarded by Universe::is_gte_jdk14x_version().
     // Also for lambda generated code, gte jdk8
-    (!is_reflect || VerifyReflectionBytecodes));
+    (!is_reflect));
 }
 
 Symbol* Verifier::inference_verify(
@@ -364,7 +364,7 @@
 
 void ErrorContext::details(outputStream* ss, const Method* method) const {
   if (is_valid()) {
-    ss->print_cr("");
+    ss->cr();
     ss->print_cr("Exception Details:");
     location_details(ss, method);
     reason_details(ss);
@@ -379,7 +379,7 @@
   streamIndentor si(ss);
   ss->indent().print_cr("Reason:");
   streamIndentor si2(ss);
-  ss->indent().print("");
+  ss->indent().print("%s", "");
   switch (_fault) {
     case INVALID_BYTECODE:
       ss->print("Error exists in the bytecode");
@@ -432,7 +432,7 @@
       ShouldNotReachHere();
       ss->print_cr("Unknown");
   }
-  ss->print_cr("");
+  ss->cr();
 }
 
 void ErrorContext::location_details(outputStream* ss, const Method* method) const {
@@ -507,7 +507,7 @@
     for (u2 i = 0; i < sm_table->number_of_entries(); ++i) {
       ss->indent();
       sm_frame->print_on(ss, current_offset);
-      ss->print_cr("");
+      ss->cr();
       current_offset += sm_frame->offset_delta();
       sm_frame = sm_frame->next();
     }
@@ -579,7 +579,8 @@
     tty->print_cr("Verifying method %s", m->name_and_sig_as_C_string());
   }
 
-  const char* bad_type_msg = "Bad type on operand stack in %s";
+// For clang, the only good constant format string is a literal constant format string.
+#define bad_type_msg "Bad type on operand stack in %s"
 
   int32_t max_stack = m->verifier_max_stack();
   int32_t max_locals = m->max_locals();
@@ -1676,6 +1677,8 @@
   }
 }
 
+#undef bad_type_message
+
 char* ClassVerifier::generate_code_data(methodHandle m, u4 code_length, TRAPS) {
   char* code_data = NEW_RESOURCE_ARRAY(char, code_length);
   memset(code_data, 0, sizeof(char) * code_length);
@@ -2363,8 +2366,8 @@
   if (opcode == Bytecodes::_invokedynamic) {
     if (_klass->major_version() < Verifier::INVOKEDYNAMIC_MAJOR_VERSION) {
       class_format_error(
-        "invokedynamic instructions not supported by this class file version",
-        _klass->external_name());
+        "invokedynamic instructions not supported by this class file version (%d), class %s",
+        _klass->major_version(), _klass->external_name());
       return;
     }
   } else {
--- a/hotspot/src/share/vm/classfile/verifier.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/verifier.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -375,15 +375,15 @@
   bool has_error() const { return result() != NULL; }
   char* exception_message() {
     stringStream ss;
-    ss.print(_message);
+    ss.print("%s", _message);
     _error_context.details(&ss, _method());
     return ss.as_string();
   }
 
   // Called when verify or class format errors are encountered.
   // May throw an exception based upon the mode.
-  void verify_error(ErrorContext ctx, const char* fmt, ...);
-  void class_format_error(const char* fmt, ...);
+  void verify_error(ErrorContext ctx, const char* fmt, ...) ATTRIBUTE_PRINTF(3, 4);
+  void class_format_error(const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3);
 
   Klass* load_class(Symbol* name, TRAPS);
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -533,7 +533,7 @@
     xtty->begin_elem("intrinsic_misdeclared actual='%s' declared='%s'",
                      actual_name, declared_name);
     xtty->method(mh);
-    xtty->end_elem("");
+    xtty->end_elem("%s", "");
   }
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("*** misidentified method; %s(%d) should be %s(%d):",
--- a/hotspot/src/share/vm/code/codeBlob.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/codeBlob.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -530,7 +530,7 @@
 }
 
 void CodeBlob::print_on(outputStream* st) const {
-  st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", this);
+  st->print_cr("[CodeBlob (" INTPTR_FORMAT ")]", p2i(this));
   st->print_cr("Framesize: %d", _frame_size);
 }
 
@@ -548,7 +548,7 @@
 }
 
 void BufferBlob::print_value_on(outputStream* st) const {
-  st->print_cr("BufferBlob (" INTPTR_FORMAT  ") used for %s", this, name());
+  st->print_cr("BufferBlob (" INTPTR_FORMAT  ") used for %s", p2i(this), name());
 }
 
 void RuntimeStub::verify() {
@@ -558,13 +558,13 @@
 void RuntimeStub::print_on(outputStream* st) const {
   ttyLocker ttyl;
   CodeBlob::print_on(st);
-  st->print("Runtime Stub (" INTPTR_FORMAT "): ", this);
-  st->print_cr(name());
+  st->print("Runtime Stub (" INTPTR_FORMAT "): ", p2i(this));
+  st->print_cr("%s", name());
   Disassembler::decode((CodeBlob*)this, st);
 }
 
 void RuntimeStub::print_value_on(outputStream* st) const {
-  st->print("RuntimeStub (" INTPTR_FORMAT "): ", this); st->print(name());
+  st->print("RuntimeStub (" INTPTR_FORMAT "): ", p2i(this)); st->print("%s", name());
 }
 
 void SingletonBlob::verify() {
@@ -574,12 +574,12 @@
 void SingletonBlob::print_on(outputStream* st) const {
   ttyLocker ttyl;
   CodeBlob::print_on(st);
-  st->print_cr(name());
+  st->print_cr("%s", name());
   Disassembler::decode((CodeBlob*)this, st);
 }
 
 void SingletonBlob::print_value_on(outputStream* st) const {
-  st->print_cr(name());
+  st->print_cr("%s", name());
 }
 
 void DeoptimizationBlob::print_value_on(outputStream* st) const {
--- a/hotspot/src/share/vm/code/codeCache.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,10 +81,10 @@
   bool is_empty()                                { return count == 0; }
 
   void print(const char* title) {
-    tty->print_cr(" #%d %s = %dK (hdr %d%%,  loc %d%%, code %d%%, stub %d%%, [oops %d%%, data %d%%, pcs %d%%])",
+    tty->print_cr(" #%d %s = %dK (hdr %d%%,  loc %d%%, code %d%%, stub %d%%, [oops %d%%, metadata %d%%, data %d%%, pcs %d%%])",
                   count,
                   title,
-                  total() / K,
+                  (int)(total() / K),
                   header_size             * 100 / total_size,
                   relocation_size         * 100 / total_size,
                   code_size               * 100 / total_size,
@@ -178,10 +178,12 @@
   // cache will contain a garbage CodeBlob until the caller can
   // run the constructor for the CodeBlob subclass he is busy
   // instantiating.
-  guarantee(size >= 0, "allocation request must be reasonable");
   assert_locked_or_safepoint(CodeCache_lock);
+  assert(size > 0, "allocation request must be reasonable");
+  if (size <= 0) {
+    return NULL;
+  }
   CodeBlob* cb = NULL;
-  _number_of_blobs++;
   while (true) {
     cb = (CodeBlob*)_heap->allocate(size, is_critical);
     if (cb != NULL) break;
@@ -191,7 +193,7 @@
     }
     if (PrintCodeCacheExtension) {
       ResourceMark rm;
-      tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (%d bytes)",
+      tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
                     (intptr_t)_heap->low_boundary(), (intptr_t)_heap->high(),
                     (address)_heap->high() - (address)_heap->low_boundary());
     }
@@ -199,6 +201,7 @@
   maxCodeCacheUsed = MAX2(maxCodeCacheUsed, ((address)_heap->high_boundary() -
                           (address)_heap->low_boundary()) - unallocated_capacity());
   print_trace("allocation", cb, size);
+  _number_of_blobs++;
   return cb;
 }
 
@@ -487,7 +490,7 @@
           if (CompiledIC::is_icholder_call_site(iter.virtual_call_reloc())) {
             CompiledIC *ic = CompiledIC_at(iter.reloc());
             if (TraceCompiledIC) {
-              tty->print("noticed icholder " INTPTR_FORMAT " ", ic->cached_icholder());
+              tty->print("noticed icholder " INTPTR_FORMAT " ", p2i(ic->cached_icholder()));
               ic->print();
             }
             assert(ic->cached_icholder() != NULL, "must be non-NULL");
@@ -741,10 +744,10 @@
   }
   // Print bytes that are allocated in the freelist
   ttyLocker ttl;
-  tty->print_cr("Number of elements in freelist: %d",    freelist_length());
-  tty->print_cr("Allocated in freelist:          %dkB",  bytes_allocated_in_freelist()/K);
-  tty->print_cr("Unused bytes in CodeBlobs:      %dkB",  (int)(wasted_bytes/K));
-  tty->print_cr("Segment map size:               %dkB",  allocated_segments()/K); // 1 byte per segment
+  tty->print_cr("Number of elements in freelist: " SSIZE_FORMAT,    freelist_length());
+  tty->print_cr("Allocated in freelist:          " SSIZE_FORMAT "kB",  bytes_allocated_in_freelist()/K);
+  tty->print_cr("Unused bytes in CodeBlobs:      " SSIZE_FORMAT "kB",  (wasted_bytes/K));
+  tty->print_cr("Segment map size:               " SSIZE_FORMAT "kB",  allocated_segments()/K); // 1 byte per segment
 }
 
 //------------------------------------------------------------------------------------------------
@@ -756,7 +759,7 @@
   if (PrintCodeCache2) {  // Need to add a new flag
     ResourceMark rm;
     if (size == 0)  size = cb->size();
-    tty->print_cr("CodeCache %s:  addr: " INTPTR_FORMAT ", size: 0x%x", event, cb, size);
+    tty->print_cr("CodeCache %s:  addr: " INTPTR_FORMAT ", size: 0x%x", event, p2i(cb), size);
   }
 }
 
@@ -926,9 +929,9 @@
 
   if (detailed) {
     st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]",
-                 _heap->low_boundary(),
-                 _heap->high(),
-                 _heap->high_boundary());
+                 p2i(_heap->low_boundary()),
+                 p2i(_heap->high()),
+                 p2i(_heap->high_boundary()));
     st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
                  " adapters=" UINT32_FORMAT,
                  nof_blobs(), nof_nmethods(), nof_adapters());
--- a/hotspot/src/share/vm/code/compiledIC.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/compiledIC.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,9 +88,9 @@
   if (TraceCompiledIC) {
     tty->print("  ");
     print_compiled_ic();
-    tty->print(" changing destination to " INTPTR_FORMAT, entry_point);
+    tty->print(" changing destination to " INTPTR_FORMAT, p2i(entry_point));
     if (!is_optimized()) {
-      tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", (address)cache);
+      tty->print(" changing cached %s to " INTPTR_FORMAT, is_icholder ? "icholder" : "metadata", p2i((address)cache));
     }
     if (is_icstub) {
       tty->print(" (icstub)");
@@ -195,7 +195,7 @@
   if (TraceICs) {
     ResourceMark rm;
     tty->print_cr ("IC@" INTPTR_FORMAT ": to megamorphic %s entry: " INTPTR_FORMAT,
-                   instruction_address(), call_info->selected_method()->print_value_string(), entry);
+                   p2i(instruction_address()), call_info->selected_method()->print_value_string(), p2i(entry));
   }
 
   // We can't check this anymore. With lazy deopt we could have already
@@ -272,7 +272,7 @@
 void CompiledIC::set_to_clean() {
   assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call");
   if (TraceInlineCacheClearing || TraceICs) {
-    tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", instruction_address());
+    tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
     print();
   }
 
@@ -354,7 +354,7 @@
       if (TraceICs) {
          ResourceMark rm(thread);
          tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter: %s",
-           instruction_address(),
+           p2i(instruction_address()),
            method->print_value_string());
       }
     } else {
@@ -362,7 +362,7 @@
       InlineCacheBuffer::create_transition_stub(this, info.claim_cached_icholder(), info.entry());
       if (TraceICs) {
          ResourceMark rm(thread);
-         tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", instruction_address());
+         tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to interpreter via icholder ", p2i(instruction_address()));
       }
     }
   } else {
@@ -392,7 +392,7 @@
       ResourceMark rm(thread);
       assert(info.cached_metadata() == NULL || info.cached_metadata()->is_klass(), "must be");
       tty->print_cr ("IC@" INTPTR_FORMAT ": monomorphic to compiled (rcvr klass) %s: %s",
-        instruction_address(),
+        p2i(instruction_address()),
         ((Klass*)info.cached_metadata())->print_value_string(),
         (safe) ? "" : "via stub");
     }
@@ -530,8 +530,8 @@
     if (TraceICs) {
       ResourceMark rm;
       tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_compiled " INTPTR_FORMAT,
-                    instruction_address(),
-                    info.entry());
+                    p2i(instruction_address()),
+                    p2i(info.entry()));
     }
     // Call to compiled code
     assert (CodeCache::contains(info.entry()), "wrong entry point");
@@ -600,11 +600,11 @@
 
 void CompiledIC::print_compiled_ic() {
   tty->print("Inline cache at " INTPTR_FORMAT ", calling %s " INTPTR_FORMAT " cached_value " INTPTR_FORMAT,
-             instruction_address(), is_call_to_interpreted() ? "interpreted " : "", ic_destination(), is_optimized() ? NULL : cached_value());
+             p2i(instruction_address()), is_call_to_interpreted() ? "interpreted " : "", p2i(ic_destination()), p2i(is_optimized() ? NULL : cached_value()));
 }
 
 void CompiledStaticCall::print() {
-  tty->print("static call at " INTPTR_FORMAT " -> ", instruction_address());
+  tty->print("static call at " INTPTR_FORMAT " -> ", p2i(instruction_address()));
   if (is_clean()) {
     tty->print("clean");
   } else if (is_call_to_compiled()) {
--- a/hotspot/src/share/vm/code/compressedStream.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/compressedStream.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -212,6 +212,8 @@
   return h ^ l;
 }
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_IGNORED // Someone needs to deal with this.
 void test_compressed_stream(int trace) {
   CompressedWriteStream bytes(stretch_limit * 100);
   jint n;
@@ -275,6 +277,7 @@
   guarantee(length == length2, "bad length");
   guarantee(fails == 0, "test failures");
 }
+PRAGMA_DIAG_POP
 
 #if defined(_MSC_VER) &&_MSC_VER >=1400 && !defined(_WIN64)
 #pragma warning(default: 4748)
--- a/hotspot/src/share/vm/code/debugInfo.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/debugInfo.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,9 @@
 #include "code/nmethod.hpp"
 #include "runtime/handles.inline.hpp"
 
-// Comstructors
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
+// Constructors
 
 DebugInfoWriteStream::DebugInfoWriteStream(DebugInformationRecorder* recorder, int initial_size)
 : CompressedWriteStream(initial_size) {
--- a/hotspot/src/share/vm/code/dependencies.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/dependencies.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1429,6 +1429,10 @@
 // Include m itself in the set, unless it is abstract.
 // If this set has exactly one element, return that element.
 Method* Dependencies::find_unique_concrete_method(Klass* ctxk, Method* m) {
+  // Return NULL if m is marked old; must have been a redefined method.
+  if (m->is_old()) {
+    return NULL;
+  }
   ClassHierarchyWalker wf(m);
   assert(wf.check_method_context(ctxk, m), "proper context");
   wf.record_witnesses(1);
--- a/hotspot/src/share/vm/code/exceptionHandlerTable.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/exceptionHandlerTable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 #include "code/nmethod.hpp"
 #include "memory/allocation.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void ExceptionHandlerTable::add_entry(HandlerTableEntry entry) {
   _nesting.check();
   if (_length >= _size) {
--- a/hotspot/src/share/vm/code/icBuffer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/icBuffer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/stubRoutines.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 DEF_STUB_INTERFACE(ICStub);
 
--- a/hotspot/src/share/vm/code/nmethod.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,8 @@
 #include "shark/sharkCompiler.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef DTRACE_ENABLED
 
 // Only bother with this argument setup if dtrace is available
--- a/hotspot/src/share/vm/code/pcDesc.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/pcDesc.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "code/scopeDesc.hpp"
 #include "memory/resourceArea.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PcDesc::PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset) {
   _pc_offset           = pc_offset;
   _scope_decode_offset = scope_decode_offset;
--- a/hotspot/src/share/vm/code/relocInfo.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/relocInfo.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 #include "runtime/stubCodeGenerator.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 const RelocationHolder RelocationHolder::none; // its type is relocInfo::none
 
--- a/hotspot/src/share/vm/code/scopeDesc.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/scopeDesc.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop) {
   _code          = code;
--- a/hotspot/src/share/vm/code/vtableStubs.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/code/vtableStubs.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,8 @@
 #include "opto/matcher.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // -----------------------------------------------------------------------------------------
 // Implementation of VtableStub
 
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -172,7 +172,7 @@
   void log_nmethod(JavaThread* thread, nmethod* nm) {
     log(thread, "nmethod %d%s " INTPTR_FORMAT " code ["INTPTR_FORMAT ", " INTPTR_FORMAT "]",
         nm->compile_id(), nm->is_osr_method() ? "%" : "",
-        nm, nm->code_begin(), nm->code_end());
+        p2i(nm), p2i(nm->code_begin()), p2i(nm->code_end()));
   }
 
   void log_failure(JavaThread* thread, CompileTask* task, const char* reason, const char* retry_message) {
@@ -704,13 +704,39 @@
     return NULL;
   }
 
-  CompileTask* task = CompilationPolicy::policy()->select_task(this);
+  CompileTask* task;
+  {
+    No_Safepoint_Verifier nsv;
+    task = CompilationPolicy::policy()->select_task(this);
+  }
   remove(task);
+  purge_stale_tasks(); // may temporarily release MCQ lock
   return task;
 }
 
-void CompileQueue::remove(CompileTask* task)
-{
+// Clean & deallocate stale compile tasks.
+// Temporarily releases MethodCompileQueue lock.
+void CompileQueue::purge_stale_tasks() {
+  assert(lock()->owned_by_self(), "must own lock");
+  if (_first_stale != NULL) {
+    // Stale tasks are purged when MCQ lock is released,
+    // but _first_stale updates are protected by MCQ lock.
+    // Once task processing starts and MCQ lock is released,
+    // other compiler threads can reuse _first_stale.
+    CompileTask* head = _first_stale;
+    _first_stale = NULL;
+    {
+      MutexUnlocker ul(lock());
+      for (CompileTask* task = head; task != NULL; ) {
+        CompileTask* next_task = task->next();
+        CompileTaskWrapper ctw(task); // Frees the task
+        task = next_task;
+      }
+    }
+  }
+}
+
+void CompileQueue::remove(CompileTask* task) {
    assert(lock()->owned_by_self(), "must own lock");
   if (task->prev() != NULL) {
     task->prev()->set_next(task->next());
@@ -730,6 +756,16 @@
   --_size;
 }
 
+void CompileQueue::remove_and_mark_stale(CompileTask* task) {
+  assert(lock()->owned_by_self(), "must own lock");
+  remove(task);
+
+  // Enqueue the task for reclamation (should be done outside MCQ lock)
+  task->set_next(_first_stale);
+  task->set_prev(NULL);
+  _first_stale = task;
+}
+
 // methods in the compile queue need to be marked as used on the stack
 // so that they don't get reclaimed by Redefine Classes
 void CompileQueue::mark_on_stack() {
@@ -1786,7 +1822,7 @@
         if (xtty != NULL) {
           ttyLocker ttyl;
           // Record any per thread log files
-          xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file_name);
+          xtty->elem("thread_logfile thread='" INTX_FORMAT "' filename='%s'", thread_id, file_name);
         }
         return;
       }
@@ -1817,7 +1853,7 @@
   if (_should_block) {
 #ifndef PRODUCT
     if (PrintCompilation && (Verbose || WizardMode))
-      tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", Thread::current());
+      tty->print_cr("compiler thread " INTPTR_FORMAT " poll detects block request", p2i(Thread::current()));
 #endif
     ThreadInVMfromNative tivfn(JavaThread::current());
   }
@@ -1834,7 +1870,7 @@
     CodeCache::print_summary(&s, detailed);
   }
   ttyLocker ttyl;
-  tty->print(s.as_string());
+  tty->print("%s", s.as_string());
 }
 
 // ------------------------------------------------------------------
@@ -2006,7 +2042,7 @@
 
   // Note that the queued_for_compilation bits are cleared without
   // protection of a mutex. [They were set by the requester thread,
-  // when adding the task to the complie queue -- at which time the
+  // when adding the task to the compile queue -- at which time the
   // compile queue lock was held. Subsequently, we acquired the compile
   // queue lock to get this task off the compile queue; thus (to belabour
   // the point somewhat) our clearing of the bits must be occurring
@@ -2039,7 +2075,7 @@
       // Lock to prevent tearing
       ttyLocker ttyl;
       xtty->begin_elem("code_cache_full");
-      xtty->print(s.as_string());
+      xtty->print("%s", s.as_string());
       xtty->stamp();
       xtty->end_elem();
     }
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -196,7 +196,11 @@
   CompileTask* _first;
   CompileTask* _last;
 
+  CompileTask* _first_stale;
+
   int _size;
+
+  void purge_stale_tasks();
  public:
   CompileQueue(const char* name, Monitor* lock) {
     _name = name;
@@ -204,6 +208,7 @@
     _first = NULL;
     _last = NULL;
     _size = 0;
+    _first_stale = NULL;
   }
 
   const char*  name() const                      { return _name; }
@@ -211,6 +216,7 @@
 
   void         add(CompileTask* task);
   void         remove(CompileTask* task);
+  void         remove_and_mark_stale(CompileTask* task);
   CompileTask* first()                           { return _first; }
   CompileTask* last()                            { return _last;  }
 
@@ -219,6 +225,7 @@
   bool         is_empty() const                  { return _first == NULL; }
   int          size()     const                  { return _size;          }
 
+
   // Redefine Classes support
   void mark_on_stack();
   void free_all();
--- a/hotspot/src/share/vm/compiler/compileLog.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -174,9 +174,9 @@
 void CompileLog::name(ciKlass* k) {
   print(" name='");
   if (!k->is_loaded()) {
-    text()->print(k->name()->as_klass_external_name());
+    text()->print("%s", k->name()->as_klass_external_name());
   } else {
-    text()->print(k->external_name());
+    text()->print("%s", k->external_name());
   }
   print("'");
 }
@@ -303,7 +303,7 @@
 // Print about successful method inlining.
 void CompileLog::inline_success(const char* reason) {
   begin_elem("inline_success reason='");
-  text(reason);
+  text("%s", reason);
   end_elem("'");
 }
 
@@ -313,7 +313,7 @@
 // Print about failed method inlining.
 void CompileLog::inline_fail(const char* reason) {
   begin_elem("inline_fail reason='");
-  text(reason);
+  text("%s", reason);
   end_elem("'");
 }
 
@@ -339,5 +339,5 @@
 void CompileLog::code_cache_state() {
   begin_elem("code_cache");
   CodeCache::log_state(this);
-  end_elem("");
+  end_elem("%s", "");
 }
--- a/hotspot/src/share/vm/compiler/compileLog.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/compileLog.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
 
   static CompileLog* _first;     // head of static chain
 
-  void va_tag(bool push, const char* format, va_list ap);
+  void va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
 
  public:
   CompileLog(const char* file_name, FILE* fp, intx thread_id);
@@ -69,7 +69,7 @@
   // or reset, context string will be silently ignored
   stringStream* context()                        { return &_context; }
   void    clear_context()                        { context()->reset(); }
-  void      set_context(const char* format, ...);
+  void      set_context(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
   void          name(ciSymbol* s);               // name='s'
   void          name(Symbol* s)                  { xmlStream::name(s); }
--- a/hotspot/src/share/vm/compiler/compilerOracle.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -520,7 +520,7 @@
     tty->print_cr("CompilerOracle: unrecognized line");
     tty->print_cr("  \"%s\"", original_line);
     if (error_msg != NULL) {
-      tty->print_cr(error_msg);
+      tty->print_cr("%s", error_msg);
     }
   }
 }
@@ -642,7 +642,7 @@
   char method_sep = have_colon ? ':' : '.';
 
   if (Verbose) {
-    tty->print_cr(line);
+    tty->print_cr("%s", line);
   }
 
   ResourceMark rm;
--- a/hotspot/src/share/vm/compiler/disassembler.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/disassembler.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,8 @@
 #include "shark/sharkEntry.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void*       Disassembler::_library               = NULL;
 bool        Disassembler::_tried_to_load_library = false;
 
@@ -84,7 +86,7 @@
   {
     // Match "jvm[^/]*" in jvm_path.
     const char* base = buf;
-    const char* p = strrchr(buf, '/');
+    const char* p = strrchr(buf, *os::file_separator());
     if (p != NULL) lib_offset = p - base + 1;
     p = strstr(p ? p : base, "jvm");
     if (p != NULL)  jvm_offset = p - base;
@@ -109,7 +111,7 @@
     if (_library == NULL) {
       // 3. <home>/jre/lib/<arch>/hsdis-<arch>.so
       buf[lib_offset - 1] = '\0';
-      const char* p = strrchr(buf, '/');
+      const char* p = strrchr(buf, *os::file_separator());
       if (p != NULL) {
         lib_offset = p - buf + 1;
         strcpy(&buf[lib_offset], hsdis_library_name);
@@ -411,6 +413,7 @@
   return env->handle_event(event, (address) arg);
 }
 
+ATTRIBUTE_PRINTF(2, 3)
 static int printf_to_env(void* env_pv, const char* format, ...) {
   decode_env* env = (decode_env*) env_pv;
   outputStream* st = env->output();
--- a/hotspot/src/share/vm/compiler/methodLiveness.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
 #include "memory/allocation.inline.hpp"
 #include "utilities/bitMap.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // The MethodLiveness class performs a simple liveness analysis on a method
 // in order to decide which locals are live (that is, will be used again) at
 // a particular bytecode index (bci).
--- a/hotspot/src/share/vm/compiler/oopMap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/compiler/oopMap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -633,8 +633,8 @@
       tty->print_cr(
         "Add derived pointer@" INTPTR_FORMAT
         " - Derived: " INTPTR_FORMAT
-        " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: %d)",
-        derived_loc, (address)*derived_loc, (address)*base_loc, base_loc, offset
+        " Base: " INTPTR_FORMAT " (@" INTPTR_FORMAT ") (Offset: " INTX_FORMAT ")",
+        p2i(derived_loc), p2i((address)*derived_loc), p2i((address)*base_loc), p2i(base_loc), offset
       );
     }
     // Set derived oop location to point to base.
@@ -661,8 +661,8 @@
 
     if (TraceDerivedPointers) {
       tty->print_cr("Updating derived pointer@" INTPTR_FORMAT
-                    " - Derived: " INTPTR_FORMAT "  Base: " INTPTR_FORMAT " (Offset: %d)",
-          derived_loc, (address)*derived_loc, (address)base, offset);
+                    " - Derived: " INTPTR_FORMAT "  Base: " INTPTR_FORMAT " (Offset: " INTX_FORMAT ")",
+          p2i(derived_loc), p2i((address)*derived_loc), p2i((address)base), offset);
     }
 
     // Delete entry
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/adaptiveFreeList.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -157,7 +157,7 @@
                  " split_deaths(" SIZE_FORMAT ")"
                  " coal_deaths(" SIZE_FORMAT ")"
                  " + count(" SSIZE_FORMAT ")",
-                 this, size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
+                 p2i(this), size(), _allocation_stats.prev_sweep(), _allocation_stats.split_births(),
                  _allocation_stats.coal_births(), _allocation_stats.split_deaths(),
                  _allocation_stats.coal_deaths(), count()));
 }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/blockOffsetTable.inline.hpp"
 #include "memory/resourceArea.hpp"
+#include "memory/space.inline.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/globals.hpp"
@@ -428,7 +429,7 @@
 void LinearAllocBlock::print_on(outputStream* st) const {
   st->print_cr(" LinearAllocBlock: ptr = " PTR_FORMAT ", word_size = " SIZE_FORMAT
             ", refillsize = " SIZE_FORMAT ", allocation_size_limit = " SIZE_FORMAT,
-            _ptr, _word_size, _refillSize, _allocation_size_limit);
+            p2i(_ptr), _word_size, _refillSize, _allocation_size_limit);
 }
 
 void CompactibleFreeListSpace::print_on(outputStream* st) const {
@@ -459,7 +460,7 @@
     for (FreeChunk* fc = _indexedFreeList[i].head(); fc != NULL;
          fc = fc->next()) {
       gclog_or_tty->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ")  %s",
-                          fc, (HeapWord*)fc + i,
+                          p2i(fc), p2i((HeapWord*)fc + i),
                           fc->cantCoalesce() ? "\t CC" : "");
     }
   }
@@ -503,7 +504,7 @@
   if (_sp->block_is_obj(addr)) {
     const bool dead = _post_remark && !_live_bit_map->isMarked(addr);
     _st->print_cr(PTR_FORMAT ": %s object of size " SIZE_FORMAT "%s",
-      addr,
+      p2i(addr),
       dead ? "dead" : "live",
       sz,
       (!dead && CMSPrintObjectsInDump) ? ":" : ".");
@@ -513,7 +514,7 @@
     }
   } else { // free block
     _st->print_cr(PTR_FORMAT ": free block of size " SIZE_FORMAT "%s",
-      addr, sz, CMSPrintChunksInDump ? ":" : ".");
+      p2i(addr), sz, CMSPrintChunksInDump ? ":" : ".");
     if (CMSPrintChunksInDump) {
       ((FreeChunk*)addr)->print_on(_st);
       _st->print_cr("--------------------------------------");
@@ -1983,7 +1984,7 @@
   assert(ur.contains(urasm),
          err_msg(" Error at save_marks(): [" PTR_FORMAT "," PTR_FORMAT ")"
                  " should contain [" PTR_FORMAT "," PTR_FORMAT ")",
-                 ur.start(), ur.end(), urasm.start(), urasm.end()));
+                 p2i(ur.start()), p2i(ur.end()), p2i(urasm.start()), p2i(urasm.end())));
 #endif
   // inform allocator that promotions should be tracked.
   assert(_promoInfo.noPromotions(), "_promoInfo inconsistency");
@@ -2206,7 +2207,7 @@
   if (PrintFLSStatistics > 0) {
     HeapWord* largestAddr = (HeapWord*) dictionary()->find_largest_dict();
     gclog_or_tty->print_cr("CMS: Large block " PTR_FORMAT,
-                           largestAddr);
+                           p2i(largestAddr));
   }
   setFLSurplus();
   setFLHints();
@@ -2355,8 +2356,8 @@
       gclog_or_tty->print_cr(
         " Current:  addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n"
         " Previous: addr = " PTR_FORMAT ", size = " SIZE_FORMAT ", obj = %s, live = %s \n",
-        addr,       res,        was_obj      ?"true":"false", was_live      ?"true":"false",
-        _last_addr, _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false");
+        p2i(addr),       res,        was_obj      ?"true":"false", was_live      ?"true":"false",
+        p2i(_last_addr), _last_size, _last_was_obj?"true":"false", _last_was_live?"true":"false");
       _sp->print_on(gclog_or_tty);
       guarantee(false, "Seppuku!");
     }
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -403,7 +403,7 @@
     if (CMSTraceSweeper) {
       gclog_or_tty->print_cr(">>>>> Saving sweep limit " PTR_FORMAT
                              "  for space [" PTR_FORMAT "," PTR_FORMAT ") <<<<<<",
-                             _sweep_limit, bottom(), end());
+                             p2i(_sweep_limit), p2i(bottom()), p2i(end()));
     }
   }
   NOT_PRODUCT(
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/classLoaderData.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
@@ -64,6 +64,8 @@
 #include "services/memoryService.hpp"
 #include "services/runtimeService.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // statics
 CMSCollector* ConcurrentMarkSweepGeneration::_collector = NULL;
 bool CMSCollector::_full_gc_requested = false;
@@ -1182,7 +1184,7 @@
     gclog_or_tty->print(" icms alloc limits:  "
                            PTR_FORMAT "," PTR_FORMAT
                            " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ",
-                           _icms_start_limit, _icms_stop_limit,
+                           p2i(_icms_start_limit), p2i(_icms_stop_limit),
                            percent_of_space(eden, _icms_start_limit),
                            percent_of_space(eden, _icms_stop_limit));
     if (Verbose) {
@@ -1210,7 +1212,7 @@
         gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT
                                ", new limit=" PTR_FORMAT
                                " (" SIZE_FORMAT "%%)",
-                               top, _icms_stop_limit,
+                               p2i(top), p2i(_icms_stop_limit),
                                percent_of_space(space, _icms_stop_limit));
       }
       ConcurrentMarkSweepThread::start_icms();
@@ -1227,7 +1229,7 @@
         gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT
                                ", new limit=" PTR_FORMAT
                                " (" SIZE_FORMAT "%%)",
-                               top, space->end(),
+                               p2i(top), p2i(space->end()),
                                percent_of_space(space, space->end()));
       }
       ConcurrentMarkSweepThread::stop_icms();
@@ -1502,7 +1504,7 @@
   if (PrintCMSInitiationStatistics && stats().valid()) {
     gclog_or_tty->print("CMSCollector shouldConcurrentCollect: ");
     gclog_or_tty->stamp();
-    gclog_or_tty->print_cr("");
+    gclog_or_tty->cr();
     stats().print_on(gclog_or_tty);
     gclog_or_tty->print_cr("time_until_cms_gen_full %3.7f",
       stats().time_until_cms_gen_full());
@@ -3588,7 +3590,7 @@
                  _collector->cmsGen()->short_name(),
                  _phase, _collector->timerValue(), _wallclock.seconds());
     if (_print_cr) {
-      gclog_or_tty->print_cr("");
+      gclog_or_tty->cr();
     }
     if (PrintCMSStatistics != 0) {
       gclog_or_tty->print_cr(" (CMS-concurrent-%s yielded %d times)", _phase,
@@ -6360,7 +6362,9 @@
   verify_overflow_empty();
 
   if (should_unload_classes()) {
-    ClassLoaderDataGraph::purge();
+    // Delay purge to the beginning of the next safepoint.  Metaspace::contains
+    // requires that the virtual spaces are stable and not deleted.
+    ClassLoaderDataGraph::set_should_purge(true);
   }
 
   _intra_sweep_timer.stop();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,7 +111,7 @@
   // From this time Thread::current() should be working.
   assert(this == Thread::current(), "just checking");
   if (BindCMSThreadToCPU && !os::bind_to_processor(CPUForCMSThread)) {
-    warning("Couldn't bind CMS thread to processor %u", CPUForCMSThread);
+    warning("Couldn't bind CMS thread to processor " UINTX_FORMAT, CPUForCMSThread);
   }
   // Wait until Universe::is_fully_initialized()
   {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -239,7 +239,7 @@
     jio_snprintf(buf, sizeof(buf), " [%.3f:  CMSThread %s] ",
                  ts.seconds(), desc);
     buf[sizeof(buf) - 1] = '\0';
-    gclog_or_tty->print(buf);
+    gclog_or_tty->print("%s", buf);
   }
 }
 
@@ -271,7 +271,7 @@
   inline void tick() {
     _ticks++;
     if (CMSLoopWarn && _ticks % _threshold == 0) {
-      warning("%s has looped %d times %s", _src, _ticks, _msg);
+      warning("%s has looped " INTX_FORMAT " times %s", _src, _ticks, _msg);
     }
   }
 };
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/freeChunk.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 #include "memory/freeBlockDictionary.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifndef PRODUCT
 
 #define baadbabeHeapWord badHeapWordVal
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "oops/markOop.inline.hpp"
 #include "oops/oop.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 /////////////////////////////////////////////////////////////////////////
 //// PromotionInfo
 /////////////////////////////////////////////////////////////////////////
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include "runtime/os.hpp"
 #include "utilities/dtrace.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 //////////////////////////////////////////////////////////
 // Methods in abstract class VM_CMS_Operation
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
+#include "runtime/prefetch.inline.hpp"
 #include "services/memTracker.hpp"
 
 // Concurrent marking bit map wrapper
@@ -537,7 +538,7 @@
 
   if (verbose_low()) {
     gclog_or_tty->print_cr("[global] init, heap start = "PTR_FORMAT", "
-                           "heap end = "PTR_FORMAT, _heap_start, _heap_end);
+                           "heap end = " PTR_FORMAT, p2i(_heap_start), p2i(_heap_end));
   }
 
   if (!_markBitMap1.allocate(heap_rs)) {
@@ -651,7 +652,7 @@
     if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) {
       warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): "
               "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
-              mark_stack_size, 1, MarkStackSizeMax);
+              mark_stack_size, (uintx) 1, MarkStackSizeMax);
       return;
     }
     FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size);
@@ -662,7 +663,7 @@
         if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
           warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): "
                   "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
-                  MarkStackSize, 1, MarkStackSizeMax);
+                  MarkStackSize, (uintx) 1, MarkStackSizeMax);
           return;
         }
       } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) {
@@ -819,9 +820,9 @@
     // false before we start remark. At this point we should also be
     // in a STW phase.
     assert(!concurrent_marking_in_progress(), "invariant");
-    assert(_finger == _heap_end,
+    assert(out_of_regions(),
            err_msg("only way to get here: _finger: "PTR_FORMAT", _heap_end: "PTR_FORMAT,
-                   _finger, _heap_end));
+                   p2i(_finger), p2i(_heap_end)));
     update_g1_committed(true);
   }
 }
@@ -978,7 +979,9 @@
   if (concurrent()) {
     SuspendibleThreadSet::leave();
   }
-  _first_overflow_barrier_sync.enter();
+
+  bool barrier_aborted = !_first_overflow_barrier_sync.enter();
+
   if (concurrent()) {
     SuspendibleThreadSet::join();
   }
@@ -986,7 +989,17 @@
   // more work
 
   if (verbose_low()) {
-    gclog_or_tty->print_cr("[%u] leaving first barrier", worker_id);
+    if (barrier_aborted) {
+      gclog_or_tty->print_cr("[%u] aborted first barrier", worker_id);
+    } else {
+      gclog_or_tty->print_cr("[%u] leaving first barrier", worker_id);
+    }
+  }
+
+  if (barrier_aborted) {
+    // If the barrier aborted we ignore the overflow condition and
+    // just abort the whole marking phase as quickly as possible.
+    return;
   }
 
   // If we're executing the concurrent phase of marking, reset the marking
@@ -1026,14 +1039,20 @@
   if (concurrent()) {
     SuspendibleThreadSet::leave();
   }
-  _second_overflow_barrier_sync.enter();
+
+  bool barrier_aborted = !_second_overflow_barrier_sync.enter();
+
   if (concurrent()) {
     SuspendibleThreadSet::join();
   }
   // at this point everything should be re-initialized and ready to go
 
   if (verbose_low()) {
-    gclog_or_tty->print_cr("[%u] leaving second barrier", worker_id);
+    if (barrier_aborted) {
+      gclog_or_tty->print_cr("[%u] aborted second barrier", worker_id);
+    } else {
+      gclog_or_tty->print_cr("[%u] leaving second barrier", worker_id);
+    }
   }
 }
 
@@ -1424,7 +1443,7 @@
     assert(start <= hr->end() && start <= ntams && ntams <= hr->end(),
            err_msg("Preconditions not met - "
                    "start: "PTR_FORMAT", ntams: "PTR_FORMAT", end: "PTR_FORMAT,
-                   start, ntams, hr->end()));
+                   p2i(start), p2i(ntams), p2i(hr->end())));
 
     // Find the first marked object at or after "start".
     start = _bm->getNextMarkedWordAddress(start, ntams);
@@ -1609,7 +1628,7 @@
     if (failures > 0 && _verbose)  {
       gclog_or_tty->print_cr("Region " HR_FORMAT ", ntams: " PTR_FORMAT ", "
                              "marked_bytes: calc/actual " SIZE_FORMAT "/" SIZE_FORMAT,
-                             HR_FORMAT_PARAMS(hr), hr->next_top_at_mark_start(),
+                             HR_FORMAT_PARAMS(hr), p2i(hr->next_top_at_mark_start()),
                              _calc_cl.region_marked_bytes(), hr->next_marked_bytes());
     }
 
@@ -2241,7 +2260,7 @@
       if (_cm->verbose_high()) {
         gclog_or_tty->print_cr("\t[%u] we're looking at location "
                                "*"PTR_FORMAT" = "PTR_FORMAT,
-                               _task->worker_id(), p, (void*) obj);
+                               _task->worker_id(), p2i(p), p2i((void*) obj));
       }
 
       _task->deal_with_reference(obj);
@@ -2675,7 +2694,7 @@
     }
 
     _out->print_cr("  "PTR_FORMAT": "PTR_FORMAT"%s%s",
-                   p, (void*) obj, str, str2);
+                   p2i(p), p2i((void*) obj), str, str2);
   }
 };
 
@@ -2702,7 +2721,7 @@
 
     if (print_it) {
       _out->print_cr(" "PTR_FORMAT"%s",
-                     (void *)o, (over_tams) ? " >" : (marked) ? " M" : "");
+                     p2i((void *)o), (over_tams) ? " >" : (marked) ? " M" : "");
       PrintReachableOopClosure oopCl(_out, _vo, _all);
       o->oop_iterate_no_header(&oopCl);
     }
@@ -2723,14 +2742,14 @@
     HeapWord* t = hr->top();
     HeapWord* p = _g1h->top_at_mark_start(hr, _vo);
     _out->print_cr("** ["PTR_FORMAT", "PTR_FORMAT"] top: "PTR_FORMAT" "
-                   "TAMS: "PTR_FORMAT, b, e, t, p);
+                   "TAMS: " PTR_FORMAT, p2i(b), p2i(e), p2i(t), p2i(p));
     _out->cr();
 
     HeapWord* from = b;
     HeapWord* to   = t;
 
     if (to > from) {
-      _out->print_cr("Objects in ["PTR_FORMAT", "PTR_FORMAT"]", from, to);
+      _out->print_cr("Objects in [" PTR_FORMAT ", " PTR_FORMAT "]", p2i(from), p2i(to));
       _out->cr();
       PrintReachableObjectClosure ocl(_out, _vo, _all, hr);
       hr->object_iterate_mem_careful(MemRegion(from, to), &ocl);
@@ -2846,7 +2865,7 @@
       gclog_or_tty->print_cr("[%u] curr_region = "PTR_FORMAT" "
                              "["PTR_FORMAT", "PTR_FORMAT"), "
                              "limit = "PTR_FORMAT,
-                             worker_id, curr_region, bottom, end, limit);
+                             worker_id, p2i(curr_region), p2i(bottom), p2i(end), p2i(limit));
     }
 
     // Is the gap between reading the finger and doing the CAS too long?
@@ -2860,13 +2879,13 @@
 
       if (verbose_low()) {
         gclog_or_tty->print_cr("[%u] we were successful with region = "
-                               PTR_FORMAT, worker_id, curr_region);
+                               PTR_FORMAT, worker_id, p2i(curr_region));
       }
 
       if (limit > bottom) {
         if (verbose_low()) {
           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is not empty, "
-                                 "returning it ", worker_id, curr_region);
+                                 "returning it ", worker_id, p2i(curr_region));
         }
         return curr_region;
       } else {
@@ -2874,7 +2893,7 @@
                "the region limit should be at bottom");
         if (verbose_low()) {
           gclog_or_tty->print_cr("[%u] region "PTR_FORMAT" is empty, "
-                                 "returning NULL", worker_id, curr_region);
+                                 "returning NULL", worker_id, p2i(curr_region));
         }
         // we return NULL and the caller should try calling
         // claim_region() again.
@@ -2886,7 +2905,7 @@
         gclog_or_tty->print_cr("[%u] somebody else moved the finger, "
                                "global finger = "PTR_FORMAT", "
                                "our finger = "PTR_FORMAT,
-                               worker_id, _finger, finger);
+                               worker_id, p2i(_finger), p2i(finger));
       }
 
       // read it again
@@ -2925,7 +2944,7 @@
   void do_object_work(oop obj) {
     guarantee(!_g1h->obj_in_cs(obj),
               err_msg("obj: "PTR_FORMAT" in CSet, phase: %s, info: %d",
-                      (void*) obj, phase_str(), _info));
+                      p2i((void*) obj), phase_str(), _info));
   }
 
 public:
@@ -3004,7 +3023,7 @@
       HeapRegion* global_hr = _g1h->heap_region_containing_raw(global_finger);
       guarantee(global_finger == global_hr->bottom(),
                 err_msg("global finger: "PTR_FORMAT" region: "HR_FORMAT,
-                        global_finger, HR_FORMAT_PARAMS(global_hr)));
+                        p2i(global_finger), HR_FORMAT_PARAMS(global_hr)));
     }
 
     // Verify the task fingers
@@ -3018,7 +3037,7 @@
         guarantee(task_finger == task_hr->bottom() ||
                   !task_hr->in_collection_set(),
                   err_msg("task finger: "PTR_FORMAT" region: "HR_FORMAT,
-                          task_finger, HR_FORMAT_PARAMS(task_hr)));
+                          p2i(task_finger), HR_FORMAT_PARAMS(task_hr)));
       }
     }
   }
@@ -3062,7 +3081,7 @@
            err_msg("Preconditions not met - "
                    "start: "PTR_FORMAT", limit: "PTR_FORMAT", "
                    "top: "PTR_FORMAT", end: "PTR_FORMAT,
-                   start, limit, hr->top(), hr->end()));
+                   p2i(start), p2i(limit), p2i(hr->top()), p2i(hr->end())));
 
     assert(hr->next_marked_bytes() == 0, "Precondition");
 
@@ -3240,6 +3259,8 @@
   for (uint i = 0; i < _max_worker_id; ++i) {
     _tasks[i]->clear_region_fields();
   }
+  _first_overflow_barrier_sync.abort();
+  _second_overflow_barrier_sync.abort();
   _has_aborted = true;
 
   SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
@@ -3303,7 +3324,7 @@
 
 void ConcurrentMark::print_on_error(outputStream* st) const {
   st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT,
-      _prevMarkBitMap, _nextMarkBitMap);
+      p2i(_prevMarkBitMap), p2i(_nextMarkBitMap));
   _prevMarkBitMap->print_on_error(st, " Prev Bits: ");
   _nextMarkBitMap->print_on_error(st, " Next Bits: ");
 }
@@ -3336,11 +3357,11 @@
 // for debugging purposes
 void ConcurrentMark::print_finger() {
   gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
-                         _heap_start, _heap_end, _finger);
+                         p2i(_heap_start), p2i(_heap_end), p2i(_finger));
   for (uint i = 0; i < _max_worker_id; ++i) {
-    gclog_or_tty->print("   %u: "PTR_FORMAT, i, _tasks[i]->finger());
+    gclog_or_tty->print("   %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger()));
   }
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 }
 #endif
 
@@ -3349,7 +3370,7 @@
 
   if (_cm->verbose_high()) {
     gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT,
-                           _worker_id, (void*) obj);
+                           _worker_id, p2i((void*) obj));
   }
 
   size_t obj_size = obj->size();
@@ -3428,7 +3449,7 @@
 
   if (_cm->verbose_low()) {
     gclog_or_tty->print_cr("[%u] setting up for region "PTR_FORMAT,
-                           _worker_id, hr);
+                           _worker_id, p2i(hr));
   }
 
   _curr_region  = hr;
@@ -3445,7 +3466,7 @@
     if (_cm->verbose_low()) {
       gclog_or_tty->print_cr("[%u] found an empty region "
                              "["PTR_FORMAT", "PTR_FORMAT")",
-                             _worker_id, bottom, limit);
+                             _worker_id, p2i(bottom), p2i(limit));
     }
     // The region was collected underneath our feet.
     // We set the finger to bottom to ensure that the bitmap
@@ -3477,7 +3498,7 @@
   assert(_curr_region != NULL, "invariant");
   if (_cm->verbose_low()) {
     gclog_or_tty->print_cr("[%u] giving up region "PTR_FORMAT,
-                           _worker_id, _curr_region);
+                           _worker_id, p2i(_curr_region));
   }
   clear_region_fields();
 }
@@ -3768,7 +3789,7 @@
 
       if (_cm->verbose_high()) {
         gclog_or_tty->print_cr("[%u] popped "PTR_FORMAT, _worker_id,
-                               (void*) obj);
+                               p2i((void*) obj));
       }
 
       assert(_g1h->is_in_g1_reserved((HeapWord*) obj), "invariant" );
@@ -4153,7 +4174,7 @@
         gclog_or_tty->print_cr("[%u] we're scanning part "
                                "["PTR_FORMAT", "PTR_FORMAT") "
                                "of region "HR_FORMAT,
-                               _worker_id, _finger, _region_limit,
+                               _worker_id, p2i(_finger), p2i(_region_limit),
                                HR_FORMAT_PARAMS(_curr_region));
       }
 
@@ -4240,7 +4261,7 @@
         if (_cm->verbose_low()) {
           gclog_or_tty->print_cr("[%u] we successfully claimed "
                                  "region "PTR_FORMAT,
-                                 _worker_id, claimed_region);
+                                 _worker_id, p2i(claimed_region));
         }
 
         setup_for_region(claimed_region);
@@ -4301,7 +4322,7 @@
       if (_cm->try_stealing(_worker_id, &_hash_seed, obj)) {
         if (_cm->verbose_medium()) {
           gclog_or_tty->print_cr("[%u] stolen "PTR_FORMAT" successfully",
-                                 _worker_id, (void*) obj);
+                                 _worker_id, p2i((void*) obj));
         }
 
         statsOnly( ++_steals );
@@ -4549,8 +4570,8 @@
                  G1PPRL_SUM_ADDR_FORMAT("committed")
                  G1PPRL_SUM_ADDR_FORMAT("reserved")
                  G1PPRL_SUM_BYTE_FORMAT("region-size"),
-                 g1_committed.start(), g1_committed.end(),
-                 g1_reserved.start(), g1_reserved.end(),
+                 p2i(g1_committed.start()), p2i(g1_committed.end()),
+                 p2i(g1_reserved.start()), p2i(g1_reserved.end()),
                  HeapRegion::GrainBytes);
   _out->print_cr(G1PPRL_LINE_PREFIX);
   _out->print_cr(G1PPRL_LINE_PREFIX
@@ -4667,7 +4688,7 @@
                  G1PPRL_DOUBLE_FORMAT
                  G1PPRL_BYTE_FORMAT
                  G1PPRL_BYTE_FORMAT,
-                 type, bottom, end,
+                 type, p2i(bottom), p2i(end),
                  used_bytes, prev_live_bytes, next_live_bytes, gc_eff,
                  remset_bytes, strong_code_roots_bytes);
 
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -542,8 +542,12 @@
   // frequently.
   HeapRegion* claim_region(uint worker_id);
 
-  // It determines whether we've run out of regions to scan
-  bool        out_of_regions() { return _finger == _heap_end; }
+  // It determines whether we've run out of regions to scan. Note that
+  // the finger can point past the heap end in case the heap was expanded
+  // to satisfy an allocation without doing a GC. This is fine, because all
+  // objects in those regions will be considered live anyway because of
+  // SATB guarantees (i.e. their TAMS will be equal to bottom).
+  bool        out_of_regions() { return _finger >= _heap_end; }
 
   // Returns the task with the given id
   CMTask* task(int id) {
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -277,7 +277,7 @@
   assert(_nextMarkBitMap->isMarked(objAddr), "invariant");
 
   if (_cm->verbose_high()) {
-    gclog_or_tty->print_cr("[%u] pushing "PTR_FORMAT, _worker_id, (void*) obj);
+    gclog_or_tty->print_cr("[%u] pushing " PTR_FORMAT, _worker_id, p2i((void*) obj));
   }
 
   if (!_task_queue->push(obj)) {
@@ -317,7 +317,7 @@
 inline void CMTask::deal_with_reference(oop obj) {
   if (_cm->verbose_high()) {
     gclog_or_tty->print_cr("[%u] we're dealing with reference = "PTR_FORMAT,
-                           _worker_id, (void*) obj);
+                           _worker_id, p2i((void*) obj));
   }
 
   ++_refs_reached;
@@ -334,7 +334,7 @@
       if (!hr->obj_allocated_since_next_marking(obj)) {
         if (_cm->verbose_high()) {
           gclog_or_tty->print_cr("[%u] "PTR_FORMAT" is not considered marked",
-                                 _worker_id, (void*) obj);
+                                 _worker_id, p2i((void*) obj));
         }
 
         // we need to mark it first
@@ -349,7 +349,7 @@
           if (_finger != NULL && objAddr < _finger) {
             if (_cm->verbose_high()) {
               gclog_or_tty->print_cr("[%u] below the local finger ("PTR_FORMAT"), "
-                                     "pushing it", _worker_id, _finger);
+                                     "pushing it", _worker_id, p2i(_finger));
             }
             push(obj);
           } else if (_curr_region != NULL && objAddr < _region_limit) {
@@ -367,7 +367,7 @@
             if (_cm->verbose_high()) {
               gclog_or_tty->print_cr("[%u] below the global finger "
                                      "("PTR_FORMAT"), pushing it",
-                                     _worker_id, global_finger);
+                                     _worker_id, p2i(global_finger));
             }
             push(obj);
           } else {
@@ -382,7 +382,7 @@
             if (_cm->verbose_high()) {
               gclog_or_tty->print_cr("[%u] below the global finger "
                                      "("PTR_FORMAT"), pushing it",
-                                     _worker_id, global_finger);
+                                     _worker_id, p2i(global_finger));
             }
             push(obj);
           }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,7 +143,7 @@
 void G1AllocRegion::fill_in_ext_msg(ar_ext_msg* msg, const char* message) {
   msg->append("[%s] %s c: %u b: %s r: "PTR_FORMAT" u: "SIZE_FORMAT,
               _name, message, _count, BOOL_TO_STR(_bot_updates),
-              _alloc_region, _used_bytes_before);
+              p2i(_alloc_region), _used_bytes_before);
 }
 
 void G1AllocRegion::init() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -184,7 +184,7 @@
 
 class ar_ext_msg : public err_msg {
 public:
-  ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("") {
+  ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("%s", "") {
     alloc_region->fill_in_ext_msg(this, message);
   }
 };
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
             REGION_SIZE_IN_WORDS * HeapWordSize);
     // Check address calculation (bounds)
     assert(array.bottom_address_mapped() == fake_heap,
-      err_msg("bottom mapped address should be "PTR_FORMAT", but is "PTR_FORMAT, fake_heap, array.bottom_address_mapped()));
+      err_msg("bottom mapped address should be " PTR_FORMAT ", but is " PTR_FORMAT, p2i(fake_heap), p2i(array.bottom_address_mapped())));
     assert(array.end_address_mapped() == (fake_heap + REGION_SIZE_IN_WORDS * NUM_REGIONS), "must be");
 
     int* bottom = array.address_mapped_to(fake_heap);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BiasedArray.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
   void initialize_base(address base, size_t length, size_t bias, size_t elem_size, uint shift_by) {
     assert(base != NULL, "just checking");
     assert(length > 0, "just checking");
-    assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %zd, larger than word size?", shift_by));
+    assert(shift_by < sizeof(uintptr_t) * 8, err_msg("Shifting by %u, larger than word size?", shift_by));
     _base = base;
     _length = length;
     _biased_base = base - (bias * elem_size);
@@ -71,10 +71,10 @@
       err_msg("mapping granularity must be power of 2, is %zd", mapping_granularity_in_bytes));
     assert((uintptr_t)bottom % mapping_granularity_in_bytes == 0,
       err_msg("bottom mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT,
-        mapping_granularity_in_bytes, bottom));
+        mapping_granularity_in_bytes, p2i(bottom)));
     assert((uintptr_t)end % mapping_granularity_in_bytes == 0,
       err_msg("end mapping area address must be a multiple of mapping granularity %zd, is "PTR_FORMAT,
-        mapping_granularity_in_bytes, end));
+        mapping_granularity_in_bytes, p2i(end)));
     size_t num_target_elems = pointer_delta(end, bottom, mapping_granularity_in_bytes);
     idx_t bias = (uintptr_t)bottom / mapping_granularity_in_bytes;
     address base = create_new_base_array(num_target_elems, target_elem_size_in_bytes);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "runtime/java.hpp"
 #include "services/memTracker.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //////////////////////////////////////////////////////////////////////
 // G1BlockOffsetSharedArray
 //////////////////////////////////////////////////////////////////////
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
   virtual void set_bottom(HeapWord* new_bottom) {
     assert(new_bottom <= _end,
            err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")",
-                   new_bottom, _end));
+                   p2i(new_bottom), p2i(_end)));
     _bottom = new_bottom;
     resize(pointer_delta(_end, _bottom));
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
   assert(pc >= (char*)_reserved.start() &&
          pc <  (char*)_reserved.end(),
          err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")",
-                 p, (char*)_reserved.start(), (char*)_reserved.end()));
+                 p2i(p), p2i(_reserved.start()), p2i(_reserved.end())));
   size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
   size_t result = delta >> LogN;
   check_index(result, "bad index from address");
@@ -65,7 +65,7 @@
          err_msg("bad address from index result " PTR_FORMAT
                  " _reserved.start() " PTR_FORMAT " _reserved.end() "
                  PTR_FORMAT,
-                 result, _reserved.start(), _reserved.end()));
+                 p2i(result), p2i(_reserved.start()), p2i(_reserved.end())));
   return result;
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
 #include "services/memTracker.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void G1CardCounts::clear_range(size_t from_card_num, size_t to_card_num) {
   if (has_count_table()) {
     assert(from_card_num >= 0 && from_card_num < _committed_max_card_num,
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,10 +77,10 @@
            err_msg("Invalid card pointer: "
                    "card_ptr: " PTR_FORMAT ", "
                    "_ct_bot: " PTR_FORMAT,
-                   card_ptr, _ct_bot));
+                   p2i(card_ptr), p2i(_ct_bot)));
     size_t card_num = pointer_delta(card_ptr, _ct_bot, sizeof(jbyte));
     assert(card_num >= 0 && card_num < _committed_max_card_num,
-           err_msg("card pointer out of range: " PTR_FORMAT, card_ptr));
+           err_msg("card pointer out of range: " PTR_FORMAT, p2i(card_ptr)));
     return card_num;
   }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -28,6 +28,8 @@
 #include "gc_implementation/g1/g1CodeCacheRemSet.hpp"
 #include "memory/iterator.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 G1CodeRootChunk::G1CodeRootChunk() : _top(NULL), _next(NULL), _prev(NULL) {
   _top = bottom();
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -22,7 +22,13 @@
  *
  */
 
+#if !defined(__clang_major__) && defined(__GNUC__)
+// FIXME, formats have issues.  Disable this macro definition, compile, and study warnings for more information.
+#define ATTRIBUTE_PRINTF(x,y)
+#endif
+
 #include "precompiled.hpp"
+#include "classfile/stringTable.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
 #include "gc_implementation/g1/bufferingOopClosure.hpp"
@@ -56,6 +62,7 @@
 #include "memory/referenceProcessor.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.pcgc.inline.hpp"
+#include "runtime/prefetch.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/globalDefinitions.hpp"
@@ -370,7 +377,7 @@
     }
   }
 
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 }
 
 void G1CollectedHeap::push_dirty_cards_region(HeapRegion* hr)
@@ -3470,7 +3477,7 @@
       // help us track down what went wrong. This is why we call
       // print_extended_on() instead of print_on().
       print_extended_on(gclog_or_tty);
-      gclog_or_tty->print_cr("");
+      gclog_or_tty->cr();
 #ifndef PRODUCT
       if (VerifyDuringGC && G1VerifyDuringGCPrintReachable) {
         concurrent_mark()->print_reachable("at-verification-failure",
@@ -3664,7 +3671,7 @@
   PrintRSetsClosure(const char* msg) : _msg(msg), _occupied_sum(0) {
     gclog_or_tty->cr();
     gclog_or_tty->print_cr("========================================");
-    gclog_or_tty->print_cr(msg);
+    gclog_or_tty->print_cr("%s", msg);
     gclog_or_tty->cr();
   }
 
@@ -5395,7 +5402,7 @@
       if (_g1h->is_in_g1_reserved(p)) {
         _par_scan_state->push_on_queue(p);
       } else {
-        assert(!ClassLoaderDataGraph::contains((address)p),
+        assert(!Metaspace::contains((const void*)p),
                err_msg("Otherwise need to call _copy_metadata_obj_cl->do_oop(p) "
                               PTR_FORMAT, p));
           _copy_non_heap_obj_cl->do_oop(p);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
   assert(addr != NULL, "invariant");
   assert(_g1_reserved.contains((const void*) addr),
       err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")",
-          (void*)addr, _g1_reserved.start(), _g1_reserved.end()));
+          p2i((void*)addr), p2i(_g1_reserved.start()), p2i(_g1_reserved.end())));
   return _hrs.addr_to_region((HeapWord*) addr);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,6 +22,11 @@
  *
  */
 
+#ifndef __clang_major__
+// FIXME, formats have issues.  Disable this macro definition, compile, and study warnings for more information.
+#define ATTRIBUTE_PRINTF(x,y)
+#endif
+
 #include "precompiled.hpp"
 #include "gc_implementation/g1/concurrentG1Refine.hpp"
 #include "gc_implementation/g1/concurrentMark.hpp"
@@ -965,7 +970,7 @@
 
 #ifndef PRODUCT
   if (G1YoungSurvRateVerbose) {
-    gclog_or_tty->print_cr("");
+    gclog_or_tty->cr();
     _short_lived_surv_rate_group->print();
     // do that for any other surv rate groups too
   }
@@ -2222,11 +2227,11 @@
 
   gclog_or_tty->print_cr("ALL PAUSES");
   print_summary_sd("   Total", &_total);
-  gclog_or_tty->print_cr("");
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
+  gclog_or_tty->cr();
   gclog_or_tty->print_cr("   Young GC Pauses: %8d", _young_pause_num);
   gclog_or_tty->print_cr("   Mixed GC Pauses: %8d", _mixed_pause_num);
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 
   gclog_or_tty->print_cr("EVACUATION PAUSES");
 
@@ -2246,7 +2251,7 @@
     print_summary("      Clear CT", &_clear_ct);
     print_summary("      Other", &_other);
   }
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
 
   gclog_or_tty->print_cr("MISC");
   print_summary_sd("   Stop World", &_all_stop_world_times_ms);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -39,7 +39,7 @@
   int _indent_level;
   int _cur;
 
-  void vappend(const char* format, va_list ap) {
+  void vappend(const char* format, va_list ap)  ATTRIBUTE_PRINTF(2, 0) {
     int res = vsnprintf(&_buffer[_cur], BUFFER_LEN - _cur, format, ap);
     if (res != -1) {
       _cur += res;
@@ -63,14 +63,14 @@
   }
 #endif
 
-  void append(const char* format, ...) {
+  void append(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3) {
     va_list ap;
     va_start(ap, format);
     vappend(format, ap);
     va_end(ap);
   }
 
-  void append_and_print_cr(const char* format, ...) {
+  void append_and_print_cr(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3) {
     va_list ap;
     va_start(ap, format);
     vappend(format, ap);
@@ -80,6 +80,8 @@
   }
 };
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
 template <class T>
 void WorkerDataArray<T>::print(int level, const char* title) {
   if (_length == 1) {
@@ -109,7 +111,7 @@
   }
 
   if (G1Log::finest()) {
-    buf.append_and_print_cr("");
+    buf.append_and_print_cr("%s", "");
   }
 
   double avg = (double)sum / (double)_length;
@@ -129,6 +131,7 @@
   }
   buf.append_and_print_cr("]");
 }
+PRAGMA_DIAG_POP
 
 #ifndef PRODUCT
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HRPrinter.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "utilities/ostream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 const char* G1HRPrinter::action_name(ActionType action) {
   switch(action) {
     case Alloc:          return "ALLOC";
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 #include "gc_implementation/g1/g1RemSet.hpp"
 #include "gc_implementation/g1/g1RemSet.inline.hpp"
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
+#include "runtime/prefetch.inline.hpp"
 
 /*
  * This really ought to be an inline function, but apparently the C++
@@ -114,7 +115,7 @@
   if (_cm->verbose_high()) {
     gclog_or_tty->print_cr("[%u] we're looking at location "
                            "*"PTR_FORMAT" = "PTR_FORMAT,
-                           _task->worker_id(), p, (void*) obj);
+                           _task->worker_id(), p2i(p), p2i((void*) obj));
   }
   _task->deal_with_reference(obj);
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/intHisto.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define CARD_REPEAT_HISTO 0
 
 #if CARD_REPEAT_HISTO
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -96,7 +96,15 @@
   jbyte *const first = byte_for(mr.start());
   jbyte *const last = byte_after(mr.last());
 
-  memset(first, g1_young_gen, last - first);
+  // Below we may use an explicit loop instead of memset() because on
+  // certain platforms memset() can give concurrent readers phantom zeros.
+  if (UseMemSetInBOT) {
+    memset(first, g1_young_gen, last - first);
+  } else {
+    for (jbyte* i = first; i < last; i++) {
+      *i = g1_young_gen;
+    }
+  }
 }
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -32,9 +32,12 @@
 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/iterator.hpp"
+#include "memory/space.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 int    HeapRegion::LogOfHRGrainBytes = 0;
 int    HeapRegion::LogOfHRGrainWords = 0;
 size_t HeapRegion::GrainBytes        = 0;
@@ -827,7 +830,7 @@
                         Mutex::_no_safepoint_check_flag);
 
         if (!_failures) {
-          gclog_or_tty->print_cr("");
+          gclog_or_tty->cr();
           gclog_or_tty->print_cr("----------");
         }
         if (!_g1h->is_in_closed_subset(obj)) {
@@ -882,7 +885,7 @@
                             Mutex::_no_safepoint_check_flag);
 
             if (!_failures) {
-              gclog_or_tty->print_cr("");
+              gclog_or_tty->cr();
               gclog_or_tty->print_cr("----------");
             }
             gclog_or_tty->print_cr("Missing rem set entry:");
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,7 +61,7 @@
                 (_hr_)->startsHumongous() ? "HS" : \
                 (_hr_)->continuesHumongous() ? "HC" : \
                 !(_hr_)->is_empty() ? "O" : "F", \
-                (_hr_)->bottom(), (_hr_)->top(), (_hr_)->end()
+                p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end())
 
 // sentinel value for hrs_index
 #define G1_NULL_HRS_INDEX ((uint) -1)
@@ -550,7 +550,7 @@
            (containing_set != NULL && _containing_set == NULL),
            err_msg("containing_set: "PTR_FORMAT" "
                    "_containing_set: "PTR_FORMAT,
-                   containing_set, _containing_set));
+                   p2i(containing_set), p2i(_containing_set)));
 
     _containing_set = containing_set;
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -36,6 +36,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/growableArray.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class PerRegionTable: public CHeapObj<mtGC> {
   friend class OtherRegionsTable;
   friend class HeapRegionRemSetIterator;
@@ -1218,7 +1220,7 @@
     while (cur_evnt < _n_recorded_events && i == cur_evnt_ind) {
       gclog_or_tty->print("Event: ");
       print_event(gclog_or_tty, cur_evnt_kind);
-      gclog_or_tty->print_cr("");
+      gclog_or_tty->cr();
       cur_evnt++;
       if (cur_evnt < MaxRecordedEvents) {
         cur_evnt_kind = _recorded_events[cur_evnt];
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -233,7 +233,7 @@
     guarantee(hr != NULL, err_msg("invariant: i: %u", i));
     guarantee(hr->bottom() == prev_end,
               err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT,
-                      i, HR_FORMAT_PARAMS(hr), prev_end));
+                      i, HR_FORMAT_PARAMS(hr), p2i(prev_end)));
     guarantee(hr->hrs_index() == i,
               err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index()));
     if (i < length()) {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,9 +30,9 @@
 
 inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
   assert(addr < heap_end(),
-        err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, addr, heap_end()));
+        err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, p2i(addr), p2i(heap_end())));
   assert(addr >= heap_bottom(),
-        err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom()));
+        err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, p2i(addr), p2i(heap_bottom())));
 
   HeapRegion* hr = _regions.get_by_address(addr);
   assert(hr != NULL, "invariant");
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -26,6 +26,8 @@
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 uint FreeRegionList::_unrealistically_long_length = 0;
 
 void HeapRegionSetBase::fill_in_ext_msg(hrs_ext_msg* msg, const char* message) {
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -162,7 +162,7 @@
 // diagnosing failures.
 class hrs_ext_msg : public hrs_err_msg {
 public:
-  hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("") {
+  hrs_ext_msg(HeapRegionSetBase* set, const char* message) : hrs_err_msg("%s","") {
     set->fill_in_ext_msg(this, message);
   }
 };
--- a/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/satbQueue.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void ObjPtrQueue::flush() {
   // The buffer might contain refs into the CSet. We have to filter it
   // first before we flush it, otherwise we might end up with an
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,23 +194,16 @@
 }
 
 bool RSHashTable::get_cards(RegionIdx_t region_ind, CardIdx_t* cards) {
-  int ind = (int) (region_ind & capacity_mask());
-  int cur_ind = _buckets[ind];
-  SparsePRTEntry* cur;
-  while (cur_ind != NullEntry &&
-         (cur = entry(cur_ind))->r_ind() != region_ind) {
-    cur_ind = cur->next_index();
+  SparsePRTEntry* entry = get_entry(region_ind);
+  if (entry == NULL) {
+    return false;
   }
-
-  if (cur_ind == NullEntry) return false;
   // Otherwise...
-  assert(cur->r_ind() == region_ind, "Postcondition of loop + test above.");
-  assert(cur->num_valid_cards() > 0, "Inv");
-  cur->copy_cards(cards);
+  entry->copy_cards(cards);
   return true;
 }
 
-SparsePRTEntry* RSHashTable::get_entry(RegionIdx_t region_ind) {
+SparsePRTEntry* RSHashTable::get_entry(RegionIdx_t region_ind) const {
   int ind = (int) (region_ind & capacity_mask());
   int cur_ind = _buckets[ind];
   SparsePRTEntry* cur;
@@ -247,27 +240,8 @@
 }
 
 SparsePRTEntry*
-RSHashTable::entry_for_region_ind(RegionIdx_t region_ind) const {
-  assert(occupied_entries() < capacity(), "Precondition");
-  int ind = (int) (region_ind & capacity_mask());
-  int cur_ind = _buckets[ind];
-  SparsePRTEntry* cur;
-  while (cur_ind != NullEntry &&
-         (cur = entry(cur_ind))->r_ind() != region_ind) {
-    cur_ind = cur->next_index();
-  }
-
-  if (cur_ind != NullEntry) {
-    assert(cur->r_ind() == region_ind, "Loop postcondition + test");
-    return cur;
-  } else {
-    return NULL;
-  }
-}
-
-SparsePRTEntry*
 RSHashTable::entry_for_region_ind_create(RegionIdx_t region_ind) {
-  SparsePRTEntry* res = entry_for_region_ind(region_ind);
+  SparsePRTEntry* res = get_entry(region_ind);
   if (res == NULL) {
     int new_ind = alloc_entry();
     assert(0 <= new_ind && (size_t)new_ind < capacity(), "There should be room.");
@@ -365,7 +339,7 @@
 }
 
 bool RSHashTable::contains_card(RegionIdx_t region_index, CardIdx_t card_index) const {
-  SparsePRTEntry* e = entry_for_region_ind(region_index);
+  SparsePRTEntry* e = get_entry(region_index);
   return (e != NULL && e->contains_card(card_index));
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,12 +122,6 @@
   // Requires that the caller hold a lock preventing parallel modifying
   // operations, and that the the table be less than completely full.  If
   // an entry for "region_ind" is already in the table, finds it and
-  // returns its address; otherwise returns "NULL."
-  SparsePRTEntry* entry_for_region_ind(RegionIdx_t region_ind) const;
-
-  // Requires that the caller hold a lock preventing parallel modifying
-  // operations, and that the the table be less than completely full.  If
-  // an entry for "region_ind" is already in the table, finds it and
   // returns its address; otherwise allocates, initializes, inserts and
   // returns a new entry for "region_ind".
   SparsePRTEntry* entry_for_region_ind_create(RegionIdx_t region_ind);
@@ -158,7 +152,7 @@
 
   void add_entry(SparsePRTEntry* e);
 
-  SparsePRTEntry* get_entry(RegionIdx_t region_id);
+  SparsePRTEntry* get_entry(RegionIdx_t region_id) const;
 
   void clear();
 
--- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "gc_implementation/g1/survRateGroup.hpp"
 #include "memory/allocation.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p,
                              const char* name,
                              size_t summary_surv_rates_len) :
@@ -202,7 +204,7 @@
   if (length == 0)
     return;
 
-  gclog_or_tty->print_cr("");
+  gclog_or_tty->cr();
   gclog_or_tty->print_cr("%s Rate Summary (for up to age " SIZE_FORMAT ")", _name, length-1);
   gclog_or_tty->print_cr("      age range     survival rate (avg)      samples (avg)");
   gclog_or_tty->print_cr("  ---------------------------------------------------------");
--- a/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parNew/asParNewGeneration.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -259,22 +259,22 @@
                   requested_eden_size, requested_survivor_size);
     gclog_or_tty->print_cr("    eden: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  eden()->bottom(),
-                  eden()->end(),
+                  p2i(eden()->bottom()),
+                  p2i(eden()->end()),
                   pointer_delta(eden()->end(),
                                 eden()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("    from: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  from()->bottom(),
-                  from()->end(),
+                  p2i(from()->bottom()),
+                  p2i(from()->end()),
                   pointer_delta(from()->end(),
                                 from()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("      to: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  to()->bottom(),
-                  to()->end(),
+                  p2i(to()->bottom()),
+                  p2i(to()->end()),
                   pointer_delta(  to()->end(),
                                   to()->bottom(),
                                   sizeof(char)));
@@ -382,18 +382,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
     }
   } else {
@@ -473,18 +473,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,8 @@
 #include "runtime/virtualspace.hpp"
 #include "runtime/vmThread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
                                                              OopsInGenClosure* cl,
                                                              CardTableRS* ct,
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,8 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/workgroup.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef _MSC_VER
 #pragma warning( push )
 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list
--- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,12 +79,12 @@
     if ((HeapWord*)obj < _boundary) {
 #ifndef PRODUCT
       if (_g->to()->is_in_reserved(obj)) {
-        tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p);
+        tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p2i(p));
         GenCollectedHeap* gch =  (GenCollectedHeap*)Universe::heap();
         Space* sp = gch->space_containing(p);
         oop obj = oop(sp->block_start(p));
         assert((HeapWord*)obj < (HeapWord*)p, "Error");
-        tty->print_cr("Object: " PTR_FORMAT, (void *)obj);
+        tty->print_cr("Object: " PTR_FORMAT, p2i((void *)obj));
         tty->print_cr("-------");
         obj->print();
         tty->print_cr("-----");
@@ -110,7 +110,7 @@
         if (TraceScavenge) {
           gclog_or_tty->print_cr("{%s %s ( " PTR_FORMAT " ) " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
              "forwarded ",
-             new_obj->klass()->internal_name(), p, (void *)obj, (void *)new_obj, new_obj->size());
+             new_obj->klass()->internal_name(), p2i(p), p2i((void *)obj), p2i((void *)new_obj), new_obj->size());
         }
 #endif
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -252,22 +252,22 @@
                   requested_eden_size, requested_survivor_size);
     gclog_or_tty->print_cr("    eden: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  eden_space()->bottom(),
-                  eden_space()->end(),
+                  p2i(eden_space()->bottom()),
+                  p2i(eden_space()->end()),
                   pointer_delta(eden_space()->end(),
                                 eden_space()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("    from: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  from_space()->bottom(),
-                  from_space()->end(),
+                  p2i(from_space()->bottom()),
+                  p2i(from_space()->end()),
                   pointer_delta(from_space()->end(),
                                 from_space()->bottom(),
                                 sizeof(char)));
     gclog_or_tty->print_cr("      to: [" PTR_FORMAT ".." PTR_FORMAT ") "
                   SIZE_FORMAT,
-                  to_space()->bottom(),
-                  to_space()->end(),
+                  p2i(to_space()->bottom()),
+                  p2i(to_space()->end()),
                   pointer_delta(  to_space()->end(),
                                   to_space()->bottom(),
                                   sizeof(char)));
@@ -373,18 +373,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
     }
   } else {
@@ -427,18 +427,18 @@
     if (PrintAdaptiveSizePolicy && Verbose) {
       gclog_or_tty->print_cr("    [eden_start .. eden_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    eden_start,
-                    eden_end,
+                    p2i(eden_start),
+                    p2i(eden_end),
                     pointer_delta(eden_end, eden_start, sizeof(char)));
       gclog_or_tty->print_cr("    [  to_start ..   to_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    to_start,
-                    to_end,
+                    p2i(to_start),
+                    p2i(to_end),
                     pointer_delta(  to_end,   to_start, sizeof(char)));
       gclog_or_tty->print_cr("    [from_start .. from_end): "
                     "[" PTR_FORMAT " .. " PTR_FORMAT ") " SIZE_FORMAT,
-                    from_start,
-                    from_end,
+                    p2i(from_start),
+                    p2i(from_end),
                     pointer_delta(from_end, from_start, sizeof(char)));
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 #include "gc_implementation/parallelScavenge/psYoungGen.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.psgc.inline.hpp"
+#include "runtime/prefetch.inline.hpp"
 
 // Checks an individual oop for missing precise marks. Mark
 // may be either dirty or newgen.
@@ -478,23 +479,23 @@
     gclog_or_tty->print_cr("  "
                   "  _covered[%d].start(): " INTPTR_FORMAT
                   "  _covered[%d].last(): " INTPTR_FORMAT,
-                  ind, _covered[ind].start(),
-                  ind, _covered[ind].last());
+                  ind, p2i(_covered[ind].start()),
+                  ind, p2i(_covered[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  _committed[%d].start(): " INTPTR_FORMAT
                   "  _committed[%d].last(): " INTPTR_FORMAT,
-                  ind, _committed[ind].start(),
-                  ind, _committed[ind].last());
+                  ind, p2i(_committed[ind].start()),
+                  ind, p2i(_committed[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  byte_for(start): " INTPTR_FORMAT
                   "  byte_for(last): " INTPTR_FORMAT,
-                  byte_for(_covered[ind].start()),
-                  byte_for(_covered[ind].last()));
+                  p2i(byte_for(_covered[ind].start())),
+                  p2i(byte_for(_covered[ind].last())));
     gclog_or_tty->print_cr("  "
                   "  addr_for(start): " INTPTR_FORMAT
                   "  addr_for(last): " INTPTR_FORMAT,
-                  addr_for((jbyte*) _committed[ind].start()),
-                  addr_for((jbyte*) _committed[ind].last()));
+                  p2i(addr_for((jbyte*) _committed[ind].start())),
+                  p2i(addr_for((jbyte*) _committed[ind].last())));
   }
   debug_only(verify_guard();)
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //
 // GCTask
 //
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,8 @@
 #include "runtime/os.hpp"
 #include "runtime/thread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 GCTaskThread::GCTaskThread(GCTaskManager* manager,
                            uint           which,
                            uint           processor_id) :
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
   static inline idx_t bits_required(MemRegion covered_region);
 
   void print_on_error(outputStream* st) const {
-    st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this);
+    st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, p2i(this));
     _beg_bits.print_on_error(st, " Begin Bits: ");
     _end_bits.print_on_error(st, " End Bits:   ");
   }
@@ -390,9 +390,9 @@
 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
   // Allow one past the last valid address; useful for loop bounds.
   assert(addr >= region_start(),
-      err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, addr, region_start()));
+      err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())));
   assert(addr <= region_end(),
-      err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, addr, region_end()));
+      err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())));
 }
 #endif  // #ifdef ASSERT
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -373,7 +373,7 @@
     if ((result == NULL) && (QueuedAllocationWarningCount > 0) &&
         (loop_count % QueuedAllocationWarningCount == 0)) {
       warning("ParallelScavengeHeap::mem_allocate retries %d times \n\t"
-              " size=%d", loop_count, size);
+              " size=" SIZE_FORMAT, loop_count, size);
     }
   }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
   const void* loc = (void*) p;
   bool result = ((HeapWord*)p) >= young_gen()->reserved().start();
   assert(result == young_gen()->is_in_reserved(p),
-        err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p));
+        err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, p2i((void*)p)));
   return result;
 }
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARALLELSCAVENGEHEAP_INLINE_HPP
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@
 #include "runtime/vmThread.hpp"
 #include "services/management.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //
 // ThreadRootsMarkingTask
 //
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 
 #include <math.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size,
                                            size_t init_promo_size,
                                            size_t init_survivor_size,
@@ -1033,7 +1035,7 @@
       "AdaptiveSizePolicy::adjust_promo_for_footprint "
       "adjusting tenured gen for footprint. "
       "starting promo size " SIZE_FORMAT
-      " reduced promo size " SIZE_FORMAT,
+      " reduced promo size " SIZE_FORMAT
       " promo delta " SIZE_FORMAT,
       desired_promo_size, reduced_size, change );
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,6 @@
+
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +24,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
@@ -54,6 +55,8 @@
 #include "utilities/events.hpp"
 #include "utilities/stack.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 elapsedTimer        PSMarkSweep::_accumulated_time;
 jlong               PSMarkSweep::_time_of_last_gc   = 0;
 CollectorCounters*  PSMarkSweep::_counters = NULL;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -32,6 +32,7 @@
 #include "gc_implementation/shared/markSweep.inline.hpp"
 #include "gc_implementation/shared/spaceDecorator.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/prefetch.inline.hpp"
 
 PSMarkSweepDecorator* PSMarkSweepDecorator::_destination_decorator = NULL;
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,8 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 inline const char* PSOldGen::select_name() {
   return UseParallelOldGC ? "ParOldGen" : "PSOldGen";
 }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
@@ -62,6 +62,8 @@
 
 #include <math.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // All sizes are in HeapWords.
 const size_t ParallelCompactData::Log2RegionSize  = 16; // 64K words
 const size_t ParallelCompactData::RegionSize      = (size_t)1 << Log2RegionSize;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 #include "oops/oop.inline.hpp"
 #include "oops/oop.psgc.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PaddedEnd<PSPromotionManager>* PSPromotionManager::_manager_array = NULL;
 OopStarTaskQueueSet*           PSPromotionManager::_stack_array_depth = NULL;
 PSOldGen*                      PSPromotionManager::_old_gen = NULL;
@@ -136,7 +138,7 @@
   }
 
   const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]);
-  for (uint i = 0; i < hlines; ++i) tty->print_cr(pm_stats_hdr[i]);
+  for (uint i = 0; i < hlines; ++i) tty->print_cr("%s", pm_stats_hdr[i]);
   for (uint i = 0; i < ParallelGCThreads + 1; ++i) {
     manager_array(i)->print_local_stats(i);
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -226,7 +226,7 @@
   if (TraceScavenge) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
-       new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
   }
 #endif
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -23,7 +24,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "code/codeCache.hpp"
 #include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
 #include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
@@ -56,6 +57,7 @@
 #include "services/memoryService.hpp"
 #include "utilities/stack.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 HeapWord*                  PSScavenge::_to_space_top_before_gc = NULL;
 int                        PSScavenge::_consecutive_skipped_scavenges = 0;
@@ -833,7 +835,7 @@
 
   if (AlwaysTenure || NeverTenure) {
     assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
-        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
+        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is %d", (int) MaxTenuringThreshold));
     _tenuring_threshold = MaxTenuringThreshold;
   } else {
     // We want to smooth out our startup times for the AdaptiveSizePolicy
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@
   if (TraceScavenge &&  o->is_forwarded()) {
     gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
        "forwarding",
-       new_obj->klass()->internal_name(), (void *)o, (void *)new_obj, new_obj->size());
+       new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
   }
 #endif
 
@@ -180,7 +180,7 @@
     if (TraceScavenge) {
       ResourceMark rm;
       gclog_or_tty->print_cr("PSScavengeKlassClosure::do_klass " PTR_FORMAT ", %s, dirty: %s",
-                             klass,
+                             p2i(klass),
                              klass->external_name(),
                              klass->has_modified_oops() ? "true" : "false");
     }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psVirtualspace.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 # include "os_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // PSVirtualSpace
 
 PSVirtualSpace::PSVirtualSpace(ReservedSpace rs, size_t alignment) :
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,8 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PSYoungGen::PSYoungGen(size_t        initial_size,
                        size_t        min_size,
                        size_t        max_size) :
--- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -84,7 +84,7 @@
 
   if (AlwaysTenure || NeverTenure) {
     assert(MaxTenuringThreshold == 0 || MaxTenuringThreshold == markOopDesc::max_age + 1,
-        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is ", MaxTenuringThreshold));
+        err_msg("MaxTenuringThreshold should be 0 or markOopDesc::max_age + 1, but is " UINTX_FORMAT, MaxTenuringThreshold));
     result = MaxTenuringThreshold;
   } else {
     size_t total = 0;
@@ -106,7 +106,7 @@
       gclog_or_tty->cr();
       gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold "
         UINTX_FORMAT " (max threshold " UINTX_FORMAT ")",
-        desired_survivor_size*oopSize, result, MaxTenuringThreshold);
+        desired_survivor_size*oopSize, (uintx) result, MaxTenuringThreshold);
     }
 
     size_t total = 0;
@@ -115,8 +115,8 @@
       total += sizes[age];
       if (sizes[age] > 0) {
         if (PrintTenuringDistribution) {
-          gclog_or_tty->print_cr("- age %3u: %10ld bytes, %10ld total",
-            age, sizes[age]*oopSize, total*oopSize);
+          gclog_or_tty->print_cr("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total",
+                                        age,    sizes[age]*oopSize,          total*oopSize);
         }
       }
       if (UsePerfData) {
--- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,7 +107,7 @@
       assert(demand >= 0,
              err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for "
                      PTR_FORMAT " (size=" SIZE_FORMAT ")",
-                     demand, this, count));
+                     demand, p2i(this), count));
       // Defensive: adjust for imprecision in event counting
       if (demand < 0) {
         demand = 0;
--- a/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/immutableSpace.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
 
 void ImmutableSpace::print() const {
   print_short();
-  tty->print_cr(" [%#-6lx,%#-6lx)", bottom(), end());
+  tty->print_cr(" [" INTPTR_FORMAT_W(#-6) "," INTPTR_FORMAT_W(#-6) ")", p2i(bottom()), p2i(end()));
 }
 
 #endif
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
 #include "oops/objArrayKlass.inline.hpp"
 #include "oops/oop.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 uint                    MarkSweep::_total_invocations = 0;
 
 Stack<oop, mtGC>              MarkSweep::_marking_stack;
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
   _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray<LGRPSpace*>(0, true);
   _page_size = os::vm_page_size();
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableSpace.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
 #include "runtime/thread.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 MutableSpace::MutableSpace(size_t alignment): ImmutableSpace(), _top(NULL), _alignment(alignment) {
   assert(MutableSpace::alignment() >= 0 &&
          MutableSpace::alignment() % os::vm_page_size() == 0,
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "oops/oop.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
   _end(NULL), _hard_end(NULL),
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 #include "memory/space.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Catch-all file for utility classes
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -599,12 +599,12 @@
   assert(heap_start >= ((uintptr_t)NULL + epsilon), "sanity");
   void* before_heap = (void*)(heap_start - epsilon);
   assert(!heap->is_in(before_heap),
-      err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap));
+      err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(before_heap)));
 
   // Test that a pointer to after the heap end is reported as outside the heap.
   assert(heap_end <= ((uintptr_t)-1 - epsilon), "sanity");
   void* after_heap = (void*)(heap_end + epsilon);
   assert(!heap->is_in(after_heap),
-      err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap));
+      err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", p2i(after_heap)));
 }
 #endif
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,7 +213,7 @@
       st->print_cr(" %s", buf);
     }
   } else {
-    st->print_cr(" " PTR_FORMAT, (void *)value);
+    st->print_cr(" " INTPTR_FORMAT, p2i((void *)value));
   }
 }
 
@@ -282,7 +282,7 @@
   if (i >= 0 && i < climit) {
     cp_index = cache->entry_at(i)->constant_pool_index();
   } else {
-    st->print_cr(" not in CP[*]?", i);
+    st->print_cr("%d not in CP[*]?", i);
       return false;
     }
   return true;
@@ -297,7 +297,7 @@
      cp_index = constants->object_to_cp_index(i);
      return true;
   } else {
-    st->print_cr(" not in OBJ[*]?", i);
+    st->print_cr("%d not in OBJ[*]?", i);
   return false;
 }
 }
@@ -321,7 +321,7 @@
   if (tag.is_int()) {
     st->print_cr(" " INT32_FORMAT, constants->int_at(i));
   } else if (tag.is_long()) {
-    st->print_cr(" " INT64_FORMAT, constants->long_at(i));
+    st->print_cr(" " INT64_FORMAT, (int64_t)(constants->long_at(i)));
   } else if (tag.is_float()) {
     st->print_cr(" %f", constants->float_at(i));
   } else if (tag.is_double()) {
@@ -340,7 +340,7 @@
   } else if (tag.is_method_handle()) {
     int kind = constants->method_handle_ref_kind_at(i);
     int i2 = constants->method_handle_index_at(i);
-    st->print(" <MethodHandle of kind %d>", kind, i2);
+    st->print(" <MethodHandle of kind %d index at %d>", kind, i2);
     print_field_or_method(-i, i2, st);
   } else {
     st->print_cr(" bad tag=%d at %d", tag.value(), i);
@@ -389,6 +389,7 @@
 }
 
 
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void BytecodePrinter::print_attributes(int bci, outputStream* st) {
   // Show attributes of pre-rewritten codes
   Bytecodes::Code code = Bytecodes::java_code(raw_code());
@@ -515,7 +516,10 @@
           int idx = ll - lo;
           const char *format = first ? " %d:" INT32_FORMAT " (delta: %d)" :
                                        ", %d:" INT32_FORMAT " (delta: %d)";
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
           st->print(format, ll, dest[idx], dest[idx]-bci);
+PRAGMA_DIAG_POP
         }
         st->cr();
       }
@@ -535,7 +539,10 @@
         for (int ll = 0; ll < len; ll++, first = false)  {
           const char *format = first ? " " INT32_FORMAT ":" INT32_FORMAT :
                                        ", " INT32_FORMAT ":" INT32_FORMAT ;
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
           st->print(format, key[ll], dest[ll]);
+PRAGMA_DIAG_POP
         }
         st->cr();
       }
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,7 +72,7 @@
   if (description() != NULL) st->print("%s  ", description());
   if (bytecode()    >= 0   ) st->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
   st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
-                code_begin(), code_end(), code_size());
+                p2i(code_begin()), p2i(code_end()), code_size());
 
   if (PrintInterpreter) {
     st->cr();
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,6 +75,8 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class UnlockFlagSaver {
   private:
     JavaThread* _thread;
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -950,7 +950,6 @@
     // reflection implementation, not just those associated with
     // sun/reflect/SerializationConstructorAccessor.
     bool is_reflect = JDK_Version::is_gte_jdk14x_version() &&
-                      UseNewReflection &&
                       klass_to_check->is_subclass_of(
                         SystemDictionary::reflect_MagicAccessorImpl_klass());
 
@@ -1626,7 +1625,7 @@
                                                      THREAD);
   if (HAS_PENDING_EXCEPTION) {
     if (TraceMethodHandles) {
-      tty->print_cr("invokedynamic throws BSME for "INTPTR_FORMAT, (void *)PENDING_EXCEPTION);
+      tty->print_cr("invokedynamic throws BSME for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION));
       PENDING_EXCEPTION->print();
     }
     if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) {
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/signature.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class OopMapCacheEntry: private InterpreterOopMap {
   friend class InterpreterOopMap;
   friend class OopMapForCacheEntry;
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,7 @@
   tty->print("[");
   for (int i = 0; i < number_of_states; i++) {
     if (i > 0) tty->print(", ");
-    tty->print(INTPTR_FORMAT, _entry[i]);
+    tty->print(INTPTR_FORMAT, p2i(_entry[i]));
   }
   tty->print("]");
 }
--- a/hotspot/src/share/vm/libadt/dict.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/libadt/dict.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,29 +24,19 @@
 
 #include "precompiled.hpp"
 #include "libadt/dict.hpp"
-#include "memory/allocation.inline.hpp"
-#include "memory/resourceArea.hpp"
-#include "runtime/thread.hpp"
 
 // Dictionaries - An Abstract Data Type
 
 // %%%%% includes not needed with AVM framework - Ungar
 
-// #include "port.hpp"
-//IMPLEMENTATION
-// #include "dict.hpp"
-
 #include <assert.h>
 
-// The iostream is not needed and it gets confused for gcc by the
-// define of bool.
-//
-// #include <iostream.h>
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 //------------------------------data-----------------------------------------
 // String hash tables
 #define MAXID 20
-static byte initflag = 0;       // True after 1st initialization
+static uint8_t initflag = 0;       // True after 1st initialization
 static const char shft[MAXID] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6};
 static short xsum[MAXID];
 
@@ -281,7 +271,7 @@
 // CmpDict compares two dictionaries; they must have the same keys (their
 // keys must match using CmpKey) and they must have the same values (pointer
 // comparison).  If so 1 is returned, if not 0 is returned.
-int32 Dict::operator ==(const Dict &d2) const {
+int32_t Dict::operator ==(const Dict &d2) const {
   if( _cnt != d2._cnt ) return 0;
   if( _hash != d2._hash ) return 0;
   if( _cmp != d2._cmp ) return 0;
@@ -318,7 +308,7 @@
 // C text shows excellent spreading of values for any size hash table.
 int hashstr(const void *t) {
   register char c, k = 0;
-  register int32 sum = 0;
+  register int32_t sum = 0;
   register const char *s = (const char *)t;
 
   while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1
@@ -332,11 +322,7 @@
 // Slimey cheap hash function; no guaranteed performance.  Better than the
 // default for pointers, especially on MS-DOS machines.
 int hashptr(const void *key) {
-#ifdef __TURBOC__
-    return ((intptr_t)key >> 16);
-#else  // __TURBOC__
-    return ((intptr_t)key >> 2);
-#endif
+  return ((intptr_t)key >> 2);
 }
 
 // Slimey cheap hash function; no guaranteed performance.
@@ -345,12 +331,12 @@
 }
 
 //------------------------------Key Comparator Functions---------------------
-int32 cmpstr(const void *k1, const void *k2) {
+int32_t cmpstr(const void *k1, const void *k2) {
   return strcmp((const char *)k1,(const char *)k2);
 }
 
 // Cheap key comparator.
-int32 cmpkey(const void *key1, const void *key2) {
+int32_t cmpkey(const void *key1, const void *key2) {
   if (key1 == key2) return 0;
   intptr_t delta = (intptr_t)key1 - (intptr_t)key2;
   if (delta > 0) return 1;
--- a/hotspot/src/share/vm/libadt/dict.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/libadt/dict.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,11 +25,12 @@
 #ifndef SHARE_VM_LIBADT_DICT_HPP
 #define SHARE_VM_LIBADT_DICT_HPP
 
-#include "libadt/port.hpp"
+// Dictionaries - An Abstract Data Type
 
-// Dictionaries - An Abstract Data Type
-//INTERFACE
-class ostream;
+#include "memory/allocation.inline.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/thread.hpp"
+
 class Dict;
 
 // These dictionaries define a key-value mapping.  They can be inserted to,
@@ -38,7 +39,7 @@
 // key comparison routine determines if two keys are equal or not.  A hash
 // function can be provided; if it's not provided the key itself is used
 // instead.  A nice string hash function is included.
-typedef int32 (*CmpKey)(const void *key1, const void *key2);
+typedef int32_t (*CmpKey)(const void *key1, const void *key2);
 typedef int  (*Hash)(const void *key);
 typedef void (*FuncDict)(const void *key, const void *val, Dict *d);
 
@@ -47,7 +48,7 @@
   class Arena *_arena;          // Where to draw storage from
   class bucket *_bin;           // Hash table is array of buckets
   uint _size;                   // Size (# of slots) in hash table
-  uint32 _cnt;                  // Number of key-value pairs in hash table
+  uint32_t _cnt;                // Number of key-value pairs in hash table
   const Hash _hash;             // Hashing function
   const CmpKey _cmp;            // Key comparison function
   void doubhash( void );        // Double hash table size
@@ -67,7 +68,7 @@
   void Clear();
 
   // Return # of key-value pairs in dict
-  uint32 Size(void) const { return _cnt; }
+  uint32_t Size(void) const { return _cnt; }
 
   // Insert inserts the given key-value pair into the dictionary.  The prior
   // value of the key is returned; NULL if the key was not previously defined.
@@ -81,7 +82,7 @@
   // == compares two dictionaries; they must have the same keys (their keys
   // must match using CmpKey) and they must have the same values (pointer
   // comparison).  If so 1 is returned, if not 0 is returned.
-  int32 operator ==(const Dict &d) const;   // Compare dictionaries for equal
+  int32_t operator ==(const Dict &d) const;   // Compare dictionaries for equal
 
   // Print out the dictionary contents as key-value pairs
   void print();
@@ -96,9 +97,9 @@
 int hashkey(const void *key);
 
 // Key comparators
-int32 cmpstr(const void *k1, const void *k2);
+int32_t cmpstr(const void *k1, const void *k2);
 // Slimey cheap key comparator.
-int32 cmpkey(const void *key1, const void *key2);
+int32_t cmpkey(const void *key1, const void *key2);
 
 //------------------------------Iteration--------------------------------------
 // The class of dictionary iterators.  Fails in the presences of modifications
--- a/hotspot/src/share/vm/libadt/port.cpp	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "libadt/port.hpp"
-
-// Code for portable compiling
-
-#ifdef __GNUC__
-#pragma implementation
-#endif
-
-// %%%%% includes not needed with AVM framework - Ungar
-// #include "port.hpp"
-
-// This is only used if turboc is used and it causes problems with
-// gcc.
-#ifdef __TURBOC__
-#include <iostream.h>
-#endif
-
-#include <stdio.h>
-
-//------------------------------gcd--------------------------------------------
-// Greatest common divisor
-uint32 gcd( register uint32 x, register uint32 y )
-{
-  register uint32 tmp;
-  while( x ) {                  // While not zero
-    tmp = x;                    // Hold onto smaller x value
-    x = y % x;                  // Compute modulus; since y>=x, 0 <= mod < x
-    y = tmp;                    // y = old x
-  }
-  return y;
-}
-
-//-----------------------------------------------------------------------------
-// Find first 1, or return 32 if empty
-int ff1( uint32 mask )
-{
-  unsigned i, n = 0;
-
-  for( i=1, n=0; i; i<<=1, n++)
-    if( mask&i ) return n;
-  return 32;
-}
-
-//-----------------------------------------------------------------------------
-// Find highest 1, or return 32 if empty
-int fh1( uint32 mask )
-{
-  unsigned i, n = 0;
-
-  for( i=((uint32)1<<31), n=31; i; i>>=1, n--)
-    if( mask&i ) return n;
-  return 32;
-}
-
-//------------------------------rotate32---------------------------------------
-// Rotate 32bits.  Postive rotates left (bits move toward high-order bit),
-// negative rotates right.
-uint32 rotate32( register uint32 x, register int32 cnt )
-{
-  if( cnt >= 0 ) {              // Positive rotates left
-    cnt &= 31;                  // Mask off extra shift bits
-  } else {                      // Negative rotates right
-    cnt = (-cnt)&31;            // Flip sign; mask extra shift bits
-    cnt = 32-cnt;               // Rotate right by big left rotation
-  }
-  return (x << cnt) | (x >> (32-cnt));
-}
-
-/* Disabled - we have another log2 in the system.
-   This function doesn't work if used as substitute
-   for the existing log2. Keep around until we have
-   verified all uses of log2 do the correct thing!
-//------------------------------log2-------------------------------------------
-// Log base 2.  Might also be called 'count leading zeros'.  Log2(x) returns
-// an l such that (1L<<l) <= x < (2L<<l).  log2(x) returns 32.
-uint log2( uint32 x )
-{
-  register uint l = 32;         // Log bits
-  register int32 sx = x;        // Treat as signed number
-  while( sx >= 0 )              // While high bit is clear
-    sx <<= 1, l--;              // Shift bits left, count down log2
-  return l;
-}
-*/
-
-//------------------------------print------------------------------------------
-// Print a pointer without modifying the contents
-#ifdef __TURBOC__
-ostream &ostream::operator << (const void *ptr)
-{
-  return (*this) << "0x" << hex << (uint)ptr << dec;
-}
-#else
-/*ostream &operator << (ostream &os, const void *ptr)
-{
-  return os << "0x" << hex << (uint)ptr << dec;
-}*/
-#endif
--- a/hotspot/src/share/vm/libadt/port.hpp	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_LIBADT_PORT_HPP
-#define SHARE_VM_LIBADT_PORT_HPP
-
-#include "utilities/top.hpp"
-
-// Typedefs for portable compiling
-
-#if defined(__GNUC__)
-
-#define INTERFACE       #pragma interface
-#define IMPLEMENTATION  #pragma implementation
-//INTERFACE
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-// Access to the C++ class virtual function pointer
-// Put the class in the macro
-typedef void *VPTR;
-// G++ puts it at the end of the base class
-#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)((char*)this+sizeof(class)-sizeof(void*));}
-
-#elif defined(__TURBOC__)
-
-#include <mem.h>
-#include <string.h>
-extern "C" int stricmp(const char *, const char *);
-inline void bcopy(const void *s, void *d, int l) { memmove(d,s,l); }
-inline void bzero(void *p, int l) { memset(p,0,l); }
-inline int bcmp(const void *s, const void *d, int l) { return memcmp(s,d,l); }
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-//strcasecmp moved to globalDefinitions_visCPP.hpp
-//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
-inline long abs( long x ) { return x < 0 ? -x : x; }
-// Access to the C++ class virtual function pointer
-// Put the class in the macro
-typedef void near *VPTR;
-// BorlandC puts it up front
-#define ACCESS_VPTR(class) VPTR&vptr(){return*(VPTR*)this;}
-
-#elif defined(__hpux)
-
-#define INTERFACE
-#define IMPLEMENTATION
-#define signed
-#include <strings.h>
-#include <stdlib.h>
-inline long min( long a, long b) { return a < b ? a : b; }
-inline long max( long a, long b) { return a > b ? a : b; }
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-inline long abs( long x ) { return x < 0 ? -x : x; }
-
-#elif defined(__MOTO__)
-// Motorola's mcc
-#define INTERFACE
-#define IMPLEMENTATION
-#include <stdlib.h>
-#include <memory.h>
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-
-#elif defined(_AIX)
-// IBM's xlC compiler
-#define INTERFACE
-#define IMPLEMENTATION
-#include <stdlib.h>
-#include <memory.h>
-
-#elif defined(_MSC_VER)
-// Microsoft Visual C++
-//#define INTERFACE
-#define IMPLEMENTATION
-#include <stdlib.h>
-#undef small
-//strcasecmp moved to globalDefinitions_visCPP.hpp
-//inline int strcasecmp(const char *s1, const char *s2) { return stricmp(s1,s2); }
-
-
-#elif defined(SPARC_WORKS)
-
-#define INTERFACE
-#define IMPLEMENTATION
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#elif defined(SOLARIS)
-
-#define INTERFACE
-#define IMPLEMENTATION
-
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-#elif defined(__TANDEM)
-
-// This case is for the Tandem Business Unit of Compaq Computer Corporation.
-// The Tandem case must precede the AT&T case,
-// because the Tandem c89 compiler also defines __cplusplus.
-
-#include "port_tandem.hpp"
-
-#elif defined(__cplusplus)
-// AT&Ts cfront
-#define INTERFACE
-#define IMPLEMENTATION
-#include <unistd.h>
-#define signed
-// #include <bstring.h>
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-
-#else  // All other machines
-
-#define signed
-extern "C" void bcopy(void *b1, void *b2, int len);
-inline int min( int a, int b) { return a < b ? a : b; }
-inline int max( int a, int b) { return a > b ? a : b; }
-
-#endif
-
-//-----------------------------------------------------------------------------
-// Safer memory allocations
-#ifdef SAFE_MEMORY
-#define malloc(size)        safe_malloc(__FILE__,__LINE__,size)
-#define free(ptr)           safe_free(__FILE__,__LINE__,ptr)
-#define realloc(ptr,size)   safe_realloc(__FILE__,__LINE__,ptr,size)
-#define calloc(nitems,size) safe_calloc(__FILE__,__LINE__,nitems,size)
-#define strdup(ptr)         safe_strdup(__FILE__,__LINE__,ptr)
-extern void *safe_malloc (const char *file, unsigned line, unsigned size);
-extern void  safe_free   (const char *file, unsigned line, void *ptr);
-extern void *safe_calloc (const char *file, unsigned line, unsigned nitems, unsigned size);
-extern void *safe_realloc(const char *file, unsigned line, void *ptr, unsigned size);
-extern char *safe_strdup (const char *file, unsigned line, const char *src);
-inline void *operator new( size_t size ) throw() { return malloc(size); }
-inline void operator delete( void *ptr )         { free(ptr); }
-#endif
-
-//-----------------------------------------------------------------------------
-// And now, the bit-size-specified integer sizes
-typedef signed char int8;
-typedef unsigned char uint8;
-typedef unsigned char byte;
-
-// All uses of *int16 changed to 32-bit to speed up compiler on Intel
-//typedef signed short int16;   // Exactly 16bits signed
-//typedef unsigned short uint16;        // Exactly 16bits unsigned
-//const unsigned int min_uint16 = 0x0000;    // smallest uint16
-//const unsigned int max_uint16 = 0xFFFF;    // largest  uint16
-
-typedef unsigned int uint;      // When you need a fast >=16bit unsigned value
-/*typedef int int; */           // When you need a fast >=16bit value
-const unsigned int max_uint = (uint)-1;
-typedef int32_t int32;   // Exactly 32bits signed
-typedef uint32_t uint32; // Exactly 32bits unsigned
-
-// Bit-sized floating point and long thingies
-#ifndef __TANDEM
-// Do not define these for Tandem, because they conflict with typedefs in softieee.h.
-typedef float float32;          // 32-bit float
-typedef double float64;         // 64-bit float
-#endif // __TANDEM
-
-typedef jlong int64;            // Java long for my 64-bit type
-typedef julong uint64;          // Java long for my 64-bit type
-
-//-----------------------------------------------------------------------------
-// Nice constants
-uint32 gcd( uint32 x, uint32 y );
-int ff1( uint32 mask );
-int fh1( uint32 mask );
-uint32 rotate32( uint32 x, int32 cnt );
-
-
-//-----------------------------------------------------------------------------
-extern uint32 heap_totalmem;      // Current total memory allocation
-extern uint32 heap_highwater;     // Highwater mark to date for memory usage
-
-#endif // SHARE_VM_LIBADT_PORT_HPP
--- a/hotspot/src/share/vm/libadt/set.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/libadt/set.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,20 +28,11 @@
 
 // Sets - An Abstract Data Type
 
-// %%%%% includes not needed with AVM framework - Ungar
-// #include "port.hpp"
-//IMPLEMENTATION
-// #include "set.hpp"
-
 #include <stdio.h>
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
 
-// Not needed and it causes terouble for gcc.
-//
-// #include <iostream.h>
-
 //-------------------------Virtual Functions-----------------------------------
 // These functions MUST be implemented by the inheriting class.
 class SparseSet;
@@ -116,7 +107,7 @@
 void Set::print() const
 {
   char *printable_set = setstr();
-  tty->print_cr(printable_set);
+  tty->print_cr("%s", printable_set);
   FreeHeap(printable_set);
 }
 
--- a/hotspot/src/share/vm/libadt/set.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/libadt/set.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,13 +25,10 @@
 #ifndef SHARE_VM_LIBADT_SET_HPP
 #define SHARE_VM_LIBADT_SET_HPP
 
-#include "libadt/port.hpp"
 #include "memory/allocation.hpp"
 
 // Sets - An Abstract Data Type
 
-//INTERFACE
-
 class SparseSet;
 class VectorSet;
 class ListSet;
--- a/hotspot/src/share/vm/libadt/vectset.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/libadt/vectset.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -28,15 +28,10 @@
 
 // Vector Sets - An Abstract Data Type
 
-// %%%%% includes not needed with AVM framework - Ungar
-// #include "port.hpp"
-//IMPLEMENTATION
-// #include "vectset.hpp"
-
 // BitsInByte is a lookup table which tells the number of bits that
 // are in the looked-up number.  It is very useful in VectorSet_Size.
 
-uint8 bitsInByte[256] = {
+uint8_t bitsInByte[256] = {
   0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
   1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
@@ -59,7 +54,7 @@
 // Create a new, empty Set.
 VectorSet::VectorSet(Arena *arena) : Set(arena) {
   size = 2;                     // Small initial size
-  data = (uint32 *)_set_arena->Amalloc(size*sizeof(uint32));
+  data = (uint32_t *)_set_arena->Amalloc(size*sizeof(uint32_t));
   data[0] = 0;                  // No elements
   data[1] = 0;
 }
@@ -85,8 +80,8 @@
 void VectorSet::slamin(const VectorSet& s)
 {
   size = s.size;                // Use new size
-  data = (uint32*)s._set_arena->Amalloc(size*sizeof(uint32)); // Make array of required size
-  memcpy( data, s.data, size*sizeof(uint32) ); // Fill the array
+  data = (uint32_t*)s._set_arena->Amalloc(size*sizeof(uint32_t)); // Make array of required size
+  memcpy( data, s.data, size*sizeof(uint32_t) ); // Fill the array
 }
 
 //------------------------------grow-------------------------------------------
@@ -96,8 +91,8 @@
   newsize = (newsize+31) >> 5;  // Convert to longwords
   uint x = size;
   while( x < newsize ) x <<= 1;
-  data = (uint32 *)_set_arena->Arealloc(data, size*sizeof(uint32), x*sizeof(uint32));
-  memset((char *)(data + size), 0, (x - size)*sizeof(uint32));
+  data = (uint32_t *)_set_arena->Arealloc(data, size*sizeof(uint32_t), x*sizeof(uint32_t));
+  memset((char *)(data + size), 0, (x - size)*sizeof(uint32_t));
   size = x;
 }
 
@@ -106,7 +101,7 @@
 Set &VectorSet::operator <<= (uint elem)
 {
   register uint word = elem >> 5;            // Get the longword offset
-  register uint32 mask = 1L << (elem & 31);  // Get bit mask
+  register uint32_t mask = 1L << (elem & 31);  // Get bit mask
 
   if( word >= size )            // Need to grow set?
     grow(elem+1);               // Then grow it
@@ -121,7 +116,7 @@
   register uint word = elem >> 5; // Get the longword offset
   if( word >= size )              // Beyond the last?
     return *this;                 // Then it's clear & return clear
-  register uint32 mask = 1L << (elem & 31);     // Get bit mask
+  register uint32_t mask = 1L << (elem & 31);     // Get bit mask
   data[word] &= ~mask;            // Clear bit
   return *this;
 }
@@ -132,8 +127,8 @@
 {
   // NOTE: The intersection is never any larger than the smallest set.
   if( s.size < size ) size = s.size; // Get smaller size
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
   for( uint i=0; i<size; i++)   // For data in set
     *u1++ &= *u2++;             // Copy and AND longwords
   return *this;                 // Return set
@@ -152,14 +147,14 @@
 {
   // This many words must be unioned
   register uint cnt = ((size<s.size)?size:s.size);
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
   for( uint i=0; i<cnt; i++)    // Copy and OR the two sets
     *u1++ |= *u2++;
   if( size < s.size ) {         // Is set 2 larger than set 1?
     // Extend result by larger set
-    grow(s.size*sizeof(uint32)*8);
-    memcpy(&data[cnt], u2, (s.size - cnt)*sizeof(uint32));
+    grow(s.size*sizeof(uint32_t)*8);
+    memcpy(&data[cnt], u2, (s.size - cnt)*sizeof(uint32_t));
   }
   return *this;                 // Return result set
 }
@@ -177,8 +172,8 @@
 {
   // This many words must be unioned
   register uint cnt = ((size<s.size)?size:s.size);
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
   for( uint i=0; i<cnt; i++ )   // For data in set
     *u1++ &= ~(*u2++);          // A <-- A & ~B  with longwords
   return *this;                 // Return new set
@@ -199,17 +194,17 @@
 //        1X --  B is a subset of A
 int VectorSet::compare (const VectorSet &s) const
 {
-  register uint32 *u1 = data;   // Pointer to the destination data
-  register uint32 *u2 = s.data; // Pointer to the source data
-  register uint32 AnotB = 0, BnotA = 0;
+  register uint32_t *u1 = data;   // Pointer to the destination data
+  register uint32_t *u2 = s.data; // Pointer to the source data
+  register uint32_t AnotB = 0, BnotA = 0;
   // This many words must be unioned
   register uint cnt = ((size<s.size)?size:s.size);
 
   // Get bits for both sets
   uint i;                       // Exit value of loop
   for( i=0; i<cnt; i++ ) {      // For data in BOTH sets
-    register uint32 A = *u1++;  // Data from one guy
-    register uint32 B = *u2++;  // Data from other guy
+    register uint32_t A = *u1++;  // Data from one guy
+    register uint32_t B = *u2++;  // Data from other guy
     AnotB |= (A & ~B);          // Compute bits in A not B
     BnotA |= (B & ~A);          // Compute bits in B not A
   }
@@ -250,8 +245,8 @@
 
   // NOTE: The intersection is never any larger than the smallest set.
   register uint small_size = ((size<s.size)?size:s.size);
-  register uint32 *u1 = data;        // Pointer to the destination data
-  register uint32 *u2 = s.data;      // Pointer to the source data
+  register uint32_t *u1 = data;        // Pointer to the destination data
+  register uint32_t *u2 = s.data;      // Pointer to the source data
   for( uint i=0; i<small_size; i++)  // For data in set
     if( *u1++ & *u2++ )              // If any elements in common
       return 0;                      // Then not disjoint
@@ -293,7 +288,7 @@
   register uint word = elem >> 5; // Get the longword offset
   if( word >= size )              // Beyond the last?
     return 0;                     // Then it's clear
-  register uint32 mask = 1L << (elem & 31);  // Get bit mask
+  register uint32_t mask = 1L << (elem & 31);  // Get bit mask
   return ((data[word] & mask))!=0;           // Return the sense of the bit
 }
 
@@ -305,7 +300,7 @@
   for( i=0; i<size; i++ )
     if( data[i] )
       break;
-  uint32 word = data[i];
+  uint32_t word = data[i];
   int j;                        // Exit value of loop
   for( j= -1; word; j++, word>>=1 );
   return (i<<5)+j;
@@ -316,11 +311,11 @@
 void VectorSet::Clear(void)
 {
   if( size > 100 ) {            // Reclaim storage only if huge
-    FREE_RESOURCE_ARRAY(uint32,data,size);
+    FREE_RESOURCE_ARRAY(uint32_t,data,size);
     size = 2;                   // Small initial size
-    data = NEW_RESOURCE_ARRAY(uint32,size);
+    data = NEW_RESOURCE_ARRAY(uint32_t,size);
   }
-  memset( data, 0, size*sizeof(uint32) );
+  memset( data, 0, size*sizeof(uint32_t) );
 }
 
 //------------------------------Size-------------------------------------------
@@ -328,8 +323,8 @@
 uint VectorSet::Size(void) const
 {
   uint sum = 0;                 // Cumulative size so far.
-  uint8 *currByte = (uint8*)data;
-  for( uint32 i = 0; i < (size<<2); i++) // While have bytes to process
+  uint8_t* currByte = (uint8_t*) data;
+  for( uint32_t i = 0; i < (size<<2); i++) // While have bytes to process
     sum += bitsInByte[*currByte++];      // Add bits in current byte to size.
   return sum;
 }
@@ -343,7 +338,7 @@
 //------------------------------hash-------------------------------------------
 int VectorSet::hash() const
 {
-  uint32 _xor = 0;
+  uint32_t _xor = 0;
   uint lim = ((size<4)?size:4);
   for( uint i = 0; i < lim; i++ )
     _xor ^= data[i];
--- a/hotspot/src/share/vm/libadt/vectset.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/libadt/vectset.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -47,7 +47,7 @@
 friend class VectorSetI;        // Friendly iterator class
 protected:
   uint size;                    // Size of data IN LONGWORDS (32bits)
-  uint32 *data;                 // The data, bit packed
+  uint32_t* data;               // The data, bit packed
 
   void slamin( const VectorSet& s );     // Initialize one set with another
   int compare(const VectorSet &s) const; // Compare set contents
@@ -99,7 +99,7 @@
   void Sort(void);                  // Sort before iterating
   int hash() const;                 // Hash function
   void Reset(void) {                // Reset a set
-    memset( data, 0, size*sizeof(uint32) );
+    memset( data, 0, size*sizeof(uint32_t) );
   }
 
   /* Removed for MCC BUG
@@ -108,7 +108,7 @@
 
   // Expose internals for speed-critical fast iterators
   uint word_size() const { return size; }
-  uint32 *EXPOSE() const { return data; }
+  uint32_t* EXPOSE() const { return data; }
 
   // Fast inlined "test and set".  Replaces the idiom:
   //     if( visited[idx] ) return;
@@ -120,8 +120,8 @@
     uint word = elem >> 5;           // Get the longword offset
     if( word >= size )               // Beyond the last?
       return test_set_grow(elem);    // Then grow; set; return 0;
-    uint32 mask = 1L << (elem & 31); // Get bit mask
-    uint32 datum = data[word] & mask;// Get bit
+    uint32_t mask = 1L << (elem & 31); // Get bit mask
+    uint32_t datum = data[word] & mask;// Get bit
     data[word] |= mask;              // Set bit
     return datum;                    // Return bit
   }
@@ -134,7 +134,7 @@
   int test( uint elem ) const {
     uint word = elem >> 5;      // Get the longword offset
     if( word >= size ) return 0; // Beyond the last?
-    uint32 mask = 1L << (elem & 31); // Get bit mask
+    uint32_t mask = 1L << (elem & 31); // Get bit mask
     return data[word] & mask;   // Get bit
   }
 
@@ -144,7 +144,7 @@
     if( word >= size ) {        // Beyond the last?
       test_set_grow(elem);      // Then grow and set
     } else {
-      uint32 mask = 1L << (elem & 31); // Get bit mask
+      uint32_t mask = 1L << (elem & 31); // Get bit mask
       data[word] |= mask;       // Set bit
     }
   }
@@ -164,7 +164,7 @@
   friend class VectorSet;
   const VectorSet *s;
   uint i, j;
-  uint32 mask;
+  uint32_t mask;
   uint next(void);
 
 public:
--- a/hotspot/src/share/vm/memory/allocation.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,11 +75,11 @@
 }
 
 bool MetaspaceObj::is_metaspace_object() const {
-  return ClassLoaderDataGraph::contains((void*)this);
+  return Metaspace::contains((void*)this);
 }
 
 void MetaspaceObj::print_address_on(outputStream* st) const {
-  st->print(" {"INTPTR_FORMAT"}", this);
+  st->print(" {" INTPTR_FORMAT "}", p2i(this));
 }
 
 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
@@ -142,7 +142,7 @@
 void ResourceObj::set_allocation_type(address res, allocation_type type) {
     // Set allocation type in the resource object
     uintptr_t allocation = (uintptr_t)res;
-    assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " PTR_FORMAT, res));
+    assert((allocation & allocation_mask) == 0, err_msg("address should be aligned to 4 bytes at least: " INTPTR_FORMAT, p2i(res)));
     assert(type <= allocation_mask, "incorrect allocation type");
     ResourceObj* resobj = (ResourceObj *)res;
     resobj->_allocation_t[0] = ~(allocation + type);
@@ -179,7 +179,7 @@
       // Operator new() was called and type was set.
       assert(!allocated_on_stack(),
              err_msg("not embedded or stack, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
-                     this, get_allocation_type(), _allocation_t[0], _allocation_t[1]));
+                     p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]));
     } else {
       // Operator new() was not called.
       // Assume that it is embedded or stack object.
@@ -193,7 +193,7 @@
     // Note: garbage may resembles valid value.
     assert(~(_allocation_t[0] | allocation_mask) != (uintptr_t)this || !is_type_set(),
            err_msg("embedded or stack only, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
-                   this, get_allocation_type(), _allocation_t[0], _allocation_t[1]));
+                   p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]));
     set_allocation_type((address)this, STACK_OR_EMBEDDED);
     _allocation_t[1] = 0; // Zap verification value
 }
@@ -202,7 +202,7 @@
     // Used in InlineTree::ok_to_inline() for WarmCallInfo.
     assert(allocated_on_stack(),
            err_msg("copy only into local, this(" PTR_FORMAT ") type %d a[0]=(" PTR_FORMAT ") a[1]=(" PTR_FORMAT ")",
-                   this, get_allocation_type(), _allocation_t[0], _allocation_t[1]));
+                   p2i(this), get_allocation_type(), _allocation_t[0], _allocation_t[1]));
     // Keep current _allocation_t value;
     return *this;
 }
@@ -218,13 +218,13 @@
 
 void trace_heap_malloc(size_t size, const char* name, void* p) {
   // A lock is not needed here - tty uses a lock internally
-  tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p, size, name == NULL ? "" : name);
+  tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p2i(p), size, name == NULL ? "" : name);
 }
 
 
 void trace_heap_free(void* p) {
   // A lock is not needed here - tty uses a lock internally
-  tty->print_cr("Heap free   " INTPTR_FORMAT, p);
+  tty->print_cr("Heap free   " INTPTR_FORMAT, p2i(p));
 }
 
 //--------------------------------------------------------------------------------------
@@ -686,50 +686,67 @@
 // a memory leak.  Use CHeapObj as the base class of such objects to make it explicit
 // that they're allocated on the C heap.
 // Commented out in product version to avoid conflicts with third-party C++ native code.
-// On certain platforms, such as Mac OS X (Darwin), in debug version, new is being called
-// from jdk source and causing data corruption. Such as
-//  Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair
-// define ALLOW_OPERATOR_NEW_USAGE for platform on which global operator new allowed.
+//
+// In C++98/03 the throwing new operators are defined with the following signature:
+//
+// void* operator new(std::size_tsize) throw(std::bad_alloc);
+// void* operator new[](std::size_tsize) throw(std::bad_alloc);
+//
+// while all the other (non-throwing) new and delete operators are defined with an empty
+// throw clause (i.e. "operator delete(void* p) throw()") which means that they do not
+// throw any exceptions (see section 18.4 of the C++ standard).
 //
-#ifndef ALLOW_OPERATOR_NEW_USAGE
-void* operator new(size_t size) throw() {
-  assert(false, "Should not call global operator new");
+// In the new C++11/14 standard, the signature of the throwing new operators was changed
+// by completely omitting the throw clause (which effectively means they could throw any
+// exception) while all the other new/delete operators where changed to have a 'nothrow'
+// clause instead of an empty throw clause.
+//
+// Unfortunately, the support for exception specifications among C++ compilers is still
+// very fragile. While some more strict compilers like AIX xlC or HP aCC reject to
+// override the default throwing new operator with a user operator with an empty throw()
+// clause, the MS Visual C++ compiler warns for every non-empty throw clause like
+// throw(std::bad_alloc) that it will ignore the exception specification. The following
+// operator definitions have been checked to correctly work with all currently supported
+// compilers and they should be upwards compatible with C++11/14. Therefore
+// PLEASE BE CAREFUL if you change the signature of the following operators!
+
+void* operator new(size_t size) /* throw(std::bad_alloc) */ {
+  fatal("Should not call global operator new");
   return 0;
 }
 
-void* operator new [](size_t size) throw() {
-  assert(false, "Should not call global operator new[]");
+void* operator new [](size_t size) /* throw(std::bad_alloc) */ {
+  fatal("Should not call global operator new[]");
   return 0;
 }
 
 void* operator new(size_t size, const std::nothrow_t&  nothrow_constant) throw() {
-  assert(false, "Should not call global operator new");
+  fatal("Should not call global operator new");
   return 0;
 }
 
 void* operator new [](size_t size, std::nothrow_t&  nothrow_constant) throw() {
-  assert(false, "Should not call global operator new[]");
+  fatal("Should not call global operator new[]");
   return 0;
 }
 
-void operator delete(void* p) {
-  assert(false, "Should not call global delete");
+void operator delete(void* p) throw() {
+  fatal("Should not call global delete");
 }
 
-void operator delete [](void* p) {
-  assert(false, "Should not call global delete []");
+void operator delete [](void* p) throw() {
+  fatal("Should not call global delete []");
 }
-#endif // ALLOW_OPERATOR_NEW_USAGE
 
 void AllocatedObj::print() const       { print_on(tty); }
 void AllocatedObj::print_value() const { print_value_on(tty); }
 
 void AllocatedObj::print_on(outputStream* st) const {
-  st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", this);
+  st->print_cr("AllocatedObj(" INTPTR_FORMAT ")", p2i(this));
 }
 
 void AllocatedObj::print_value_on(outputStream* st) const {
-  st->print("AllocatedObj(" INTPTR_FORMAT ")", this);
+  st->print("AllocatedObj(" INTPTR_FORMAT ")", p2i(this));
 }
 
 julong Arena::_bytes_allocated = 0;
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1318,7 +1318,7 @@
     for (Chunk_t* fc = fl->head(); fc != NULL;
          fc = fc->next()) {
       _st->print_cr("\t[" PTR_FORMAT "," PTR_FORMAT ")  %s",
-                    fc, (HeapWord*)fc + sz,
+                    p2i(fc), p2i((HeapWord*)fc + sz),
                     fc->cantCoalesce() ? "\t CC" : "");
     }
   }
--- a/hotspot/src/share/vm/memory/blockOffsetTable.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/blockOffsetTable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,12 +59,12 @@
                   "  rs.base(): " INTPTR_FORMAT
                   "  rs.size(): " INTPTR_FORMAT
                   "  rs end(): " INTPTR_FORMAT,
-                  rs.base(), rs.size(), rs.base() + rs.size());
+                  p2i(rs.base()), rs.size(), p2i(rs.base() + rs.size()));
     gclog_or_tty->print_cr("  "
                   "  _vs.low_boundary(): " INTPTR_FORMAT
                   "  _vs.high_boundary(): " INTPTR_FORMAT,
-                  _vs.low_boundary(),
-                  _vs.high_boundary());
+                  p2i(_vs.low_boundary()),
+                  p2i(_vs.high_boundary()));
   }
 }
 
@@ -537,10 +537,10 @@
     q -= (N_words * n_cards_back);
     assert(q >= _sp->bottom(),
            err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
-                   q, _sp->bottom()));
+                   p2i(q), p2i(_sp->bottom())));
     assert(q < _sp->end(),
            err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
-                   q, _sp->end()));
+                   p2i(q), p2i(_sp->end())));
     index -= n_cards_back;
     offset = _array->offset_array(index);
   }
@@ -549,10 +549,10 @@
   q -= offset;
   assert(q >= _sp->bottom(),
          err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
-                 q, _sp->bottom()));
+                 p2i(q), p2i(_sp->bottom())));
   assert(q < _sp->end(),
          err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
-                 q, _sp->end()));
+                 p2i(q), p2i(_sp->end())));
   HeapWord* n = q;
 
   while (n <= addr) {
@@ -563,14 +563,14 @@
            err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT","
                    " while querying blk_start(" PTR_FORMAT ")"
                    " on _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
-                   n, last, addr, _sp->bottom(), _sp->end()));
+                   p2i(n), p2i(last), p2i(addr), p2i(_sp->bottom()), p2i(_sp->end())));
   }
   assert(q <= addr,
          err_msg("wrong order for current (" INTPTR_FORMAT ")" " <= arg (" INTPTR_FORMAT ")",
-                 q, addr));
+                 p2i(q), p2i(addr)));
   assert(addr <= n,
          err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")",
-                 addr, n));
+                 p2i(addr), p2i(n)));
   return q;
 }
 
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -138,11 +138,11 @@
     gclog_or_tty->print_cr("  "
                   "  &_byte_map[0]: " INTPTR_FORMAT
                   "  &_byte_map[_last_valid_index]: " INTPTR_FORMAT,
-                  &_byte_map[0],
-                  &_byte_map[_last_valid_index]);
+                  p2i(&_byte_map[0]),
+                  p2i(&_byte_map[_last_valid_index]));
     gclog_or_tty->print_cr("  "
                   "  byte_map_base: " INTPTR_FORMAT,
-                  byte_map_base);
+                  p2i(byte_map_base));
   }
 }
 
@@ -392,23 +392,23 @@
     gclog_or_tty->print_cr("  "
                   "  _covered[%d].start(): " INTPTR_FORMAT
                   "  _covered[%d].last(): " INTPTR_FORMAT,
-                  ind, _covered[ind].start(),
-                  ind, _covered[ind].last());
+                  ind, p2i(_covered[ind].start()),
+                  ind, p2i(_covered[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  _committed[%d].start(): " INTPTR_FORMAT
                   "  _committed[%d].last(): " INTPTR_FORMAT,
-                  ind, _committed[ind].start(),
-                  ind, _committed[ind].last());
+                  ind, p2i(_committed[ind].start()),
+                  ind, p2i(_committed[ind].last()));
     gclog_or_tty->print_cr("  "
                   "  byte_for(start): " INTPTR_FORMAT
                   "  byte_for(last): " INTPTR_FORMAT,
-                  byte_for(_covered[ind].start()),
-                  byte_for(_covered[ind].last()));
+                  p2i(byte_for(_covered[ind].start())),
+                  p2i(byte_for(_covered[ind].last())));
     gclog_or_tty->print_cr("  "
                   "  addr_for(start): " INTPTR_FORMAT
                   "  addr_for(last): " INTPTR_FORMAT,
-                  addr_for((jbyte*) _committed[ind].start()),
-                  addr_for((jbyte*) _committed[ind].last()));
+                  p2i(addr_for((jbyte*) _committed[ind].start())),
+                  p2i(addr_for((jbyte*) _committed[ind].last())));
   }
   // Touch the last card of the covered region to show that it
   // is committed (or SEGV).
@@ -657,14 +657,14 @@
     if (failed) {
       if (!failures) {
         tty->cr();
-        tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]", start, end);
+        tty->print_cr("== CT verification failed: [" INTPTR_FORMAT "," INTPTR_FORMAT "]", p2i(start), p2i(end));
         tty->print_cr("==   %sexpecting value: %d",
                       (val_equals) ? "" : "not ", val);
         failures = true;
       }
       tty->print_cr("==   card "PTR_FORMAT" ["PTR_FORMAT","PTR_FORMAT"], "
-                    "val: %d", curr, addr_for(curr),
-                    (HeapWord*) (((size_t) addr_for(curr)) + card_size),
+                    "val: %d", p2i(curr), p2i(addr_for(curr)),
+                    p2i((HeapWord*) (((size_t) addr_for(curr)) + card_size)),
                     (int) curr_val);
     }
   }
@@ -682,7 +682,7 @@
 
 void CardTableModRefBS::print_on(outputStream* st) const {
   st->print_cr("Card table byte_map: [" INTPTR_FORMAT "," INTPTR_FORMAT "] byte_map_base: " INTPTR_FORMAT,
-               _byte_map, _byte_map + _byte_map_size, byte_map_base);
+               p2i(_byte_map), p2i(_byte_map + _byte_map_size), p2i(byte_map_base));
 }
 
 bool CardTableModRefBSForCTRS::card_will_be_scanned(jbyte cv) {
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
     assert(_whole_heap.contains(p),
            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
-                   p, _whole_heap.start(), _whole_heap.end()));
+                   p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
     jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
     assert(result >= _byte_map && result < _byte_map + _byte_map_size,
            "out of bounds accessor for card marking array");
@@ -431,7 +431,7 @@
     assert(_whole_heap.contains(result),
            err_msg("Returning result = "PTR_FORMAT" out of bounds of "
                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
-                   result, _whole_heap.start(), _whole_heap.end()));
+                   p2i(result), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
     return result;
   }
 
@@ -440,7 +440,7 @@
     assert(_whole_heap.contains(p),
            err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
                    " card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
-                   p, _whole_heap.start(), _whole_heap.end()));
+                   p2i(p), p2i(_whole_heap.start()), p2i(_whole_heap.end())));
     return byte_for(p) - _byte_map;
   }
 
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -288,14 +288,14 @@
          err_msg("Did you forget to call save_marks()? "
                  "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
                  "[" PTR_FORMAT ", " PTR_FORMAT ")",
-                 urasm.start(), urasm.end(), ur.start(), ur.end()));
+                 p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())));
   // In the case of CMS+ParNew, issue a warning
   if (!ur.contains(urasm)) {
     assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
     warning("CMS+ParNew: Did you forget to call save_marks()? "
             "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
             "[" PTR_FORMAT ", " PTR_FORMAT ")",
-             urasm.start(), urasm.end(), ur.start(), ur.end());
+             p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end()));
     MemRegion ur2 = sp->used_region();
     MemRegion urasm2 = sp->used_region_at_save_marks();
     if (!ur.equals(ur2)) {
@@ -349,12 +349,12 @@
     assert(jp >= _begin && jp < _end,
            err_msg("Error: jp " PTR_FORMAT " should be within "
                    "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
-                   jp, _begin, _end));
+                   p2i(jp), p2i(_begin), p2i(_end)));
     oop obj = oopDesc::load_decode_heap_oop(p);
     guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
               err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
                       "clean card crosses boundary" PTR_FORMAT,
-                      (HeapWord*)obj, jp, _boundary));
+                      p2i((HeapWord*)obj), p2i(jp), p2i(_boundary)));
   }
 
 public:
@@ -362,10 +362,10 @@
     _boundary(b), _begin(begin), _end(end) {
     assert(b <= begin,
            err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT,
-                   b, begin));
+                   p2i(b), p2i(begin)));
     assert(begin <= end,
            err_msg("Error: begin " PTR_FORMAT " should be strictly below end " PTR_FORMAT,
-                   begin, end));
+                   p2i(begin), p2i(end)));
   }
 
   virtual void do_oop(oop* p)       { VerifyCleanCardClosure::do_oop_work(p); }
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -736,7 +736,7 @@
     if ((QueuedAllocationWarningCount > 0) &&
         (try_count % QueuedAllocationWarningCount == 0)) {
           warning("TwoGenerationCollectorPolicy::mem_allocate_work retries %d times \n\t"
-                  " size=%d %s", try_count, size, is_tlab ? "(TLAB)" : "");
+                  " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : "");
     }
   }
 }
@@ -903,7 +903,7 @@
     if ((QueuedAllocationWarningCount > 0) &&
         (loop_count % QueuedAllocationWarningCount == 0)) {
       warning("satisfy_failed_metadata_allocation() retries %d times \n\t"
-              " size=%d", loop_count, word_size);
+              " size=" SIZE_FORMAT, loop_count, word_size);
     }
   } while (true);  // Until a GC is done
 }
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,11 +42,14 @@
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
+#include "runtime/prefetch.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/stack.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 //
 // DefNewGeneration functions.
 
--- a/hotspot/src/share/vm/memory/filemap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/filemap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
 #define O_BINARY 0     // otherwise do nothing.
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 extern address JVM_FunctionAtStart();
 extern address JVM_FunctionAtEnd();
--- a/hotspot/src/share/vm/memory/gcLocker.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/gcLocker.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
       tty->print_cr("critical counts don't match: %d != %d", _jni_lock_count, count);
       for (JavaThread* thr = Threads::first(); thr; thr = thr->next()) {
         if (thr->in_critical()) {
-          tty->print_cr(INTPTR_FORMAT " in_critical %d", thr, thr->in_critical());
+          tty->print_cr(INTPTR_FORMAT " in_critical %d", p2i(thr), thr->in_critical());
         }
       }
     }
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -794,7 +794,7 @@
 bool GenCollectedHeap::is_in_young(oop p) {
   bool result = ((HeapWord*)p) < _gens[_n_gens - 1]->reserved().start();
   assert(result == _gens[0]->is_in_reserved(p),
-         err_msg("incorrect test - result=%d, p=" PTR_FORMAT, result, (void*)p));
+         err_msg("incorrect test - result=%d, p=" INTPTR_FORMAT, result, p2i((void*)p)));
   return result;
 }
 
@@ -1067,7 +1067,7 @@
   for (int i = _n_gens-1; i >= 0; i--) {
     Generation* g = _gens[i];
     if (!silent) {
-      gclog_or_tty->print(g->name());
+      gclog_or_tty->print("%s", g->name());
       gclog_or_tty->print(" ");
     }
     g->verify();
@@ -1270,7 +1270,7 @@
   // back a time later than 'now'.
   jlong retVal = now - tolgc_cl.time();
   if (retVal < 0) {
-    NOT_PRODUCT(warning("time warp: "INT64_FORMAT, retVal);)
+    NOT_PRODUCT(warning("time warp: "INT64_FORMAT, (int64_t) retVal);)
     return 0;
   }
   return retVal;
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/codeCache.hpp"
--- a/hotspot/src/share/vm/memory/genOopClosures.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/genOopClosures.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -193,7 +193,7 @@
  protected:
   template <class T> inline void do_oop_work(T* p) {
     oop obj = oopDesc::load_decode_heap_oop(p);
-    guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, (oopDesc*) obj));
+    guarantee(obj->is_oop_or_null(), err_msg("invalid oop: " INTPTR_FORMAT, p2i((oopDesc*) obj)));
   }
  public:
   virtual void do_oop(oop* p);
--- a/hotspot/src/share/vm/memory/generation.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/generation.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/events.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 Generation::Generation(ReservedSpace rs, size_t initial_size, int level) :
   _level(level),
   _ref_processor(NULL) {
--- a/hotspot/src/share/vm/memory/generation.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/generation.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -422,7 +422,7 @@
     // have to guard against non-monotonicity.
     NOT_PRODUCT(
       if (now < _time_of_last_gc) {
-        warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now);
+        warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, (int64_t)_time_of_last_gc, (int64_t)now);
       }
     )
     return _time_of_last_gc;
--- a/hotspot/src/share/vm/memory/heapInspection.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // HeapInspection
 
 int KlassInfoEntry::compare(KlassInfoEntry* e1, KlassInfoEntry* e2) {
@@ -270,6 +272,7 @@
   return true;
 }
 
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void KlassInfoHisto::print_title(outputStream* st, bool csv_format,
                                  bool selected[], int width_table[],
                                  const char *name_table[]) {
@@ -282,7 +285,10 @@
   } else {
     st->print("Index Super");
     for (int c=0; c<KlassSizeStats::_num_columns; c++) {
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
       if (selected[c]) {st->print(str_fmt(width_table[c]), name_table[c]);}
+PRAGMA_DIAG_POP
     }
     st->print(" ClassName");
   }
@@ -395,12 +401,18 @@
           case KlassSizeStats::_index_inst_size:
           case KlassSizeStats::_index_inst_count:
           case KlassSizeStats::_index_method_count:
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
             st->print(str_fmt(width_table[c]), "-");
+PRAGMA_DIAG_POP
             break;
           default:
             {
               double perc = (double)(100) * (double)(colsum_table[c]) / (double)sz_sum._total_bytes;
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
               st->print(perc_fmt(width_table[c]), perc);
+PRAGMA_DIAG_POP
             }
           }
         }
--- a/hotspot/src/share/vm/memory/heapInspection.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/heapInspection.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -295,6 +295,9 @@
   // returns a format string to print a julong with the given width. E.g,
   // printf(num_fmt(6), julong(10)) would print out the number 10 with 4
   // leading spaces.
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+
   static void print_julong(outputStream* st, int width, julong n) {
     int num_spaces = width - julong_width(n);
     if (num_spaces > 0) {
@@ -302,6 +305,7 @@
     }
     st->print(JULONG_FORMAT, n);
   }
+PRAGMA_DIAG_POP
 
   static char* perc_fmt(int width) {
     static char buf[32];
--- a/hotspot/src/share/vm/memory/metachunk.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/metachunk.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 class VirtualSpaceNode;
 
 const size_t metadata_chunk_initialize = 0xf7f7f7f7;
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > BlockTreeDictionary;
 typedef BinaryTreeDictionary<Metachunk, FreeList<Metachunk> > ChunkTreeDictionary;
 
@@ -314,6 +316,8 @@
   MetaWord* bottom() const { return (MetaWord*) _virtual_space.low(); }
   MetaWord* end() const { return (MetaWord*) _virtual_space.high(); }
 
+  bool contains(const void* ptr) { return ptr >= low() && ptr < high(); }
+
   size_t reserved_words() const  { return _virtual_space.reserved_size() / BytesPerWord; }
   size_t committed_words() const { return _virtual_space.actual_committed_size() / BytesPerWord; }
 
@@ -555,6 +559,8 @@
   void inc_virtual_space_count();
   void dec_virtual_space_count();
 
+  bool contains(const void* ptr);
+
   // Unlink empty VirtualSpaceNodes and free it.
   void purge(ChunkManager* chunk_manager);
 
@@ -639,8 +645,6 @@
   // Accessors
   Metachunk* chunks_in_use(ChunkIndex index) const { return _chunks_in_use[index]; }
   void set_chunks_in_use(ChunkIndex index, Metachunk* v) {
-    // ensure lock-free iteration sees fully initialized node
-    OrderAccess::storestore();
     _chunks_in_use[index] = v;
   }
 
@@ -755,8 +759,6 @@
   void print_on(outputStream* st) const;
   void locked_print_chunks_in_use_on(outputStream* st) const;
 
-  bool contains(const void *ptr);
-
   void verify();
   void verify_chunk_size(Metachunk* chunk);
   NOT_PRODUCT(void mangle_freed_chunks();)
@@ -1076,6 +1078,7 @@
 // nodes with a 0 container_count.  Remove Metachunks in
 // the node from their respective freelists.
 void VirtualSpaceList::purge(ChunkManager* chunk_manager) {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be called at safepoint for contains to work");
   assert_lock_strong(SpaceManager::expand_lock());
   // Don't use a VirtualSpaceListIterator because this
   // list is being changed and a straightforward use of an iterator is not safe.
@@ -1109,8 +1112,8 @@
   }
 #ifdef ASSERT
   if (purged_vsl != NULL) {
-  // List should be stable enough to use an iterator here.
-  VirtualSpaceListIterator iter(virtual_space_list());
+    // List should be stable enough to use an iterator here.
+    VirtualSpaceListIterator iter(virtual_space_list());
     while (iter.repeat()) {
       VirtualSpaceNode* vsl = iter.get_next();
       assert(vsl != purged_vsl, "Purge of vsl failed");
@@ -1119,6 +1122,23 @@
 #endif
 }
 
+
+// This function looks at the mmap regions in the metaspace without locking.
+// The chunks are added with store ordering and not deleted except for at
+// unloading time during a safepoint.
+bool VirtualSpaceList::contains(const void* ptr) {
+  // List should be stable enough to use an iterator here because removing virtual
+  // space nodes is only allowed at a safepoint.
+  VirtualSpaceListIterator iter(virtual_space_list());
+  while (iter.repeat()) {
+    VirtualSpaceNode* vsn = iter.get_next();
+    if (vsn->contains(ptr)) {
+      return true;
+    }
+  }
+  return false;
+}
+
 void VirtualSpaceList::retire_current_virtual_space() {
   assert_lock_strong(SpaceManager::expand_lock());
 
@@ -1208,6 +1228,8 @@
   } else {
     assert(new_entry->reserved_words() == vs_word_size,
         "Reserved memory size differs from requested memory size");
+    // ensure lock-free iteration sees fully initialized node
+    OrderAccess::storestore();
     link_vs(new_entry);
     return true;
   }
@@ -1961,7 +1983,7 @@
       st->print_cr(" free " SIZE_FORMAT,
                    chunk->free_word_size());
     } else {
-      st->print_cr("");
+      st->cr();
     }
   }
 
@@ -2245,7 +2267,7 @@
     humongous_chunks = next_humongous_chunks;
   }
   if (TraceMetadataChunkAllocation && Verbose) {
-    gclog_or_tty->print_cr("");
+    gclog_or_tty->cr();
     gclog_or_tty->print_cr("updated dictionary count %d %s",
                      chunk_manager()->humongous_dictionary()->total_count(),
                      chunk_size_name(HumongousIndex));
@@ -2432,21 +2454,6 @@
   return result;
 }
 
-// This function looks at the chunks in the metaspace without locking.
-// The chunks are added with store ordering and not deleted except for at
-// unloading time.
-bool SpaceManager::contains(const void *ptr) {
-  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i))
-  {
-    Metachunk* curr = chunks_in_use(i);
-    while (curr != NULL) {
-      if (curr->contains(ptr)) return true;
-      curr = curr->next();
-    }
-  }
-  return false;
-}
-
 void SpaceManager::verify() {
   // If there are blocks in the dictionary, then
   // verification of chunks does not work since
@@ -3536,11 +3543,15 @@
 }
 
 bool Metaspace::contains(const void* ptr) {
-  if (vsm()->contains(ptr)) return true;
-  if (using_class_space()) {
-    return class_vsm()->contains(ptr);
+  if (UseSharedSpaces && MetaspaceShared::is_in_shared_space(ptr)) {
+    return true;
   }
-  return false;
+
+  if (using_class_space() && get_space_list(ClassType)->contains(ptr)) {
+     return true;
+  }
+
+  return get_space_list(NonClassType)->contains(ptr);
 }
 
 void Metaspace::verify() {
@@ -3785,5 +3796,4 @@
   TestVirtualSpaceNodeTest::test();
   TestVirtualSpaceNodeTest::test_is_available();
 }
-
 #endif
--- a/hotspot/src/share/vm/memory/metaspace.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/metaspace.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -232,7 +232,8 @@
   MetaWord* expand_and_allocate(size_t size,
                                 MetadataType mdtype);
 
-  bool contains(const void* ptr);
+  static bool contains(const void* ptr);
+
   void dump(outputStream* const out) const;
 
   // Free empty virtualspaces
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
 #include "runtime/vmThread.hpp"
 #include "utilities/hashtable.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 int MetaspaceShared::_max_alignment = 0;
 
@@ -337,13 +338,14 @@
   int all_rw_count = 0;
   int all_rw_bytes = 0;
 
-  const char *fmt = "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f";
+// To make fmt_stats be a syntactic constant (for format warnings), use #define.
+#define fmt_stats "%-20s: %8d %10d %5.1f | %8d %10d %5.1f | %8d %10d %5.1f"
   const char *sep = "--------------------+---------------------------+---------------------------+--------------------------";
   const char *hdr = "                        ro_cnt   ro_bytes     % |   rw_cnt   rw_bytes     % |  all_cnt  all_bytes     %";
 
   tty->print_cr("Detailed metadata info (rw includes md and mc):");
-  tty->print_cr(hdr);
-  tty->print_cr(sep);
+  tty->print_cr("%s", hdr);
+  tty->print_cr("%s", sep);
   for (int type = 0; type < int(_number_of_types); type ++) {
     const char *name = type_name((Type)type);
     int ro_count = _counts[RO][type];
@@ -357,7 +359,7 @@
     double rw_perc = 100.0 * double(rw_bytes) / double(rw_all);
     double perc    = 100.0 * double(bytes)    / double(ro_all + rw_all);
 
-    tty->print_cr(fmt, name,
+    tty->print_cr(fmt_stats, name,
                   ro_count, ro_bytes, ro_perc,
                   rw_count, rw_bytes, rw_perc,
                   count, bytes, perc);
@@ -375,14 +377,15 @@
   double all_rw_perc = 100.0 * double(all_rw_bytes) / double(rw_all);
   double all_perc    = 100.0 * double(all_bytes)    / double(ro_all + rw_all);
 
-  tty->print_cr(sep);
-  tty->print_cr(fmt, "Total",
+  tty->print_cr("%s", sep);
+  tty->print_cr(fmt_stats, "Total",
                 all_ro_count, all_ro_bytes, all_ro_perc,
                 all_rw_count, all_rw_bytes, all_rw_perc,
                 all_count, all_bytes, all_perc);
 
   assert(all_ro_bytes == ro_all, "everything should have been counted");
   assert(all_rw_bytes == rw_all, "everything should have been counted");
+#undef fmt_stats
 }
 
 // Populate the shared space.
@@ -514,7 +517,8 @@
   md_top = wc.get_top();
 
   // Print shared spaces all the time
-  const char* fmt = "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT;
+// To make fmt_space be a syntactic constant (for format warnings), use #define.
+#define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " INTPTR_FORMAT
   Metaspace* ro_space = _loader_data->ro_metaspace();
   Metaspace* rw_space = _loader_data->rw_metaspace();
 
@@ -545,10 +549,10 @@
   const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0;
   const double total_u_perc = total_bytes / double(total_alloced) * 100.0;
 
-  tty->print_cr(fmt, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
-  tty->print_cr(fmt, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
-  tty->print_cr(fmt, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
-  tty->print_cr(fmt, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
+  tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
+  tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
+  tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
+  tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
   tty->print_cr("total   : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]",
                  total_bytes, total_alloced, total_u_perc);
 
@@ -603,6 +607,7 @@
 
     dac.dump_stats(int(ro_bytes), int(rw_bytes), int(md_bytes), int(mc_bytes));
   }
+#undef fmt_space
 }
 
 static void link_shared_classes(Klass* obj, TRAPS) {
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 #include "runtime/java.hpp"
 #include "runtime/jniHandles.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ReferencePolicy* ReferenceProcessor::_always_clear_soft_ref_policy = NULL;
 ReferencePolicy* ReferenceProcessor::_default_soft_ref_policy      = NULL;
 bool             ReferenceProcessor::_pending_list_uses_discovered_field = false;
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
@@ -35,6 +35,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/workgroup.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 SharedHeap* SharedHeap::_sh;
 
 // The set of potentially parallel tasks in strong root scanning.
--- a/hotspot/src/share/vm/memory/space.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/space.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,12 +37,15 @@
 #include "oops/oop.inline.hpp"
 #include "oops/oop.inline2.hpp"
 #include "runtime/java.hpp"
+#include "runtime/prefetch.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/safepoint.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top,
                                                 HeapWord* top_obj) {
   if (top_obj != NULL) {
--- a/hotspot/src/share/vm/memory/space.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/space.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -33,24 +33,8 @@
 #include "memory/watermark.hpp"
 #include "oops/markOop.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/prefetch.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/workgroup.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "os_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "os_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "os_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_aix
-# include "os_aix.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "os_bsd.inline.hpp"
-#endif
 
 // A space is an abstraction for the "storage units" backing
 // up the generation abstraction. It includes specific
@@ -468,272 +452,6 @@
                         size_t word_len);
 };
 
-#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) {            \
-  /* Compute the new addresses for the live objects and store it in the mark \
-   * Used by universe::mark_sweep_phase2()                                   \
-   */                                                                        \
-  HeapWord* compact_top; /* This is where we are currently compacting to. */ \
-                                                                             \
-  /* We're sure to be here before any objects are compacted into this        \
-   * space, so this is a good time to initialize this:                       \
-   */                                                                        \
-  set_compaction_top(bottom());                                              \
-                                                                             \
-  if (cp->space == NULL) {                                                   \
-    assert(cp->gen != NULL, "need a generation");                            \
-    assert(cp->threshold == NULL, "just checking");                          \
-    assert(cp->gen->first_compaction_space() == this, "just checking");      \
-    cp->space = cp->gen->first_compaction_space();                           \
-    compact_top = cp->space->bottom();                                       \
-    cp->space->set_compaction_top(compact_top);                              \
-    cp->threshold = cp->space->initialize_threshold();                       \
-  } else {                                                                   \
-    compact_top = cp->space->compaction_top();                               \
-  }                                                                          \
-                                                                             \
-  /* We allow some amount of garbage towards the bottom of the space, so     \
-   * we don't start compacting before there is a significant gain to be made.\
-   * Occasionally, we want to ensure a full compaction, which is determined  \
-   * by the MarkSweepAlwaysCompactCount parameter.                           \
-   */                                                                        \
-  uint invocations = MarkSweep::total_invocations();                         \
-  bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);       \
-                                                                             \
-  size_t allowed_deadspace = 0;                                              \
-  if (skip_dead) {                                                           \
-    const size_t ratio = allowed_dead_ratio();                               \
-    allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize;           \
-  }                                                                          \
-                                                                             \
-  HeapWord* q = bottom();                                                    \
-  HeapWord* t = scan_limit();                                                \
-                                                                             \
-  HeapWord*  end_of_live= q;    /* One byte beyond the last byte of the last \
-                                   live object. */                           \
-  HeapWord*  first_dead = end();/* The first dead object. */                 \
-  LiveRange* liveRange  = NULL; /* The current live range, recorded in the   \
-                                   first header of preceding free area. */   \
-  _first_dead = first_dead;                                                  \
-                                                                             \
-  const intx interval = PrefetchScanIntervalInBytes;                         \
-                                                                             \
-  while (q < t) {                                                            \
-    assert(!block_is_obj(q) ||                                               \
-           oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||   \
-           oop(q)->mark()->has_bias_pattern(),                               \
-           "these are the only valid states during a mark sweep");           \
-    if (block_is_obj(q) && oop(q)->is_gc_marked()) {                         \
-      /* prefetch beyond q */                                                \
-      Prefetch::write(q, interval);                                          \
-      size_t size = block_size(q);                                           \
-      compact_top = cp->space->forward(oop(q), size, cp, compact_top);       \
-      q += size;                                                             \
-      end_of_live = q;                                                       \
-    } else {                                                                 \
-      /* run over all the contiguous dead objects */                         \
-      HeapWord* end = q;                                                     \
-      do {                                                                   \
-        /* prefetch beyond end */                                            \
-        Prefetch::write(end, interval);                                      \
-        end += block_size(end);                                              \
-      } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\
-                                                                             \
-      /* see if we might want to pretend this object is alive so that        \
-       * we don't have to compact quite as often.                            \
-       */                                                                    \
-      if (allowed_deadspace > 0 && q == compact_top) {                       \
-        size_t sz = pointer_delta(end, q);                                   \
-        if (insert_deadspace(allowed_deadspace, q, sz)) {                    \
-          compact_top = cp->space->forward(oop(q), sz, cp, compact_top);     \
-          q = end;                                                           \
-          end_of_live = end;                                                 \
-          continue;                                                          \
-        }                                                                    \
-      }                                                                      \
-                                                                             \
-      /* otherwise, it really is a free region. */                           \
-                                                                             \
-      /* for the previous LiveRange, record the end of the live objects. */  \
-      if (liveRange) {                                                       \
-        liveRange->set_end(q);                                               \
-      }                                                                      \
-                                                                             \
-      /* record the current LiveRange object.                                \
-       * liveRange->start() is overlaid on the mark word.                    \
-       */                                                                    \
-      liveRange = (LiveRange*)q;                                             \
-      liveRange->set_start(end);                                             \
-      liveRange->set_end(end);                                               \
-                                                                             \
-      /* see if this is the first dead region. */                            \
-      if (q < first_dead) {                                                  \
-        first_dead = q;                                                      \
-      }                                                                      \
-                                                                             \
-      /* move on to the next object */                                       \
-      q = end;                                                               \
-    }                                                                        \
-  }                                                                          \
-                                                                             \
-  assert(q == t, "just checking");                                           \
-  if (liveRange != NULL) {                                                   \
-    liveRange->set_end(q);                                                   \
-  }                                                                          \
-  _end_of_live = end_of_live;                                                \
-  if (end_of_live < first_dead) {                                            \
-    first_dead = end_of_live;                                                \
-  }                                                                          \
-  _first_dead = first_dead;                                                  \
-                                                                             \
-  /* save the compaction_top of the compaction space. */                     \
-  cp->space->set_compaction_top(compact_top);                                \
-}
-
-#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) {                             \
-  /* adjust all the interior pointers to point at the new locations of objects  \
-   * Used by MarkSweep::mark_sweep_phase3() */                                  \
-                                                                                \
-  HeapWord* q = bottom();                                                       \
-  HeapWord* t = _end_of_live;  /* Established by "prepare_for_compaction". */   \
-                                                                                \
-  assert(_first_dead <= _end_of_live, "Stands to reason, no?");                 \
-                                                                                \
-  if (q < t && _first_dead > q &&                                               \
-      !oop(q)->is_gc_marked()) {                                                \
-    /* we have a chunk of the space which hasn't moved and we've                \
-     * reinitialized the mark word during the previous pass, so we can't        \
-     * use is_gc_marked for the traversal. */                                   \
-    HeapWord* end = _first_dead;                                                \
-                                                                                \
-    while (q < end) {                                                           \
-      /* I originally tried to conjoin "block_start(q) == q" to the             \
-       * assertion below, but that doesn't work, because you can't              \
-       * accurately traverse previous objects to get to the current one         \
-       * after their pointers have been                                         \
-       * updated, until the actual compaction is done.  dld, 4/00 */            \
-      assert(block_is_obj(q),                                                   \
-             "should be at block boundaries, and should be looking at objs");   \
-                                                                                \
-      /* point all the oops to the new location */                              \
-      size_t size = oop(q)->adjust_pointers();                                  \
-      size = adjust_obj_size(size);                                             \
-                                                                                \
-      q += size;                                                                \
-    }                                                                           \
-                                                                                \
-    if (_first_dead == t) {                                                     \
-      q = t;                                                                    \
-    } else {                                                                    \
-      /* $$$ This is funky.  Using this to read the previously written          \
-       * LiveRange.  See also use below. */                                     \
-      q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer();                \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  const intx interval = PrefetchScanIntervalInBytes;                            \
-                                                                                \
-  debug_only(HeapWord* prev_q = NULL);                                          \
-  while (q < t) {                                                               \
-    /* prefetch beyond q */                                                     \
-    Prefetch::write(q, interval);                                               \
-    if (oop(q)->is_gc_marked()) {                                               \
-      /* q is alive */                                                          \
-      /* point all the oops to the new location */                              \
-      size_t size = oop(q)->adjust_pointers();                                  \
-      size = adjust_obj_size(size);                                             \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    } else {                                                                    \
-      /* q is not a live object, so its mark should point at the next           \
-       * live object */                                                         \
-      debug_only(prev_q = q);                                                   \
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
-      assert(q > prev_q, "we should be moving forward through memory");         \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  assert(q == t, "just checking");                                              \
-}
-
-#define SCAN_AND_COMPACT(obj_size) {                                            \
-  /* Copy all live objects to their new location                                \
-   * Used by MarkSweep::mark_sweep_phase4() */                                  \
-                                                                                \
-  HeapWord*       q = bottom();                                                 \
-  HeapWord* const t = _end_of_live;                                             \
-  debug_only(HeapWord* prev_q = NULL);                                          \
-                                                                                \
-  if (q < t && _first_dead > q &&                                               \
-      !oop(q)->is_gc_marked()) {                                                \
-    debug_only(                                                                 \
-    /* we have a chunk of the space which hasn't moved and we've reinitialized  \
-     * the mark word during the previous pass, so we can't use is_gc_marked for \
-     * the traversal. */                                                        \
-    HeapWord* const end = _first_dead;                                          \
-                                                                                \
-    while (q < end) {                                                           \
-      size_t size = obj_size(q);                                                \
-      assert(!oop(q)->is_gc_marked(),                                           \
-             "should be unmarked (special dense prefix handling)");             \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    }                                                                           \
-    )  /* debug_only */                                                         \
-                                                                                \
-    if (_first_dead == t) {                                                     \
-      q = t;                                                                    \
-    } else {                                                                    \
-      /* $$$ Funky */                                                           \
-      q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer();               \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  const intx scan_interval = PrefetchScanIntervalInBytes;                       \
-  const intx copy_interval = PrefetchCopyIntervalInBytes;                       \
-  while (q < t) {                                                               \
-    if (!oop(q)->is_gc_marked()) {                                              \
-      /* mark is pointer to next marked oop */                                  \
-      debug_only(prev_q = q);                                                   \
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
-      assert(q > prev_q, "we should be moving forward through memory");         \
-    } else {                                                                    \
-      /* prefetch beyond q */                                                   \
-      Prefetch::read(q, scan_interval);                                         \
-                                                                                \
-      /* size and destination */                                                \
-      size_t size = obj_size(q);                                                \
-      HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();                \
-                                                                                \
-      /* prefetch beyond compaction_top */                                      \
-      Prefetch::write(compaction_top, copy_interval);                           \
-                                                                                \
-      /* copy object and reinit its mark */                                     \
-      assert(q != compaction_top, "everything in this pass should be moving");  \
-      Copy::aligned_conjoint_words(q, compaction_top, size);                    \
-      oop(compaction_top)->init_mark();                                         \
-      assert(oop(compaction_top)->klass() != NULL, "should have a class");      \
-                                                                                \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  /* Let's remember if we were empty before we did the compaction. */           \
-  bool was_empty = used_region().is_empty();                                    \
-  /* Reset space after compaction is complete */                                \
-  reset_after_compaction();                                                     \
-  /* We do this clear, below, since it has overloaded meanings for some */      \
-  /* space subtypes.  For example, OffsetTableContigSpace's that were   */      \
-  /* compacted into will have had their offset table thresholds updated */      \
-  /* continuously, but those that weren't need to have their thresholds */      \
-  /* re-initialized.  Also mangles unused area for debugging.           */      \
-  if (used_region().is_empty()) {                                               \
-    if (!was_empty) clear(SpaceDecorator::Mangle);                              \
-  } else {                                                                      \
-    if (ZapUnusedHeapArea) mangle_unused_area();                                \
-  }                                                                             \
-}
-
 class GenSpaceMangler;
 
 // A space in which the free area is contiguous.  It therefore supports
--- a/hotspot/src/share/vm/memory/space.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/space.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -28,12 +28,279 @@
 #include "gc_interface/collectedHeap.hpp"
 #include "memory/space.hpp"
 #include "memory/universe.hpp"
+#include "runtime/prefetch.inline.hpp"
 #include "runtime/safepoint.hpp"
 
 inline HeapWord* Space::block_start(const void* p) {
   return block_start_const(p);
 }
 
+#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) {            \
+  /* Compute the new addresses for the live objects and store it in the mark \
+   * Used by universe::mark_sweep_phase2()                                   \
+   */                                                                        \
+  HeapWord* compact_top; /* This is where we are currently compacting to. */ \
+                                                                             \
+  /* We're sure to be here before any objects are compacted into this        \
+   * space, so this is a good time to initialize this:                       \
+   */                                                                        \
+  set_compaction_top(bottom());                                              \
+                                                                             \
+  if (cp->space == NULL) {                                                   \
+    assert(cp->gen != NULL, "need a generation");                            \
+    assert(cp->threshold == NULL, "just checking");                          \
+    assert(cp->gen->first_compaction_space() == this, "just checking");      \
+    cp->space = cp->gen->first_compaction_space();                           \
+    compact_top = cp->space->bottom();                                       \
+    cp->space->set_compaction_top(compact_top);                              \
+    cp->threshold = cp->space->initialize_threshold();                       \
+  } else {                                                                   \
+    compact_top = cp->space->compaction_top();                               \
+  }                                                                          \
+                                                                             \
+  /* We allow some amount of garbage towards the bottom of the space, so     \
+   * we don't start compacting before there is a significant gain to be made.\
+   * Occasionally, we want to ensure a full compaction, which is determined  \
+   * by the MarkSweepAlwaysCompactCount parameter.                           \
+   */                                                                        \
+  uint invocations = MarkSweep::total_invocations();                         \
+  bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);       \
+                                                                             \
+  size_t allowed_deadspace = 0;                                              \
+  if (skip_dead) {                                                           \
+    const size_t ratio = allowed_dead_ratio();                               \
+    allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize;           \
+  }                                                                          \
+                                                                             \
+  HeapWord* q = bottom();                                                    \
+  HeapWord* t = scan_limit();                                                \
+                                                                             \
+  HeapWord*  end_of_live= q;    /* One byte beyond the last byte of the last \
+                                   live object. */                           \
+  HeapWord*  first_dead = end();/* The first dead object. */                 \
+  LiveRange* liveRange  = NULL; /* The current live range, recorded in the   \
+                                   first header of preceding free area. */   \
+  _first_dead = first_dead;                                                  \
+                                                                             \
+  const intx interval = PrefetchScanIntervalInBytes;                         \
+                                                                             \
+  while (q < t) {                                                            \
+    assert(!block_is_obj(q) ||                                               \
+           oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||   \
+           oop(q)->mark()->has_bias_pattern(),                               \
+           "these are the only valid states during a mark sweep");           \
+    if (block_is_obj(q) && oop(q)->is_gc_marked()) {                         \
+      /* prefetch beyond q */                                                \
+      Prefetch::write(q, interval);                                          \
+      size_t size = block_size(q);                                           \
+      compact_top = cp->space->forward(oop(q), size, cp, compact_top);       \
+      q += size;                                                             \
+      end_of_live = q;                                                       \
+    } else {                                                                 \
+      /* run over all the contiguous dead objects */                         \
+      HeapWord* end = q;                                                     \
+      do {                                                                   \
+        /* prefetch beyond end */                                            \
+        Prefetch::write(end, interval);                                      \
+        end += block_size(end);                                              \
+      } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\
+                                                                             \
+      /* see if we might want to pretend this object is alive so that        \
+       * we don't have to compact quite as often.                            \
+       */                                                                    \
+      if (allowed_deadspace > 0 && q == compact_top) {                       \
+        size_t sz = pointer_delta(end, q);                                   \
+        if (insert_deadspace(allowed_deadspace, q, sz)) {                    \
+          compact_top = cp->space->forward(oop(q), sz, cp, compact_top);     \
+          q = end;                                                           \
+          end_of_live = end;                                                 \
+          continue;                                                          \
+        }                                                                    \
+      }                                                                      \
+                                                                             \
+      /* otherwise, it really is a free region. */                           \
+                                                                             \
+      /* for the previous LiveRange, record the end of the live objects. */  \
+      if (liveRange) {                                                       \
+        liveRange->set_end(q);                                               \
+      }                                                                      \
+                                                                             \
+      /* record the current LiveRange object.                                \
+       * liveRange->start() is overlaid on the mark word.                    \
+       */                                                                    \
+      liveRange = (LiveRange*)q;                                             \
+      liveRange->set_start(end);                                             \
+      liveRange->set_end(end);                                               \
+                                                                             \
+      /* see if this is the first dead region. */                            \
+      if (q < first_dead) {                                                  \
+        first_dead = q;                                                      \
+      }                                                                      \
+                                                                             \
+      /* move on to the next object */                                       \
+      q = end;                                                               \
+    }                                                                        \
+  }                                                                          \
+                                                                             \
+  assert(q == t, "just checking");                                           \
+  if (liveRange != NULL) {                                                   \
+    liveRange->set_end(q);                                                   \
+  }                                                                          \
+  _end_of_live = end_of_live;                                                \
+  if (end_of_live < first_dead) {                                            \
+    first_dead = end_of_live;                                                \
+  }                                                                          \
+  _first_dead = first_dead;                                                  \
+                                                                             \
+  /* save the compaction_top of the compaction space. */                     \
+  cp->space->set_compaction_top(compact_top);                                \
+}
+
+#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) {                             \
+  /* adjust all the interior pointers to point at the new locations of objects  \
+   * Used by MarkSweep::mark_sweep_phase3() */                                  \
+                                                                                \
+  HeapWord* q = bottom();                                                       \
+  HeapWord* t = _end_of_live;  /* Established by "prepare_for_compaction". */   \
+                                                                                \
+  assert(_first_dead <= _end_of_live, "Stands to reason, no?");                 \
+                                                                                \
+  if (q < t && _first_dead > q &&                                               \
+      !oop(q)->is_gc_marked()) {                                                \
+    /* we have a chunk of the space which hasn't moved and we've                \
+     * reinitialized the mark word during the previous pass, so we can't        \
+     * use is_gc_marked for the traversal. */                                   \
+    HeapWord* end = _first_dead;                                                \
+                                                                                \
+    while (q < end) {                                                           \
+      /* I originally tried to conjoin "block_start(q) == q" to the             \
+       * assertion below, but that doesn't work, because you can't              \
+       * accurately traverse previous objects to get to the current one         \
+       * after their pointers have been                                         \
+       * updated, until the actual compaction is done.  dld, 4/00 */            \
+      assert(block_is_obj(q),                                                   \
+             "should be at block boundaries, and should be looking at objs");   \
+                                                                                \
+      /* point all the oops to the new location */                              \
+      size_t size = oop(q)->adjust_pointers();                                  \
+      size = adjust_obj_size(size);                                             \
+                                                                                \
+      q += size;                                                                \
+    }                                                                           \
+                                                                                \
+    if (_first_dead == t) {                                                     \
+      q = t;                                                                    \
+    } else {                                                                    \
+      /* $$$ This is funky.  Using this to read the previously written          \
+       * LiveRange.  See also use below. */                                     \
+      q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer();                \
+    }                                                                           \
+  }                                                                             \
+                                                                                \
+  const intx interval = PrefetchScanIntervalInBytes;                            \
+                                                                                \
+  debug_only(HeapWord* prev_q = NULL);                                          \
+  while (q < t) {                                                               \
+    /* prefetch beyond q */                                                     \
+    Prefetch::write(q, interval);                                               \
+    if (oop(q)->is_gc_marked()) {                                               \
+      /* q is alive */                                                          \
+      /* point all the oops to the new location */                              \
+      size_t size = oop(q)->adjust_pointers();                                  \
+      size = adjust_obj_size(size);                                             \
+      debug_only(prev_q = q);                                                   \
+      q += size;                                                                \
+    } else {                                                                    \
+      /* q is not a live object, so its mark should point at the next           \
+       * live object */                                                         \
+      debug_only(prev_q = q);                                                   \
+      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
+      assert(q > prev_q, "we should be moving forward through memory");         \
+    }                                                                           \
+  }                                                                             \
+                                                                                \
+  assert(q == t, "just checking");                                              \
+}
+
+#define SCAN_AND_COMPACT(obj_size) {                                            \
+  /* Copy all live objects to their new location                                \
+   * Used by MarkSweep::mark_sweep_phase4() */                                  \
+                                                                                \
+  HeapWord*       q = bottom();                                                 \
+  HeapWord* const t = _end_of_live;                                             \
+  debug_only(HeapWord* prev_q = NULL);                                          \
+                                                                                \
+  if (q < t && _first_dead > q &&                                               \
+      !oop(q)->is_gc_marked()) {                                                \
+    debug_only(                                                                 \
+    /* we have a chunk of the space which hasn't moved and we've reinitialized  \
+     * the mark word during the previous pass, so we can't use is_gc_marked for \
+     * the traversal. */                                                        \
+    HeapWord* const end = _first_dead;                                          \
+                                                                                \
+    while (q < end) {                                                           \
+      size_t size = obj_size(q);                                                \
+      assert(!oop(q)->is_gc_marked(),                                           \
+             "should be unmarked (special dense prefix handling)");             \
+      debug_only(prev_q = q);                                                   \
+      q += size;                                                                \
+    }                                                                           \
+    )  /* debug_only */                                                         \
+                                                                                \
+    if (_first_dead == t) {                                                     \
+      q = t;                                                                    \
+    } else {                                                                    \
+      /* $$$ Funky */                                                           \
+      q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer();               \
+    }                                                                           \
+  }                                                                             \
+                                                                                \
+  const intx scan_interval = PrefetchScanIntervalInBytes;                       \
+  const intx copy_interval = PrefetchCopyIntervalInBytes;                       \
+  while (q < t) {                                                               \
+    if (!oop(q)->is_gc_marked()) {                                              \
+      /* mark is pointer to next marked oop */                                  \
+      debug_only(prev_q = q);                                                   \
+      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
+      assert(q > prev_q, "we should be moving forward through memory");         \
+    } else {                                                                    \
+      /* prefetch beyond q */                                                   \
+      Prefetch::read(q, scan_interval);                                         \
+                                                                                \
+      /* size and destination */                                                \
+      size_t size = obj_size(q);                                                \
+      HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();                \
+                                                                                \
+      /* prefetch beyond compaction_top */                                      \
+      Prefetch::write(compaction_top, copy_interval);                           \
+                                                                                \
+      /* copy object and reinit its mark */                                     \
+      assert(q != compaction_top, "everything in this pass should be moving");  \
+      Copy::aligned_conjoint_words(q, compaction_top, size);                    \
+      oop(compaction_top)->init_mark();                                         \
+      assert(oop(compaction_top)->klass() != NULL, "should have a class");      \
+                                                                                \
+      debug_only(prev_q = q);                                                   \
+      q += size;                                                                \
+    }                                                                           \
+  }                                                                             \
+                                                                                \
+  /* Let's remember if we were empty before we did the compaction. */           \
+  bool was_empty = used_region().is_empty();                                    \
+  /* Reset space after compaction is complete */                                \
+  reset_after_compaction();                                                     \
+  /* We do this clear, below, since it has overloaded meanings for some */      \
+  /* space subtypes.  For example, OffsetTableContigSpace's that were   */      \
+  /* compacted into will have had their offset table thresholds updated */      \
+  /* continuously, but those that weren't need to have their thresholds */      \
+  /* re-initialized.  Also mangles unused area for debugging.           */      \
+  if (used_region().is_empty()) {                                               \
+    if (!was_empty) clear(SpaceDecorator::Mangle);                              \
+  } else {                                                                      \
+    if (ZapUnusedHeapArea) mangle_unused_area();                                \
+  }                                                                             \
+}
+
 inline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
   HeapWord* res = ContiguousSpace::allocate(size);
   if (res != NULL) {
--- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Thread-Local Edens support
 
 // static member initialization
--- a/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/threadLocalAllocBuffer.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,7 @@
                         " obj: "SIZE_FORMAT
                         " free: "SIZE_FORMAT
                         " waste: "SIZE_FORMAT"\n",
-                        "slow", thrd, thrd->osthread()->thread_id(),
+                        "slow", p2i(thrd), thrd->osthread()->thread_id(),
                         obj_size, free(), refill_waste_limit());
   }
 }
--- a/hotspot/src/share/vm/memory/universe.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/memory/universe.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "classfile/classLoader.hpp"
 #include "classfile/classLoaderData.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/codeCache.hpp"
@@ -78,6 +78,8 @@
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Known objects
 Klass* Universe::_boolArrayKlassObj                 = NULL;
 Klass* Universe::_byteArrayKlassObj                 = NULL;
@@ -1348,7 +1350,7 @@
   HandleMark hm;  // Handles created during verification can be zapped
   _verify_count++;
 
-  if (!silent) gclog_or_tty->print(prefix);
+  if (!silent) gclog_or_tty->print("%s", prefix);
   if (!silent) gclog_or_tty->print("[Verifying ");
   if (!silent) gclog_or_tty->print("threads ");
   Threads::verify();
--- a/hotspot/src/share/vm/oops/annotations.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/annotations.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
 
 
 void Annotations::print_value_on(outputStream* st) const {
-  st->print("Anotations(" INTPTR_FORMAT ")", this);
+  st->print("Anotations(" INTPTR_FORMAT ")", p2i(this));
 }
 
 #if INCLUDE_SERVICES
--- a/hotspot/src/share/vm/oops/constMethod.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/constMethod.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -388,8 +388,8 @@
 void ConstMethod::print_on(outputStream* st) const {
   ResourceMark rm;
   assert(is_constMethod(), "must be constMethod");
-  st->print_cr(internal_name());
-  st->print(" - method:       " INTPTR_FORMAT " ", (address)method());
+  st->print_cr("%s", internal_name());
+  st->print(" - method:       " INTPTR_FORMAT " ", p2i((address)method()));
   method()->print_value_on(st); st->cr();
   if (has_stackmap_table()) {
     st->print(" - stackmap data:       ");
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,7 @@
 #include "classfile/classLoaderData.hpp"
 #include "classfile/javaClasses.hpp"
 #include "classfile/metadataOnStackMark.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "interpreter/linkResolver.hpp"
@@ -42,6 +42,8 @@
 #include "runtime/signature.hpp"
 #include "runtime/vframe.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
   // Tags are RW but comment below applies to tags also.
   Array<u1>* tags = MetadataFactory::new_writeable_array<u1>(loader_data, length, 0, CHECK_NULL);
@@ -1892,7 +1894,7 @@
 
 void ConstantPool::print_on(outputStream* st) const {
   assert(is_constantPool(), "must be constantPool");
-  st->print_cr(internal_name());
+  st->print_cr("%s", internal_name());
   if (flags() != 0) {
     st->print(" - flags: 0x%x", flags());
     if (has_preresolution()) st->print(" has_preresolution");
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -39,8 +39,9 @@
 # include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
-// Implememtation of ConstantPoolCacheEntry
+// Implementation of ConstantPoolCacheEntry
 
 void ConstantPoolCacheEntry::initialize_entry(int index) {
   assert(0 < index && index < 0x10000, "sanity check");
@@ -497,9 +498,10 @@
     // _f1 == NULL || !_f1->is_method() are OK here
     return true;
   }
-  // return false if _f1 refers to an old or an obsolete method
+  // return false if _f1 refers to a non-deleted old or obsolete method
   return (NOT_PRODUCT(_f1->is_valid() &&) _f1->is_method() &&
-          !((Method*)_f1)->is_old() && !((Method*)_f1)->is_obsolete());
+          (f1_as_method()->is_deleted() ||
+          (!f1_as_method()->is_old() && !f1_as_method()->is_obsolete())));
 }
 
 bool ConstantPoolCacheEntry::is_interesting_method_entry(Klass* k) {
@@ -668,7 +670,7 @@
 
 void ConstantPoolCache::print_on(outputStream* st) const {
   assert(is_constantPoolCache(), "obj must be constant pool cache");
-  st->print_cr(internal_name());
+  st->print_cr("%s", internal_name());
   // print constant pool cache entries
   for (int i = 0; i < length(); i++) entry_at(i)->print(st, i);
 }
--- a/hotspot/src/share/vm/oops/generateOopMap.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/generateOopMap.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -412,9 +412,9 @@
   int copy_cts                              (CellTypeState *dst, CellTypeState *src);
 
   // Error handling
-  void  error_work                          (const char *format, va_list ap);
-  void  report_error                        (const char *format, ...);
-  void  verify_error                        (const char *format, ...);
+  void  error_work                          (const char *format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void  report_error                        (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void  verify_error                        (const char *format, ...) ATTRIBUTE_PRINTF(2, 3);
   bool  got_error()                         { return _got_error; }
 
   // Create result set
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -77,6 +77,8 @@
 #include "c1/c1_Compiler.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef DTRACE_ENABLED
 
 
@@ -2857,7 +2859,7 @@
   st->print(BULLET"instance size:     %d", size_helper());                        st->cr();
   st->print(BULLET"klass size:        %d", size());                               st->cr();
   st->print(BULLET"access:            "); access_flags().print_on(st);            st->cr();
-  st->print(BULLET"state:             "); st->print_cr(state_names[_init_state]);
+  st->print(BULLET"state:             "); st->print_cr("%s", state_names[_init_state]);
   st->print(BULLET"name:              "); name()->print_value_on(st);             st->cr();
   st->print(BULLET"super:             "); super()->print_value_on_maybe_null(st); st->cr();
   st->print(BULLET"sub:               ");
--- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,8 @@
 #include "oops/oop.pcgc.inline.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 template <class T>
 void specialized_oop_follow_contents(InstanceRefKlass* ref, oop obj) {
   T* referent_addr = (T*)java_lang_ref_Reference::referent_addr(obj);
--- a/hotspot/src/share/vm/oops/klass.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -640,7 +640,7 @@
 
   // This can be expensive, but it is worth checking that this klass is actually
   // in the CLD graph but not in production.
-  assert(ClassLoaderDataGraph::contains((address)this), "Should be");
+  assert(Metaspace::contains((address)this), "Should be");
 
   guarantee(this->is_klass(),"should be klass");
 
--- a/hotspot/src/share/vm/oops/klass.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/klass.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -555,36 +555,6 @@
 
   static void clean_weak_klass_links(BoolObjectClosure* is_alive);
 
-  // Prefetch within oop iterators.  This is a macro because we
-  // can't guarantee that the compiler will inline it.  In 64-bit
-  // it generally doesn't.  Signature is
-  //
-  // static void prefetch_beyond(oop* const start,
-  //                             oop* const end,
-  //                             const intx foffset,
-  //                             const Prefetch::style pstyle);
-#define prefetch_beyond(start, end, foffset, pstyle) {   \
-    const intx foffset_ = (foffset);                     \
-    const Prefetch::style pstyle_ = (pstyle);            \
-    assert(foffset_ > 0, "prefetch beyond, not behind"); \
-    if (pstyle_ != Prefetch::do_none) {                  \
-      oop* ref = (start);                                \
-      if (ref < (end)) {                                 \
-        switch (pstyle_) {                               \
-        case Prefetch::do_read:                          \
-          Prefetch::read(*ref, foffset_);                \
-          break;                                         \
-        case Prefetch::do_write:                         \
-          Prefetch::write(*ref, foffset_);               \
-          break;                                         \
-        default:                                         \
-          ShouldNotReachHere();                          \
-          break;                                         \
-        }                                                \
-      }                                                  \
-    }                                                    \
-  }
-
   // iterators
   virtual int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) = 0;
   virtual int oop_oop_iterate_v(oop obj, ExtendedOopClosure* blk) {
--- a/hotspot/src/share/vm/oops/klass.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/klass.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,7 @@
   assert(!is_null(v), "narrow klass value can never be zero");
   int    shift = Universe::narrow_klass_shift();
   Klass* result = (Klass*)(void*)((uintptr_t)Universe::narrow_klass_base() + ((uintptr_t)v << shift));
-  assert(check_klass_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result));
+  assert(check_klass_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result)));
   return result;
 }
 
--- a/hotspot/src/share/vm/oops/klassVtable.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/klassVtable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -39,6 +39,8 @@
 #include "runtime/handles.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 inline InstanceKlass* klassVtable::ik() const {
   Klass* k = _klass();
   assert(k->oop_is_instance(), "not an InstanceKlass");
--- a/hotspot/src/share/vm/oops/markOop.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/markOop.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,11 @@
 #include "oops/markOop.hpp"
 #include "runtime/thread.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void markOopDesc::print_on(outputStream* st) const {
   if (is_locked()) {
-    st->print("locked(0x%lx)->", value());
+    st->print("locked(" INTPTR_FORMAT ")->", value());
     markOop(*(markOop*)value())->print_on(st);
   } else {
     assert(is_unlocked() || has_bias_pattern(), "just checking");
--- a/hotspot/src/share/vm/oops/method.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/method.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -56,6 +56,7 @@
 #include "utilities/quickSort.hpp"
 #include "utilities/xmlstream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of Method
 
@@ -1018,13 +1019,11 @@
  *  security related stack walks (like Reflection.getCallerClass).
  */
 bool Method::is_ignored_by_security_stack_walk() const {
-  const bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection;
-
   if (intrinsic_id() == vmIntrinsics::_invoke) {
     // This is Method.invoke() -- ignore it
     return true;
   }
-  if (use_new_reflection &&
+  if (JDK_Version::is_gte_jdk14x_version() &&
       method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
     // This is an auxilary frame -- ignore it
     return true;
@@ -1425,7 +1424,7 @@
 
   void type_name(const char* name) {
     if (_use_separator) _st->print(", ");
-    _st->print(name);
+    _st->print("%s", name);
     _use_separator = true;
   }
 
@@ -1867,6 +1866,14 @@
   loader_data->jmethod_ids()->clear_all_methods();
 }
 
+bool Method::has_method_vptr(const void* ptr) {
+  Method m;
+  // This assumes that the vtbl pointer is the first word of a C++ object.
+  // This assumption is also in universe.cpp patch_klass_vtble
+  void* vtbl2 = dereference_vptr((const void*)&m);
+  void* this_vtbl = dereference_vptr(ptr);
+  return vtbl2 == this_vtbl;
+}
 
 // Check that this pointer is valid by checking that the vtbl pointer matches
 bool Method::is_valid_method() const {
@@ -1875,12 +1882,7 @@
   } else if (!is_metaspace_object()) {
     return false;
   } else {
-    Method m;
-    // This assumes that the vtbl pointer is the first word of a C++ object.
-    // This assumption is also in universe.cpp patch_klass_vtble
-    void* vtbl2 = dereference_vptr((void*)&m);
-    void* this_vtbl = dereference_vptr((void*)this);
-    return vtbl2 == this_vtbl;
+    return has_method_vptr((const void*)this);
   }
 }
 
@@ -1898,7 +1900,7 @@
 void Method::print_on(outputStream* st) const {
   ResourceMark rm;
   assert(is_method(), "must be method");
-  st->print_cr(internal_name());
+  st->print_cr("%s", internal_name());
   // get the effect of PrintOopAddress, always, for methods:
   st->print_cr(" - this oop:          "INTPTR_FORMAT, (intptr_t)this);
   st->print   (" - method holder:     "); method_holder()->print_value_on(st); st->cr();
@@ -1981,7 +1983,7 @@
 
 void Method::print_value_on(outputStream* st) const {
   assert(is_method(), "must be method");
-  st->print(internal_name());
+  st->print("%s", internal_name());
   print_address_on(st);
   st->print(" ");
   name()->print_value_on(st);
--- a/hotspot/src/share/vm/oops/method.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/method.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -200,10 +200,11 @@
   // Tracking number of breakpoints, for fullspeed debugging.
   // Only mutated by VM thread.
   u2   number_of_breakpoints()             const {
-    if (method_counters() == NULL) {
+    MethodCounters* mcs = method_counters();
+    if (mcs == NULL) {
       return 0;
     } else {
-      return method_counters()->number_of_breakpoints();
+      return mcs->number_of_breakpoints();
     }
   }
   void incr_number_of_breakpoints(TRAPS)         {
@@ -220,8 +221,9 @@
   }
   // Initialization only
   void clear_number_of_breakpoints()             {
-    if (method_counters() != NULL) {
-      method_counters()->clear_number_of_breakpoints();
+    MethodCounters* mcs = method_counters();
+    if (mcs != NULL) {
+      mcs->clear_number_of_breakpoints();
     }
   }
 
@@ -268,10 +270,11 @@
   }
 
   int  interpreter_throwout_count() const        {
-    if (method_counters() == NULL) {
+    MethodCounters* mcs = method_counters();
+    if (mcs == NULL) {
       return 0;
     } else {
-      return method_counters()->interpreter_throwout_count();
+      return mcs->interpreter_throwout_count();
     }
   }
 
@@ -346,31 +349,40 @@
       return method_counters()->interpreter_invocation_count();
     }
   }
-  void set_prev_event_count(int count, TRAPS)    {
-    MethodCounters* mcs = get_method_counters(CHECK);
+  void set_prev_event_count(int count) {
+    MethodCounters* mcs = method_counters();
     if (mcs != NULL) {
       mcs->set_interpreter_invocation_count(count);
     }
   }
   jlong prev_time() const                        {
-    return method_counters() == NULL ? 0 : method_counters()->prev_time();
+    MethodCounters* mcs = method_counters();
+    return mcs == NULL ? 0 : mcs->prev_time();
   }
-  void set_prev_time(jlong time, TRAPS)          {
-    MethodCounters* mcs = get_method_counters(CHECK);
+  void set_prev_time(jlong time) {
+    MethodCounters* mcs = method_counters();
     if (mcs != NULL) {
       mcs->set_prev_time(time);
     }
   }
   float rate() const                             {
-    return method_counters() == NULL ? 0 : method_counters()->rate();
+    MethodCounters* mcs = method_counters();
+    return mcs == NULL ? 0 : mcs->rate();
   }
-  void set_rate(float rate, TRAPS) {
-    MethodCounters* mcs = get_method_counters(CHECK);
+  void set_rate(float rate) {
+    MethodCounters* mcs = method_counters();
     if (mcs != NULL) {
       mcs->set_rate(rate);
     }
   }
 #endif
+  int nmethod_age() const {
+    if (method_counters() == NULL) {
+      return INT_MAX;
+    } else {
+      return method_counters()->nmethod_age();
+    }
+  }
 
   int invocation_count();
   int backedge_count();
@@ -383,9 +395,12 @@
   static MethodCounters* build_method_counters(Method* m, TRAPS);
 
   int interpreter_invocation_count() {
-    if (TieredCompilation) return invocation_count();
-    else return (method_counters() == NULL) ? 0 :
-                 method_counters()->interpreter_invocation_count();
+    if (TieredCompilation) {
+      return invocation_count();
+    } else {
+      MethodCounters* mcs = method_counters();
+      return (mcs == NULL) ? 0 : mcs->interpreter_invocation_count();
+    }
   }
   int increment_interpreter_invocation_count(TRAPS) {
     if (TieredCompilation) ShouldNotReachHere();
@@ -669,6 +684,8 @@
   void set_is_old()                                 { _access_flags.set_is_old(); }
   bool is_obsolete() const                          { return access_flags().is_obsolete(); }
   void set_is_obsolete()                            { _access_flags.set_is_obsolete(); }
+  bool is_deleted() const                           { return access_flags().is_deleted(); }
+  void set_is_deleted()                             { _access_flags.set_is_deleted(); }
   bool on_stack() const                             { return access_flags().on_stack(); }
   void set_on_stack(const bool value);
 
@@ -861,6 +878,7 @@
   const char* internal_name() const { return "{method}"; }
 
   // Check for valid method pointer
+  static bool has_method_vptr(const void* ptr);
   bool is_valid_method() const;
 
   // Verify
--- a/hotspot/src/share/vm/oops/methodCounters.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/methodCounters.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -34,4 +34,5 @@
   backedge_counter()->reset();
   set_interpreter_throwout_count(0);
   set_interpreter_invocation_count(0);
+  set_nmethod_age(INT_MAX);
 }
--- a/hotspot/src/share/vm/oops/methodCounters.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -36,6 +36,15 @@
   u2                _number_of_breakpoints;      // fullspeed debugging support
   InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
   InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequencey-based optimizations
+  // NMethod age is a counter for warm methods detection in the code cache sweeper.
+  // The counter is reset by the sweeper and is decremented by some of the compiled
+  // code. The counter values are interpreted as follows:
+  // 1. (HotMethodDetection..INT_MAX] - initial value, no counters inserted
+  // 2. (1..HotMethodDetectionLimit)  - the method is warm, the counter is used
+  //                                    to figure out which methods can be flushed.
+  // 3. (INT_MIN..0]                  - method is hot and will deopt and get
+  //                                    recompiled without the counters
+  int               _nmethod_age;
 
 #ifdef TIERED
   float             _rate;                        // Events (invocation and backedge counter increments) per millisecond
@@ -44,7 +53,8 @@
 
   MethodCounters() : _interpreter_invocation_count(0),
                      _interpreter_throwout_count(0),
-                     _number_of_breakpoints(0)
+                     _number_of_breakpoints(0),
+                     _nmethod_age(INT_MAX)
 #ifdef TIERED
                    , _rate(0),
                      _prev_time(0)
@@ -52,6 +62,10 @@
   {
     invocation_counter()->init();
     backedge_counter()->init();
+
+    if (StressCodeAging) {
+      set_nmethod_age(HotMethodDetectionLimit);
+    }
   }
 
  public:
@@ -104,6 +118,24 @@
   InvocationCounter* invocation_counter() { return &_invocation_counter; }
   InvocationCounter* backedge_counter()   { return &_backedge_counter; }
 
+  int nmethod_age() {
+    return _nmethod_age;
+  }
+  void set_nmethod_age(int age) {
+    _nmethod_age = age;
+  }
+  void reset_nmethod_age() {
+    set_nmethod_age(HotMethodDetectionLimit);
+  }
+
+  static bool is_nmethod_hot(int age)       { return age <= 0; }
+  static bool is_nmethod_warm(int age)      { return age < HotMethodDetectionLimit; }
+  static bool is_nmethod_age_unset(int age) { return age > HotMethodDetectionLimit; }
+
+  static ByteSize nmethod_age_offset() {
+    return byte_offset_of(MethodCounters, _nmethod_age);
+  }
+
   static ByteSize interpreter_invocation_counter_offset() {
     return byte_offset_of(MethodCounters, _interpreter_invocation_count);
   }
--- a/hotspot/src/share/vm/oops/methodData.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,8 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // ==================================================================
 // DataLayout
 //
@@ -127,7 +129,7 @@
     st->print("trap(%s) ", Deoptimization::format_trap_state(buf, sizeof(buf), trap));
   }
   if (extra != NULL) {
-    st->print(extra);
+    st->print("%s", extra);
   }
   int flags = data()->flags();
   if (flags != 0) {
@@ -635,7 +637,7 @@
 }
 
 void ParametersTypeData::print_data_on(outputStream* st, const char* extra) const {
-  st->print("parameter types", extra);
+  st->print("parameter types"); // FIXME extra ignored?
   _parameters.print_data_on(st);
 }
 
@@ -1128,6 +1130,7 @@
   _backedge_counter.init();
   _invocation_counter_start = 0;
   _backedge_counter_start = 0;
+  _tenure_traps = 0;
   _num_loops = 0;
   _num_blocks = 0;
   _highest_comp_level = 0;
--- a/hotspot/src/share/vm/oops/methodData.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -851,11 +851,10 @@
     return _base_off + stack_slot_local_offset(i);
   }
 
-protected:
   const int _number_of_entries;
 
   // offset of cell for type for entry i within ProfileData object
-  int type_offset(int i) const {
+  int type_offset_in_cells(int i) const {
     return _base_off + type_local_offset(i);
   }
 
@@ -868,6 +867,8 @@
 
   void post_initialize(Symbol* signature, bool has_receiver, bool include_receiver);
 
+  int number_of_entries() const { return _number_of_entries; }
+
   // offset of cell for stack slot for entry i within this block of cells for a TypeStackSlotEntries
   static int stack_slot_local_offset(int i) {
     return i * per_arg_cell_count + stack_slot_entry;
@@ -893,13 +894,13 @@
   // type for entry i
   intptr_t type(int i) const {
     assert(i >= 0 && i < _number_of_entries, "oob");
-    return _pd->intptr_at(type_offset(i));
+    return _pd->intptr_at(type_offset_in_cells(i));
   }
 
   // set type for entry i
   void set_type(int i, intptr_t k) {
     assert(i >= 0 && i < _number_of_entries, "oob");
-    _pd->set_intptr_at(type_offset(i), k);
+    _pd->set_intptr_at(type_offset_in_cells(i), k);
   }
 
   static ByteSize per_arg_size() {
@@ -907,7 +908,11 @@
   }
 
   static int per_arg_count() {
-    return per_arg_cell_count ;
+    return per_arg_cell_count;
+  }
+
+  ByteSize type_offset(int i) const {
+    return DataLayout::cell_offset(type_offset_in_cells(i));
   }
 
   // GC support
@@ -973,7 +978,7 @@
   }
 
   static int argument_type_local_offset(int i) {
-    return header_cell_count() + TypeStackSlotEntries::type_local_offset(i);;
+    return header_cell_count() + TypeStackSlotEntries::type_local_offset(i);
   }
 
 public:
@@ -1129,6 +1134,14 @@
     return cell_offset(CounterData::static_cell_count()) + TypeEntriesAtCall::args_data_offset();
   }
 
+  ByteSize argument_type_offset(int i) {
+    return _args.type_offset(i);
+  }
+
+  ByteSize return_type_offset() {
+    return _ret.type_offset();
+  }
+
   // GC support
   virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) {
     if (has_arguments()) {
@@ -1436,6 +1449,14 @@
     return cell_offset(VirtualCallData::static_cell_count()) + TypeEntriesAtCall::args_data_offset();
   }
 
+  ByteSize argument_type_offset(int i) {
+    return _args.type_offset(i);
+  }
+
+  ByteSize return_type_offset() {
+    return _ret.type_offset();
+  }
+
   // GC support
   virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) {
     ReceiverTypeData::clean_weak_klass_links(is_alive_closure);
@@ -1926,7 +1947,7 @@
 class SpeculativeTrapData : public ProfileData {
 protected:
   enum {
-    method_offset,
+    speculative_trap_method,
     speculative_trap_cell_count
   };
 public:
@@ -1946,11 +1967,15 @@
 
   // Direct accessor
   Method* method() const {
-    return (Method*)intptr_at(method_offset);
+    return (Method*)intptr_at(speculative_trap_method);
   }
 
   void set_method(Method* m) {
-    set_intptr_at(method_offset, (intptr_t)m);
+    set_intptr_at(speculative_trap_method, (intptr_t)m);
+  }
+
+  static ByteSize method_offset() {
+    return cell_offset(speculative_trap_method);
   }
 
   virtual void print_data_on(outputStream* st, const char* extra = NULL) const;
@@ -2059,6 +2084,7 @@
   // Counter values at the time profiling started.
   int               _invocation_counter_start;
   int               _backedge_counter_start;
+  uint              _tenure_traps;
 
 #if INCLUDE_RTM_OPT
   // State of RTM code generation during compilation of the method
@@ -2398,6 +2424,12 @@
       method()->set_not_compilable(CompLevel_full_optimization, true, "decompile_count > PerMethodRecompilationCutoff");
     }
   }
+  uint tenure_traps() const {
+    return _tenure_traps;
+  }
+  void inc_tenure_traps() {
+    _tenure_traps += 1;
+  }
 
   // Return pointer to area dedicated to parameters in MDO
   ParametersTypeData* parameters_type_data() const {
--- a/hotspot/src/share/vm/oops/oop.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/oop.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -30,6 +30,8 @@
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 bool always_do_update_barrier = false;
 
 BarrierSet* oopDesc::_bs = NULL;
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -211,7 +211,7 @@
   address base = Universe::narrow_oop_base();
   int    shift = Universe::narrow_oop_shift();
   oop result = (oop)(void*)((uintptr_t)base + ((uintptr_t)v << shift));
-  assert(check_obj_alignment(result), err_msg("address not aligned: " PTR_FORMAT, (void*) result));
+  assert(check_obj_alignment(result), err_msg("address not aligned: " INTPTR_FORMAT, p2i((void*) result)));
   return result;
 }
 
--- a/hotspot/src/share/vm/opto/block.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/block.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -339,7 +339,7 @@
     st->print(" FRegPressure: %d",_freg_pressure);
     st->print(" FHRP Index: %d",_fhrp_index);
   }
-  st->print_cr("");
+  st->cr();
 }
 
 void Block::dump() const {
@@ -1268,7 +1268,6 @@
 }
 
 void UnionFind::reset( uint max ) {
-  assert( max <= max_uint, "Must fit within uint" );
   // Force the Union-Find mapping to be at least this large
   extend(max,0);
   // Initialize to be the ID mapping.
--- a/hotspot/src/share/vm/opto/callGenerator.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -391,7 +391,7 @@
   }
 
   // Setup default node notes to be picked up by the inlining
-  Node_Notes* old_nn = C->default_node_notes();
+  Node_Notes* old_nn = C->node_notes_at(call->_idx);
   if (old_nn != NULL) {
     Node_Notes* entry_nn = old_nn->clone(C);
     entry_nn->set_jvms(jvms);
--- a/hotspot/src/share/vm/opto/callnode.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/callnode.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@
 #ifndef PRODUCT
 void ParmNode::dump_spec(outputStream *st) const {
   if( _con < TypeFunc::Parms ) {
-    st->print(names[_con]);
+    st->print("%s", names[_con]);
   } else {
     st->print("Parm%d: ",_con-TypeFunc::Parms);
     // Verbose and WizardMode dump bottom_type for all nodes
@@ -348,19 +348,19 @@
       break;
     case Type::AryPtr:
     case Type::InstPtr:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->isa_oopptr()->const_oop());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->isa_oopptr()->const_oop()));
       break;
     case Type::KlassPtr:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_klassptr()->klass());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_klassptr()->klass()));
       break;
     case Type::MetadataPtr:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_metadataptr()->metadata());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_metadataptr()->metadata()));
       break;
     case Type::NarrowOop:
-      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,t->make_ptr()->isa_oopptr()->const_oop());
+      st->print(" %s%d]=#Ptr" INTPTR_FORMAT,msg,i,p2i(t->make_ptr()->isa_oopptr()->const_oop()));
       break;
     case Type::RawPtr:
-      st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,t->is_rawptr());
+      st->print(" %s%d]=#Raw" INTPTR_FORMAT,msg,i,p2i(t->is_rawptr()));
       break;
     case Type::DoubleCon:
       st->print(" %s%d]=#%fD",msg,i,t->is_double_constant()->_d);
@@ -369,7 +369,7 @@
       st->print(" %s%d]=#%fF",msg,i,t->is_float_constant()->_f);
       break;
     case Type::Long:
-      st->print(" %s%d]=#"INT64_FORMAT,msg,i,t->is_long()->get_con());
+      st->print(" %s%d]=#"INT64_FORMAT,msg,i,(int64_t)(t->is_long()->get_con()));
       break;
     case Type::Half:
     case Type::Top:
@@ -428,7 +428,7 @@
 
     for (i = 0; i < (uint)scobjs.length(); i++) {
       // Scalar replaced objects.
-      st->print_cr("");
+      st->cr();
       st->print("        # ScObj" INT32_FORMAT " ", i);
       SafePointScalarObjectNode* spobj = scobjs.at(i);
       ciKlass* cik = spobj->bottom_type()->is_oopptr()->klass();
@@ -485,7 +485,7 @@
       st->print(" }");
     }
   }
-  st->print_cr("");
+  st->cr();
   if (caller() != NULL) caller()->format(regalloc, n, st);
 }
 
@@ -981,7 +981,7 @@
 #ifndef PRODUCT
 void CallRuntimeNode::dump_spec(outputStream *st) const {
   st->print("# ");
-  st->print(_name);
+  st->print("%s", _name);
   CallNode::dump_spec(st);
 }
 #endif
@@ -999,7 +999,7 @@
 #ifndef PRODUCT
 void CallLeafNode::dump_spec(outputStream *st) const {
   st->print("# ");
-  st->print(_name);
+  st->print("%s", _name);
   CallNode::dump_spec(st);
 }
 #endif
--- a/hotspot/src/share/vm/opto/chaitin.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/chaitin.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2020,25 +2020,25 @@
       tty->print_cr("new LRG");
     }
   }
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-degree list
   tty->print("Lo degree: ");
   for(uint i3 = _lo_degree; i3; i3 = lrgs(i3)._next )
     tty->print("L%d ",i3);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-stk-degree list
   tty->print("Lo stk degree: ");
   for(uint i4 = _lo_stk_degree; i4; i4 = lrgs(i4)._next )
     tty->print("L%d ",i4);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-degree list
   tty->print("Hi degree: ");
   for(uint i5 = _hi_degree; i5; i5 = lrgs(i5)._next )
     tty->print("L%d ",i5);
-  tty->print_cr("");
+  tty->cr();
 }
 
 void PhaseChaitin::dump_degree_lists() const {
@@ -2046,26 +2046,26 @@
   tty->print("Lo degree: ");
   for( uint i = _lo_degree; i; i = lrgs(i)._next )
     tty->print("L%d ",i);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-stk-degree list
   tty->print("Lo stk degree: ");
   for(uint i2 = _lo_stk_degree; i2; i2 = lrgs(i2)._next )
     tty->print("L%d ",i2);
-  tty->print_cr("");
+  tty->cr();
 
   // Dump lo-degree list
   tty->print("Hi degree: ");
   for(uint i3 = _hi_degree; i3; i3 = lrgs(i3)._next )
     tty->print("L%d ",i3);
-  tty->print_cr("");
+  tty->cr();
 }
 
 void PhaseChaitin::dump_simplified() const {
   tty->print("Simplified: ");
   for( uint i = _simplified; i; i = lrgs(i)._next )
     tty->print("L%d ",i);
-  tty->print_cr("");
+  tty->cr();
 }
 
 static char *print_reg( OptoReg::Name reg, const PhaseChaitin *pc, char *buf ) {
@@ -2144,7 +2144,7 @@
       }
       tty->print("   : parm %d: ", k);
       domain->field_at(k + TypeFunc::Parms)->dump();
-      tty->print_cr("");
+      tty->cr();
     }
   }
 
@@ -2166,7 +2166,7 @@
           _matcher._parm_regs[j].second() == reg ) {
         tty->print("parm %d: ",j);
         domain->field_at(j + TypeFunc::Parms)->dump();
-        tty->print_cr("");
+        tty->cr();
         break;
       }
     }
--- a/hotspot/src/share/vm/opto/chaitin.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/chaitin.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,6 @@
 #define SHARE_VM_OPTO_CHAITIN_HPP
 
 #include "code/vmreg.hpp"
-#include "libadt/port.hpp"
 #include "memory/resourceArea.hpp"
 #include "opto/connode.hpp"
 #include "opto/live.hpp"
@@ -142,7 +141,7 @@
 
   // Number of registers this live range uses when it colors
 private:
-  uint8 _num_regs;              // 2 for Longs and Doubles, 1 for all else
+  uint8_t _num_regs;            // 2 for Longs and Doubles, 1 for all else
                                 // except _num_regs is kill count for fat_proj
 public:
   int num_regs() const { return _num_regs; }
@@ -151,7 +150,7 @@
 private:
   // Number of physical registers this live range uses when it colors
   // Architecture and register-set dependent
-  uint8 _reg_pressure;
+  uint8_t _reg_pressure;
 public:
   void set_reg_pressure(int i)  { _reg_pressure = i; }
   int      reg_pressure() const { return _reg_pressure; }
--- a/hotspot/src/share/vm/opto/compile.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/compile.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1089,6 +1089,7 @@
   set_do_scheduling(OptoScheduling);
   set_do_count_invocations(false);
   set_do_method_data_update(false);
+  set_age_code(has_method() && method()->profile_aging());
   set_rtm_state(NoRTM); // No RTM lock eliding by default
 #if INCLUDE_RTM_OPT
   if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) {
@@ -2424,7 +2425,7 @@
         starts_bundle = ' ';
         tty->print("\t");
         delay->format(_regalloc, tty);
-        tty->print_cr("");
+        tty->cr();
         delay = NULL;
       }
 
@@ -2438,12 +2439,12 @@
     if (pcs && n->_idx < pc_limit)
       tty->print_cr("%3.3x", pcs[n->_idx]);
     else
-      tty->print_cr("");
+      tty->cr();
 
     assert(cut_short || delay == NULL, "no unconditional delay branch");
 
   } // End of per-block dump
-  tty->print_cr("");
+  tty->cr();
 
   if (cut_short)  tty->print_cr("*** disassembly is cut short ***");
 }
@@ -3688,7 +3689,8 @@
     default: ShouldNotReachHere();
     }
     assert(constant_addr, "consts section too small");
-    assert((constant_addr - _masm.code()->consts()->start()) == con.offset(), err_msg_res("must be: %d == %d", constant_addr - _masm.code()->consts()->start(), con.offset()));
+    assert((constant_addr - _masm.code()->consts()->start()) == con.offset(),
+            err_msg_res("must be: %d == %d", (int) (constant_addr - _masm.code()->consts()->start()), (int)(con.offset())));
   }
 }
 
@@ -3768,7 +3770,7 @@
 
   for (uint i = 0; i < n->outcnt(); i++) {
     address* constant_addr = &jump_table_base[i];
-    assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, *constant_addr, (((address) n) + i)));
+    assert(*constant_addr == (((address) n) + i), err_msg_res("all jump-table entries must contain adjusted node pointer: " INTPTR_FORMAT " == " INTPTR_FORMAT, p2i(*constant_addr), p2i(((address) n) + i)));
     *constant_addr = cb.consts()->target(*labels.at(i), (address) constant_addr);
     cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type);
   }
@@ -3884,7 +3886,7 @@
   }
   if (do_print_inlining) {
     for (int i = 0; i < _print_inlining_list->length(); i++) {
-      tty->print(_print_inlining_list->adr_at(i)->ss()->as_string());
+      tty->print("%s", _print_inlining_list->adr_at(i)->ss()->as_string());
     }
   }
 }
--- a/hotspot/src/share/vm/opto/compile.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/compile.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@
 #include "compiler/compilerOracle.hpp"
 #include "compiler/compileBroker.hpp"
 #include "libadt/dict.hpp"
-#include "libadt/port.hpp"
 #include "libadt/vectset.hpp"
 #include "memory/resourceArea.hpp"
 #include "opto/idealGraphPrinter.hpp"
@@ -311,6 +310,7 @@
   bool                  _do_freq_based_layout;  // True if we intend to do frequency based block layout
   bool                  _do_count_invocations;  // True if we generate code to count invocations
   bool                  _do_method_data_update; // True if we generate code to update MethodData*s
+  bool                  _age_code;              // True if we need to profile code age (decrement the aging counter)
   int                   _AliasLevel;            // Locally-adjusted version of AliasLevel flag.
   bool                  _print_assembly;        // True if we should dump assembly code for this compilation
   bool                  _print_inlining;        // True if we should print inlining for this compilation
@@ -459,7 +459,7 @@
   void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
     stringStream ss;
     CompileTask::print_inlining(&ss, method, inline_level, bci, msg);
-    print_inlining_stream()->print(ss.as_string());
+    print_inlining_stream()->print("%s", ss.as_string());
   }
 
   void log_late_inline(CallGenerator* cg);
@@ -584,7 +584,9 @@
   void          set_do_count_invocations(bool z){ _do_count_invocations = z; }
   bool              do_method_data_update() const { return _do_method_data_update; }
   void          set_do_method_data_update(bool z) { _do_method_data_update = z; }
-  int               AliasLevel() const          { return _AliasLevel; }
+  bool              age_code() const             { return _age_code; }
+  void          set_age_code(bool z)             { _age_code = z; }
+  int               AliasLevel() const           { return _AliasLevel; }
   bool              print_assembly() const       { return _print_assembly; }
   void          set_print_assembly(bool z)       { _print_assembly = z; }
   bool              print_inlining() const       { return _print_inlining; }
--- a/hotspot/src/share/vm/opto/divnode.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/divnode.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -514,7 +514,7 @@
   int widen = MAX2(i1->_widen, i2->_widen);
 
   if( i2->is_con() && i2->get_con() != 0 ) {
-    int32 d = i2->get_con(); // Divisor
+    int32_t d = i2->get_con(); // Divisor
     jint lo, hi;
     if( d >= 0 ) {
       lo = i1->_lo/d;
@@ -536,7 +536,7 @@
 
   // If the dividend is a constant
   if( i1->is_con() ) {
-    int32 d = i1->get_con();
+    int32_t d = i1->get_con();
     if( d < 0 ) {
       if( d == min_jint ) {
         //  (-min_jint) == min_jint == (min_jint / -1)
--- a/hotspot/src/share/vm/opto/doCall.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/doCall.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
     out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
     stringStream ss;
     prof_klass->name()->print_symbol_on(&ss);
-    out->print(ss.as_string());
+    out->print("%s", ss.as_string());
     out->cr();
   }
 }
@@ -364,7 +364,7 @@
 bool Compile::should_delay_boxing_inlining(ciMethod* call_method, JVMState* jvms) {
   if (eliminate_boxing() && call_method->is_boxing_method()) {
     set_has_boxed_value(true);
-    return true;
+    return aggressive_unboxing();
   }
   return false;
 }
--- a/hotspot/src/share/vm/opto/domgraph.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/domgraph.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -397,8 +397,9 @@
     ntarjan[i]._control = NULL;
 
   // Store the DFS order for the main loop
+  const uint fill_value = max_juint;
   uint *dfsorder = NEW_RESOURCE_ARRAY(uint,C->unique()+1);
-  memset(dfsorder, max_uint, (C->unique()+1) * sizeof(uint));
+  memset(dfsorder, fill_value, (C->unique()+1) * sizeof(uint));
 
   // Tarjan's algorithm, almost verbatim:
   // Step 1:
@@ -419,7 +420,7 @@
       if( whead->in(j) == NULL || !whead->in(j)->is_CFG() )
         continue;                            // Only process control nodes
       uint b = dfsorder[whead->in(j)->_idx];
-      if(b == max_uint) continue;
+      if(b == fill_value) continue;
       NTarjan *vx = &ntarjan[b];
       NTarjan *u = vx->EVAL();
       if( u->_semi < w->_semi )
--- a/hotspot/src/share/vm/opto/gcm.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/gcm.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2014,7 +2014,7 @@
   tty->print("%s: %d  trip_count: %6.0f freq: %6.0f\n",
              _depth == 0 ? "Method" : "Loop", _id, trip_count(), _freq);
   for (int i = 0; i < _depth; i++) tty->print("   ");
-  tty->print("         members:", _id);
+  tty->print("         members:");
   int k = 0;
   for (int i = 0; i < _members.length(); i++) {
     if (k++ >= 6) {
--- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -155,7 +155,7 @@
     } else {
       // It would be nice if we could shut down cleanly but it should
       // be an error if we can't connect to the visualizer.
-      fatal(err_msg_res("Couldn't connect to visualizer at %s:%d",
+      fatal(err_msg_res("Couldn't connect to visualizer at %s:" INTX_FORMAT,
                         PrintIdealGraphAddress, PrintIdealGraphPort));
     }
   }
@@ -195,7 +195,7 @@
 
 
 void IdealGraphPrinter::begin_elem(const char *s) {
-  _xml->begin_elem(s);
+  _xml->begin_elem("%s", s);
 }
 
 void IdealGraphPrinter::end_elem() {
@@ -203,7 +203,7 @@
 }
 
 void IdealGraphPrinter::begin_head(const char *s) {
-  _xml->begin_head(s);
+  _xml->begin_head("%s", s);
 }
 
 void IdealGraphPrinter::end_head() {
@@ -223,7 +223,7 @@
 }
 
 void IdealGraphPrinter::head(const char *name) {
-  _xml->head(name);
+  _xml->head("%s", name);
 }
 
 void IdealGraphPrinter::tail(const char *name) {
@@ -231,7 +231,7 @@
 }
 
 void IdealGraphPrinter::text(const char *s) {
-  _xml->text(s);
+  _xml->text("%s", s);
 }
 
 void IdealGraphPrinter::print_prop(const char *name, int val) {
@@ -359,7 +359,7 @@
 void IdealGraphPrinter::print_indent() {
   tty->print_cr("printing ident %d", _depth);
   for (int i = 0; i < _depth; i++) {
-    _xml->print(INDENT);
+    _xml->print("%s", INDENT);
   }
 }
 
--- a/hotspot/src/share/vm/opto/ifg.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/ifg.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -256,7 +256,7 @@
   for( i = 0; i < _maxlrg*2; i++ )
     if( h_cnt[i] )
       tty->print("%d/%d ",i,h_cnt[i]);
-  tty->print_cr("");
+  tty->cr();
 }
 
 void PhaseIFG::verify( const PhaseChaitin *pc ) const {
--- a/hotspot/src/share/vm/opto/ifnode.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/ifnode.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -673,7 +673,7 @@
 //           /    Region
 //
 Node* IfNode::fold_compares(PhaseGVN* phase) {
-  if (!phase->C->eliminate_boxing() || Opcode() != Op_If) return NULL;
+  if (Opcode() != Op_If) return NULL;
 
   Node* this_cmp = in(1)->in(1);
   if (this_cmp != NULL && this_cmp->Opcode() == Op_CmpI &&
--- a/hotspot/src/share/vm/opto/indexSet.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/indexSet.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -51,7 +51,7 @@
 #endif
 
 // What is the first set bit in a 5 bit integer?
-const byte IndexSetIterator::_first_bit[32] = {
+const uint8_t IndexSetIterator::_first_bit[32] = {
   0, 0, 1, 0,
   2, 0, 1, 0,
   3, 0, 1, 0,
@@ -63,7 +63,7 @@
 };
 
 // What is the second set bit in a 5 bit integer?
-const byte IndexSetIterator::_second_bit[32] = {
+const uint8_t IndexSetIterator::_second_bit[32] = {
   5, 5, 5, 1,
   5, 2, 2, 1,
   5, 3, 3, 1,
@@ -298,7 +298,7 @@
       set_block(i, &_empty_block);
     } else {
       BitBlock *new_block = alloc_block();
-      memcpy(new_block->words(), block->words(), sizeof(uint32) * words_per_block);
+      memcpy(new_block->words(), block->words(), sizeof(uint32_t) * words_per_block);
       set_block(i, new_block);
     }
   }
--- a/hotspot/src/share/vm/opto/indexSet.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/indexSet.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -106,12 +106,12 @@
     // is used by IndexSet to mainting this free list.
 
     union {
-      uint32 _words[words_per_block];
+      uint32_t _words[words_per_block];
       BitBlock *_next;
     } _data;
 
     // accessors
-    uint32 *words() { return _data._words; }
+    uint32_t* words() { return _data._words; }
     void set_next(BitBlock *next) { _data._next = next; }
     BitBlock *next() { return _data._next; }
 
@@ -120,22 +120,22 @@
     // not assume that the block index has been masked out.
 
     void clear() {
-      memset(words(), 0, sizeof(uint32) * words_per_block);
+      memset(words(), 0, sizeof(uint32_t) * words_per_block);
     }
 
     bool member(uint element) {
       uint word_index = IndexSet::get_word_index(element);
       uint bit_index = IndexSet::get_bit_index(element);
 
-      return ((words()[word_index] & (uint32)(0x1 << bit_index)) != 0);
+      return ((words()[word_index] & (uint32_t)(0x1 << bit_index)) != 0);
     }
 
     bool insert(uint element) {
       uint word_index = IndexSet::get_word_index(element);
       uint bit_index = IndexSet::get_bit_index(element);
 
-      uint32 bit = (0x1 << bit_index);
-      uint32 before = words()[word_index];
+      uint32_t bit = (0x1 << bit_index);
+      uint32_t before = words()[word_index];
       words()[word_index] = before | bit;
       return ((before & bit) != 0);
     }
@@ -144,8 +144,8 @@
       uint word_index = IndexSet::get_word_index(element);
       uint bit_index = IndexSet::get_bit_index(element);
 
-      uint32 bit = (0x1 << bit_index);
-      uint32 before = words()[word_index];
+      uint32_t bit = (0x1 << bit_index);
+      uint32_t before = words()[word_index];
       words()[word_index] = before & ~bit;
       return ((before & bit) != 0);
     }
@@ -404,14 +404,14 @@
          table_size  = (1 << window_size) };
 
   // For an integer of length window_size, what is the first set bit?
-  static const byte _first_bit[table_size];
+  static const uint8_t _first_bit[table_size];
 
   // For an integer of length window_size, what is the second set bit?
-  static const byte _second_bit[table_size];
+  static const uint8_t _second_bit[table_size];
 
  private:
   // The current word we are inspecting
-  uint32                _current;
+  uint32_t              _current;
 
   // What element number are we currently on?
   uint                  _value;
@@ -420,7 +420,7 @@
   uint                  _next_word;
 
   // A pointer to the contents of the current block
-  uint32               *_words;
+  uint32_t             *_words;
 
   // The index of the next block we will inspect
   uint                  _next_block;
--- a/hotspot/src/share/vm/opto/library_call.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -420,7 +420,6 @@
     return NULL;
 
   case vmIntrinsics::_getCallerClass:
-    if (!UseNewReflection)  return NULL;
     if (!InlineReflectionGetCallerClass)  return NULL;
     if (SystemDictionary::reflect_CallerSensitive_klass() == NULL)  return NULL;
     break;
--- a/hotspot/src/share/vm/opto/live.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/live.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_LIVE_HPP
 #define SHARE_VM_OPTO_LIVE_HPP
 
-#include "libadt/port.hpp"
 #include "libadt/vectset.hpp"
 #include "opto/block.hpp"
 #include "opto/indexSet.hpp"
--- a/hotspot/src/share/vm/opto/loopPredicate.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/loopPredicate.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -639,7 +639,7 @@
 
   if (TraceLoopPredicate) {
     predString->print_cr("<u range");
-    tty->print(predString->as_string());
+    tty->print("%s", predString->as_string());
   }
   return bol;
 }
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3569,7 +3569,7 @@
 
 #ifdef ASSERT
 void PhaseIdealLoop::dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA) {
-  tty->print_cr(msg);
+  tty->print_cr("%s", msg);
   tty->print("n: "); n->dump();
   tty->print("early(n): "); early->dump();
   if (n->in(0) != NULL  && !n->in(0)->is_top() &&
--- a/hotspot/src/share/vm/opto/loopnode.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -339,11 +339,11 @@
 
   Node_List _body;              // Loop body for inner loops
 
-  uint8 _nest;                  // Nesting depth
-  uint8 _irreducible:1,         // True if irreducible
-        _has_call:1,            // True if has call safepoint
-        _has_sfpt:1,            // True if has non-call safepoint
-        _rce_candidate:1;       // True if candidate for range check elimination
+  uint8_t _nest;                // Nesting depth
+  uint8_t _irreducible:1,       // True if irreducible
+          _has_call:1,          // True if has call safepoint
+          _has_sfpt:1,          // True if has non-call safepoint
+          _rce_candidate:1;     // True if candidate for range check elimination
 
   Node_List* _safepts;          // List of safepoints in this loop
   Node_List* _required_safept;  // A inner loop cannot delete these safepts;
--- a/hotspot/src/share/vm/opto/matcher.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/matcher.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2622,7 +2622,7 @@
         tty->print_cr("%s  %d  %s",
                       ruleName[i], _cost[i], ruleName[_rule[i]] );
       }
-  tty->print_cr("");
+  tty->cr();
 
   for( i=0; i<2; i++ )
     if( _kids[i] )
--- a/hotspot/src/share/vm/opto/memnode.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3981,7 +3981,7 @@
     intptr_t st_off = get_store_offset(st, phase);
     if (st_off < 0)  continue;  // ignore dead garbage
     if (last_off > st_off) {
-      tty->print_cr("*** bad store offset at %d: %d > %d", i, last_off, st_off);
+      tty->print_cr("*** bad store offset at %d: " INTX_FORMAT " > " INTX_FORMAT, i, last_off, st_off);
       this->dump(2);
       assert(false, "ascending store offsets");
       return false;
--- a/hotspot/src/share/vm/opto/mulnode.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/mulnode.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -235,23 +235,23 @@
   const TypeInt *r1 = t1->is_int();
 
   // Fetch endpoints of all ranges
-  int32 lo0 = r0->_lo;
+  int32_t lo0 = r0->_lo;
   double a = (double)lo0;
-  int32 hi0 = r0->_hi;
+  int32_t hi0 = r0->_hi;
   double b = (double)hi0;
-  int32 lo1 = r1->_lo;
+  int32_t lo1 = r1->_lo;
   double c = (double)lo1;
-  int32 hi1 = r1->_hi;
+  int32_t hi1 = r1->_hi;
   double d = (double)hi1;
 
   // Compute all endpoints & check for overflow
-  int32 A = lo0*lo1;
+  int32_t A = lo0*lo1;
   if( (double)A != a*c ) return TypeInt::INT; // Overflow?
-  int32 B = lo0*hi1;
+  int32_t B = lo0*hi1;
   if( (double)B != a*d ) return TypeInt::INT; // Overflow?
-  int32 C = hi0*lo1;
+  int32_t C = hi0*lo1;
   if( (double)C != b*c ) return TypeInt::INT; // Overflow?
-  int32 D = hi0*hi1;
+  int32_t D = hi0*hi1;
   if( (double)D != b*d ) return TypeInt::INT; // Overflow?
 
   if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints
@@ -1228,12 +1228,12 @@
   //
   //   const TypeInstPtr *o = t1->is_instptr();
   //   if( t1->singleton() )
-  //     return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift );
+  //     return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift );
   // }
   // else if( t1->base() == Type::KlassPtr ) {
   //   const TypeKlassPtr *o = t1->is_klassptr();
   //   if( t1->singleton() )
-  //     return TypeInt::make( ((uint32)o->const_oop() + o->_offset) >> shift );
+  //     return TypeInt::make( ((uint32_t)o->const_oop() + o->_offset) >> shift );
   // }
 
   return TypeInt::INT;
--- a/hotspot/src/share/vm/opto/node.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/node.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1688,7 +1688,7 @@
       }
     }
   }
-  if (suffix) st->print(suffix);
+  if (suffix) st->print("%s", suffix);
   C->_in_dump_cnt--;
 }
 
--- a/hotspot/src/share/vm/opto/node.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/node.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_NODE_HPP
 #define SHARE_VM_OPTO_NODE_HPP
 
-#include "libadt/port.hpp"
 #include "libadt/vectset.hpp"
 #include "opto/compile.hpp"
 #include "opto/type.hpp"
--- a/hotspot/src/share/vm/opto/output.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/output.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -366,8 +366,8 @@
   // third inserts nops where needed.
 
   // Step one, perform a pessimistic sizing pass.
-  uint last_call_adr = max_uint;
-  uint last_avoid_back_to_back_adr = max_uint;
+  uint last_call_adr = max_juint;
+  uint last_avoid_back_to_back_adr = max_juint;
   uint nop_size = (new (this) MachNopNode())->size(_regalloc);
   for (uint i = 0; i < nblocks; i++) { // For all blocks
     Block* block = _cfg->get_block(i);
@@ -479,7 +479,7 @@
 
   // Step two, replace eligible long jumps.
   bool progress = true;
-  uint last_may_be_short_branch_adr = max_uint;
+  uint last_may_be_short_branch_adr = max_juint;
   while (has_short_branch_candidate && progress) {
     progress = false;
     has_short_branch_candidate = false;
--- a/hotspot/src/share/vm/opto/parse.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/parse.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -581,6 +581,7 @@
   void    jump_switch_ranges(Node* a, SwitchRange* lo, SwitchRange* hi, int depth = 0);
   bool    create_jump_tables(Node* a, SwitchRange* lo, SwitchRange* hi);
 
+  void decrement_age();
   // helper functions for methodData style profiling
   void test_counter_against_threshold(Node* cnt, int limit);
   void increment_and_test_invocation_counter(int limit);
--- a/hotspot/src/share/vm/opto/parse1.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -568,6 +568,9 @@
   } else {
     set_map(entry_map);
     do_method_entry();
+    if (depth() == 1 && C->age_code()) {
+      decrement_age();
+    }
   }
   if (depth() == 1) {
     // Add check to deoptimize the nmethod if RTM state was changed
@@ -611,7 +614,7 @@
   set_map(entry_map);
   do_exits();
 
-  if (log)  log->done("parse nodes='%d' live='%d' memory='%d'",
+  if (log)  log->done("parse nodes='%d' live='%d' memory='" SIZE_FORMAT "'",
                       C->unique(), C->live_nodes(), C->node_arena()->used());
 }
 
@@ -1395,7 +1398,7 @@
       tty->print((( i < ns) ? " %d" : " %d(e)"), b->successor_at(i)->rpo());
     }
     if (b->is_loop_head()) tty->print("  lphd");
-    tty->print_cr("");
+    tty->cr();
   }
 
   assert(block()->is_merged(), "must be merged before being parsed");
@@ -2048,6 +2051,31 @@
 #endif
 }
 
+void Parse::decrement_age() {
+  MethodCounters* mc = method()->ensure_method_counters();
+  if (mc == NULL) {
+    C->record_failure("Must have MCs");
+    return;
+  }
+  assert(!is_osr_parse(), "Not doing this for OSRs");
+
+  // Set starting bci for uncommon trap.
+  set_parse_bci(0);
+
+  const TypePtr* adr_type = TypeRawPtr::make((address)mc);
+  Node* mc_adr = makecon(adr_type);
+  Node* cnt_adr = basic_plus_adr(mc_adr, mc_adr, in_bytes(MethodCounters::nmethod_age_offset()));
+  Node* cnt = make_load(control(), cnt_adr, TypeInt::INT, T_INT, adr_type, MemNode::unordered);
+  Node* decr = _gvn.transform(new (C) SubINode(cnt, makecon(TypeInt::ONE)));
+  store_to_memory(control(), cnt_adr, decr, T_INT, adr_type, MemNode::unordered);
+  Node *chk   = _gvn.transform(new (C) CmpINode(decr, makecon(TypeInt::ZERO)));
+  Node* tst   = _gvn.transform(new (C) BoolNode(chk, BoolTest::gt));
+  { BuildCutout unless(this, tst, PROB_ALWAYS);
+    uncommon_trap(Deoptimization::Reason_tenured,
+                  Deoptimization::Action_make_not_entrant);
+  }
+}
+
 //------------------------------return_current---------------------------------
 // Append current _map to _exit_return
 void Parse::return_current(Node* value) {
--- a/hotspot/src/share/vm/opto/parse2.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/parse2.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -405,9 +405,9 @@
 
   bool needs_guard = false;
   int default_dest;
-  int64 total_outlier_size = 0;
-  int64 hi_size = ((int64)hi->hi()) - ((int64)hi->lo()) + 1;
-  int64 lo_size = ((int64)lo->hi()) - ((int64)lo->lo()) + 1;
+  int64_t total_outlier_size = 0;
+  int64_t hi_size = ((int64_t)hi->hi()) - ((int64_t)hi->lo()) + 1;
+  int64_t lo_size = ((int64_t)lo->hi()) - ((int64_t)lo->lo()) + 1;
 
   if (lo->dest() == hi->dest()) {
     total_outlier_size = hi_size + lo_size;
@@ -429,7 +429,7 @@
   }
 
   // Find the total number of cases and ranges
-  int64 num_cases = ((int64)hi->hi()) - ((int64)lo->lo()) + 1;
+  int64_t num_cases = ((int64_t)hi->hi()) - ((int64_t)lo->lo()) + 1;
   int num_range = hi - lo + 1;
 
   // Don't create table if: too large, too small, or too sparse.
@@ -473,7 +473,7 @@
   // These are the switch destinations hanging off the jumpnode
   int i = 0;
   for (SwitchRange* r = lo; r <= hi; r++) {
-    for (int64 j = r->lo(); j <= r->hi(); j++, i++) {
+    for (int64_t j = r->lo(); j <= r->hi(); j++, i++) {
       Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval)));
       {
         PreserveJVMState pjvms(this);
@@ -628,7 +628,7 @@
     _method->print_short_name();
     tty->print_cr(" switch decision tree");
     tty->print_cr("    %d ranges (%d singletons), max_depth=%d, est_depth=%d",
-                  hi-lo+1, nsing, _max_switch_depth, _est_switch_depth);
+                  (int) (hi-lo+1), nsing, _max_switch_depth, _est_switch_depth);
     if (_max_switch_depth > _est_switch_depth) {
       tty->print_cr("******** BAD SWITCH DEPTH ********");
     }
@@ -636,7 +636,7 @@
     for( r = lo; r <= hi; r++ ) {
       r->print();
     }
-    tty->print_cr("");
+    tty->cr();
   }
 #endif
 }
--- a/hotspot/src/share/vm/opto/phase.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/phase.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_PHASE_HPP
 #define SHARE_VM_OPTO_PHASE_HPP
 
-#include "libadt/port.hpp"
 #include "runtime/timer.hpp"
 
 class Compile;
--- a/hotspot/src/share/vm/opto/phaseX.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/phaseX.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -958,10 +958,10 @@
   if (VerifyIterativeGVN && PrintOpto) {
     if (_verify_counter == _verify_full_passes) {
       tty->print_cr("VerifyIterativeGVN: %d transforms and verify passes",
-                    _verify_full_passes);
+                    (int) _verify_full_passes);
     } else {
       tty->print_cr("VerifyIterativeGVN: %d transforms, %d full verify passes",
-                  _verify_counter, _verify_full_passes);
+                  (int) _verify_counter, (int) _verify_full_passes);
     }
   }
 }
@@ -1393,6 +1393,15 @@
           _worklist.push(u);
       }
     }
+    // If changed AddI/SubI inputs, check CmpU for range check optimization.
+    if (use_op == Op_AddI || use_op == Op_SubI) {
+      for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
+        Node* u = use->fast_out(i2);
+        if (u->is_Cmp() && (u->Opcode() == Op_CmpU)) {
+          _worklist.push(u);
+        }
+      }
+    }
     // If changed AddP inputs, check Stores for loop invariant
     if( use_op == Op_AddP ) {
       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
--- a/hotspot/src/share/vm/opto/regmask.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/regmask.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
 
 //-------------Non-zero bit search methods used by RegMask---------------------
 // Find lowest 1, or return 32 if empty
-int find_lowest_bit( uint32 mask ) {
+int find_lowest_bit( uint32_t mask ) {
   int n = 0;
   if( (mask & 0xffff) == 0 ) {
     mask >>= 16;
@@ -80,7 +80,7 @@
 }
 
 // Find highest 1, or return 32 if empty
-int find_hihghest_bit( uint32 mask ) {
+int find_hihghest_bit( uint32_t mask ) {
   int n = 0;
   if( mask > 0xffff ) {
     mask >>= 16;
@@ -116,7 +116,7 @@
   case Special: st->print("r---"); break;
   case Bad:     st->print("rBAD"); break;
   default:
-    if (r < _last_Mach_Reg) st->print(Matcher::regName[r]);
+    if (r < _last_Mach_Reg) st->print("%s", Matcher::regName[r]);
     else st->print("rS%d",r);
     break;
   }
@@ -395,7 +395,7 @@
 //------------------------------Size-------------------------------------------
 // Compute size of register mask in bits
 uint RegMask::Size() const {
-  extern uint8 bitsInByte[256];
+  extern uint8_t bitsInByte[256];
   uint sum = 0;
   for( int i = 0; i < RM_SIZE; i++ )
     sum +=
--- a/hotspot/src/share/vm/opto/regmask.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/regmask.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,6 @@
 #define SHARE_VM_OPTO_REGMASK_HPP
 
 #include "code/vmreg.hpp"
-#include "libadt/port.hpp"
 #include "opto/optoreg.hpp"
 #ifdef TARGET_ARCH_MODEL_x86_32
 # include "adfiles/adGlobals_x86_32.hpp"
@@ -68,9 +67,9 @@
 
 //-------------Non-zero bit search methods used by RegMask---------------------
 // Find lowest 1, or return 32 if empty
-int find_lowest_bit( uint32 mask );
+int find_lowest_bit( uint32_t mask );
 // Find highest 1, or return 32 if empty
-int find_hihghest_bit( uint32 mask );
+int find_hihghest_bit( uint32_t mask );
 
 //------------------------------RegMask----------------------------------------
 // The ADL file describes how to print the machine-specific registers, as well
--- a/hotspot/src/share/vm/opto/runtime.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/runtime.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -960,7 +960,7 @@
   } else {
     // Receiver did not match any saved receiver and there is no empty row for it.
     // Increment total counter to indicate polymorphic case.
-    intptr_t* count_p = (intptr_t*)(((byte*)(data)) + in_bytes(CounterData::count_offset()));
+    intptr_t* count_p = (intptr_t*)(((uint8_t*)(data)) + in_bytes(CounterData::count_offset()));
     *count_p += DataLayout::counter_increment;
   }
 JRT_END
@@ -1393,7 +1393,7 @@
   } else {
     tty->print("<unknown>");
   }
-  tty->print(" at " INTPTR_FORMAT,  exception_pc);
+  tty->print(" at " INTPTR_FORMAT,  p2i(exception_pc));
   tty->print_cr("]");
 }
 
--- a/hotspot/src/share/vm/opto/subnode.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/subnode.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
 
 //------------------------------Value------------------------------------------
 // A subtract node differences it's two inputs.
-const Type *SubNode::Value( PhaseTransform *phase ) const {
+const Type* SubNode::Value_common(PhaseTransform *phase) const {
   const Node* in1 = in(1);
   const Node* in2 = in(2);
   // Either input is TOP ==> the result is TOP
@@ -97,6 +97,16 @@
   if( t1 == Type::BOTTOM || t2 == Type::BOTTOM )
     return bottom_type();
 
+  return NULL;
+}
+
+const Type* SubNode::Value(PhaseTransform *phase) const {
+  const Type* t = Value_common(phase);
+  if (t != NULL) {
+    return t;
+  }
+  const Type* t1 = phase->type(in(1));
+  const Type* t2 = phase->type(in(2));
   return sub(t1,t2);            // Local flavor of type subtraction
 
 }
@@ -242,8 +252,8 @@
 const Type *SubINode::sub( const Type *t1, const Type *t2 ) const {
   const TypeInt *r0 = t1->is_int(); // Handy access
   const TypeInt *r1 = t2->is_int();
-  int32 lo = r0->_lo - r1->_hi;
-  int32 hi = r0->_hi - r1->_lo;
+  int32_t lo = r0->_lo - r1->_hi;
+  int32_t hi = r0->_hi - r1->_lo;
 
   // We next check for 32-bit overflow.
   // If that happens, we just assume all integers are possible.
@@ -570,6 +580,81 @@
   return TypeInt::CC;                   // else use worst case results
 }
 
+const Type* CmpUNode::Value(PhaseTransform *phase) const {
+  const Type* t = SubNode::Value_common(phase);
+  if (t != NULL) {
+    return t;
+  }
+  const Node* in1 = in(1);
+  const Node* in2 = in(2);
+  const Type* t1 = phase->type(in1);
+  const Type* t2 = phase->type(in2);
+  assert(t1->isa_int(), "CmpU has only Int type inputs");
+  if (t2 == TypeInt::INT) { // Compare to bottom?
+    return bottom_type();
+  }
+  uint in1_op = in1->Opcode();
+  if (in1_op == Op_AddI || in1_op == Op_SubI) {
+    // The problem rise when result of AddI(SubI) may overflow
+    // signed integer value. Let say the input type is
+    // [256, maxint] then +128 will create 2 ranges due to
+    // overflow: [minint, minint+127] and [384, maxint].
+    // But C2 type system keep only 1 type range and as result
+    // it use general [minint, maxint] for this case which we
+    // can't optimize.
+    //
+    // Make 2 separate type ranges based on types of AddI(SubI) inputs
+    // and compare results of their compare. If results are the same
+    // CmpU node can be optimized.
+    const Node* in11 = in1->in(1);
+    const Node* in12 = in1->in(2);
+    const Type* t11 = (in11 == in1) ? Type::TOP : phase->type(in11);
+    const Type* t12 = (in12 == in1) ? Type::TOP : phase->type(in12);
+    // Skip cases when input types are top or bottom.
+    if ((t11 != Type::TOP) && (t11 != TypeInt::INT) &&
+        (t12 != Type::TOP) && (t12 != TypeInt::INT)) {
+      const TypeInt *r0 = t11->is_int();
+      const TypeInt *r1 = t12->is_int();
+      jlong lo_r0 = r0->_lo;
+      jlong hi_r0 = r0->_hi;
+      jlong lo_r1 = r1->_lo;
+      jlong hi_r1 = r1->_hi;
+      if (in1_op == Op_SubI) {
+        jlong tmp = hi_r1;
+        hi_r1 = -lo_r1;
+        lo_r1 = -tmp;
+        // Note, for substructing [minint,x] type range
+        // long arithmetic provides correct overflow answer.
+        // The confusion come from the fact that in 32-bit
+        // -minint == minint but in 64-bit -minint == maxint+1.
+      }
+      jlong lo_long = lo_r0 + lo_r1;
+      jlong hi_long = hi_r0 + hi_r1;
+      int lo_tr1 = min_jint;
+      int hi_tr1 = (int)hi_long;
+      int lo_tr2 = (int)lo_long;
+      int hi_tr2 = max_jint;
+      bool underflow = lo_long != (jlong)lo_tr2;
+      bool overflow  = hi_long != (jlong)hi_tr1;
+      // Use sub(t1, t2) when there is no overflow (one type range)
+      // or when both overflow and underflow (too complex).
+      if ((underflow != overflow) && (hi_tr1 < lo_tr2)) {
+        // Overflow only on one boundary, compare 2 separate type ranges.
+        int w = MAX2(r0->_widen, r1->_widen); // _widen does not matter here
+        const TypeInt* tr1 = TypeInt::make(lo_tr1, hi_tr1, w);
+        const TypeInt* tr2 = TypeInt::make(lo_tr2, hi_tr2, w);
+        const Type* cmp1 = sub(tr1, t2);
+        const Type* cmp2 = sub(tr2, t2);
+        if (cmp1 == cmp2) {
+          return cmp1; // Hit!
+        }
+      }
+    }
+  }
+
+  return sub(t1, t2);            // Local flavor of type subtraction
+}
+
 bool CmpUNode::is_index_range_check() const {
   // Check for the "(X ModI Y) CmpU Y" shape
   return (in(1)->Opcode() == Op_ModI &&
@@ -1065,7 +1150,7 @@
 #ifndef PRODUCT
 void BoolTest::dump_on(outputStream *st) const {
   const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"};
-  st->print(msg[_test]);
+  st->print("%s", msg[_test]);
 }
 #endif
 
--- a/hotspot/src/share/vm/opto/subnode.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/subnode.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -50,6 +50,7 @@
   // Compute a new Type for this node.  Basically we just do the pre-check,
   // then call the virtual add() to set the type.
   virtual const Type *Value( PhaseTransform *phase ) const;
+  const Type* Value_common( PhaseTransform *phase ) const;
 
   // Supplied function returns the subtractend of the inputs.
   // This also type-checks the inputs for sanity.  Guaranteed never to
@@ -158,6 +159,7 @@
   CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
   virtual int Opcode() const;
   virtual const Type *sub( const Type *, const Type * ) const;
+  const Type *Value( PhaseTransform *phase ) const;
   bool is_index_range_check() const;
 };
 
--- a/hotspot/src/share/vm/opto/type.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/type.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@
 #include "opto/opcodes.hpp"
 #include "opto/type.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Portions of code courtesy of Clifford Click
 
 // Optimization - Graph Style
@@ -842,7 +844,7 @@
 #ifndef PRODUCT
 //------------------------------dump2------------------------------------------
 void Type::dump2( Dict &d, uint depth, outputStream *st ) const {
-  st->print(_type_info[_base].msg);
+  st->print("%s", _type_info[_base].msg);
 }
 
 //------------------------------dump-------------------------------------------
--- a/hotspot/src/share/vm/opto/type.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/opto/type.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_OPTO_TYPE_HPP
 #define SHARE_VM_OPTO_TYPE_HPP
 
-#include "libadt/port.hpp"
 #include "opto/adlcVMDeps.hpp"
 #include "runtime/handles.hpp"
 
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -199,6 +199,7 @@
 # include "runtime/perfData.hpp"
 # include "runtime/perfMemory.hpp"
 # include "runtime/prefetch.hpp"
+# include "runtime/prefetch.inline.hpp"
 # include "runtime/reflection.hpp"
 # include "runtime/reflectionUtils.hpp"
 # include "runtime/registerMap.hpp"
@@ -247,7 +248,6 @@
 # include "utilities/yieldingWorkgroup.hpp"
 #ifdef COMPILER2
 # include "libadt/dict.hpp"
-# include "libadt/port.hpp"
 # include "libadt/set.hpp"
 # include "libadt/vectset.hpp"
 # include "opto/addnode.hpp"
--- a/hotspot/src/share/vm/prims/jni.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jni.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -275,7 +275,7 @@
 
   class JNITraceWrapper : public StackObj {
    public:
-    JNITraceWrapper(const char* format, ...) {
+    JNITraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
       if (TraceJNICalls) {
         va_list ap;
         va_start(ap, format);
@@ -544,7 +544,7 @@
   if (m->is_initializer()) {
     reflection_method = Reflection::new_constructor(m, CHECK_NULL);
   } else {
-    reflection_method = Reflection::new_method(m, UseNewReflection, false, CHECK_NULL);
+    reflection_method = Reflection::new_method(m, false, CHECK_NULL);
   }
   ret = JNIHandles::make_local(env, reflection_method);
   return ret;
@@ -2272,7 +2272,7 @@
     found = InstanceKlass::cast(k)->find_field_from_offset(offset, false, &fd);
   }
   assert(found, "bad fieldID passed into jni_ToReflectedField");
-  oop reflected = Reflection::new_field(&fd, UseNewReflection, CHECK_NULL);
+  oop reflected = Reflection::new_field(&fd, CHECK_NULL);
   ret = JNIHandles::make_local(env, reflected);
   return ret;
 JNI_END
--- a/hotspot/src/share/vm/prims/jniCheck.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,7 +100,7 @@
   result_type JNICALL header {                                           \
     JavaThread* thr = (JavaThread*)ThreadLocalStorage::get_thread_slow();\
     if (thr == NULL || !thr->is_Java_thread()) {                         \
-      tty->print_cr(fatal_using_jnienv_in_nonjava);                      \
+      tty->print_cr("%s", fatal_using_jnienv_in_nonjava);                      \
       os::abort(true);                                                   \
     }                                                                    \
     JNIEnv* xenv = thr->jni_environment();                               \
@@ -184,7 +184,7 @@
 functionEnter(JavaThread* thr)
 {
   if (thr->in_critical()) {
-    tty->print_cr(warn_other_function_in_critical);
+    tty->print_cr("%s", warn_other_function_in_critical);
   }
   if (thr->has_pending_exception()) {
     NativeReportJNIWarning(thr, "JNI call made with exception pending");
@@ -195,7 +195,7 @@
 functionEnterExceptionAllowed(JavaThread* thr)
 {
   if (thr->in_critical()) {
-    tty->print_cr(warn_other_function_in_critical);
+    tty->print_cr("%s", warn_other_function_in_critical);
   }
 }
 
--- a/hotspot/src/share/vm/prims/jvm.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,7 @@
 #include "classfile/classLoader.hpp"
 #include "classfile/javaAssertions.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
@@ -215,7 +215,7 @@
 #ifdef ASSERT
   class JVMTraceWrapper : public StackObj {
    public:
-    JVMTraceWrapper(const char* format, ...) {
+    JVMTraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
       if (TraceJVMCalls) {
         va_list ap;
         va_start(ap, format);
@@ -1854,7 +1854,7 @@
 
     if (!publicOnly || fs.access_flags().is_public()) {
       fd.reinitialize(k(), fs.index());
-      oop field = Reflection::new_field(&fd, UseNewReflection, CHECK_NULL);
+      oop field = Reflection::new_field(&fd, CHECK_NULL);
       result->obj_at_put(out_idx, field);
       ++out_idx;
     }
@@ -1932,7 +1932,7 @@
       if (want_constructor) {
         m = Reflection::new_constructor(method, CHECK_NULL);
       } else {
-        m = Reflection::new_method(method, UseNewReflection, false, CHECK_NULL);
+        m = Reflection::new_method(method, false, CHECK_NULL);
       }
       result->obj_at_put(i, m);
     }
@@ -2055,7 +2055,7 @@
   }
   oop method;
   if (!m->is_initializer() || m->is_static()) {
-    method = Reflection::new_method(m, true, true, CHECK_NULL);
+    method = Reflection::new_method(m, true, CHECK_NULL);
   } else {
     method = Reflection::new_constructor(m, CHECK_NULL);
   }
@@ -2105,7 +2105,7 @@
   if (target_klass == NULL) {
     THROW_MSG_0(vmSymbols::java_lang_RuntimeException(), "Unable to look up field in target class");
   }
-  oop field = Reflection::new_field(&fd, true, CHECK_NULL);
+  oop field = Reflection::new_field(&fd, CHECK_NULL);
   return JNIHandles::make_local(field);
 }
 
@@ -2736,14 +2736,14 @@
 
 
 JVM_LEAF(jlong, JVM_Lseek(jint fd, jlong offset, jint whence))
-  JVMWrapper4("JVM_Lseek (0x%x, %Ld, %d)", fd, offset, whence);
+  JVMWrapper4("JVM_Lseek (0x%x, " INT64_FORMAT ", %d)", fd, (int64_t) offset, whence);
   //%note jvm_r6
   return os::lseek(fd, offset, whence);
 JVM_END
 
 
 JVM_LEAF(jint, JVM_SetLength(jint fd, jlong length))
-  JVMWrapper3("JVM_SetLength (0x%x, %Ld)", fd, length);
+  JVMWrapper3("JVM_SetLength (0x%x, " INT64_FORMAT ")", fd, (int64_t) length);
   return os::ftruncate(fd, length);
 JVM_END
 
@@ -2758,13 +2758,14 @@
 // Printing support //////////////////////////////////////////////////
 extern "C" {
 
+ATTRIBUTE_PRINTF(3, 0)
 int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
   // see bug 4399518, 4417214
   if ((intptr_t)count <= 0) return -1;
   return vsnprintf(str, count, fmt, args);
 }
 
-
+ATTRIBUTE_PRINTF(3, 0)
 int jio_snprintf(char *str, size_t count, const char *fmt, ...) {
   va_list args;
   int len;
@@ -2774,7 +2775,7 @@
   return len;
 }
 
-
+ATTRIBUTE_PRINTF(2,3)
 int jio_fprintf(FILE* f, const char *fmt, ...) {
   int len;
   va_list args;
@@ -2784,7 +2785,7 @@
   return len;
 }
 
-
+ATTRIBUTE_PRINTF(2, 0)
 int jio_vfprintf(FILE* f, const char *fmt, va_list args) {
   if (Arguments::vfprintf_hook() != NULL) {
      return Arguments::vfprintf_hook()(f, fmt, args);
@@ -2793,7 +2794,7 @@
   }
 }
 
-
+ATTRIBUTE_PRINTF(1, 2)
 JNIEXPORT int jio_printf(const char *fmt, ...) {
   int len;
   va_list args;
@@ -2930,7 +2931,7 @@
   JavaThread* receiver = java_lang_Thread::thread(java_thread);
   Events::log_exception(JavaThread::current(),
                         "JVM_StopThread thread JavaThread " INTPTR_FORMAT " as oop " INTPTR_FORMAT " [exception " INTPTR_FORMAT "]",
-                        receiver, (address)java_thread, throwable);
+                        p2i(receiver), p2i((address)java_thread), p2i(throwable));
   // First check if thread is alive
   if (receiver != NULL) {
     // Check if exception is getting thrown at self (use oop equality, since the
@@ -3520,7 +3521,6 @@
 
 JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
   for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
-    // UseNewReflection
     vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
     oop loader = vfst.method()->method_holder()->class_loader();
     if (loader != NULL) {
--- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Wed Jul 05 19:42:29 2017 +0200
@@ -1,6 +1,6 @@
 <?xml version="1.0"?> 
 <!--
- Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,9 @@
 # include "prims/jvmtiRawMonitor.hpp"
 # include "prims/jvmtiUtil.hpp"
 
+// There are known-bad format/arg pairings in the code generated by this file.
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 </xsl:text>
 
   <xsl:if test="$trace = 'Trace'">
--- a/hotspot/src/share/vm/prims/jvmtiEnvThreadState.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jvmtiEnvThreadState.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -113,7 +113,7 @@
     JvmtiFramePop fp = JvmtiFramePop(_pops->at(i));
     tty->print("%d: ", i);
     fp.print();
-    tty->print_cr("");
+    tty->cr();
   }
 }
 #endif
--- a/hotspot/src/share/vm/prims/jvmtiEventController.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jvmtiEventController.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -38,6 +38,8 @@
 #include "runtime/vmThread.hpp"
 #include "runtime/vm_operations.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef JVMTI_TRACE
 #define EC_TRACE(out) do { \
   if (JvmtiTrace::trace_event_controller()) { \
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -56,6 +56,8 @@
 #include "gc_implementation/parallelScavenge/psMarkSweep.hpp"
 #endif // INCLUDE_ALL_GCS
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef JVMTI_TRACE
 #define EVT_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_SENT) != 0) { SafeResourceMark rm; tty->print_cr out; }
 #define EVT_TRIG_TRACE(evt,out) if ((JvmtiTrace::event_trace_flags(evt) & JvmtiTrace::SHOW_EVENT_TRIGGER) != 0) { SafeResourceMark rm; tty->print_cr out; }
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -413,7 +413,7 @@
     JvmtiBreakpoint& bp = _bps.at(i);
     tty->print("%d: ", i);
     bp.print();
-    tty->print_cr("");
+    tty->cr();
   }
 #endif
 }
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
 #include "runtime/relocator.hpp"
 #include "utilities/bitMap.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 Array<Method*>* VM_RedefineClasses::_old_methods = NULL;
 Array<Method*>* VM_RedefineClasses::_new_methods = NULL;
@@ -1904,6 +1905,8 @@
 // annotations_typeArray if needed. Returns the original constant
 // pool reference if a rewrite was not needed or the new constant
 // pool reference if a rewrite was needed.
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
 u2 VM_RedefineClasses::rewrite_cp_ref_in_annotation_data(
      AnnotationArray* annotations_typeArray, int &byte_i_ref,
      const char * trace_mesg, TRAPS) {
@@ -1920,6 +1923,7 @@
   byte_i_ref += 2;
   return old_cp_index;
 }
+PRAGMA_DIAG_POP
 
 
 // Rewrite constant pool references in the element_value portion of an
@@ -2966,7 +2970,8 @@
     assert(!old_method->has_vtable_index(),
            "cannot delete methods with vtable entries");;
 
-    // Mark all deleted methods as old and obsolete
+    // Mark all deleted methods as old, obsolete and deleted
+    old_method->set_is_deleted();
     old_method->set_is_old();
     old_method->set_is_obsolete();
     ++obsolete_count;
@@ -3572,7 +3577,7 @@
       no_old_methods = false;
     }
 
-    // the constant pool cache should never contain old or obsolete methods
+    // the constant pool cache should never contain non-deleted old or obsolete methods
     if (ik->constants() != NULL &&
         ik->constants()->cache() != NULL &&
         !ik->constants()->cache()->check_no_old_or_obsolete_entries()) {
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "compiler/compileBroker.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/oopMapCache.hpp"
@@ -536,7 +536,7 @@
           // unknown letter, or we don't want to know its name
           st->put(ch);
         } else {
-          st->print(n);
+          st->print("%s", n);
           prev_type = true;
         }
         break;
--- a/hotspot/src/share/vm/prims/privilegedStack.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/privilegedStack.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 #include "prims/privilegedStack.hpp"
 #include "runtime/vframe.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 void PrivilegedElement::initialize(vframeStream* vfst, oop context, PrivilegedElement* next, TRAPS) {
   Method* method        = vfst->method();
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "prims/jvm.h"
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/prefetch.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/synchronizer.hpp"
@@ -41,6 +42,8 @@
 #include "utilities/copy.hpp"
 #include "utilities/dtrace.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 /*
  *      Implementation of class sun.misc.Unsafe
  */
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -27,7 +27,7 @@
 #include "memory/universe.hpp"
 #include "oops/oop.inline.hpp"
 
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/classLoaderData.hpp"
 
 #include "prims/whitebox.hpp"
@@ -53,6 +53,8 @@
 #include "compiler/compileBroker.hpp"
 #include "runtime/compilationPolicy.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define SIZE_T_MAX_VALUE ((size_t) -1)
 
 bool WhiteBox::_used = false;
@@ -493,8 +495,8 @@
 
 #ifdef TIERED
     mcs->set_rate(0.0F);
-    mh->set_prev_event_count(0, THREAD);
-    mh->set_prev_time(0, THREAD);
+    mh->set_prev_event_count(0);
+    mh->set_prev_time(0);
 #endif
   }
 WB_END
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -75,11 +75,14 @@
 
 // update_rate() is called from select_task() while holding a compile queue lock.
 void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
-  JavaThread* THREAD = JavaThread::current();
+  // Skip update if counters are absent.
+  // Can't allocate them since we are holding compile queue lock.
+  if (m->method_counters() == NULL)  return;
+
   if (is_old(m)) {
     // We don't remove old methods from the queue,
     // so we can just zero the rate.
-    m->set_rate(0, THREAD);
+    m->set_rate(0);
     return;
   }
 
@@ -95,14 +98,15 @@
   if (delta_s >= TieredRateUpdateMinTime) {
     // And we must've taken the previous point at least 1ms before.
     if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) {
-      m->set_prev_time(t, THREAD);
-      m->set_prev_event_count(event_count, THREAD);
-      m->set_rate((float)delta_e / (float)delta_t, THREAD); // Rate is events per millisecond
-    } else
+      m->set_prev_time(t);
+      m->set_prev_event_count(event_count);
+      m->set_rate((float)delta_e / (float)delta_t); // Rate is events per millisecond
+    } else {
       if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) {
         // If nothing happened for 25ms, zero the rate. Don't modify prev values.
-        m->set_rate(0, THREAD);
+        m->set_rate(0);
       }
+    }
   }
 }
 
@@ -164,7 +168,6 @@
   for (CompileTask* task = compile_queue->first(); task != NULL;) {
     CompileTask* next_task = task->next();
     Method* method = task->method();
-    MethodData* mdo = method->method_data();
     update_rate(t, method);
     if (max_task == NULL) {
       max_task = task;
@@ -175,8 +178,7 @@
         if (PrintTieredEvents) {
           print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level());
         }
-        CompileTaskWrapper ctw(task); // Frees the task
-        compile_queue->remove(task);
+        compile_queue->remove_and_mark_stale(task);
         method->clear_queued_for_compilation();
         task = next_task;
         continue;
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaAssertions.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/symbolTable.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "memory/allocation.inline.hpp"
@@ -310,6 +311,10 @@
   { "UseBoundThreads",               JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { "DefaultThreadPriority",         JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { "NoYieldsInMicrolock",           JDK_Version::jdk(9), JDK_Version::jdk(10) },
+  { "BackEdgeThreshold",             JDK_Version::jdk(9), JDK_Version::jdk(10) },
+  { "UseNewReflection",              JDK_Version::jdk(9), JDK_Version::jdk(10) },
+  { "ReflectionWrapResolutionErrors",JDK_Version::jdk(9), JDK_Version::jdk(10) },
+  { "VerifyReflectionBytecodes",     JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { NULL, JDK_Version(0), JDK_Version(0) }
 };
 
@@ -579,11 +584,20 @@
 // Parses a memory size specification string.
 static bool atomull(const char *s, julong* result) {
   julong n = 0;
-  int args_read = sscanf(s, JULONG_FORMAT, &n);
+  int args_read = 0;
+  bool is_hex = false;
+  // Skip leading 0[xX] for hexadecimal
+  if (*s =='0' && (*(s+1) == 'x' || *(s+1) == 'X')) {
+    s += 2;
+    is_hex = true;
+    args_read = sscanf(s, JULONG_FORMAT_X, &n);
+  } else {
+    args_read = sscanf(s, JULONG_FORMAT, &n);
+  }
   if (args_read != 1) {
     return false;
   }
-  while (*s != '\0' && isdigit(*s)) {
+  while (*s != '\0' && (isdigit(*s) || (is_hex && isxdigit(*s)))) {
     s++;
   }
   // 4705540: illegal if more characters are found after the first non-digit
@@ -777,7 +791,7 @@
     }
   }
 
-#define VALUE_RANGE "[-kmgtKMGT0123456789]"
+#define VALUE_RANGE "[-kmgtxKMGTX0123456789abcdefABCDEF]"
   if (sscanf(arg, "%" XSTR(BUFLEN) NAME_RANGE "=" "%" XSTR(BUFLEN) VALUE_RANGE "%c", name, value, &dummy) == 2) {
     return set_numeric_flag(name, value, origin);
   }
@@ -852,7 +866,7 @@
     for (int i=0; i < _num_jvm_flags; i++) {
       st->print("%s ", _jvm_flags_array[i]);
     }
-    st->print_cr("");
+    st->cr();
   }
 }
 
@@ -861,7 +875,7 @@
     for (int i=0; i < _num_jvm_args; i++) {
       st->print("%s ", _jvm_args_array[i]);
     }
-    st->print_cr("");
+    st->cr();
   }
 }
 
@@ -1151,6 +1165,32 @@
   }
 }
 
+/**
+ * Returns the minimum number of compiler threads needed to run the JVM. The following
+ * configurations are possible.
+ *
+ * 1) The JVM is build using an interpreter only. As a result, the minimum number of
+ *    compiler threads is 0.
+ * 2) The JVM is build using the compiler(s) and tiered compilation is disabled. As
+ *    a result, either C1 or C2 is used, so the minimum number of compiler threads is 1.
+ * 3) The JVM is build using the compiler(s) and tiered compilation is enabled. However,
+ *    the option "TieredStopAtLevel < CompLevel_full_optimization". As a result, only
+ *    C1 can be used, so the minimum number of compiler threads is 1.
+ * 4) The JVM is build using the compilers and tiered compilation is enabled. The option
+ *    'TieredStopAtLevel = CompLevel_full_optimization' (the default value). As a result,
+ *    the minimum number of compiler threads is 2.
+ */
+int Arguments::get_min_number_of_compiler_threads() {
+#if !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)
+  return 0;   // case 1
+#else
+  if (!TieredCompilation || (TieredStopAtLevel < CompLevel_full_optimization)) {
+    return 1; // case 2 or case 3
+  }
+  return 2;   // case 4 (tiered)
+#endif
+}
+
 #if INCLUDE_ALL_GCS
 static void disable_adaptive_size_policy(const char* collector_name) {
   if (UseAdaptiveSizePolicy) {
@@ -1349,8 +1389,8 @@
   }
   if (PrintGCDetails && Verbose) {
     tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
-      MarkStackSize / K, MarkStackSizeMax / K);
-    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
+      (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
+    tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
   }
 }
 #endif // INCLUDE_ALL_GCS
@@ -1430,7 +1470,7 @@
     if (PrintGCDetails) {
       // Cannot use gclog_or_tty yet.
       tty->print_cr("Automatic selection of the low pause collector"
-       " based on pause goal of %d (ms)", MaxGCPauseMillis);
+       " based on pause goal of %d (ms)", (int) MaxGCPauseMillis);
     }
     return true;
   }
@@ -1647,8 +1687,8 @@
 
   if (PrintGCDetails && Verbose) {
     tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
-      MarkStackSize / K, MarkStackSizeMax / K);
-    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
+      (unsigned int) (MarkStackSize / K), (uint) (MarkStackSizeMax / K));
+    tty->print_cr("ConcGCThreads: %u", (uint) ConcGCThreads);
   }
 }
 
@@ -1732,7 +1772,7 @@
 
     if (PrintGCDetails && Verbose) {
       // Cannot use gclog_or_tty yet.
-      tty->print_cr("  Maximum heap size " SIZE_FORMAT, reasonable_max);
+      tty->print_cr("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
     }
     FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max);
   }
@@ -2105,7 +2145,7 @@
     // Using "else if" below to avoid printing two error messages if min > max.
     // This will also prevent us from reporting both min>100 and max>100 at the
     // same time, but that is less annoying than printing two identical errors IMHO.
-    FormatBuffer<80> err_msg("");
+    FormatBuffer<80> err_msg("%s","");
     if (!verify_MinHeapFreeRatio(err_msg, MinHeapFreeRatio)) {
       jio_fprintf(defaultStream::error_stream(), "%s\n", err_msg.buffer());
       status = false;
@@ -2335,6 +2375,9 @@
   status = status && verify_percentage(MarkSweepDeadRatio, "MarkSweepDeadRatio");
 
   status = status && verify_min_value(MarkSweepAlwaysCompactCount, 1, "MarkSweepAlwaysCompactCount");
+#ifdef COMPILER1
+  status = status && verify_min_value(ValueMapInitialSize, 1, "ValueMapInitialSize");
+#endif
 
   if (PrintNMTStatistics) {
 #if INCLUDE_NMT
@@ -2398,9 +2441,11 @@
   status &= verify_interval(CodeCacheMinBlockLength, 1, 100, "CodeCacheMinBlockLength");
   status &= verify_interval(CodeCacheSegmentSize, 1, 1024, "CodeCacheSegmentSize");
 
-  // TieredCompilation needs at least 2 compiler threads.
-  const int num_min_compiler_threads = (TieredCompilation && (TieredStopAtLevel >= CompLevel_full_optimization)) ? 2 : CI_COMPILER_COUNT;
-  status &=verify_min_value(CICompilerCount, num_min_compiler_threads, "CICompilerCount");
+  int min_number_of_compiler_threads = get_min_number_of_compiler_threads();
+  // The default CICompilerCount's value is CI_COMPILER_COUNT.
+  assert(min_number_of_compiler_threads <= CI_COMPILER_COUNT, "minimum should be less or equal default number");
+  // Check the minimum number of compiler threads
+  status &=verify_min_value(CICompilerCount, min_number_of_compiler_threads, "CICompilerCount");
 
   if (!FLAG_IS_DEFAULT(CICompilerCount) && !FLAG_IS_DEFAULT(CICompilerCountPerCPU) && CICompilerCountPerCPU) {
     warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 extern "C" {
   typedef void (JNICALL *abort_hook_t)(void);
   typedef void (JNICALL *exit_hook_t)(jint code);
-  typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args);
+  typedef jint (JNICALL *vfprintf_hook_t)(FILE *fp, const char *format, va_list args)  ATTRIBUTE_PRINTF(2, 0);
 }
 
 // Forward declarations
@@ -323,6 +323,7 @@
 
   // Tiered
   static void set_tiered_flags();
+  static int  get_min_number_of_compiler_threads();
   // CMS/ParNew garbage collectors
   static void set_parnew_gc_flags();
   static void set_cms_and_parnew_gc_flags();
--- a/hotspot/src/share/vm/runtime/biasedLocking.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/biasedLocking.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -161,7 +161,7 @@
   if (TraceBiasedLocking && (Verbose || !is_bulk)) {
     ResourceMark rm;
     tty->print_cr("Revoking bias of object " INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s , prototype header " INTPTR_FORMAT " , allow rebias %d , requesting thread " INTPTR_FORMAT,
-                  (void *)obj, (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
+                  p2i((void *)obj), (intptr_t) mark, obj->klass()->external_name(), (intptr_t) obj->klass()->prototype_header(), (allow_rebias ? 1 : 0), (intptr_t) requesting_thread);
   }
 
   JavaThread* biased_thread = mark->biased_locker();
@@ -214,8 +214,8 @@
     if (mon_info->owner() == obj) {
       if (TraceBiasedLocking && Verbose) {
         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") == obj (" PTR_FORMAT ")",
-                      (void *) mon_info->owner(),
-                      (void *) obj);
+                      p2i((void *) mon_info->owner()),
+                      p2i((void *) obj));
       }
       // Assume recursive case and fix up highest lock later
       markOop mark = markOopDesc::encode((BasicLock*) NULL);
@@ -224,8 +224,8 @@
     } else {
       if (TraceBiasedLocking && Verbose) {
         tty->print_cr("   mon_info->owner (" PTR_FORMAT ") != obj (" PTR_FORMAT ")",
-                      (void *) mon_info->owner(),
-                      (void *) obj);
+                      p2i((void *) mon_info->owner()),
+                      p2i((void *) obj));
       }
     }
   }
@@ -328,7 +328,7 @@
     tty->print_cr("* Beginning bulk revocation (kind == %s) because of object "
                   INTPTR_FORMAT " , mark " INTPTR_FORMAT " , type %s",
                   (bulk_rebias ? "rebias" : "revoke"),
-                  (void *) o, (intptr_t) o->mark(), o->klass()->external_name());
+                  p2i((void *) o), (intptr_t) o->mark(), o->klass()->external_name());
   }
 
   jlong cur_time = os::javaTimeMillis();
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -170,7 +170,7 @@
 void NonTieredCompPolicy::trace_osr_completion(nmethod* osr_nm) {
   if (TraceOnStackReplacement) {
     if (osr_nm == NULL) tty->print_cr("compilation failed");
-    else tty->print_cr("nmethod " INTPTR_FORMAT, osr_nm);
+    else tty->print_cr("nmethod " INTPTR_FORMAT, p2i(osr_nm));
   }
 }
 #endif // !PRODUCT
@@ -417,6 +417,7 @@
 }
 
 #ifndef PRODUCT
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) {
   if (TraceInvocationCounterOverflow) {
     MethodCounters* mcs = m->method_counters();
@@ -428,7 +429,10 @@
       bci == InvocationEntryBci
       ? "comp-policy cntr ovfl @ %d in entry of "
       : "comp-policy cntr ovfl @ %d in loop of ";
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
     tty->print(msg, bci);
+PRAGMA_DIAG_POP
     m->print_value();
     tty->cr();
     ic->print();
@@ -503,7 +507,7 @@
     if (TraceCompilationPolicy) {
       tty->print("method invocation trigger: ");
       m->print_short_name(tty);
-      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)m(), m->code_size());
+      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)m()), m->code_size());
     }
     RegisterMap reg_map(thread, false);
     javaVFrame* triggerVF = thread->last_java_vframe(&reg_map);
@@ -512,7 +516,7 @@
 
     if (first->top_method()->code() != NULL) {
       // called obsolete method/nmethod -- no need to recompile
-      if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, first->top_method()->code());
+      if (TraceCompilationPolicy) tty->print_cr(" --> " INTPTR_FORMAT, p2i(first->top_method()->code()));
     } else {
       if (TimeCompilationPolicy) accumulated_time()->start();
       GrowableArray<RFrame*>* stack = new GrowableArray<RFrame*>(50);
@@ -640,7 +644,7 @@
     if (TraceCompilationPolicy && Verbose) {
       tty->print("\n\t     check caller: ");
       next_m->print_short_name(tty);
-      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", (address)next_m(), next_m->code_size());
+      tty->print(" ( interpreted " INTPTR_FORMAT ", size=%d ) ", p2i((address)next_m()), next_m->code_size());
     }
 
     current = next;
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,8 @@
 #endif
 #endif // COMPILER2
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 bool DeoptimizationMarker::_is_active = false;
 
 Deoptimization::UnrollBlock::UnrollBlock(int  size_of_deoptimized_frame,
@@ -742,6 +744,8 @@
   return 0;
 }
 
+Deoptimization::DeoptAction Deoptimization::_unloaded_action
+  = Deoptimization::Action_reinterpret;
 
 #ifdef COMPILER2
 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) {
@@ -1183,6 +1187,23 @@
 }
 JRT_END
 
+MethodData*
+Deoptimization::get_method_data(JavaThread* thread, methodHandle m,
+                                bool create_if_missing) {
+  Thread* THREAD = thread;
+  MethodData* mdo = m()->method_data();
+  if (mdo == NULL && create_if_missing && !HAS_PENDING_EXCEPTION) {
+    // Build an MDO.  Ignore errors like OutOfMemory;
+    // that simply means we won't have an MDO to update.
+    Method::build_interpreter_method_data(m, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
+      CLEAR_PENDING_EXCEPTION;
+    }
+    mdo = m()->method_data();
+  }
+  return mdo;
+}
 
 #if defined(COMPILER2) || defined(SHARK)
 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) {
@@ -1283,7 +1304,7 @@
 
     // Ensure that we can record deopt. history:
     // Need MDO to record RTM code generation state.
-    bool create_if_missing = ProfileTraps RTM_OPT_ONLY( || UseRTMLocking );
+    bool create_if_missing = ProfileTraps || UseCodeAging RTM_OPT_ONLY( || UseRTMLocking );
 
     MethodData* trap_mdo =
       get_method_data(thread, trap_method, create_if_missing);
@@ -1319,7 +1340,7 @@
         if (xtty != NULL)
           xtty->name(class_name);
       }
-      if (xtty != NULL && trap_mdo != NULL) {
+      if (xtty != NULL && trap_mdo != NULL && (int)reason < (int)MethodData::_trap_hist_limit) {
         // Dump the relevant MDO state.
         // This is the deopt count for the current reason, any previous
         // reasons or recompiles seen at this point.
@@ -1419,7 +1440,7 @@
     //
     // The other actions cause immediate removal of the present code.
 
-    bool update_trap_state = true;
+    bool update_trap_state = (reason != Reason_tenured);
     bool make_not_entrant = false;
     bool make_not_compilable = false;
     bool reprofile = false;
@@ -1546,7 +1567,6 @@
       if (make_not_entrant && maybe_prior_recompile && maybe_prior_trap) {
         reprofile = true;
       }
-
     }
 
     // Take requested actions on the method:
@@ -1575,6 +1595,11 @@
         trap_mdo->atomic_set_rtm_state(ProfileRTM);
       }
 #endif
+      // For code aging we count traps separately here, using make_not_entrant()
+      // as a guard against simultaneous deopts in multiple threads.
+      if (reason == Reason_tenured && trap_mdo != NULL) {
+        trap_mdo->inc_tenure_traps();
+      }
     }
 
     if (inc_recompile_count) {
@@ -1607,24 +1632,6 @@
 }
 JRT_END
 
-MethodData*
-Deoptimization::get_method_data(JavaThread* thread, methodHandle m,
-                                bool create_if_missing) {
-  Thread* THREAD = thread;
-  MethodData* mdo = m()->method_data();
-  if (mdo == NULL && create_if_missing && !HAS_PENDING_EXCEPTION) {
-    // Build an MDO.  Ignore errors like OutOfMemory;
-    // that simply means we won't have an MDO to update.
-    Method::build_interpreter_method_data(m, THREAD);
-    if (HAS_PENDING_EXCEPTION) {
-      assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
-      CLEAR_PENDING_EXCEPTION;
-    }
-    mdo = m()->method_data();
-  }
-  return mdo;
-}
-
 ProfileData*
 Deoptimization::query_update_method_data(MethodData* trap_mdo,
                                          int trap_bci,
@@ -1811,9 +1818,7 @@
 
 
 //--------------------------------statics--------------------------------------
-Deoptimization::DeoptAction Deoptimization::_unloaded_action
-  = Deoptimization::Action_reinterpret;
-const char* Deoptimization::_trap_reason_name[Reason_LIMIT] = {
+const char* Deoptimization::_trap_reason_name[] = {
   // Note:  Keep this in sync. with enum DeoptReason.
   "none",
   "null_check",
@@ -1834,9 +1839,10 @@
   "loop_limit_check",
   "speculate_class_check",
   "speculate_null_check",
-  "rtm_state_change"
+  "rtm_state_change",
+  "tenured"
 };
-const char* Deoptimization::_trap_action_name[Action_LIMIT] = {
+const char* Deoptimization::_trap_action_name[] = {
   // Note:  Keep this in sync. with enum DeoptAction.
   "none",
   "maybe_recompile",
@@ -1846,6 +1852,9 @@
 };
 
 const char* Deoptimization::trap_reason_name(int reason) {
+  // Check that every reason has a name
+  STATIC_ASSERT(sizeof(_trap_reason_name)/sizeof(const char*) == Reason_LIMIT);
+
   if (reason == Reason_many)  return "many";
   if ((uint)reason < Reason_LIMIT)
     return _trap_reason_name[reason];
@@ -1854,6 +1863,9 @@
   return buf;
 }
 const char* Deoptimization::trap_action_name(int action) {
+  // Check that every action has a name
+  STATIC_ASSERT(sizeof(_trap_action_name)/sizeof(const char*) == Action_LIMIT);
+
   if ((uint)action < Action_LIMIT)
     return _trap_action_name[action];
   static char buf[20];
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -62,6 +62,7 @@
     Reason_speculate_class_check, // saw unexpected object class from type speculation
     Reason_speculate_null_check,  // saw unexpected null from type speculation
     Reason_rtm_state_change,      // rtm state change detected
+    Reason_tenured,               // age of the code has reached the limit
     Reason_LIMIT,
     // Note:  Keep this enum in sync. with _trap_reason_name.
     Reason_RECORDED_LIMIT = Reason_bimorphic  // some are not recorded per bc
@@ -357,8 +358,8 @@
   // returning to a deoptimized caller
   static void popframe_preserve_args(JavaThread* thread, int bytes_to_save, void* start_address);
 
+  static MethodData* get_method_data(JavaThread* thread, methodHandle m, bool create_if_missing);
  private:
-  static MethodData* get_method_data(JavaThread* thread, methodHandle m, bool create_if_missing);
   // Update the mdo's count and per-BCI reason bits, returning previous state:
   static ProfileData* query_update_method_data(MethodData* trap_mdo,
                                                int trap_bci,
@@ -375,8 +376,8 @@
   static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread);
 
   static DeoptAction _unloaded_action; // == Action_reinterpret;
-  static const char* _trap_reason_name[Reason_LIMIT];
-  static const char* _trap_action_name[Action_LIMIT];
+  static const char* _trap_reason_name[];
+  static const char* _trap_action_name[];
 
   static juint _deoptimization_hist[Reason_LIMIT][1+Action_LIMIT][BC_CASE_LIMIT];
   // Note:  Histogram array size is 1-2 Kb.
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 #include "runtime/vframe.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Static fields of FlatProfiler
 int               FlatProfiler::received_gc_ticks   = 0;
 int               FlatProfiler::vm_operation_ticks  = 0;
@@ -309,7 +311,7 @@
     st->fill_to(col2);
     t->print_native(st);
     st->fill_to(col3);
-    st->print(msg);
+    st->print("%s", msg);
     st->cr();
   }
 
--- a/hotspot/src/share/vm/runtime/frame.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/frame.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,6 +62,8 @@
 # include "nativeInst_ppc.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 RegisterMap::RegisterMap(JavaThread *thread, bool update_map) {
   _thread         = thread;
   _update_map     = update_map;
--- a/hotspot/src/share/vm/runtime/globals.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/globals.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,8 @@
 #include "shark/shark_globals.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 RUNTIME_FLAGS(MATERIALIZE_DEVELOPER_FLAG, MATERIALIZE_PD_DEVELOPER_FLAG, \
               MATERIALIZE_PRODUCT_FLAG, MATERIALIZE_PD_PRODUCT_FLAG, \
               MATERIALIZE_DIAGNOSTIC_FLAG, MATERIALIZE_EXPERIMENTAL_FLAG, \
@@ -283,6 +285,7 @@
 // Length of format string (e.g. "%.1234s") for printing ccstr below
 #define FORMAT_BUFFER_LEN 16
 
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 void Flag::print_on(outputStream* st, bool withComments) {
   // Don't print notproduct and develop flags in a product build.
   if (is_constant_in_binary()) {
@@ -315,7 +318,10 @@
         size_t llen = pointer_delta(eol, cp, sizeof(char));
         jio_snprintf(format_buffer, FORMAT_BUFFER_LEN,
             "%%." SIZE_FORMAT "s", llen);
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
         st->print(format_buffer, cp);
+PRAGMA_DIAG_POP
         st->cr();
         cp = eol+1;
         st->print("%5s %-35s += ", "", _name);
@@ -372,7 +378,7 @@
         } else {
           st->print(" ");
         }
-        st->print(d.name);
+        st->print("%s", d.name);
       }
     }
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -177,7 +177,6 @@
 define_pd_global(bool, TieredCompilation,            false);
 
 define_pd_global(intx, CompileThreshold,             0);
-define_pd_global(intx, BackEdgeThreshold,            0);
 
 define_pd_global(intx, OnStackReplacePercentage,     0);
 define_pd_global(bool, ResizeTLAB,                   false);
@@ -525,13 +524,6 @@
   product_pd(bool, UseMembar,                                               \
           "(Unstable) Issues membars on thread state transitions")          \
                                                                             \
-  /* Temp PPC Flag to allow disabling the use of lwsync on ppc platforms    \
-   * that don't support it.  This will be replaced by processor detection   \
-   * logic.                                                                 \
-   */                                                                       \
-  product(bool, UsePPCLWSYNC, true,                                         \
-          "Use lwsync instruction if true, else use slower sync")           \
-                                                                            \
   develop(bool, CleanChunkPoolAsync, falseInEmbedded,                       \
           "Clean the chunk pool asynchronously")                            \
                                                                             \
@@ -2562,6 +2554,20 @@
   diagnostic(bool, PrintMethodFlushingStatistics, false,                    \
           "print statistics about method flushing")                         \
                                                                             \
+  diagnostic(intx, HotMethodDetectionLimit, 100000,                         \
+          "Number of compiled code invocations after which "                \
+          "the method is considered as hot by the flusher")                 \
+                                                                            \
+  diagnostic(intx, MinPassesBeforeFlush, 10,                                \
+          "Minimum number of sweeper passes before an nmethod "             \
+          "can be flushed")                                                 \
+                                                                            \
+  product(bool, UseCodeAging, true,                                         \
+          "Insert counter to detect warm methods")                          \
+                                                                            \
+  diagnostic(bool, StressCodeAging, false,                                  \
+          "Start with counters compiled in")                                \
+                                                                            \
   develop(bool, UseRelocIndex, false,                                       \
           "Use an index to speed random access to relocations")             \
                                                                             \
@@ -3525,10 +3531,6 @@
   product_pd(intx, CompileThreshold,                                        \
           "number of interpreted method invocations before (re-)compiling") \
                                                                             \
-  product_pd(intx, BackEdgeThreshold,                                       \
-          "Interpreter Back edge threshold at which an OSR compilation is " \
-          "invoked")                                                        \
-                                                                            \
   product(intx, Tier0InvokeNotifyFreqLog, 7,                                \
           "Interpreter (tier 0) invocation notification frequency")         \
                                                                             \
@@ -3654,22 +3656,6 @@
                                                                             \
   /* New JDK 1.4 reflection implementation */                               \
                                                                             \
-  develop(bool, UseNewReflection, true,                                     \
-          "Temporary flag for transition to reflection based on dynamic "   \
-          "bytecode generation in 1.4; can no longer be turned off in 1.4 " \
-          "JDK, and is unneeded in 1.3 JDK, but marks most places VM "      \
-          "changes were needed")                                            \
-                                                                            \
-  develop(bool, VerifyReflectionBytecodes, false,                           \
-          "Force verification of 1.4 reflection bytecodes. Does not work "  \
-          "in situations like that described in 4486457 or for "            \
-          "constructors generated for serialization, so can not be enabled "\
-          "in product.")                                                    \
-                                                                            \
-  product(bool, ReflectionWrapResolutionErrors, true,                       \
-          "Temporary flag for transition to AbstractMethodError wrapped "   \
-          "in InvocationTargetException. See 6531596")                      \
-                                                                            \
   develop(intx, FastSuperclassLimit, 8,                                     \
           "Depth of hardwired instanceof accelerator array")                \
                                                                             \
--- a/hotspot/src/share/vm/runtime/handles.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,8 @@
 # include "os_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef ASSERT
 oop* HandleArea::allocate_handle(oop obj) {
   assert(_handle_mark_nesting > 1, "memory leak: allocating handle outside HandleMark");
--- a/hotspot/src/share/vm/runtime/init.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/init.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "code/icBuffer.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "interpreter/bytecodes.hpp"
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 #include "runtime/vframe.hpp"
 #include "utilities/preserveException.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of InterfaceSupport
 
--- a/hotspot/src/share/vm/runtime/java.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/java.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/classLoader.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "compiler/compileBroker.hpp"
@@ -97,6 +97,7 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 GrowableArray<Method*>* collected_profiled_methods;
 
@@ -366,7 +367,7 @@
       BaselineTTYOutputer outputer(tty);
       MemTracker::print_memory_usage(outputer, K, false);
     } else {
-      tty->print_cr(MemTracker::reason());
+      tty->print_cr("%s", MemTracker::reason());
     }
   }
 }
@@ -407,7 +408,7 @@
       BaselineTTYOutputer outputer(tty);
       MemTracker::print_memory_usage(outputer, K, false);
     } else {
-      tty->print_cr(MemTracker::reason());
+      tty->print_cr("%s", MemTracker::reason());
     }
   }
 }
--- a/hotspot/src/share/vm/runtime/jniHandles.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/jniHandles.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -30,6 +30,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/thread.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 JNIHandleBlock* JNIHandles::_global_handles       = NULL;
 JNIHandleBlock* JNIHandles::_weak_global_handles  = NULL;
--- a/hotspot/src/share/vm/runtime/mutex.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 # include "mutex_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
 //
 // Native Monitor-Mutex locking - theory of operations
--- a/hotspot/src/share/vm/runtime/os.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/os.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,8 @@
 
 # include <signal.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 OSThread*         os::_starting_thread    = NULL;
 address           os::_polling_page       = NULL;
 volatile int32_t* os::_mem_serialize_page = NULL;
@@ -909,9 +911,9 @@
 
     for (int i = 0; env_list[i] != NULL; i++) {
       if (getenv(env_list[i], buffer, len)) {
-        st->print(env_list[i]);
+        st->print("%s", env_list[i]);
         st->print("=");
-        st->print_cr(buffer);
+        st->print_cr("%s", buffer);
       }
     }
   }
@@ -1095,11 +1097,15 @@
 
   }
 
-  // Check if in metaspace.
-  if (ClassLoaderDataGraph::contains((address)addr)) {
-    // Use addr->print() from the debugger instead (not here)
-    st->print_cr(INTPTR_FORMAT
-                 " is pointing into metadata", addr);
+  // Check if in metaspace and print types that have vptrs (only method now)
+  if (Metaspace::contains(addr)) {
+    if (Method::has_method_vptr((const void*)addr)) {
+      ((Method*)addr)->print_value_on(st);
+      st->cr();
+    } else {
+      // Use addr->print() from the debugger instead (not here)
+      st->print_cr(INTPTR_FORMAT " is pointing into metadata", addr);
+    }
     return;
   }
 
--- a/hotspot/src/share/vm/runtime/osThread.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/osThread.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/osThread.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 OSThread::OSThread(OSThreadStartFunc start_proc, void* start_parm) {
   pd_initialize();
--- a/hotspot/src/share/vm/runtime/perfData.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/perfData.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,8 @@
 #include "utilities/exceptions.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PerfDataList*   PerfDataManager::_all = NULL;
 PerfDataList*   PerfDataManager::_sampled = NULL;
 PerfDataList*   PerfDataManager::_constants = NULL;
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -35,6 +35,8 @@
 #include "runtime/statSampler.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Prefix of performance data file.
 const char               PERFDATA_NAME[] = "hsperfdata";
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/runtime/prefetch.inline.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP
+#define SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP
+
+#include "runtime/prefetch.hpp"
+
+// Linux
+#ifdef TARGET_OS_ARCH_linux_x86
+# include "prefetch_linux_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_sparc
+# include "prefetch_linux_sparc.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_zero
+# include "prefetch_linux_zero.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_arm
+# include "prefetch_linux_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_ppc
+# include "prefetch_linux_ppc.inline.hpp"
+#endif
+
+// Solaris
+#ifdef TARGET_OS_ARCH_solaris_x86
+# include "prefetch_solaris_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_solaris_sparc
+# include "prefetch_solaris_sparc.inline.hpp"
+#endif
+
+// Windows
+#ifdef TARGET_OS_ARCH_windows_x86
+# include "prefetch_windows_x86.inline.hpp"
+#endif
+
+// AIX
+#ifdef TARGET_OS_ARCH_aix_ppc
+# include "prefetch_aix_ppc.inline.hpp"
+#endif
+
+// BSD
+#ifdef TARGET_OS_ARCH_bsd_x86
+# include "prefetch_bsd_x86.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_bsd_zero
+# include "prefetch_bsd_zero.inline.hpp"
+#endif
+
+#endif // SHARE_VM_RUNTIME_PREFETCH_INLINE_HPP
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/verifier.hpp"
 #include "classfile/vmSymbols.hpp"
@@ -466,7 +466,6 @@
   // New (1.4) reflection implementation. Allow all accesses from
   // sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
   if (   JDK_Version::is_gte_jdk14x_version()
-      && UseNewReflection
       && current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return true;
   }
@@ -571,7 +570,6 @@
   // New (1.4) reflection implementation. Allow all accesses from
   // sun/reflect/MagicAccessorImpl subclasses to succeed trivially.
   if (   JDK_Version::is_gte_jdk14x_version()
-      && UseNewReflection
       && current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return true;
   }
@@ -708,7 +706,7 @@
 }
 
 
-oop Reflection::new_method(methodHandle method, bool intern_name, bool for_constant_pool_access, TRAPS) {
+oop Reflection::new_method(methodHandle method, bool for_constant_pool_access, TRAPS) {
   // In jdk1.2.x, getMethods on an interface erroneously includes <clinit>, thus the complicated assert.
   // Also allow sun.reflect.ConstantPool to refer to <clinit> methods as java.lang.reflect.Methods.
   assert(!method()->is_initializer() ||
@@ -731,14 +729,8 @@
   if (exception_types.is_null()) return NULL;
 
   Symbol*  method_name = method->name();
-  Handle name;
-  if (intern_name) {
-    // intern_name is only true with UseNewReflection
-    oop name_oop = StringTable::intern(method_name, CHECK_NULL);
-    name = Handle(THREAD, name_oop);
-  } else {
-    name = java_lang_String::create_from_symbol(method_name, CHECK_NULL);
-  }
+  oop name_oop = StringTable::intern(method_name, CHECK_NULL);
+  Handle name = Handle(THREAD, name_oop);
   if (name == NULL) return NULL;
 
   int modifiers = method->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS;
@@ -825,16 +817,10 @@
 }
 
 
-oop Reflection::new_field(fieldDescriptor* fd, bool intern_name, TRAPS) {
+oop Reflection::new_field(fieldDescriptor* fd, TRAPS) {
   Symbol*  field_name = fd->name();
-  Handle name;
-  if (intern_name) {
-    // intern_name is only true with UseNewReflection
-    oop name_oop = StringTable::intern(field_name, CHECK_NULL);
-    name = Handle(THREAD, name_oop);
-  } else {
-    name = java_lang_String::create_from_symbol(field_name, CHECK_NULL);
-  }
+  oop name_oop = StringTable::intern(field_name, CHECK_NULL);
+  Handle name = Handle(THREAD, name_oop);
   Symbol*  signature  = fd->signature();
   instanceKlassHandle  holder    (THREAD, fd->field_holder());
   Handle type = new_type(signature, holder, CHECK_NULL);
@@ -933,27 +919,23 @@
       // resolve based on the receiver
       if (reflected_method->method_holder()->is_interface()) {
         // resolve interface call
-        if (ReflectionWrapResolutionErrors) {
-          // new default: 6531596
-          // Match resolution errors with those thrown due to reflection inlining
-          // Linktime resolution & IllegalAccessCheck already done by Class.getMethod()
-          method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
-          if (HAS_PENDING_EXCEPTION) {
-          // Method resolution threw an exception; wrap it in an InvocationTargetException
-            oop resolution_exception = PENDING_EXCEPTION;
-            CLEAR_PENDING_EXCEPTION;
-            // JVMTI has already reported the pending exception
-            // JVMTI internal flag reset is needed in order to report InvocationTargetException
-            if (THREAD->is_Java_thread()) {
-              JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
-            }
-            JavaCallArguments args(Handle(THREAD, resolution_exception));
-            THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
-                vmSymbols::throwable_void_signature(),
-                &args);
+        //
+        // Match resolution errors with those thrown due to reflection inlining
+        // Linktime resolution & IllegalAccessCheck already done by Class.getMethod()
+        method = resolve_interface_call(klass, reflected_method, target_klass, receiver, THREAD);
+        if (HAS_PENDING_EXCEPTION) {
+        // Method resolution threw an exception; wrap it in an InvocationTargetException
+          oop resolution_exception = PENDING_EXCEPTION;
+          CLEAR_PENDING_EXCEPTION;
+          // JVMTI has already reported the pending exception
+          // JVMTI internal flag reset is needed in order to report InvocationTargetException
+          if (THREAD->is_Java_thread()) {
+            JvmtiExport::clear_detected_exception((JavaThread*) THREAD);
           }
-        } else {
-          method = resolve_interface_call(klass, reflected_method, target_klass, receiver, CHECK_(NULL));
+          JavaCallArguments args(Handle(THREAD, resolution_exception));
+          THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
+              vmSymbols::throwable_void_signature(),
+              &args);
         }
       }  else {
         // if the method can be overridden, we resolve using the vtable index.
@@ -970,24 +952,16 @@
           // Check for abstract methods as well
           if (method->is_abstract()) {
             // new default: 6531596
-            if (ReflectionWrapResolutionErrors) {
-              ResourceMark rm(THREAD);
-              Handle h_origexception = Exceptions::new_exception(THREAD,
-                     vmSymbols::java_lang_AbstractMethodError(),
-                     Method::name_and_sig_as_C_string(target_klass(),
-                     method->name(),
-                     method->signature()));
-              JavaCallArguments args(h_origexception);
-              THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
-                vmSymbols::throwable_void_signature(),
-                &args);
-            } else {
-              ResourceMark rm(THREAD);
-              THROW_MSG_0(vmSymbols::java_lang_AbstractMethodError(),
-                        Method::name_and_sig_as_C_string(target_klass(),
-                                                                method->name(),
-                                                                method->signature()));
-            }
+            ResourceMark rm(THREAD);
+            Handle h_origexception = Exceptions::new_exception(THREAD,
+                   vmSymbols::java_lang_AbstractMethodError(),
+                   Method::name_and_sig_as_C_string(target_klass(),
+                   method->name(),
+                   method->signature()));
+            JavaCallArguments args(h_origexception);
+            THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
+              vmSymbols::throwable_void_signature(),
+              &args);
           }
         }
       }
@@ -1006,7 +980,7 @@
 
   // In the JDK 1.4 reflection implementation, the security check is
   // done at the Java level
-  if (!(JDK_Version::is_gte_jdk14x_version() && UseNewReflection)) {
+  if (!JDK_Version::is_gte_jdk14x_version()) {
 
   // Access checking (unless overridden by Method)
   if (!override) {
@@ -1018,7 +992,7 @@
     }
   }
 
-  } // !(Universe::is_gte_jdk14x_version() && UseNewReflection)
+  } // !Universe::is_gte_jdk14x_version()
 
   assert(ptypes->is_objArray(), "just checking");
   int args_len = args.is_null() ? 0 : args->length();
--- a/hotspot/src/share/vm/runtime/reflection.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/reflection.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,11 +113,11 @@
   //
 
   // Create a java.lang.reflect.Method object based on a method
-  static oop new_method(methodHandle method, bool intern_name, bool for_constant_pool_access, TRAPS);
+  static oop new_method(methodHandle method, bool for_constant_pool_access, TRAPS);
   // Create a java.lang.reflect.Constructor object based on a method
   static oop new_constructor(methodHandle method, TRAPS);
   // Create a java.lang.reflect.Field object based on a field descriptor
-  static oop new_field(fieldDescriptor* fd, bool intern_name, TRAPS);
+  static oop new_field(fieldDescriptor* fd, TRAPS);
   // Create a java.lang.reflect.Parameter object based on a
   // MethodParameterElement
   static oop new_parameter(Handle method, int index, Symbol* sym,
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -23,7 +23,7 @@
  */
 
 #include "precompiled.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
@@ -82,6 +82,8 @@
 #include "c1/c1_globals.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // --------------------------------------------------------------------------------------------------
 // Implementation of Safepoint begin/end
 
@@ -539,6 +541,13 @@
     gclog_or_tty->rotate_log(false);
   }
 
+  {
+    // CMS delays purging the CLDG until the beginning of the next safepoint and to
+    // make sure concurrent sweep is done
+    TraceTime t7("purging class loader data graph", TraceSafepointCleanupTime);
+    ClassLoaderDataGraph::purge_if_needed();
+  }
+
   if (MemTracker::is_on()) {
     MemTracker::sync();
   }
@@ -787,7 +796,7 @@
   old_sp += incr*32;  new_sp += incr*32;  was_oops += incr*32;
   for( int i2=0; i2<16; i2++ ) {
     tty->print("call %c%d |"PTR_FORMAT" ","LI"[i2>>3],i2&7,new_sp); print_ptrs(*old_sp++,*new_sp++,*was_oops++); }
-  tty->print_cr("");
+  tty->cr();
 }
 #endif  // SPARC
 #endif  // PRODUCT
@@ -829,7 +838,7 @@
     timeout_error_printed = true;
     // Print out the thread info which didn't reach the safepoint for debugging
     // purposes (useful when there are lots of threads in the debugger).
-    tty->print_cr("");
+    tty->cr();
     tty->print_cr("# SafepointSynchronize::begin: Timeout detected:");
     if (reason ==  _spinning_timeout) {
       tty->print_cr("# SafepointSynchronize::begin: Timed out while spinning to reach a safepoint.");
@@ -849,7 +858,7 @@
            (reason == _blocking_timeout && !cur_state->has_called_back()))) {
         tty->print("# ");
         cur_thread->print();
-        tty->print_cr("");
+        tty->cr();
       }
     }
     tty->print_cr("# SafepointSynchronize::begin: (End of list)");
@@ -1322,7 +1331,7 @@
        spstat->_time_to_sync > PrintSafepointStatisticsTimeout * MICROUNITS) {
     print_statistics();
   }
-  tty->print_cr("");
+  tty->cr();
 
   // Print out polling page sampling status.
   if (!need_to_track_page_armed_status) {
--- a/hotspot/src/share/vm/runtime/safepoint.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/safepoint.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -174,7 +174,7 @@
 
   // Debugging
   static void print_state()                                PRODUCT_RETURN;
-  static void safepoint_msg(const char* format, ...)       PRODUCT_RETURN;
+  static void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(1, 2) PRODUCT_RETURN;
 
   static void deferred_initialize_stat();
   static void print_stat_on_exit();
@@ -240,7 +240,7 @@
   static void create(JavaThread *thread);
   static void destroy(JavaThread *thread);
 
-  void safepoint_msg(const char* format, ...) {
+  void safepoint_msg(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
     if (ShowSafepointMsgs) {
       va_list ap;
       va_start(ap, format);
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -82,6 +82,8 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Shared stub locations
 RuntimeStub*        SharedRuntime::_wrong_method_blob;
 RuntimeStub*        SharedRuntime::_wrong_method_abstract_blob;
--- a/hotspot/src/share/vm/runtime/signature.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/signature.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 #include "oops/typeArrayKlass.hpp"
 #include "runtime/signature.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of SignatureIterator
 
--- a/hotspot/src/share/vm/runtime/stackValue.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/stackValue.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -196,7 +196,7 @@
 
     case T_OBJECT:
      _o()->print_value_on(st);
-      st->print(" <" INTPTR_FORMAT ">", (address)_o());
+      st->print(" <" INTPTR_FORMAT ">", p2i((address)_o()));
      break;
 
     case T_CONFLICT:
--- a/hotspot/src/share/vm/runtime/stackValueCollection.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/stackValueCollection.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,8 @@
 # include "jniTypes_ppc.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 jint StackValueCollection::int_at(int slot) const {
   intptr_t val =  at(slot)->get_int();
   jint ival = *((jint*) (&val));
--- a/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/stubCodeGenerator.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -60,10 +60,10 @@
 
 
 void StubCodeDesc::print_on(outputStream* st) const {
-  st->print(group());
+  st->print("%s", group());
   st->print("::");
-  st->print(name());
-  st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", begin(), end(), size_in_bytes());
+  st->print("%s", name());
+  st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT "[ (%d bytes)", p2i(begin()), p2i(end()), size_in_bytes());
 }
 
 // Implementation of StubCodeGenerator
--- a/hotspot/src/share/vm/runtime/sweeper.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,8 @@
 #include "utilities/ticks.inline.hpp"
 #include "utilities/xmlstream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef ASSERT
 
 #define SWEEP(nm) record_sweep(nm, __LINE__)
@@ -571,37 +573,7 @@
       SWEEP(nm);
     }
   } else {
-    if (UseCodeCacheFlushing) {
-      if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) {
-        // Do not make native methods and OSR-methods not-entrant
-        nm->dec_hotness_counter();
-        // Get the initial value of the hotness counter. This value depends on the
-        // ReservedCodeCacheSize
-        int reset_val = hotness_counter_reset_val();
-        int time_since_reset = reset_val - nm->hotness_counter();
-        double threshold = -reset_val + (CodeCache::reverse_free_ratio() * NmethodSweepActivity);
-        // The less free space in the code cache we have - the bigger reverse_free_ratio() is.
-        // I.e., 'threshold' increases with lower available space in the code cache and a higher
-        // NmethodSweepActivity. If the current hotness counter - which decreases from its initial
-        // value until it is reset by stack walking - is smaller than the computed threshold, the
-        // corresponding nmethod is considered for removal.
-        if ((NmethodSweepActivity > 0) && (nm->hotness_counter() < threshold) && (time_since_reset > 10)) {
-          // A method is marked as not-entrant if the method is
-          // 1) 'old enough': nm->hotness_counter() < threshold
-          // 2) The method was in_use for a minimum amount of time: (time_since_reset > 10)
-          //    The second condition is necessary if we are dealing with very small code cache
-          //    sizes (e.g., <10m) and the code cache size is too small to hold all hot methods.
-          //    The second condition ensures that methods are not immediately made not-entrant
-          //    after compilation.
-          nm->make_not_entrant();
-          // Code cache state change is tracked in make_not_entrant()
-          if (PrintMethodFlushing && Verbose) {
-            tty->print_cr("### Nmethod %d/" PTR_FORMAT "made not-entrant: hotness counter %d/%d threshold %f",
-                          nm->compile_id(), nm, nm->hotness_counter(), reset_val, threshold);
-          }
-        }
-      }
-    }
+    possibly_flush(nm);
     // Clean-up all inline caches that point to zombie/non-reentrant methods
     MutexLocker cl(CompiledIC_lock);
     nm->cleanup_inline_caches();
@@ -610,6 +582,93 @@
   return freed_memory;
 }
 
+
+void NMethodSweeper::possibly_flush(nmethod* nm) {
+  if (UseCodeCacheFlushing) {
+    if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) {
+      bool make_not_entrant = false;
+
+      // Do not make native methods and OSR-methods not-entrant
+      nm->dec_hotness_counter();
+      // Get the initial value of the hotness counter. This value depends on the
+      // ReservedCodeCacheSize
+      int reset_val = hotness_counter_reset_val();
+      int time_since_reset = reset_val - nm->hotness_counter();
+      double threshold = -reset_val + (CodeCache::reverse_free_ratio() * NmethodSweepActivity);
+      // The less free space in the code cache we have - the bigger reverse_free_ratio() is.
+      // I.e., 'threshold' increases with lower available space in the code cache and a higher
+      // NmethodSweepActivity. If the current hotness counter - which decreases from its initial
+      // value until it is reset by stack walking - is smaller than the computed threshold, the
+      // corresponding nmethod is considered for removal.
+      if ((NmethodSweepActivity > 0) && (nm->hotness_counter() < threshold) && (time_since_reset > MinPassesBeforeFlush)) {
+        // A method is marked as not-entrant if the method is
+        // 1) 'old enough': nm->hotness_counter() < threshold
+        // 2) The method was in_use for a minimum amount of time: (time_since_reset > MinPassesBeforeFlush)
+        //    The second condition is necessary if we are dealing with very small code cache
+        //    sizes (e.g., <10m) and the code cache size is too small to hold all hot methods.
+        //    The second condition ensures that methods are not immediately made not-entrant
+        //    after compilation.
+        make_not_entrant = true;
+      }
+
+      // The stack-scanning low-cost detection may not see the method was used (which can happen for
+      // flat profiles). Check the age counter for possible data.
+      if (UseCodeAging && make_not_entrant && (nm->is_compiled_by_c2() || nm->is_compiled_by_c1())) {
+        MethodCounters* mc = nm->method()->method_counters();
+        if (mc == NULL) {
+          // Sometimes we can get here without MethodCounters. For example if we run with -Xcomp.
+          // Try to allocate them.
+          mc = Method::build_method_counters(nm->method(), Thread::current());
+        }
+        if (mc != NULL) {
+          // Snapshot the value as it's changed concurrently
+          int age = mc->nmethod_age();
+          if (MethodCounters::is_nmethod_hot(age)) {
+            // The method has gone through flushing, and it became relatively hot that it deopted
+            // before we could take a look at it. Give it more time to appear in the stack traces,
+            // proportional to the number of deopts.
+            MethodData* md = nm->method()->method_data();
+            if (md != NULL && time_since_reset > (int)(MinPassesBeforeFlush * (md->tenure_traps() + 1))) {
+              // It's been long enough, we still haven't seen it on stack.
+              // Try to flush it, but enable counters the next time.
+              mc->reset_nmethod_age();
+            } else {
+              make_not_entrant = false;
+            }
+          } else if (MethodCounters::is_nmethod_warm(age)) {
+            // Method has counters enabled, and the method was used within
+            // previous MinPassesBeforeFlush sweeps. Reset the counter. Stay in the existing
+            // compiled state.
+            mc->reset_nmethod_age();
+            // delay the next check
+            nm->set_hotness_counter(NMethodSweeper::hotness_counter_reset_val());
+            make_not_entrant = false;
+          } else if (MethodCounters::is_nmethod_age_unset(age)) {
+            // No counters were used before. Set the counters to the detection
+            // limit value. If the method is going to be used again it will be compiled
+            // with counters that we're going to use for analysis the the next time.
+            mc->reset_nmethod_age();
+          } else {
+            // Method was totally idle for 10 sweeps
+            // The counter already has the initial value, flush it and may be recompile
+            // later with counters
+          }
+        }
+      }
+
+      if (make_not_entrant) {
+        nm->make_not_entrant();
+
+        // Code cache state change is tracked in make_not_entrant()
+        if (PrintMethodFlushing && Verbose) {
+          tty->print_cr("### Nmethod %d/" PTR_FORMAT "made not-entrant: hotness counter %d/%d threshold %f",
+              nm->compile_id(), nm, nm->hotness_counter(), reset_val, threshold);
+        }
+      }
+    }
+  }
+}
+
 // Print out some state information about the current sweep and the
 // state of the code cache if it's requested.
 void NMethodSweeper::log_sweep(const char* msg, const char* format, ...) {
@@ -627,7 +686,7 @@
       tty->vprint(format, ap);
       va_end(ap);
     }
-    tty->print_cr(s.as_string());
+    tty->print_cr("%s", s.as_string());
   }
 
   if (LogCompilation && (xtty != NULL)) {
@@ -644,7 +703,7 @@
       xtty->vprint(format, ap);
       va_end(ap);
     }
-    xtty->print(s.as_string());
+    xtty->print("%s", s.as_string());
     xtty->stamp();
     xtty->end_elem();
   }
--- a/hotspot/src/share/vm/runtime/sweeper.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
   static const Tickspan total_time_sweeping()      { return _total_time_sweeping; }
   static const Tickspan peak_sweep_time()          { return _peak_sweep_time; }
   static const Tickspan peak_sweep_fraction_time() { return _peak_sweep_fraction_time; }
-  static void log_sweep(const char* msg, const char* format = NULL, ...);
+  static void log_sweep(const char* msg, const char* format = NULL, ...) ATTRIBUTE_PRINTF(2, 3);
 
 
 #ifdef ASSERT
@@ -111,6 +111,7 @@
   static int hotness_counter_reset_val();
   static void report_state_change(nmethod* nm);
   static void possibly_enable_sweeper();
+  static void possibly_flush(nmethod* nm);
   static void print();   // Printing/debugging
 };
 
--- a/hotspot/src/share/vm/runtime/synchronizer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/synchronizer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -60,6 +60,8 @@
   #define ATTR
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // The "core" versions of monitor enter and exit reside in this file.
 // The interpreter and compilers contain specialized transliterated
 // variants of the enter-exit fast-path operations.  See i486.ad fast_lock(),
--- a/hotspot/src/share/vm/runtime/thread.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -112,6 +112,8 @@
 #include "runtime/rtmLocking.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef DTRACE_ENABLED
 
 // Only bother with this argument setup if dtrace is available
@@ -4273,7 +4275,7 @@
 // Threads::print_on() is called at safepoint by VM_PrintThreads operation.
 void Threads::print_on(outputStream* st, bool print_stacks, bool internal_format, bool print_concurrent_locks) {
   char buf[32];
-  st->print_cr(os::local_time_string(buf, sizeof(buf)));
+  st->print_cr("%s", os::local_time_string(buf, sizeof(buf)));
 
   st->print_cr("Full thread dump %s (%s %s):",
                 Abstract_VM_Version::vm_name(),
--- a/hotspot/src/share/vm/runtime/thread.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -684,7 +684,7 @@
   NamedThread();
   ~NamedThread();
   // May only be called once per thread.
-  void set_name(const char* format, ...);
+  void set_name(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3);
   virtual bool is_Named_thread() const { return true; }
   virtual char* name() const { return _name == NULL ? (char*)"Unknown Thread" : _name; }
   JavaThread *processed_thread() { return _processed_thread; }
--- a/hotspot/src/share/vm/runtime/timer.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/timer.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -204,7 +204,7 @@
       _logfile->print("[Error in TraceCPUTime]");
     }
     if (_print_cr) {
-      _logfile->print_cr("");
+      _logfile->cr();
     }
     _logfile->flush();
   }
--- a/hotspot/src/share/vm/runtime/unhandledOops.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/unhandledOops.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
 #include "runtime/unhandledOops.hpp"
 #include "utilities/globalDefinitions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef CHECK_UNHANDLED_OOPS
 const int free_list_size = 256;
 
--- a/hotspot/src/share/vm/runtime/vframe.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/vframe.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,8 @@
 #include "runtime/vframeArray.hpp"
 #include "runtime/vframe_hp.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 vframe::vframe(const frame* fr, const RegisterMap* reg_map, JavaThread* thread)
 : _reg_map(reg_map), _thread(thread) {
   assert(fr != NULL, "must have frame");
@@ -471,7 +473,7 @@
 
 void vframeStreamCommon::skip_reflection_related_frames() {
   while (!at_end() &&
-         (JDK_Version::is_gte_jdk14x_version() && UseNewReflection &&
+         (JDK_Version::is_gte_jdk14x_version() &&
           (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
            method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
     next();
--- a/hotspot/src/share/vm/runtime/vframe.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/vframe.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -399,7 +399,7 @@
     if (WizardMode) {
       tty->print_cr("Error in fill_from_frame: pc_desc for "
                     INTPTR_FORMAT " not found or invalid at %d",
-                    _frame.pc(), decode_offset);
+                    p2i(_frame.pc()), decode_offset);
       nm()->print();
       nm()->method()->print_codes();
       nm()->print_code();
--- a/hotspot/src/share/vm/runtime/vframeArray.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 int vframeArrayElement:: bci(void) const { return (_bci == SynchronizationEntryBCI ? 0 : _bci); }
 
--- a/hotspot/src/share/vm/runtime/virtualspace.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/virtualspace.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
 # include "os_bsd.inline.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // ReservedSpace
 
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -27,6 +27,7 @@
 #include "classfile/javaClasses.hpp"
 #include "classfile/loaderConstraints.hpp"
 #include "classfile/placeholders.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "ci/ciField.hpp"
 #include "ci/ciInstance.hpp"
@@ -353,6 +354,7 @@
   nonstatic_field(MethodData,           _method,                                       Method*)                               \
   nonstatic_field(MethodData,           _data_size,                                    int)                                   \
   nonstatic_field(MethodData,           _data[0],                                      intptr_t)                              \
+  nonstatic_field(MethodData,           _parameters_type_data_di,                      int)                                   \
   nonstatic_field(MethodData,           _nof_decompiles,                               uint)                                  \
   nonstatic_field(MethodData,           _nof_overflow_recompiles,                      uint)                                  \
   nonstatic_field(MethodData,           _nof_overflow_traps,                           uint)                                  \
@@ -361,10 +363,12 @@
   nonstatic_field(MethodData,           _arg_local,                                    intx)                                  \
   nonstatic_field(MethodData,           _arg_stack,                                    intx)                                  \
   nonstatic_field(MethodData,           _arg_returned,                                 intx)                                  \
+  nonstatic_field(MethodData,           _tenure_traps,                                 uint)                                  \
   nonstatic_field(DataLayout,           _header._struct._tag,                          u1)                                    \
   nonstatic_field(DataLayout,           _header._struct._flags,                        u1)                                    \
   nonstatic_field(DataLayout,           _header._struct._bci,                          u2)                                    \
   nonstatic_field(DataLayout,           _cells[0],                                     intptr_t)                              \
+  nonstatic_field(MethodCounters,       _nmethod_age,                                  int)                                   \
   nonstatic_field(MethodCounters,       _interpreter_invocation_count,                 int)                                   \
   nonstatic_field(MethodCounters,       _interpreter_throwout_count,                   u2)                                    \
   nonstatic_field(MethodCounters,       _number_of_breakpoints,                        u2)                                    \
@@ -2497,6 +2501,10 @@
   declare_constant(Deoptimization::Reason_age)                            \
   declare_constant(Deoptimization::Reason_predicate)                      \
   declare_constant(Deoptimization::Reason_loop_limit_check)               \
+  declare_constant(Deoptimization::Reason_speculate_class_check)          \
+  declare_constant(Deoptimization::Reason_speculate_null_check)           \
+  declare_constant(Deoptimization::Reason_rtm_state_change)               \
+  declare_constant(Deoptimization::Reason_tenured)                        \
   declare_constant(Deoptimization::Reason_LIMIT)                          \
   declare_constant(Deoptimization::Reason_RECORDED_LIMIT)                 \
                                                                           \
--- a/hotspot/src/share/vm/runtime/vmThread.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/vmThread.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,8 @@
 #include "utilities/events.hpp"
 #include "utilities/xmlstream.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Dummy VM operation to act as first element in our circular double-linked list
 class VM_Dummy: public VM_Operation {
   VMOp_Type type() const { return VMOp_Dummy; }
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,8 @@
 #include "services/threadService.hpp"
 #include "trace/tracing.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define VM_OP_NAME_INITIALIZE(name) #name,
 
 const char* VM_Operation::_names[VM_Operation::VMOp_Terminating] = \
--- a/hotspot/src/share/vm/runtime/vm_version.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/runtime/vm_version.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
   set_version_field(&_vm_minor_version, JDK_MINOR_VERSION, "bad minor version");
   set_version_field(&_vm_micro_version, JDK_MICRO_VERSION, "bad micro version");
   int offset = (JDK_BUILD_NUMBER != NULL && JDK_BUILD_NUMBER[0] == 'b') ? 1 : 0;
-  set_version_field(&_vm_build_number, JDK_BUILD_NUMBER + offset,
+  set_version_field(&_vm_build_number, &JDK_BUILD_NUMBER[offset],
                     "bad build number");
 
   _initialized = true;
--- a/hotspot/src/share/vm/services/attachListener.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -284,15 +284,15 @@
   }
 
   if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
-    FormatBuffer<80> err_msg("");
+    FormatBuffer<80> err_msg("%s", "");
     if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) {
-      out->print_cr(err_msg.buffer());
+      out->print_cr("%s", err_msg.buffer());
       return JNI_ERR;
     }
   } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
-    FormatBuffer<80> err_msg("");
+    FormatBuffer<80> err_msg("%s", "");
     if (!Arguments::verify_MinHeapFreeRatio(err_msg, value)) {
-      out->print_cr(err_msg.buffer());
+      out->print_cr("%s", err_msg.buffer());
       return JNI_ERR;
     }
   }
@@ -381,7 +381,7 @@
   Flag* f = Flag::find_flag((char*)name, strlen(name));
   if (f) {
     f->print_as_flag(out);
-    out->print_cr("");
+    out->cr();
   } else {
     out->print_cr("no such flag '%s'", name);
   }
--- a/hotspot/src/share/vm/services/classLoadingService.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/classLoadingService.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -136,7 +136,7 @@
 
   if (TraceClassUnloading) {
     ResourceMark rm;
-    tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), k);
+    tty->print_cr("[Unloading class %s " INTPTR_FORMAT "]", k->external_name(), p2i(k));
   }
 }
 
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,8 @@
 #include "services/management.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void DCmdRegistrant::register_dcmds(){
   // Registration of the diagnostic commands
   // First argument specifies which interfaces will export the command
@@ -101,7 +103,7 @@
     if (factory != NULL) {
       output()->print_cr("%s%s", factory->name(),
                          factory->is_enabled() ? "" : " [disabled]");
-      output()->print_cr(factory->description());
+      output()->print_cr("%s", factory->description());
       output()->print_cr("\nImpact: %s", factory->impact());
       JavaPermission p = factory->permission();
       if(p._class != NULL) {
--- a/hotspot/src/share/vm/services/diagnosticFramework.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -259,7 +259,7 @@
     }
     arg = arg->next();
   }
-  out->print_cr("");
+  out->cr();
   if (_arguments_list != NULL) {
     out->print_cr("\nArguments:");
     arg = _arguments_list;
@@ -268,7 +268,7 @@
                  arg->is_mandatory() ? "" : "[optional]",
                  arg->description(), arg->type());
       if (arg->has_default()) {
-        out->print(arg->default_string());
+        out->print("%s", arg->default_string());
       } else {
         out->print("no default value");
       }
@@ -284,7 +284,7 @@
                  arg->is_mandatory() ? "" : "[optional]",
                  arg->description(), arg->type());
       if (arg->has_default()) {
-        out->print(arg->default_string());
+        out->print("%s", arg->default_string());
       } else {
         out->print("no default value");
       }
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1842,6 +1842,7 @@
 }
 
 // dump the heap to given path.
+PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
 int HeapDumper::dump(const char* path) {
   assert(path != NULL && strlen(path) > 0, "path missing");
 
@@ -1882,7 +1883,10 @@
       char msg[256];
       sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]",
         JLONG_FORMAT, timer()->seconds());
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
       tty->print_cr(msg, writer.bytes_written());
+PRAGMA_DIAG_POP
     } else {
       tty->print_cr("Dump file is incomplete: %s", writer.error());
     }
--- a/hotspot/src/share/vm/services/lowMemoryDetector.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -353,7 +353,7 @@
 
 #ifndef PRODUCT
 void SensorInfo::print() {
-  tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %ld pending_clears = %ld",
+  tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %d pending_clears = %d",
                 (_sensor_on ? "on" : "off"),
                 _sensor_count, _pending_trigger_count, _pending_clear_count);
 }
--- a/hotspot/src/share/vm/services/management.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/management.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,8 @@
 #include "services/threadService.hpp"
 #include "utilities/macros.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 PerfVariable* Management::_begin_vm_creation_time = NULL;
 PerfVariable* Management::_end_vm_creation_time = NULL;
 PerfVariable* Management::_vm_init_done_time = NULL;
@@ -1839,12 +1841,12 @@
     uintx uvalue = (uintx)new_value.j;
 
     if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
-      FormatBuffer<80> err_msg("");
+      FormatBuffer<80> err_msg("%s", "");
       if (!Arguments::verify_MaxHeapFreeRatio(err_msg, uvalue)) {
         THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer());
       }
     } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
-      FormatBuffer<80> err_msg("");
+      FormatBuffer<80> err_msg("%s", "");
       if (!Arguments::verify_MinHeapFreeRatio(err_msg, uvalue)) {
         THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), err_msg.buffer());
       }
--- a/hotspot/src/share/vm/services/memReporter.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/memReporter.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "services/memPtrArray.hpp"
 #include "services/memTracker.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 const char* BaselineOutputer::memory_unit(size_t scale) {
   switch(scale) {
     case K: return "KB";
--- a/hotspot/src/share/vm/services/memSnapshot.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/memSnapshot.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
 #include "services/memSnapshot.hpp"
 #include "services/memTracker.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef ASSERT
 
 void decode_pointer_record(MemPointerRecord* rec) {
@@ -733,7 +735,7 @@
         if (os::dll_address_to_function_name(ex->pc(), buf, sizeof(buf), NULL)) {
           tty->print_cr("\t%s", buf);
         } else {
-          tty->print_cr("");
+          tty->cr();
         }
       }
     }
--- a/hotspot/src/share/vm/services/memTrackWorker.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/memTrackWorker.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
   // create thread uses cgc thread type for now. We should revisit
   // the option, or create new thread type.
   _has_error = !os::create_thread(this, os::cgc_thread);
-  set_name("MemTrackWorker", 0);
+  set_name("MemTrackWorker");
 
   // initial generation circuit buffer
   if (!has_error()) {
--- a/hotspot/src/share/vm/services/nmtDCmd.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/nmtDCmd.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,7 @@
   // native memory tracking has to be on
   if (!MemTracker::is_on() || MemTracker::shutdown_in_progress()) {
     // if it is not on, what's the reason?
-    output()->print_cr(MemTracker::reason());
+    output()->print_cr("%s", MemTracker::reason());
     return;
   }
 
--- a/hotspot/src/share/vm/services/threadService.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/services/threadService.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,8 @@
 #include "runtime/vm_operations.hpp"
 #include "services/threadService.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // TODO: we need to define a naming convention for perf counters
 // to distinguish counters for:
 //   - standard JSR174 use
--- a/hotspot/src/share/vm/trace/traceStream.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/trace/traceStream.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
   }
 
   void print_val(const char* label, s8 val) {
-    _st.print("%s = "INT64_FORMAT, label, val);
+    _st.print("%s = "INT64_FORMAT, label, (int64_t) val);
   }
 
   void print_val(const char* label, bool val) {
@@ -113,7 +113,7 @@
   }
 
   void print(const char* val) {
-    _st.print(val);
+    _st.print("%s", val);
   }
 };
 
--- a/hotspot/src/share/vm/utilities/accessFlags.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/accessFlags.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -54,7 +54,8 @@
   JVM_ACC_IS_OLD                  = 0x00010000,     // RedefineClasses() has replaced this method
   JVM_ACC_IS_OBSOLETE             = 0x00020000,     // RedefineClasses() has made method obsolete
   JVM_ACC_IS_PREFIXED_NATIVE      = 0x00040000,     // JVMTI has prefixed this native method
-  JVM_ACC_ON_STACK                = 0x00080000,     // RedefinedClasses() is used on the stack
+  JVM_ACC_ON_STACK                = 0x00080000,     // RedefineClasses() was used on the stack
+  JVM_ACC_IS_DELETED              = 0x00008000,     // RedefineClasses() has deleted this method
 
   // Klass* flags
   JVM_ACC_HAS_MIRANDA_METHODS     = 0x10000000,     // True if this class has miranda methods in it's vtable
@@ -131,6 +132,7 @@
   bool has_jsrs                () const { return (_flags & JVM_ACC_HAS_JSRS               ) != 0; }
   bool is_old                  () const { return (_flags & JVM_ACC_IS_OLD                 ) != 0; }
   bool is_obsolete             () const { return (_flags & JVM_ACC_IS_OBSOLETE            ) != 0; }
+  bool is_deleted              () const { return (_flags & JVM_ACC_IS_DELETED             ) != 0; }
   bool is_prefixed_native      () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE     ) != 0; }
 
   // Klass* flags
@@ -195,6 +197,7 @@
   void set_has_jsrs()                  { atomic_set_bits(JVM_ACC_HAS_JSRS);                }
   void set_is_old()                    { atomic_set_bits(JVM_ACC_IS_OLD);                  }
   void set_is_obsolete()               { atomic_set_bits(JVM_ACC_IS_OBSOLETE);             }
+  void set_is_deleted()                { atomic_set_bits(JVM_ACC_IS_DELETED);              }
   void set_is_prefixed_native()        { atomic_set_bits(JVM_ACC_IS_PREFIXED_NATIVE);      }
 
   void clear_not_c1_compilable()       { atomic_clear_bits(JVM_ACC_NOT_C1_COMPILABLE);       }
--- a/hotspot/src/share/vm/utilities/array.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/array.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -376,7 +376,7 @@
 
   // FIXME: How to handle this?
   void print_value_on(outputStream* st) const {
-    st->print("Array<T>(" INTPTR_FORMAT ")", this);
+    st->print("Array<T>(" INTPTR_FORMAT ")", p2i(this));
   }
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/utilities/bitMap.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,13 +522,13 @@
 
 void BitMap::print_on_error(outputStream* st, const char* prefix) const {
   st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")",
-      prefix, map(), (char*)map() + (size() >> LogBitsPerByte));
+      prefix, p2i(map()), p2i((char*)map() + (size() >> LogBitsPerByte)));
 }
 
 #ifndef PRODUCT
 
 void BitMap::print_on(outputStream* st) const {
-  tty->print("Bitmap(%d):", size());
+  tty->print("Bitmap(" SIZE_FORMAT "):", size());
   for (idx_t index = 0; index < size(); index++) {
     tty->print("%c", at(index) ? '1' : '0');
   }
--- a/hotspot/src/share/vm/utilities/constantTag.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -28,7 +28,7 @@
 #ifndef PRODUCT
 
 void constantTag::print_on(outputStream* st) const {
-  st->print(internal_name());
+  st->print("%s", internal_name());
 }
 
 #endif // PRODUCT
--- a/hotspot/src/share/vm/utilities/debug.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,8 @@
 #  endif
 #endif // PRODUCT
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 FormatBufferResource::FormatBufferResource(const char * format, ...)
   : FormatBufferBase((char*)resource_allocate_bytes(RES_BUFSZ)) {
   va_list argp;
@@ -96,6 +98,7 @@
   va_end(argp);
 }
 
+ATTRIBUTE_PRINTF(1, 2)
 void warning(const char* format, ...) {
   if (PrintWarnings) {
     FILE* const err = defaultStream::error_stream();
--- a/hotspot/src/share/vm/utilities/debug.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -43,17 +43,17 @@
 #define RES_BUFSZ 256
 class FormatBufferResource : public FormatBufferBase {
  public:
-  FormatBufferResource(const char * format, ...);
+  FormatBufferResource(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
 };
 
 // Use stack for buffer
 template <size_t bufsz = 256>
 class FormatBuffer : public FormatBufferBase {
  public:
-  inline FormatBuffer(const char * format, ...);
-  inline void append(const char* format, ...);
-  inline void print(const char* format, ...);
-  inline void printv(const char* format, va_list ap);
+  inline FormatBuffer(const char * format, ...) ATTRIBUTE_PRINTF(2, 3);
+  inline void append(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3);
+  inline void print(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3);
+  inline void printv(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
 
   char* buffer() { return _buf; }
   int size() { return bufsz; }
@@ -223,7 +223,7 @@
 void report_unimplemented(const char* file, int line);
 void report_untested(const char* file, int line, const char* message);
 
-void warning(const char* format, ...);
+void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
 
 #ifdef ASSERT
 // Compile-time asserts.
--- a/hotspot/src/share/vm/utilities/events.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/events.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -82,7 +82,7 @@
     va_start(ap, format);
     // Save a copy of begin message and log it.
     _buffer.printv(format, ap);
-    Events::log(NULL, _buffer);
+    Events::log(NULL, "%s", _buffer.buffer());
     va_end(ap);
   }
 }
@@ -91,6 +91,6 @@
   if (LogEvents) {
     // Append " done" to the begin message and log it
     _buffer.append(" done");
-    Events::log(NULL, _buffer);
+    Events::log(NULL, "%s", _buffer.buffer());
   }
 }
--- a/hotspot/src/share/vm/utilities/events.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/events.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,7 +128,7 @@
   void print(outputStream* out, EventRecord<T>& e) {
     out->print("Event: %.3f ", e.timestamp);
     if (e.thread != NULL) {
-      out->print("Thread " INTPTR_FORMAT " ", e.thread);
+      out->print("Thread " INTPTR_FORMAT " ", p2i(e.thread));
     }
     print(out, e.data);
   }
@@ -148,7 +148,7 @@
  public:
   StringEventLog(const char* name, int count = LogEventsBufferEntries) : EventLogBase<StringLogMessage>(name, count) {}
 
-  void logv(Thread* thread, const char* format, va_list ap) {
+  void logv(Thread* thread, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0) {
     if (!should_log()) return;
 
     double timestamp = fetch_timestamp();
@@ -159,7 +159,7 @@
     _records[index].data.printv(format, ap);
   }
 
-  void log(Thread* thread, const char* format, ...) {
+  void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(3, 4) {
     va_list ap;
     va_start(ap, format);
     logv(thread, format, ap);
@@ -193,18 +193,17 @@
   static void print();
 
   // Logs a generic message with timestamp and format as printf.
-  static void log(Thread* thread, const char* format, ...);
+  static void log(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
   // Log exception related message
-  static void log_exception(Thread* thread, const char* format, ...);
+  static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
-  static void log_deopt_message(Thread* thread, const char* format, ...);
+  static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
   // Register default loggers
   static void init();
 };
 
-
 inline void Events::log(Thread* thread, const char* format, ...) {
   if (LogEvents) {
     va_list ap;
@@ -283,7 +282,7 @@
 
  public:
   // log a begin event, format as printf
-  EventMark(const char* format, ...);
+  EventMark(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   // log an end event
   ~EventMark();
 };
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 #include "utilities/events.hpp"
 #include "utilities/exceptions.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Implementation of ThreadShadow
 void check_ThreadShadow() {
@@ -237,6 +238,7 @@
   _throw_msg(thread, file, line, h_name, msg);
 }
 
+
 // Creates an exception oop, calls the <init> method with the given signature.
 // and returns a Handle
 Handle Exceptions::new_exception(Thread *thread, Symbol* name,
--- a/hotspot/src/share/vm/utilities/exceptions.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -132,7 +132,7 @@
   // There is no THROW... macro for this method. Caller should remember
   // to do a return after calling it.
   static void fthrow(Thread* thread, const char* file, int line, Symbol* name,
-                     const char* format, ...);
+                     const char* format, ...) ATTRIBUTE_PRINTF(5, 6);
 
   // Create and initialize a new exception
   static Handle new_exception(Thread* thread, Symbol* name,
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,32 @@
 # include "utilities/globalDefinitions_xlc.hpp"
 #endif
 
+#ifndef PRAGMA_DIAG_PUSH
+#define PRAGMA_DIAG_PUSH
+#endif
+#ifndef PRAGMA_DIAG_POP
+#define PRAGMA_DIAG_POP
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED
+#endif
+#ifndef PRAGMA_FORMAT_IGNORED
+#define PRAGMA_FORMAT_IGNORED
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#endif
+#ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#endif
+#ifndef PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+#endif
+#ifndef ATTRIBUTE_PRINTF
+#define ATTRIBUTE_PRINTF(fmt, vargs)
+#endif
+
+
 #include "utilities/macros.hpp"
 
 // This file holds all globally used constants & types, class (forward)
@@ -1284,6 +1310,11 @@
   return ((int)((unsigned int)high << 16) | (unsigned int)low);
 }
 
+// Convert pointer to intptr_t, for use in printing pointers.
+inline intptr_t p2i(const void * p) {
+  return (intptr_t) p;
+}
+
 // Printf-style formatters for fixed- and variable-width types as pointers and
 // integers.  These are derived from the definitions in inttypes.h.  If the platform
 // doesn't provide appropriate definitions, they should be provided in
@@ -1302,6 +1333,7 @@
 // Format 64-bit quantities.
 #define INT64_FORMAT           "%" PRId64
 #define UINT64_FORMAT          "%" PRIu64
+#define UINT64_FORMAT_X        "%" PRIx64
 #define INT64_FORMAT_W(width)  "%" #width PRId64
 #define UINT64_FORMAT_W(width) "%" #width PRIu64
 
@@ -1314,6 +1346,9 @@
 #ifndef JULONG_FORMAT
 #define JULONG_FORMAT          UINT64_FORMAT
 #endif
+#ifndef JULONG_FORMAT_X
+#define JULONG_FORMAT_X        UINT64_FORMAT_X
+#endif
 
 // Format pointers which change size between 32- and 64-bit.
 #ifdef  _LP64
@@ -1324,6 +1359,8 @@
 #define PTR_FORMAT    "0x%08"  PRIxPTR
 #endif  // _LP64
 
+#define INTPTR_FORMAT_W(width)   "%" #width PRIxPTR
+
 #define SSIZE_FORMAT             "%"   PRIdPTR
 #define SIZE_FORMAT              "%"   PRIuPTR
 #define SIZE_FORMAT_HEX          "0x%" PRIxPTR
@@ -1351,11 +1388,10 @@
 // All C++ compilers that we know of have the vtbl pointer in the first
 // word.  If there are exceptions, this function needs to be made compiler
 // specific.
-static inline void* dereference_vptr(void* addr) {
+static inline void* dereference_vptr(const void* addr) {
   return *(void**)addr;
 }
 
-
 #ifndef PRODUCT
 
 // For unit testing only
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -282,6 +282,47 @@
 #define PRAGMA_IMPLEMENTATION        #pragma implementation
 #define VALUE_OBJ_CLASS_SPEC
 
+#ifndef ATTRIBUTE_PRINTF
+// Diagnostic pragmas like the ones defined below in PRAGMA_FORMAT_NONLITERAL_IGNORED
+// were only introduced in GCC 4.2. Because we have no other possibility to ignore
+// these warnings for older versions of GCC, we simply don't decorate our printf-style
+// functions with __attribute__(format) in that case.
+#if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || (__GNUC__ > 4)
+#define ATTRIBUTE_PRINTF(fmt,vargs)  __attribute__((format(printf, fmt, vargs)))
+#else
+#define ATTRIBUTE_PRINTF(fmt,vargs)
+#endif
+#endif
+
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"") \
+                                         _Pragma("GCC diagnostic ignored \"-Wformat-security\"")
+#define PRAGMA_FORMAT_IGNORED _Pragma("GCC diagnostic ignored \"-Wformat\"")
+
+#if defined(__clang_major__) && \
+      (__clang_major__ >= 4 || \
+      (__clang_major__ >= 3 && __clang_minor__ >= 1)) || \
+    ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
+// Tested to work with clang version 3.1 and better.
+#define PRAGMA_DIAG_PUSH             _Pragma("GCC diagnostic push")
+#define PRAGMA_DIAG_POP              _Pragma("GCC diagnostic pop")
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED
+
+// Hack to deal with gcc yammering about non-security format stuff
+#else
+// Old versions of gcc don't do push/pop, also do not cope with this pragma within a function
+// One method does so much varied printing that it is decorated with both internal and external
+// versions of the macro-pragma to obtain better checking with newer compilers.
+#define PRAGMA_DIAG_PUSH
+#define PRAGMA_DIAG_POP
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL PRAGMA_FORMAT_NONLITERAL_IGNORED
+#define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
+#endif
+
+#ifndef __clang_major__
+#define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC _Pragma("GCC diagnostic ignored \"-Wformat\"") _Pragma("GCC diagnostic error \"-Wformat-nonliteral\"") _Pragma("GCC diagnostic error \"-Wformat-security\"")
+#endif
+
 #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 95)
 #define TEMPLATE_TABLE_BUG
 #endif
--- a/hotspot/src/share/vm/utilities/hashtable.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/javaClasses.hpp"
+#include "classfile/stringTable.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "memory/resourceArea.hpp"
--- a/hotspot/src/share/vm/utilities/numberSeq.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/numberSeq.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -258,5 +258,5 @@
     }
     s->print("\t[%d]=%7.3f", i, _sequence[i]);
   }
-  s->print_cr("");
+  s->cr();
 }
--- a/hotspot/src/share/vm/utilities/ostream.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/ostream.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -268,7 +268,7 @@
   size_t limit = (len + 16) / 16 * 16;
   for (size_t i = 0; i < limit; ++i) {
     if (i % 16 == 0) {
-      indent().print("%07x:", i);
+      indent().print(INTPTR_FORMAT_W(07)":", i);
     }
     if (i % 2 == 0) {
       print(" ");
@@ -289,7 +289,7 @@
           }
         }
       }
-      print_cr("");
+      cr();
     }
   }
 }
@@ -606,7 +606,7 @@
 // memory usage and command line flags into header
 void gcLogFileStream::dump_loggc_header() {
   if (is_open()) {
-    print_cr(Abstract_VM_Version::internal_vm_info_string());
+    print_cr("%s", Abstract_VM_Version::internal_vm_info_string());
     os::print_memory_info(this);
     print("CommandLine flags: ");
     CommandLineFlags::printSetFlags(this);
@@ -687,7 +687,7 @@
     write(time_msg, strlen(time_msg));
 
     if (out != NULL) {
-      out->print(time_msg);
+      out->print("%s", time_msg);
     }
 
     dump_loggc_header();
@@ -720,7 +720,7 @@
     write(time_msg, strlen(time_msg));
 
     if (out != NULL) {
-      out->print(time_msg);
+      out->print("%s", time_msg);
     }
 
     fclose(_file);
@@ -765,7 +765,7 @@
     write(time_msg, strlen(time_msg));
 
     if (out != NULL) {
-      out->print(time_msg);
+      out->print("%s", time_msg);
     }
 
     dump_loggc_header();
@@ -845,7 +845,7 @@
     xs->head("hotspot_log version='%d %d'"
              " process='%d' time_ms='"INT64_FORMAT"'",
              LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
-             os::current_process_id(), time_ms);
+             os::current_process_id(), (int64_t)time_ms);
     // Write VM version header immediately.
     xs->head("vm_version");
     xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
--- a/hotspot/src/share/vm/utilities/ostream.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/ostream.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
    static const char* do_vsnprintf(char* buffer, size_t buflen,
                                    const char* format, va_list ap,
                                    bool add_cr,
-                                   size_t& result_len);
+                                   size_t& result_len)  ATTRIBUTE_PRINTF(3, 0);
 
  public:
    // creation
@@ -80,10 +80,10 @@
    void set_position(int pos)   { _position = pos; }
 
    // printing
-   void print(const char* format, ...);
-   void print_cr(const char* format, ...);
-   void vprint(const char *format, va_list argptr);
-   void vprint_cr(const char* format, va_list argptr);
+   void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+   void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+   void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
+   void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
    void print_raw(const char* str)            { write(str, strlen(str)); }
    void print_raw(const char* str, int len)   { write(str,         len); }
    void print_raw_cr(const char* str)         { write(str, strlen(str)); cr(); }
@@ -274,10 +274,10 @@
   ~staticBufferStream() {};
   virtual void write(const char* c, size_t len);
   void flush();
-  void print(const char* format, ...);
-  void print_cr(const char* format, ...);
-  void vprint(const char *format, va_list argptr);
-  void vprint_cr(const char* format, va_list argptr);
+  void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void print_cr(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void vprint(const char *format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
+  void vprint_cr(const char* format, va_list argptr) ATTRIBUTE_PRINTF(2, 0);
 };
 
 // In the non-fixed buffer case an underlying buffer will be created and
--- a/hotspot/src/share/vm/utilities/quickSort.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/quickSort.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
   for (int i = 0; i < length; i++) {
     tty->print(" %d", array[i]);
   }
-  tty->print_cr("");
+  tty->cr();
 }
 
 bool QuickSort::compare_arrays(int* actual, int* expected, int length) {
--- a/hotspot/src/share/vm/utilities/taskqueue.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/taskqueue.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
 #include "utilities/stack.inline.hpp"
 #include "utilities/taskqueue.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #ifdef TRACESPINNING
 uint ParallelTaskTerminator::_total_yields = 0;
 uint ParallelTaskTerminator::_total_spins = 0;
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,6 +42,8 @@
 #include "utilities/top.hpp"
 #include "utilities/vmError.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // List of environment variables that should be reported in error log file.
 const char *env_list[] = {
   // All platforms
@@ -358,17 +360,17 @@
            st->print((_id == (int)OOM_MALLOC_ERROR) ? "(malloc) failed to allocate " :
                                                  "(mmap) failed to map ");
            jio_snprintf(buf, sizeof(buf), SIZE_FORMAT, _size);
-           st->print(buf);
+           st->print("%s", buf);
            st->print(" bytes");
            if (_message != NULL) {
              st->print(" for ");
-             st->print(_message);
+             st->print("%s", _message);
            }
            st->cr();
          } else {
            if (_message != NULL)
              st->print("# ");
-             st->print_cr(_message);
+             st->print_cr("%s", _message);
          }
          // In error file give some solutions
          if (_verbose) {
@@ -485,7 +487,7 @@
     } else {
       st->print("Failed to write core dump. %s", coredump_message);
     }
-    st->print_cr("");
+    st->cr();
     st->print_cr("#");
 
   STEP(65, "(printing bug submit message)")
--- a/hotspot/src/share/vm/utilities/workgroup.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 #include "runtime/os.hpp"
 #include "utilities/workgroup.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Definitions of WorkGang methods.
 
 AbstractWorkGang::AbstractWorkGang(const char* name,
@@ -376,21 +378,22 @@
 
 WorkGangBarrierSync::WorkGangBarrierSync()
   : _monitor(Mutex::safepoint, "work gang barrier sync", true),
-    _n_workers(0), _n_completed(0), _should_reset(false) {
+    _n_workers(0), _n_completed(0), _should_reset(false), _aborted(false) {
 }
 
 WorkGangBarrierSync::WorkGangBarrierSync(uint n_workers, const char* name)
   : _monitor(Mutex::safepoint, name, true),
-    _n_workers(n_workers), _n_completed(0), _should_reset(false) {
+    _n_workers(n_workers), _n_completed(0), _should_reset(false), _aborted(false) {
 }
 
 void WorkGangBarrierSync::set_n_workers(uint n_workers) {
-  _n_workers   = n_workers;
-  _n_completed = 0;
+  _n_workers    = n_workers;
+  _n_completed  = 0;
   _should_reset = false;
+  _aborted      = false;
 }
 
-void WorkGangBarrierSync::enter() {
+bool WorkGangBarrierSync::enter() {
   MutexLockerEx x(monitor(), Mutex::_no_safepoint_check_flag);
   if (should_reset()) {
     // The should_reset() was set and we are the first worker to enter
@@ -413,10 +416,17 @@
     set_should_reset(true);
     monitor()->notify_all();
   } else {
-    while (n_completed() != n_workers()) {
+    while (n_completed() != n_workers() && !aborted()) {
       monitor()->wait(/* no_safepoint_check */ true);
     }
   }
+  return !aborted();
+}
+
+void WorkGangBarrierSync::abort() {
+  MutexLockerEx x(monitor(), Mutex::_no_safepoint_check_flag);
+  set_aborted();
+  monitor()->notify_all();
 }
 
 // SubTasksDone functions.
--- a/hotspot/src/share/vm/utilities/workgroup.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/workgroup.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -359,18 +359,20 @@
 class WorkGangBarrierSync : public StackObj {
 protected:
   Monitor _monitor;
-  uint     _n_workers;
-  uint     _n_completed;
+  uint    _n_workers;
+  uint    _n_completed;
   bool    _should_reset;
+  bool    _aborted;
 
   Monitor* monitor()        { return &_monitor; }
   uint     n_workers()      { return _n_workers; }
   uint     n_completed()    { return _n_completed; }
   bool     should_reset()   { return _should_reset; }
+  bool     aborted()        { return _aborted; }
 
   void     zero_completed() { _n_completed = 0; }
   void     inc_completed()  { _n_completed++; }
-
+  void     set_aborted()    { _aborted = true; }
   void     set_should_reset(bool v) { _should_reset = v; }
 
 public:
@@ -383,8 +385,14 @@
 
   // Enter the barrier. A worker that enters the barrier will
   // not be allowed to leave until all other threads have
-  // also entered the barrier.
-  void enter();
+  // also entered the barrier or the barrier is aborted.
+  // Returns false if the barrier was aborted.
+  bool enter();
+
+  // Aborts the barrier and wakes up any threads waiting for
+  // the barrier to complete. The barrier will remain in the
+  // aborted state until the next call to set_n_workers().
+  void abort();
 };
 
 // A class to manage claiming of subtasks within a group of tasks.  The
--- a/hotspot/src/share/vm/utilities/xmlstream.cpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/xmlstream.cpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -336,6 +336,8 @@
   print_raw_cr(">");
 }
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
 // ------------------------------------------------------------------
 void xmlStream::va_done(const char* format, va_list ap) {
   char buffer[200];
@@ -354,6 +356,7 @@
   buffer[kind_len] = 0;
   tail(buffer);
 }
+PRAGMA_DIAG_POP
 
 // Output a timestamp attribute.
 void xmlStream::stamp() {
@@ -399,7 +402,7 @@
   ResourceMark rm;
   assert_if_no_error(inside_attrs(), "printing attributes");
   if (method.is_null())  return;
-  text()->print(method->method_holder()->external_name());
+  text()->print("%s", method->method_holder()->external_name());
   print_raw(" ");  // " " is easier for tools to parse than "::"
   method->name()->print_symbol_on(text());
   print_raw(" ");  // separator
--- a/hotspot/src/share/vm/utilities/xmlstream.hpp	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/src/share/vm/utilities/xmlstream.hpp	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,7 +80,7 @@
   outputStream* out()                            { return _out; }
 
   // helpers for writing XML elements
-  void          va_tag(bool push, const char* format, va_list ap);
+  void          va_tag(bool push, const char* format, va_list ap) ATTRIBUTE_PRINTF(3, 0);
   virtual void see_tag(const char* tag, bool push) NOT_DEBUG({});
   virtual void pop_tag(const char* tag) NOT_DEBUG({});
 
@@ -109,29 +109,29 @@
   int unflushed_count() { return (int)(out()->count() - _last_flush); }
 
   // writing complete XML elements
-  void          elem(const char* format, ...);
-  void    begin_elem(const char* format, ...);
-  void      end_elem(const char* format, ...);
+  void          elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void    begin_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void      end_elem(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   void      end_elem();
-  void          head(const char* format, ...);
-  void    begin_head(const char* format, ...);
-  void      end_head(const char* format, ...);
+  void          head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void    begin_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void      end_head(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   void      end_head();
-  void          done(const char* format, ...);  // xxx_done event, plus tail
+  void          done(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);  // xxx_done event, plus tail
   void          done_raw(const char * kind);
   void          tail(const char* kind);
 
   // va_list versions
-  void       va_elem(const char* format, va_list ap);
-  void va_begin_elem(const char* format, va_list ap);
-  void       va_head(const char* format, va_list ap);
-  void va_begin_head(const char* format, va_list ap);
-  void       va_done(const char* format, va_list ap);
+  void       va_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void va_begin_elem(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void       va_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void va_begin_head(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
+  void       va_done(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0);
 
   // write text (with quoting of special XML characters <>&'" etc.)
   outputStream* text() { return _text; }
-  void          text(const char* format, ...);
-  void       va_text(const char* format, va_list ap) {
+  void          text(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
+  void       va_text(const char* format, va_list ap) ATTRIBUTE_PRINTF(2, 0) {
     text()->vprint(format, ap);
   }
 
--- a/hotspot/test/Makefile	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/Makefile	Wed Jul 05 19:42:29 2017 +0200
@@ -147,6 +147,11 @@
 all: jtreg_tests
 	@$(ECHO) "Testing completed successfully"
 
+# Support "hotspot_" prefixed test make targets too
+# The hotspot_% targets are for example invoked by the top level Makefile
+hotspot_%:
+	$(MAKE) $*
+
 # Prep for output
 prep: clean
 	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
--- a/hotspot/test/TEST.groups	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/TEST.groups	Wed Jul 05 19:42:29 2017 +0200
@@ -66,7 +66,6 @@
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/metaspace/TestPerfCountersAndMemoryPools.java \
   runtime/6819213/TestBootNativeLibraryPath.java \
-  runtime/6925573/SortMethodsTest.java \
   runtime/7158988/FieldMonitor.java \
   runtime/7194254/Test7194254.java \
   runtime/Metaspace/FragmentMetaspace.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/EscapeAnalysis/TestAllocatedEscapesPtrComparison.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2014 Google, 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043354
+ * @summary  bcEscapeAnalyzer allocated_escapes not conservative enough
+ * @run main/othervm -XX:CompileOnly=.visitAndPop TestAllocatedEscapesPtrComparison
+ * @author Chuck Rasbold rasbold@google.com
+ */
+
+/*
+ * Test always passes with -XX:-OptmimizePtrCompare
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestAllocatedEscapesPtrComparison {
+
+  static TestAllocatedEscapesPtrComparison dummy;
+
+  class Marker {
+  }
+
+  List<Marker> markerList = new ArrayList<>();
+
+  // Suppress compilation of this method, it must be processed
+  // by the bytecode escape analyzer.
+
+  // Make a new marker and put it on the List
+  Marker getMarker() {
+    // result escapes through markerList
+    final Marker result = new Marker();
+    markerList.add(result);
+    return result;
+  }
+
+  void visit(int depth) {
+    // Make a new marker
+    getMarker();
+
+    // Call visitAndPop every once in a while
+    // Cap the depth of our recursive visits
+    if (depth % 10 == 2) {
+      visitAndPop(depth + 1);
+    } else if (depth < 15) {
+      visit(depth + 1);
+    }
+  }
+
+   void visitAndPop(int depth) {
+    // Random dummy allocation to force EscapeAnalysis to process this method
+    dummy = new TestAllocatedEscapesPtrComparison();
+
+    // Make a new marker
+    Marker marker = getMarker();
+
+    visit(depth + 1);
+
+    // Walk and pop the marker list up to the current marker
+    boolean found = false;
+    for (int i = markerList.size() - 1; i >= 0; i--) {
+      Marker removed = markerList.remove(i);
+
+      // In the failure, EA mistakenly converts this comparison to false
+      if (removed == marker) {
+        found = true;
+        break;
+      }
+    }
+
+    if (!found) {
+      throw new RuntimeException("test fails");
+    }
+  }
+
+
+  public static void main(String args[]) {
+    TestAllocatedEscapesPtrComparison tc = new TestAllocatedEscapesPtrComparison();
+
+    // Warmup and run enough times
+    for (int i = 0; i < 20000; i++) {
+      tc.visit(0);
+    }
+  }
+}
--- a/hotspot/test/compiler/ciReplay/TestVM.sh	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/compiler/ciReplay/TestVM.sh	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,6 @@
 ##
 ## @test
 ## @bug 8011675
-## @ignore 8032498
 ## @summary testing of ciReplay with using generated by VM replay.txt 
 ## @author igor.ignatyev@oracle.com
 ## @run shell TestVM.sh
--- a/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/compiler/ciReplay/TestVM_no_comp_level.sh	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,6 @@
 ##
 ## @test
 ## @bug 8011675
-## @ignore 8032498
 ## @summary testing of ciReplay with using generated by VM replay.txt w/o comp_level
 ## @author igor.ignatyev@oracle.com
 ## @run shell TestVM_no_comp_level.sh
--- a/hotspot/test/compiler/ciReplay/common.sh	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/compiler/ciReplay/common.sh	Wed Jul 05 19:42:29 2017 +0200
@@ -234,6 +234,12 @@
             sed -e 's/.*location: //'`
     echo CRASH OUTPUT:
     cat crash.out    
+    
+    if [ "${core_locations}" = "" ]
+    then
+        test_fail 2 "CHECK :: CORE_LOCATION" "output doesn't contain the location of core file, see crash.out"
+    fi
+
     rm crash.out 
     
     # processing core locations for *nix
--- a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java	Wed Jul 05 19:42:29 2017 +0200
@@ -21,6 +21,11 @@
  * questions.
  */
 
+import static com.oracle.java.testlibrary.Asserts.assertEQ;
+import static com.oracle.java.testlibrary.Asserts.assertFalse;
+import static com.oracle.java.testlibrary.Asserts.assertTrue;
+import com.oracle.java.testlibrary.DynamicVMOption;
+
 /**
  * @test TestDynMaxHeapFreeRatio
  * @bug 8028391
@@ -33,32 +38,45 @@
  * @run main/othervm -XX:MinHeapFreeRatio=51 -XX:MaxHeapFreeRatio=52 TestDynMaxHeapFreeRatio
  * @run main/othervm -XX:MinHeapFreeRatio=75 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio
  */
-import com.oracle.java.testlibrary.TestDynamicVMOption;
-import com.oracle.java.testlibrary.DynamicVMOptionChecker;
-
-public class TestDynMaxHeapFreeRatio extends TestDynamicVMOption {
-
-    public static final String MinFreeRatioFlagName = "MinHeapFreeRatio";
-    public static final String MaxFreeRatioFlagName = "MaxHeapFreeRatio";
-
-    public TestDynMaxHeapFreeRatio() {
-        super(MaxFreeRatioFlagName);
-    }
-
-    public void test() {
-
-        int minHeapFreeValue = DynamicVMOptionChecker.getIntValue(MinFreeRatioFlagName);
-        System.out.println(MinFreeRatioFlagName + " = " + minHeapFreeValue);
-
-        testPercentageValues();
-
-        checkInvalidValue(Integer.toString(minHeapFreeValue - 1));
-        checkValidValue(Integer.toString(minHeapFreeValue));
-        checkValidValue("100");
-    }
+public class TestDynMaxHeapFreeRatio {
 
     public static void main(String args[]) throws Exception {
-        new TestDynMaxHeapFreeRatio().test();
+
+        // low boundary value
+        int minValue = DynamicVMOption.getInt("MinHeapFreeRatio");
+        System.out.println("MinHeapFreeRatio= " + minValue);
+
+        String badValues[] = {
+            null,
+            "",
+            "not a number",
+            "8.5", "-0.01",
+            Integer.toString(Integer.MIN_VALUE),
+            Integer.toString(Integer.MAX_VALUE),
+            Integer.toString(minValue - 1),
+            "-1024", "-1", "101", "1997"
+        };
+
+        String goodValues[] = {
+            Integer.toString(minValue),
+            Integer.toString(minValue + 1),
+            Integer.toString((minValue + 100) / 2),
+            "99", "100"
+        };
+
+        DynamicVMOption option = new DynamicVMOption("MaxHeapFreeRatio");
+
+        assertTrue(option.isWriteable(), "Option " + option.name
+                + " is expected to be writable");
+
+        for (String v : badValues) {
+            assertFalse(option.isValidValue(v),
+                    "'" + v + "' is expected to be illegal for flag " + option.name);
+        }
+        for (String v : goodValues) {
+            option.setValue(v);
+            String newValue = option.getValue();
+            assertEQ(v, newValue);
+        }
     }
-
 }
--- a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java	Wed Jul 05 19:42:29 2017 +0200
@@ -33,30 +33,52 @@
  * @run main/othervm -XX:MinHeapFreeRatio=51 -XX:MaxHeapFreeRatio=52 TestDynMinHeapFreeRatio
  * @run main/othervm -XX:MinHeapFreeRatio=75 -XX:MaxHeapFreeRatio=100 TestDynMinHeapFreeRatio
  */
-import com.oracle.java.testlibrary.TestDynamicVMOption;
-import com.oracle.java.testlibrary.DynamicVMOptionChecker;
-
-public class TestDynMinHeapFreeRatio extends TestDynamicVMOption {
-
-    public static final String MinFreeRatioFlagName = "MinHeapFreeRatio";
-    public static final String MaxFreeRatioFlagName = "MaxHeapFreeRatio";
+import static com.oracle.java.testlibrary.Asserts.assertEQ;
+import static com.oracle.java.testlibrary.Asserts.assertFalse;
+import static com.oracle.java.testlibrary.Asserts.assertTrue;
+import com.oracle.java.testlibrary.DynamicVMOption;
 
-    public TestDynMinHeapFreeRatio() {
-        super(MinFreeRatioFlagName);
-    }
-
-    public void test() {
-        int maxHeapFreeValue = DynamicVMOptionChecker.getIntValue(MaxFreeRatioFlagName);
-        System.out.println(MaxFreeRatioFlagName + " = " + maxHeapFreeValue);
-
-        testPercentageValues();
-
-        checkInvalidValue(Integer.toString(maxHeapFreeValue + 1));
-        checkValidValue(Integer.toString(maxHeapFreeValue));
-        checkValidValue("0");
-    }
+public class TestDynMinHeapFreeRatio {
 
     public static void main(String args[]) throws Exception {
-        new TestDynMinHeapFreeRatio().test();
+
+        // high boundary value
+        int maxValue = DynamicVMOption.getInt("MaxHeapFreeRatio");
+        System.out.println("MaxHeapFreeRatio= " + maxValue);
+
+        String badValues[] = {
+            null,
+            "",
+            "not a number",
+            "8.5", "-0.01",
+            Integer.toString(Integer.MIN_VALUE),
+            Integer.toString(Integer.MAX_VALUE),
+            Integer.toString(maxValue + 1),
+            "-1024", "-1", "101", "1997"
+        };
+
+        String goodValues[] = {
+            Integer.toString(maxValue),
+            Integer.toString(maxValue - 1),
+            Integer.toString(maxValue / 2),
+            "0", "1"
+        };
+
+        // option under test
+        DynamicVMOption option = new DynamicVMOption("MinHeapFreeRatio");
+
+        assertTrue(option.isWriteable(), "Option " + option.name
+                + " is expected to be writable");
+
+        for (String v : badValues) {
+            assertFalse(option.isValidValue(v),
+                    "'" + v + "' is expected to be illegal for flag " + option.name);
+        }
+
+        for (String v : goodValues) {
+            option.setValue(v);
+            String newValue = option.getValue();
+            assertEQ(v, newValue);
+        }
     }
 }
--- a/hotspot/test/gc/g1/TestGCLogMessages.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java	Wed Jul 05 19:42:29 2017 +0200
@@ -22,7 +22,7 @@
  */
 
 /*
- * @test TestPrintGCDetails
+ * @test TestGCLogMessages
  * @bug 8035406 8027295 8035398 8019342
  * @summary Ensure that the PrintGCDetails output for a minor GC with G1
  * includes the expected necessary messages.
@@ -90,12 +90,6 @@
     output.shouldContain("[String Dedup Fixup");
     output.shouldContain("[Young Free CSet");
     output.shouldContain("[Non-Young Free CSet");
-
-    // also check evacuation failure messages once
-    output.shouldNotContain("[Evacuation Failure");
-    output.shouldNotContain("[Recalculate Used");
-    output.shouldNotContain("[Remove Self Forwards");
-    output.shouldNotContain("[Restore RemSet");
     output.shouldHaveExitValue(0);
   }
 
--- a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,8 +28,7 @@
  * @library /testlibrary
  * @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -verbose:gc TestDynShrinkHeap
  */
-
-import com.oracle.java.testlibrary.TestDynamicVMOption;
+import com.oracle.java.testlibrary.DynamicVMOption;
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryUsage;
 import java.util.ArrayList;
@@ -44,12 +43,7 @@
     private static ArrayList<byte[]> list = new ArrayList<>(0);
     private static final int M = 1024 * 1024; // to make heap more manageable by test code
 
-    private final TestDynamicVMOption maxRatioOption;
-    private final TestDynamicVMOption minRatioOption;
-
     public TestDynShrinkHeap() {
-        minRatioOption = new TestDynamicVMOption(MIN_FREE_RATIO_FLAG_NAME);
-        maxRatioOption = new TestDynamicVMOption(MAX_FREE_RATIO_FLAG_NAME);
     }
 
     private final void test() {
@@ -86,7 +80,8 @@
     }
 
     private void free() {
-        maxRatioOption.setIntValue(minRatioOption.getIntValue() + 1);
+        int min = DynamicVMOption.getInt(MIN_FREE_RATIO_FLAG_NAME);
+        DynamicVMOption.setInt(MAX_FREE_RATIO_FLAG_NAME, min);
         System.gc();
         MemoryUsagePrinter.printMemoryUsage("under pressure");
     }
--- a/hotspot/test/runtime/7110720/Test7110720.sh	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-#
-#  Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-
-
-#
-# @test Test7110720.sh
-# @bug 7110720
-# @summary improve VM configuration file loading
-# @run shell Test7110720.sh
-#
-
-if [ "${TESTSRC}" = "" ]
-then
-  TESTSRC=${PWD}
-  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
-fi
-echo "TESTSRC=${TESTSRC}"
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
-
-# Jtreg sets TESTVMOPTS which may include -d64 which is
-# required to test a 64-bit JVM on some platforms.
-# If another test harness still creates HOME/JDK64BIT,
-# we can recognise that.
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin )
-    FS="/"
-    RM=/bin/rm
-    CP=/bin/cp
-    MV=/bin/mv
-    ## for solaris, linux it's HOME
-    FILE_LOCATION=$HOME
-    if [ -f ${FILE_LOCATION}${FS}JDK64BIT -a ${OS} = "SunOS" ]
-    then
-        TESTVMOPTS=`cat ${FILE_LOCATION}${FS}JDK64BIT`
-    fi
-    ;;
-  Windows_* )
-    FS="\\"
-    RM=rm
-    CP=cp
-    MV=mv
-    ;;
-  CYGWIN_* )
-    FS="/"
-    RM=rm
-    CP=cp
-    MV=mv
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-
-JAVA=${TESTJAVA}${FS}bin${FS}java
-
-# Don't test debug builds, they do read the config files:
-${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "debug" >/dev/null
-if [ "$?" = "0" ]; then
-  echo Skipping test for debug build.
-  exit 0
-fi
-
-ok=yes
-
-$RM -f .hotspot_compiler .hotspotrc
-
-${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
-if [ "$?" = "0" ]; then
-  echo "FAILED: base case failure"
-  exit 1
-fi
-
-
-echo "garbage in, garbage out" > .hotspot_compiler
-${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage in" >/dev/null
-if [ "$?" = "0" ]; then
-  echo "FAILED: .hotspot_compiler was read"
-  ok=no
-fi
-
-$MV .hotspot_compiler hs_comp.txt
-${JAVA} ${TESTVMOPTS} -XX:CompileCommandFile=hs_comp.txt -version 2>&1 | grep "garbage in" >/dev/null
-if [ "$?" = "1" ]; then
-  echo "FAILED: explicit compiler command file not read"
-  ok=no
-fi
-
-$RM -f .hotspot_compiler hs_comp.txt
-
-echo "garbage" > .hotspotrc
-${JAVA} ${TESTVMOPTS} -version 2>&1 | grep "garbage" >/dev/null
-if [ "$?" = "0" ]; then
-  echo "FAILED: .hotspotrc was read"
-  ok=no
-fi
-
-$MV .hotspotrc hs_flags.txt
-${JAVA} ${TESTVMOPTS} -XX:Flags=hs_flags.txt -version 2>&1 | grep "garbage" >/dev/null
-if [ "$?" = "1" ]; then
-  echo "FAILED: explicit flags file not read"
-  ok=no
-fi
-
-if [ "${ok}" = "no" ]; then 
-  echo "Some tests failed."
-  exit 1
-else 
-  echo "Passed"
-  exit 0
-fi
-
--- a/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java	Wed Jul 05 19:42:29 2017 +0200
@@ -33,17 +33,28 @@
 
 public class CompilerConfigFileWarning {
     public static void main(String[] args) throws Exception {
-        if (Platform.isDebugBuild()) {
-            System.out.println("Skip on debug builds since we'll always read the file there");
-            return;
-        }
+        ProcessBuilder pb;
+        OutputAnalyzer output;
+        PrintWriter pw;
 
-        PrintWriter pw = new PrintWriter(".hotspot_compiler");
-        pw.println("aa");
+        pw = new PrintWriter("hs_comp.txt");
+        pw.println("aaa, aaa");
         pw.close();
 
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-version");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("warning: .hotspot_compiler file is present but has been ignored.  Run with -XX:CompileCommandFile=.hotspot_compiler to load the file.");
+        pb = ProcessTools.createJavaProcessBuilder("-XX:CompileCommandFile=hs_comp.txt", "-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("CompilerOracle: unrecognized line");
+        output.shouldContain("aaa  aaa");
+
+        // Skip on debug builds since we'll always read the file there
+        if (!Platform.isDebugBuild()) {
+            pw = new PrintWriter(".hotspot_compiler");
+            pw.println("aa");
+            pw.close();
+
+            pb = ProcessTools.createJavaProcessBuilder("-version");
+            output = new OutputAnalyzer(pb.start());
+            output.shouldContain("warning: .hotspot_compiler file is present but has been ignored.  Run with -XX:CompileCommandFile=.hotspot_compiler to load the file.");
+        }
     }
 }
--- a/hotspot/test/runtime/CommandLine/ConfigFileWarning.java	Tue May 27 16:39:05 2014 -0600
+++ b/hotspot/test/runtime/CommandLine/ConfigFileWarning.java	Wed Jul 05 19:42:29 2017 +0200
@@ -33,17 +33,28 @@
 
 public class ConfigFileWarning {
     public static void main(String[] args) throws Exception {
-        if (Platform.isDebugBuild()) {
-            System.out.println("Skip on debug builds since we'll always read the file there");
-            return;
-        }
+        PrintWriter pw;
+        ProcessBuilder pb;
+        OutputAnalyzer output;
 
-        PrintWriter pw = new PrintWriter(".hotspotrc");
-        pw.println("aa");
+        pw = new PrintWriter("hs_flags.txt");
+        pw.println("aaa");
         pw.close();
 
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-version");
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.shouldContain("warning: .hotspotrc file is present but has been ignored.  Run with -XX:Flags=.hotspotrc to load the file.");
+        pb = ProcessTools.createJavaProcessBuilder("-XX:Flags=hs_flags.txt","-version");
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Unrecognized VM option 'aaa'");
+        output.shouldHaveExitValue(1);
+
+        // Skip on debug builds since we'll always read the file there
+        if (!Platform.isDebugBuild()) {
+            pw = new PrintWriter(".hotspotrc");
+            pw.println("aa");
+            pw.close();
+
+            pb = ProcessTools.createJavaProcessBuilder("-version");
+            output = new OutputAnalyzer(pb.start());
+            output.shouldContain("warning: .hotspotrc file is present but has been ignored.  Run with -XX:Flags=.hotspotrc to load the file.");
+        }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/CommandLine/TestHexArguments.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8042885
+ * @summary Make sure there is no error using hexadecimal format in vm options
+ * @author Yumin Qi
+ * @library /testlibrary
+ */
+
+import java.io.File;
+import com.oracle.java.testlibrary.*;
+
+public class TestHexArguments {
+    public static void main(String args[]) throws Exception {
+      String[] javaArgs = {"-XX:SharedBaseAddress=0x1D000000", "-version"};
+      ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, javaArgs);
+
+      OutputAnalyzer output = new OutputAnalyzer(pb.start());
+      output.shouldNotContain("Could not create the Java Virtual Machine");
+      output.shouldHaveExitValue(0);
+
+      String[] javaArgs1 = {"-XX:SharedBaseAddress=1D000000", "-version"};
+      pb = ProcessTools.createJavaProcessBuilder(true, javaArgs1);
+      output = new OutputAnalyzer(pb.start());
+      output.shouldContain("Could not create the Java Virtual Machine");
+  }
+}
--- a/hotspot/test/runtime/SharedArchiveFile/CdsWriteError.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test CdsWriteError
- * @summary Test how VM handles situation when it is impossible to write the
- *          CDS archive. VM is expected to exit gracefully and display the
- *          correct reason for the error.
- * @library /testlibrary
- * @run main CdsWriteError
- * @bug 8032222
- */
-
-import com.oracle.java.testlibrary.*;
-import java.io.File;
-
-public class CdsWriteError {
-    public static void main(String[] args) throws Exception {
-
-        if (Platform.isWindows()) {
-            System.out.println("This test is ignored on Windows. This test " +
-                "manipulates folder writable attribute, which is known to be " +
-                "often ignored by Windows");
-
-            return;
-        }
-
-        // This test has been unstable for Mac OSx (see JDK-8032222)
-        if (Platform.isOSX()) {
-            System.out.println("This test is skipped on Mac");
-            return;
-        }
-
-        String folderName = "tmp";
-        String fileName = folderName + File.separator + "empty.jsa";
-
-        // create an empty archive file and make it read only
-        File folder = new File(folderName);
-        if (!folder.mkdir())
-            throw new RuntimeException("Error when creating a tmp folder");
-
-        File cdsFile = new File(fileName);
-        if (!cdsFile.createNewFile())
-            throw new RuntimeException("Error when creating an empty CDS file");
-        if (!cdsFile.setWritable(false))
-            throw new RuntimeException("Error: could not set writable attribute on cds file");
-        if (!folder.setWritable(false))
-            throw new RuntimeException("Error: could not set writable attribute on the cds folder");
-
-        try {
-           ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-             "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + fileName, "-Xshare:dump");
-
-            OutputAnalyzer output = new OutputAnalyzer(pb.start());
-            output.shouldContain("Unable to create shared archive file");
-            output.shouldHaveExitValue(1);
-        } finally {
-            // doing this, just in case, to make sure that files can be deleted by the harness
-            // on any subsequent run
-            folder.setWritable(true);
-            cdsFile.setWritable(true);
-        }
-    }
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestEmptyBootstrapMethodsAttr
+ * @bug 8041918
+ * @library /testlibrary
+ * @summary Test empty bootstrap_methods table within BootstrapMethods attribute
+ * @compile TestEmptyBootstrapMethodsAttr.java
+ * @run main TestEmptyBootstrapMethodsAttr
+ */
+
+import java.io.File;
+import com.oracle.java.testlibrary.*;
+
+public class TestEmptyBootstrapMethodsAttr {
+
+    public static void main(String args[]) throws Throwable {
+        System.out.println("Regression test for bug 8041918");
+        String jarFile = System.getProperty("test.src") + File.separator + "emptynumbootstrapmethods.jar";
+
+        // ====== extract the test case
+        ProcessBuilder pb = new ProcessBuilder(new String[] { JDKToolFinder.getJDKTool("jar"), "xvf", jarFile } );
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+
+        // Test case #1:
+        // Try loading class with empty bootstrap_methods table where no
+        // other attributes are following BootstrapMethods in attribute table.
+        String className = "emptynumbootstrapmethods1";
+
+        // ======= execute test case #1
+        // Expect a lack of main method, this implies that the class loaded correctly
+        // with an empty bootstrap_methods and did not generate a ClassFormatError.
+        pb = ProcessTools.createJavaProcessBuilder("-cp", ".", className);
+        output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("java.lang.ClassFormatError");
+        output.shouldContain("Main method not found in class " + className);
+        output.shouldHaveExitValue(1);
+
+        // Test case #2:
+        // Try loading class with empty bootstrap_methods table where an
+        // AnnotationDefault attribute follows the BootstrapMethods in the attribute table.
+        className = "emptynumbootstrapmethods2";
+
+        // ======= execute test case #2
+        // Expect a lack of main method, this implies that the class loaded correctly
+        // with an empty bootstrap_methods and did not generate ClassFormatError.
+        pb = ProcessTools.createJavaProcessBuilder("-cp", ".", className);
+        output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("java.lang.ClassFormatError");
+        output.shouldContain("Main method not found in class " + className);
+        output.shouldHaveExitValue(1);
+    }
+}
Binary file hotspot/test/runtime/classFileParserBug/emptynumbootstrapmethods.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/emptynumbootstrapmethods1.jcod	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This test contains a BootstrapMethods attribute with an empty
+ * bootstrap_methods table.  This yields a BootstrapMethods
+ * attribute length of 2 and should not cause a
+ * java.lang.ClassFormatError to be thrown.
+ */
+class emptynumbootstrapmethods1 {
+  0xCAFEBABE;
+  0; // minor version
+  51; // version
+  [12] { // Constant Pool
+    ; // first element is empty
+    class #2; // #1     at 0x0A
+    Utf8 "emptynumbootstrapmethods1"; // #2     at 0x0D
+    class #4; // #3     at 0x1F
+    Utf8 "java/lang/Object"; // #4     at 0x22
+    MethodHandle 5b #9; // #5     at 0x35
+    NameAndType #7 #8; // #6     at 0x39
+    Utf8 "equals"; // #7     at 0x3E
+    Utf8 "(Ljava/lang/Object;)Z"; // #8     at 0x47
+    Method #3 #6; // #9     at 0x5F
+    Utf8 "equalsx"; // #10    at 0x3E
+    Utf8 "BootstrapMethods"; // #11     at 0x69
+  } // Constant Pool
+
+  0x0001; // access
+  #1;// this_cpx
+  #3;// super_cpx
+
+  [0] { // Interfaces
+  } // Interfaces
+
+  [0] { // fields
+  } // fields
+
+  [0] { // methods
+  } // methods
+
+  [1] { // Attributes
+    Attr(#11, 2) { // BootstrapMethods at 0x8A
+      [0] { // bootstrap_methods
+      }
+    } // end BootstrapMethods
+  } // Attributes
+} // end class atrbsm00101m10p
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/emptynumbootstrapmethods2.jcod	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This test contains a BootstrapMethods attribute with an empty
+ * bootstrap_methods table.  This yields a BootstrapMethods
+ * attribute length of 2 and should not cause a
+ * java.lang.ClassFormatError to be thrown. To ensure that an empty
+ * bootstrap_methods table is parsed correctly, another attribute,
+ * AnnotationDefault, follows the BootstrapMethods attribute in 
+ * the attribute table.
+ */
+
+class emptynumbootstrapmethods2 {
+  0xCAFEBABE;
+  0; // minor version
+  51; // version
+  [14] { // Constant Pool
+    ; // first element is empty
+    class #2; // #1     at 0x0A
+    Utf8 "emptynumbootstrapmethods2"; // #2     at 0x0D
+    class #4; // #3     at 0x1F
+    Utf8 "java/lang/Object"; // #4     at 0x22
+    MethodHandle 5b #9; // #5     at 0x35
+    NameAndType #7 #8; // #6     at 0x39
+    Utf8 "equals"; // #7     at 0x3E
+    Utf8 "(Ljava/lang/Object;)Z"; // #8     at 0x47
+    Method #3 #6; // #9     at 0x5F
+    Utf8 "equalsx"; // #10    at 0x3E
+    Utf8 "BootstrapMethods"; // #11     at 0x69
+    Utf8 "AnnotationDefault"; // #12
+    Utf8 "LAnnotationDefaultI;"; // #13
+  } // Constant Pool
+
+  0x0001; // access
+  #1;// this_cpx
+  #3;// super_cpx
+
+  [0] { // Interfaces
+  } // Interfaces
+
+  [0] { // fields
+  } // fields
+
+  [0] { // methods
+  } // methods
+
+  [2] { // Attributes
+    Attr(#11, 2) { // BootstrapMethods at 0x8A
+      [0] { // bootstrap_methods
+      }
+    } // end BootstrapMethods
+    ;
+    Attr(#12) { // AnnotationDefault
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #13; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end AnnotationDefault
+  } // Attributes
+} // end class atrbsm00101m10p
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/duplAttributes/DuplAttributes.jcod	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,1310 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * This file contains ten different sub-tests.  Each sub-test consists of a
+ * class with a different case of an invalid duplicate attribute.  The main
+ * test runs each of these tests individually.  If any of them fail then the
+ * whole test fails.
+ */
+
+
+
+/*
+ * This test contains a class with invalid duplicate AnnotationDefault attributes.
+ */
+class AnnotationDefaultDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "AnnotationDefault"; // #9
+    Utf8 "LAnnotationDefaultI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "AnnotationDefaultDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "AnnotationDefaultDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+
+        Attr(#9) { // AnnotationDefault
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end AnnotationDefault
+    // wrong:
+        ;
+        Attr(#9) { // AnnotationDefault
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end AnnotationDefault
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // AnnotationDefault
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end AnnotationDefault
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a class with invalid duplicate RuntimeInvisibleAnnotations
+ * attributes.
+ */
+class ClassInvisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeInvisibleAnnotations"; // #9
+    Utf8 "LClassInvisAnnotsI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "ClassInvisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "ClassInvisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeInvisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeInvisibleAnnotations
+// wrong:
+    ;
+    Attr(#9) { // RuntimeInvisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeInvisibleAnnotations
+// end wrong
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a class with invalid duplicate RuntimeVisibleAnnotations
+ * attributes.
+ */
+class ClassVisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeVisibleAnnotations"; // #9
+    Utf8 "LClassVisAnnotsI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "ClassVisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "ClassVisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeVisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeVisibleAnnotations
+// wrong:
+    ;
+    Attr(#9) { // RuntimeVisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeVisibleAnnotations
+// end wrong
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a field with invalid duplicate RuntimeInvisibleAnnotations
+ * attributes.
+ */
+class FieldInvisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "fld"; // #5
+    Utf8 "Ljava/util/ArrayList;"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
+    Utf8 "RuntimeInvisibleAnnotations"; // #9
+    Utf8 "LFieldInvisAnnotsI;"; // #10
+    Utf8 "<init>"; // #11
+    Utf8 "()V"; // #12
+    Utf8 "Code"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #11 #12; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "FieldInvisAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "FieldInvisAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Signature
+          #8;
+        } // end Signature
+        ;
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+    // end wrong
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #11; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a field with invalid duplicate RuntimeVisibleAnnotations
+ * attributes.
+ */
+class FieldVisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "fld"; // #5
+    Utf8 "Ljava/util/ArrayList;"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "Ljava/util/ArrayList<Ljava/lang/Object;>;"; // #8
+    Utf8 "RuntimeVisibleAnnotations"; // #9
+    Utf8 "LFieldVisAnnotsI;"; // #10
+    Utf8 "<init>"; // #11
+    Utf8 "()V"; // #12
+    Utf8 "Code"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #11 #12; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "FieldVisAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "FieldVisAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Signature
+          #8;
+        } // end Signature
+        ;
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+    // end wrong
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #11; // name_cpx
+      #12; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#13) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate RuntimeInvisibleAnnotations
+ * attributes.
+ */
+class MethInvisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeInvisibleAnnotations"; // #9
+    Utf8 "LMethInvisAnnotsI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "MethInvisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "MethInvisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeInvisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeInvisibleAnnotations
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeInvisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeInvisibleAnnotations
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate
+ * RuntimeInvisibleParameterAnnotations attributes.
+ */
+class MethInvisParamAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "<init>"; // #5
+    Utf8 "()V"; // #6
+    Utf8 "Code"; // #7
+    Utf8 "m"; // #8
+    Utf8 "()I"; // #9
+    Utf8 "Signature"; // #10
+    Utf8 "<T:Ljava/lang/Object;>()I"; // #11
+    Utf8 "RuntimeInvisibleParameterAnnotations"; // #12
+    Utf8 "LMethInvisParamAnnotsI;"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #5 #6; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "MethInvisParamAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "MethInvisParamAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0001; // access
+      #8; // name_cpx
+      #9; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x03AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+        Attr(#10) { // Signature
+          #11;
+        } // end Signature
+        ;
+        Attr(#12) { // RuntimeInvisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeInvisibleParameterAnnotations
+// wrong:
+        ;
+        Attr(#12) { // RuntimeInvisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeInvisibleParameterAnnotations
+// end wrong
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate RuntimeVisibleAnnotations
+ * attributes.
+ */
+class MethVisAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "RuntimeVisibleAnnotations"; // #9
+    Utf8 "LMethodVisAnnotsDupI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "MethVisAnnotsDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "MethVisAnnotsDupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+    // wrong:
+        ;
+        Attr(#9) { // RuntimeVisibleAnnotations
+          [] { // type annotations
+            { // type annotation
+              0x00;  // target_type
+              0x00;  // type_parameter_index
+              []b { //  type_path
+              }
+
+              #10; // type_index
+              [] { // element_value_pairs
+              } // element_value_pairs
+            } // type annotation
+          } // type annotations
+        } // end RuntimeVisibleAnnotations
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // RuntimeVisibleAnnotations
+      [] { // type annotations
+        { // type annotation
+          0x00;  // target_type
+          0x00;  // type_parameter_index
+          []b { //  type_path
+          }
+
+          #10; // type_index
+          [] { // element_value_pairs
+          } // element_value_pairs
+        } // type annotation
+      } // type annotations
+    } // end RuntimeVisibleAnnotations
+  } // Attributes
+
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate
+ * RuntimeVisibleParameterAnnotations attributes.
+ */
+class MethVisParamAnnotsDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #4 #16; // #1
+    Method #17 #18; // #2
+    class #19; // #3
+    class #20; // #4
+    Utf8 "<init>"; // #5
+    Utf8 "()V"; // #6
+    Utf8 "Code"; // #7
+    Utf8 "m"; // #8
+    Utf8 "()I"; // #9
+    Utf8 "Signature"; // #10
+    Utf8 "<T:Ljava/lang/Object;>()I"; // #11
+    Utf8 "RuntimeVisibleParameterAnnotations"; // #12
+    Utf8 "LMethVisParamAnnotsI;"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #5 #6; // #16
+    class #21; // #17
+    NameAndType #14 #15; // #18
+    Utf8 "MethVisParamAnnotsDup"; // #19
+    Utf8 "java/lang/Object"; // #20
+    Utf8 "MethVisParamAnnotsDupChecker"; // #21
+  } // Constant Pool
+
+  0x0021; // access
+  #3;// this_cpx
+  #4;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #5; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0001; // access
+      #8; // name_cpx
+      #9; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x03AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+        ;
+        Attr(#10) { // Signature
+          #11;
+        } // end Signature
+        ;
+        Attr(#12) { // RuntimeVisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeVisibleParameterAnnotations
+// wrong:
+        ;
+        Attr(#12) { // RuntimeVisibleParameterAnnotations
+          0x0001010000000D00;
+          0x00;
+        } // end RuntimeVisibleParameterAnnotations
+// end wrong
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#7) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80002AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+  } // Attributes
+} // end class
+
+
+
+/*
+ * This test contains a method with invalid duplicate SourceDebugExtension
+ * attributes.
+ */
+class SrcDbgExtDup {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #11; // #1
+    class #12; // #2
+    class #13; // #3
+    Utf8 "<init>"; // #4
+    Utf8 "()V"; // #5
+    Utf8 "Code"; // #6
+    Utf8 "Signature"; // #7
+    Utf8 "<T:Ljava/lang/Object;>Ljava/lang/Object;"; // #8
+    Utf8 "SourceDebugExtension"; // #9
+    Utf8 "LSrcDbgExtDupI;"; // #10
+    NameAndType #4 #5; // #11
+    Utf8 "SrcDbgExtDup"; // #12
+    Utf8 "java/lang/Object"; // #13
+    Utf8 "run"; // #14
+    Utf8 "([Ljava/lang/String;Ljava/io/PrintStream;)I"; // #15
+    NameAndType #14 #15; // #16
+    class #19; // #17
+    Method #17 #16; // #18
+    Utf8 "SrcDbgExt_dupChecker"; // #19
+  } // Constant Pool
+
+  0x0021; // access
+  #2;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0001; // access
+      #4; // name_cpx
+      #5; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #14; // name_cpx
+      #15; // sig_cpx
+      [] { // Attributes
+        Attr(#6) { // Code
+          2; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2A2BB80012AC;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#7) { // Signature
+      #8;
+    } // end Signature
+    ;
+    Attr(#9) { // SourceDebugExtension
+      [] { // debug_extensions
+        { // type debug_extension
+          []b { //  type_path
+          }
+        } // type debug_extension
+      } // type debug_extensions
+    } // end SourceDebugExtension
+// wrong:
+    ;
+    Attr(#9) { // SourceDebugExtension
+      [] { // debug_extensions
+        { // type debug_extension
+          []b { //  type_path
+          }
+        } // type debug_extension
+      } // type debug_extensions
+    } // end SourceDebugExtension
+// end wrong
+  } // Attributes
+
+} // end class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8040292
+ * @library /testlibrary
+ * @summary Throw exceptions when duplicate attributes are detected.
+ * @run main DuplAttributesTest
+ */
+
+import java.io.File;
+import com.oracle.java.testlibrary.*;
+
+public class DuplAttributesTest {
+
+    static final String testsrc = System.getProperty("test.src");
+
+    public static void runTest(String test, String result) throws Throwable {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-cp", testsrc + File.separator + "test.jar", test);
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("java.lang.ClassFormatError: Multiple " + result);
+    }
+
+    public static void main(String args[]) throws Throwable {
+        System.out.println("Regression test for bug 8040292");
+
+        runTest("ClassInvisAnnotsDup", "RuntimeInvisibleAnnotations");
+        runTest("ClassVisAnnotsDup", "RuntimeVisibleAnnotations");
+        runTest("SrcDbgExtDup", "SourceDebugExtension");
+
+        runTest("FieldInvisAnnotsDup", "RuntimeInvisibleAnnotations");
+        runTest("FieldVisAnnotsDup", "RuntimeVisibleAnnotations");
+
+        runTest("AnnotationDefaultDup", "AnnotationDefault");
+        runTest("MethInvisAnnotsDup", "RuntimeInvisibleAnnotations");
+        runTest("MethVisAnnotsDup", "RuntimeVisibleAnnotations");
+        runTest("MethInvisParamAnnotsDup", "RuntimeInvisibleParameterAnnotations");
+        runTest("MethVisParamAnnotsDup", "RuntimeVisibleParameterAnnotations");
+    }
+}
+
Binary file hotspot/test/runtime/duplAttributes/test.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/DynamicVMOption.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.java.testlibrary;
+
+import com.sun.management.HotSpotDiagnosticMXBean;
+import java.lang.management.ManagementFactory;
+
+/**
+ * A utility class to work with VM options which could be altered during
+ * execution.
+ *
+ * This class is a wrapper around {@code com.sun.management.VMOption}.
+ * It provides more convenient interface to read/write the values.
+ *
+ */
+public class DynamicVMOption {
+
+    private final HotSpotDiagnosticMXBean mxBean;
+
+    /**
+     * VM option name, like "MinHeapFreeRatio".
+     */
+    public final String name;
+
+    /**
+     * Creates an instance of DynamicVMOption.
+     *
+     * @param name the VM option name
+     */
+    public DynamicVMOption(String name) {
+        this.name = name;
+        mxBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
+    }
+
+    /**
+     * Sets a new value for the option.
+     * Trying to set not applicable value will cause IllegalArgumentException.
+     * Behavior with null is undefined, most likely NPE will be thrown.
+     *
+     * @param newValue the value to be set
+     * @see #getValue()
+     * @throws IllegalArgumentException if newValue is not applicable to the option
+     */
+    public final void setValue(String newValue) {
+        mxBean.setVMOption(name, newValue);
+    }
+
+    /**
+     * Returns the value of option.
+     *
+     * @return the current option value
+     * @see #setValue(java.lang.String)
+     */
+    public final String getValue() {
+        return mxBean.getVMOption(name).getValue();
+    }
+
+    /**
+     * Returns true, if option is writable, false otherwise.
+     *
+     * @return true, if option is writable, false otherwise
+     */
+    public final boolean isWriteable() {
+        return mxBean.getVMOption(name).isWriteable();
+    }
+
+    /**
+     * Checks if the given value is applicable for the option.
+     *
+     * This method tries to set the option to the new value. If no exception
+     * has been thrown the value is treated as valid.
+     *
+     * Calling this method will not change the option value. After an attempt
+     * to set a new value, the option will be restored to its previous value.
+     *
+     * @param value the value to verify
+     * @return true if option could be set to the given value
+     */
+    public boolean isValidValue(String value) {
+        boolean isValid = true;
+        String oldValue = getValue();
+        try {
+            setValue(value);
+        } catch (NullPointerException e) {
+            if (value == null) {
+                isValid = false;
+            }
+        } catch (IllegalArgumentException e) {
+            isValid = false;
+        } finally {
+            setValue(oldValue);
+        }
+        return isValid;
+    }
+
+    /**
+     * Returns the value of the given VM option as String.
+     *
+     * This is a simple shortcut for {@code new DynamicVMOption(name).getValue()}
+     *
+     * @param name the name of VM option
+     * @return value as a string
+     * @see #getValue()
+     */
+    public static String getString(String name) {
+        return new DynamicVMOption(name).getValue();
+    }
+
+    /**
+     * Returns the value of the given option as int.
+     *
+     * @param name the name of VM option
+     * @return value parsed as integer
+     * @see #getString(java.lang.String)
+     *
+     */
+    public static int getInt(String name) {
+        return Integer.parseInt(getString(name));
+    }
+
+    /**
+     * Sets the VM option to a new value.
+     *
+     * This is a simple shortcut for {@code new DynamicVMOption(name).setValue(value)}
+     *
+     * @param name the name of VM option
+     * @param value the value to be set
+     * @see #setValue(java.lang.String)
+     */
+    public static void setString(String name, String value) {
+        new DynamicVMOption(name).setValue(value);
+    }
+
+    /**
+     * Sets the VM option value to a new integer value.
+     *
+     * @param name the name of VM option
+     * @param value the integer value to be set
+     * @see #setString(java.lang.String, java.lang.String)
+     */
+    public static void setInt(String name, int value) {
+        new DynamicVMOption(name).setValue(Integer.toString(value));
+    }
+
+}
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/DynamicVMOptionChecker.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.java.testlibrary;
-
-import com.sun.management.HotSpotDiagnosticMXBean;
-import com.sun.management.VMOption;
-import java.lang.management.ManagementFactory;
-
-/**
- * Simple class to check writeability, invalid and valid values for VMOption
- */
-public class DynamicVMOptionChecker {
-
-    /**
-     * Reads VM option from PlatformMXBean and parse it to integer value
-     *
-     * @param name of option
-     * @return parsed value
-     */
-    public static int getIntValue(String name) {
-
-        VMOption option = ManagementFactory.
-                getPlatformMXBean(HotSpotDiagnosticMXBean.class).
-                getVMOption(name);
-
-        return Integer.parseInt(option.getValue());
-    }
-
-    /**
-     * Sets VM option value
-     *
-     * @param name of option
-     * @param value to set
-     */
-    public static void setIntValue(String name, int value) {
-        ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class).setVMOption(name, Integer.toString(value));
-    }
-
-    /**
-     * Checks that VM option is dynamically writable
-     *
-     * @param name
-     * @throws RuntimeException if option if not writable
-     * @return always true
-     */
-    public static boolean checkIsWritable(String name) {
-        VMOption option = ManagementFactory.
-                getPlatformMXBean(HotSpotDiagnosticMXBean.class).
-                getVMOption(name);
-
-        if (!option.isWriteable()) {
-            throw new RuntimeException(name + " is not writable");
-        }
-
-        return true;
-    }
-
-    /**
-     * Checks that value cannot be set
-     *
-     * @param name of flag
-     * @param value string representation of value to set
-     * @throws RuntimeException on error - when expected exception hasn't been thrown
-     */
-    public static void checkInvalidValue(String name, String value) {
-        // should throw
-        try {
-            ManagementFactory.
-                    getPlatformMXBean(HotSpotDiagnosticMXBean.class).
-                    setVMOption(name, value);
-
-        } catch (IllegalArgumentException e) {
-            return;
-        }
-
-        throw new RuntimeException("Expected IllegalArgumentException was not thrown, " + name + "= " + value);
-    }
-
-    /**
-     * Checks that value can be set
-     *
-     * @param name of flag to set
-     * @param value string representation of value to set
-     * @throws RuntimeException on error - when value in VM is not equal to origin
-     */
-    public static void checkValidValue(String name, String value) {
-        ManagementFactory.
-                getPlatformMXBean(HotSpotDiagnosticMXBean.class).
-                setVMOption(name, value);
-
-        VMOption option = ManagementFactory.
-                getPlatformMXBean(HotSpotDiagnosticMXBean.class).
-                getVMOption(name);
-
-        if (!option.getValue().equals(value)) {
-            throw new RuntimeException("Actual value of " + name + " \"" + option.getValue()
-                    + "\" not equal origin \"" + value + "\"");
-        }
-    }
-
-}
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/TestDynamicVMOption.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.oracle.java.testlibrary;
-
-/**
- * Simple class to check writeability, invalid and valid values for concrete VMOption
- */
-public class TestDynamicVMOption {
-
-    private final String name;
-    private final int value;
-
-    /**
-     * Constructor
-     *
-     * @param name of VM option to test
-     */
-    public TestDynamicVMOption(String name) {
-        this.name = name;
-        this.value = DynamicVMOptionChecker.getIntValue(name);
-        System.out.println(this.name + " = " + this.value);
-    }
-
-    /**
-     * Checks that this value can accept valid percentage values and cannot accept invalid percentage values
-     *
-     * @throws RuntimeException
-     */
-    public void testPercentageValues() {
-        checkInvalidValue(Integer.toString(Integer.MIN_VALUE));
-        checkInvalidValue(Integer.toString(Integer.MAX_VALUE));
-        checkInvalidValue("-10");
-        checkInvalidValue("190");
-    }
-
-    /**
-     * Reads VM option from PlatformMXBean and parse it to integer value
-     *
-     * @return value
-     */
-    public int getIntValue() {
-        return DynamicVMOptionChecker.getIntValue(this.name);
-    }
-
-    /**
-     * Sets VM option value
-     *
-     * @param value to set
-     */
-    public void setIntValue(int value) {
-        DynamicVMOptionChecker.setIntValue(this.name, value);
-    }
-
-    /**
-     * Checks that this VM option is dynamically writable
-     *
-     * @throws RuntimeException if option if not writable
-     * @return true
-     */
-    public boolean checkIsWritable() throws RuntimeException {
-        return DynamicVMOptionChecker.checkIsWritable(this.name);
-    }
-
-    /**
-     * Checks that value for this VM option cannot be set
-     *
-     * @param value to check
-     * @throws RuntimeException on error - when expected exception hasn't been thrown
-     */
-    public void checkInvalidValue(String value) {
-        DynamicVMOptionChecker.checkInvalidValue(this.name, value);
-    }
-
-    /**
-     * Checks that value for this VM option can be set
-     *
-     * @param value to check
-     * @throws RuntimeException on error - when value in VM is not equal to origin
-     */
-    public void checkValidValue(String value) {
-        DynamicVMOptionChecker.checkValidValue(this.name, value);
-    }
-
-}
--- a/jaxp/.hgtags	Tue May 27 16:39:05 2014 -0600
+++ b/jaxp/.hgtags	Wed Jul 05 19:42:29 2017 +0200
@@ -256,3 +256,4 @@
 6b4280dceb00642f54d5bc1c2cb7d34c99a04992 jdk9-b11
 e88cecf5a21b760ff7d7761c2db6bb8c82bc9f0c jdk9-b12
 5eaf717f6e36037a6d3744ffeee0e4c88e64a0d2 jdk9-b13
+32b3fc4bc7374a34d52b7f4e2391b4b4b0c084e8 jdk9-b14
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Makefile.inc	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-###########################################################################
-# reserved comment block
-# DO NOT REMOVE OR ALTER!
-###########################################################################
-##########################################################################
-# Copyright 2001-2004 The Apache Software Foundation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-#
-# $Id: Makefile.inc,v 1.2 2004/02/17 16:32:49 minchau Exp $
-#
-####################################################################
-#                                                                  #
-# Makefile.inc for XSLT compiler                                   #
-#                                                                  #
-####################################################################
-
-####################################################################
-# Useful macros                                                    #
-####################################################################
-
-JAVAC = javac
-#JAVAC_FLAGS = -g -d $(XSLT)/src/classes
-JAVAC_FLAGS = -sourcepath $(XSLT)/src
-JAVACC = javacc
-JAVACC_FLAGS = -static=FALSE 
-JAVACUP = javacup
-JAVACUP_FLAGS =
-JAVALEX = jlex
-JAVALEX_FLAGS =
-
-####################################################################
-#  Explicit rules                                                  #
-####################################################################
-
-.SUFFIXES: .java .class .jj .lex .cup
-
-.java.class:
-	$(JAVAC) $(JAVAC_FLAGS) $<
-
-.jj.java:
-	$(JAVACC) $(JAVACC_FLAGS) $<
-
-.cup.java:
-	$(JAVACUP) $(JAVACUP_FLAGS) $<
-
-.lex.java:
-	$(JAVALEX) $(JAVALEX_FLAGS) $<
-
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/javax.xml.transform.TransformerFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
--- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.apache.xerces.dom.DOMImplementationSourceImpl	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.dom.DOMImplementationSourceImpl
--- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/org.w3c.dom.DOMImplementationSourceList	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/datatype/javax.xml.datatype.DatatypeFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.DocumentBuilderFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/javax.xml.parsers.SAXParserFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/javax.xml.validation.SchemaFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.DTDConfiguration	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.parsers.DTDConfiguration
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XML11Configuration	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.parsers.XML11Configuration
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.apache.xerces.xni.parser.XMLParserConfiguration	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfiguration
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/org.xml.sax.driver	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-com.sun.org.apache.xerces.internal.parsers.SAXParser
-
--- a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLEventFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.xml.internal.stream.events.XMLEventFactoryImpl
--- a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLInputFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.xml.internal.stream.XMLInputFactoryImpl
--- a/jaxp/src/com/sun/xml/internal/stream/javax.xml.stream.XMLOutputFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.sun.xml.internal.stream.XMLOutputFactoryImpl
--- a/jaxp/src/org/xml/sax/COPYING	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-SAX IS FREE
------------
-
-I hereby abandon any property rights to SAX 2.0 (the Simple API for
-XML), and release all of the SAX 2.0 source code, compiled code, and
-documentation contained in this distribution into the Public Domain.
-SAX comes with NO WARRANTY or guarantee of fitness for any purpose.
-
-
-David Megginson
-david@megginson.com
-2000-01-14
--- a/jaxp/src/org/xml/sax/COPYING.txt	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-			 SAX COPYRIGHT STATUS
-
-Version 1.0 of the Simple API for XML (SAX), created collectively by
-the membership of the XML-DEV mailing list, is hereby released into
-the public domain.
-
-No one owns SAX: you may use it freely in both commercial and
-non-commercial applications, bundle it with your software
-distribution, include it on a CD-ROM, list the source code in a book,
-mirror the documentation at your own web site, or use it in any other
-way you see fit.
-
-
-			     NO WARRANTY
-
-Because SAX is released to the public domain, there is no warranty for
-the design or for the software implementation, to the extent permitted
-by applicable law.  Except when otherwise stated in writing the
-copyright holders and/or other parties provide SAX "as is" without
-warranty of any kind, either expressed or implied, including, but not
-limited to, the implied warranties of merchantability and fitness for
-a particular purpose.  The entire risk as to the quality and
-performance of SAX is with you.  Should SAX prove defective, you
-assume the cost of all necessary servicing, repair or correction.
-
-In no event unless required by applicable law or agreed to in writing
-will any copyright holder, or any other party who may modify and/or
-redistribute SAX, be liable to you for damages, including any general,
-special, incidental or consequential damages arising out of the use or
-inability to use SAX (including but not limited to loss of data or
-data being rendered inaccurate or losses sustained by you or third
-parties or a failure of the SAX to operate with any other programs),
-even if such holder or other party has been advised of the possibility
-of such damages.
-
-
-David Megginson <sax@megginson.com>
-1998-05-11
-
--- a/jaxws/.hgtags	Tue May 27 16:39:05 2014 -0600
+++ b/jaxws/.hgtags	Wed Jul 05 19:42:29 2017 +0200
@@ -259,3 +259,4 @@
 1f953ba7db2b535e19f0354abfee6d67605e0684 jdk9-b11
 779f8b21c75f83e3918dac8499e4d0ecb3a54ed7 jdk9-b12
 3d42204854c9f703e3ccdc8891248e73057713ab jdk9-b13
+02e58850b7062825308413d420f2b02c1f25a724 jdk9-b14
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/etc/META-INF/services/com.sun.xml.internal.ws.spi.db.BindingContextFactory	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-com.sun.xml.internal.ws.db.glassfish.JAXBRIContextFactory
-# com.sun.xml.internal.ws.db.toplink.JAXBContextFactory
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/gen/config/config.rng	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<grammar
- xmlns="http://relaxng.org/ns/structure/1.0"
- xmlns:r="http://relaxng.org/ns/structure/1.0"
- xmlns:a="http://relaxng.org/ns/annotation/1.0"
- xmlns:ref="urn:crossreference"
- xmlns:c="http://www.xml.gr.jp/xmlns/relaxngcc"
- c:runtime-type="com.sun.tools.internal.jxc.NGCCRuntimeEx"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
- c:package="com.sun.tools.internal.jxc.gen.config">
-
-
-<start c:class="Config" c:access="public">
-
- <c:java-import>
-    import java.util.List;
-    import java.util.ArrayList;
-    import java.io.File;
- </c:java-import>
-
-<c:java-body>
-   private File baseDir;
-   private Classes classes;
-   private List schema = new ArrayList();
-   public Classes getClasses() { return this.classes;}
-   public File getBaseDir() { return baseDir;}
-   public List getSchema() { return this.schema;}
-</c:java-body>
-
-  <element name="config">
-     <attribute name="baseDir">
-        bd = <data type="string"/>
-        baseDir = $runtime.getBaseDir(bd);
-     </attribute>
-     <ref name="Classes" c:alias="classes"/>
-     <zeroOrMore>
-        <ref name="Schema" c:alias="_schema" />(baseDir);
-        this.schema.add (_schema);
-     </zeroOrMore>
-     </element>
-  </start>
-
-
-   <define name="Classes" c:access="public">
-   <c:java-import>
-    import java.util.List;
-    import java.util.ArrayList;
-    </c:java-import>
-     <c:java-body>
-       private List includes = new ArrayList();
-       public List getIncludes() { return $runtime.getIncludePatterns(this.includes);}
-       private List excludes = new ArrayList();
-       public List getExcludes() { return $runtime.getExcludePatterns(this.excludes);}
-       </c:java-body>
-     <element name="classes">
-
-        <element name="includes">
-            <list>
-               <oneOrMore>
-                <data type="string" c:alias="include_content"/>
-                <c:java> this.includes.add(include_content); </c:java>
-               </oneOrMore>
-            </list>
-
-         </element>
-        <optional>
-        <element name="excludes">
-            <list>
-               <zeroOrMore>
-                <data type="string" c:alias="exclude_content"/>
-                <c:java> this.excludes.add(exclude_content); </c:java>
-               </zeroOrMore>
-            </list>
-
-         </element>
-        </optional>
-     </element>
-    </define>
-
-
-   <define name="Schema" c:access="public" c:params="File baseDir">
-     <c:java-import>
-       import java.io.File;
-     </c:java-import>
-     <c:java-body>
-       private File location;
-       private String namespace;
-       public String getNamespace() { return this.namespace;}
-       public File getLocation() { return this.location;}
-     </c:java-body>
-     <element name="schema">
-       <optional>
-         <attribute name="namespace">
-           namespace = <data type="string" />
-         </attribute>
-       </optional>
-
-       <optional>
-         <attribute name="location">
-           loc = <data type="string" />
-           location = new File(baseDir,loc);
-         </attribute>
-       </optional>
-     </element>
-  </define>
-</grammar>
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/bindingfile.rng	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<!--
-DTD binding information file which is supported by this version of XJC.
-
-- Changes from the EA1 is marked by "CHANGE:"
-- "ref:key" and "ref:keyref" are used to specify cross-reference
-  information.
-- "a:defaultValue" is used to specify the default behavior.
-  Note that default behaviors are hard-coded to the source code.
-  Values specified in this schema is not used in the actual processing.
--->
-<grammar
-  xmlns="http://relaxng.org/ns/structure/1.0"
-  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
-  xmlns:a="http://relaxng.org/ns/annotation/1.0"
-  xmlns:ref="urn:crossreference"
-  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-
-  <start>
-    <element name="xml-java-binding-schema">
-      <optional>
-        <attribute name="version">
-          <value>1.0ea2</value>
-        </attribute>
-      </optional>
-
-      <interleave>
-        <optional>
-          <element name="options">
-            <optional>
-              <attribute name="package"/>
-            </optional>
-          </element>
-        </optional>
-        <optional>
-          <element name="xjc:serializable">
-            <optional>
-              <attribute name="uid">
-                <data type="long"/>
-              </attribute>
-            </optional>
-          </element>
-        </optional>
-        <optional>
-          <element name="xjc:superClass">
-            <attribute name="name"/>
-          </element>
-        </optional>
-        <!-- light-weight runtime -->
-        <optional>
-          <element name="xjc:noMarshaller">
-            <empty/>
-          </element>
-        </optional>
-        <optional>
-          <element name="xjc:noUnmarshaller">
-            <empty/>
-          </element>
-        </optional>
-        <optional>
-          <element name="xjc:noValidator">
-            <empty/>
-          </element>
-        </optional>
-        <optional>
-          <element name="xjc:noValidatingUnmarshaller">
-            <empty/>
-          </element>
-        </optional>
-        <zeroOrMore>
-          <choice>
-            <ref name="toplevel.declaration"/>
-            <ref name="global.or.local.declaration"/>
-          </choice>
-        </zeroOrMore>
-      </interleave>
-    </element>
-  </start>
- 
- 
- 
- 
-  <!-- element-class declaration -->
-  <define name="toplevel.declaration" combine="choice">
-    <element name="element">
-      <attribute name="name"/>
-      <attribute name="type">
-        <value>class</value>
-      </attribute>
-      <optional>
-        <attribute name="class">
-          <ref name="java.classname.datatype"/>
-        </attribute>
-      </optional>
-      <optional>
-        <attribute name="root" a:defaultValue="false">
-          <choice>
-            <value>true</value>
-            <value>false</value>
-          </choice>
-        </attribute>
-      </optional>
-
-      <interleave>
-        <!-- attribute-property declaration -->
-        <zeroOrMore>
-          <element name="attribute">
-            <attribute name="name"/>
-            <optional>
-              <attribute name="property"/>
-            </optional>
-            <optional>
-              <ref name="collection.att"/>
-            </optional>
-            <optional>
-              <attribute name="convert">
-                <text ref:keyref="conversion"/>
-              </attribute>
-            </optional>
-          </element>
-        </zeroOrMore>
-
-        <zeroOrMore>
-          <ref name="global.or.local.declaration"/>
-        </zeroOrMore>
-
-        <!-- element-local declarations -->
-        <zeroOrMore>
-          <element name="constructor">
-            <attribute name="properties">
-              <list>
-                <oneOrMore>
-                  <!-- point to a property defined in this element -->
-                  <data type="token"/>
-                </oneOrMore>
-              </list>
-            </attribute>
-          </element>
-        </zeroOrMore>
-
-        <optional>
-          <element name="content">
-            <interleave>
-              <choice>
-                <!-- general content-property declaration -->
-                <ref name="collection.particle.decl"/>
-
-                <!-- model-based content property declaration -->
-                <group>
-                  <zeroOrMore>
-                    <choice>
-                      <element name="element-ref">
-                        <attribute name="name"/>
-                        <optional>
-                          <attribute name="property"/>
-                        </optional>
-                        <optional>
-                          <ref name="collection.att"/>
-                        </optional>
-                      </element>
-                      <element>
-                        <choice>
-                          <name>sequence</name>
-                          <name>choice</name>
-                        </choice>
-                        <ref name="collection.particle.decl"/>
-                      </element>
-                    </choice>
-                  </zeroOrMore>
-                  <optional><!-- followed by an optional <rest> -->
-                    <element name="rest">
-                      <ref name="collection.particle.decl"/>
-                    </element>
-                  </optional>
-                </group>
-              </choice>
-            </interleave>
-          </element>
-        </optional>
-      </interleave>
-    </element>
-  </define>
-
-  <define name="collection.particle.decl">
-    <attribute name="property"/>
-    <optional>
-      <ref name="collection.att"/>
-    </optional>
-    <optional>
-      <attribute name="supertype"/>
-    </optional>
-  </define>
-
-  <define name="collection.att">
-    <attribute name="collection">
-      <!-- CHANGE: array is removed and set,vector are added -->
-      <choice>
-        <value>list</value>
-        <value>set</value>
-        <value>vector</value>
-      </choice>
-    </attribute>
-  </define>
-
- 
- 
-  <!-- conversion declaration -->
-  <define name="global.or.local.declaration" combine="choice">
-    <element name="conversion">
-      <attribute name="name" ref:key="conversion"/>
-      <optional>
-        <!-- defaults to @name -->
-        <attribute name="type"/>
-      </optional>
-      <optional>
-        <attribute name="parse" a:defaultValue="new"/>
-      </optional>
-      <optional>
-        <attribute name="print" a:defaultValue="toString"/>
-      </optional>
-      <optional>
-        <attribute name="whitespace" a:defaultValue="collapse">
-          <choice>
-            <value>preserve</value>
-            <value>replace</value><!-- CHANGE: it was normalize -->
-            <value>collapse</value>
-          </choice>
-        </attribute>
-      </optional>
-    </element>
-  </define>
- 
-  <!-- element-value declaration -->
-  <define name="toplevel.declaration" combine="choice">
-    <element name="element">
-      <attribute name="name"/>
-      <attribute name="type">
-        <value>value</value>
-      </attribute>
-      <optional>
-        <attribute name="convert">
-          <text ref:keyref="conversion"/>
-        </attribute>
-      </optional>
-    </element>
-  </define>
- 
-  <!-- interface declaration -->
-  <define name="toplevel.declaration" combine="choice">
-    <element name="interface">
-      <attribute name="name">
-        <ref name="java.classname.datatype"/>
-      </attribute>
-      <attribute name="members">
-        <list>
-          <oneOrMore>
-            <ref name="java.classname.datatype"/>
-          </oneOrMore>
-        </list>
-      </attribute>
-      <!-- CHANGE: TODO: @properties is not supported yet -->
-    </element>
-  </define>
- 
-  <!-- enumeration declaration -->
-  <define name="global.or.local.declaration" combine="choice">
-    <element name="enumeration">
-      <attribute name="name">
-        <ref name="java.classname.datatype"/>
-      </attribute>
-      <attribute name="members">
-        <list>
-          <oneOrMore>
-            <data type="token"/>
-          </oneOrMore>
-        </list>
-      </attribute>
-    </element>
-  </define>
- 
- 
- 
-  <!-- valid Java name -->
-  <define name="java.name.datatype">
-    <!-- TODO: add pattern facet or implement a custom datatype -->
-    <data type="token"/>
-  </define>
-
-  <define name="java.classname.datatype">
-    <ref name="java.name.datatype"/>
-  </define>
-</grammar>
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/bindinfo/binding.rng	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,913 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<!DOCTYPE grammar [
-
-
-<!ENTITY XJCURI "http://java.sun.com/xml/ns/jaxb/xjc">
-]>
-<grammar
-  xmlns="http://relaxng.org/ns/structure/1.0"
-  xmlns:cc="http://www.xml.gr.jp/xmlns/relaxngcc"
-  xmlns:xs="http://www.w3.org/2001/XMLSchema"
-  xmlns:xjc="&XJCURI;"
-  xmlns:p="post-processor-to-build-schema-for-validation"
-  
-  ns="http://java.sun.com/xml/ns/jaxb"
-  
-  cc:runtime-type="com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.NGCCRuntimeEx"
-  cc:package="com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.parser"
-  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
-<!--  cc:$runtime-type="com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx">-->
-  
-  <cc:java-import>
-    import com.sun.codemodel.internal.*;
-    import com.sun.tools.internal.xjc.generator.bean.field.*;
-    import com.sun.tools.internal.xjc.model.*;
-    import com.sun.xml.internal.bind.api.impl.NameConverter;
-    import com.sun.xml.internal.bind.v2.WellKnownNamespace;
-    import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
-    import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.*;
-    import com.sun.tools.internal.xjc.reader.Const;
-    import org.xml.sax.*;
-    import org.w3c.dom.Document;
-    import org.xml.sax.helpers.DefaultHandler;
-    import java.util.*;
-    import javax.xml.namespace.QName;
-    import javax.xml.parsers.ParserConfigurationException;
-  </cc:java-import>
-  
-  <start cc:class="Root">
-    <choice>
-      <!-- root of the external binding file. -->
-      <ref name="declaration"/>
-      <!-- root of the internal binding -->
-      <ref name="annotation"/>
-    </choice>
-  </start>
-  
-  <!--
-    in context of XML Schema annotation
-  -->
-  <define name="annotation" cc:access="public" cc:class="AnnotationState"
-    cc:return-type="BindInfo" cc:return-value="bi">
-    
-    <cc:java-import>
-      import java.io.StringWriter;
-      import com.sun.xml.internal.bind.marshaller.DataWriter;
-    </cc:java-import>
-    <cc:java-body>
-      // customization declarations
-      public BindInfo bi;
-      
-      private StringWriter w;
-
-      private SAX2DOMEx sax2dom;
-    </cc:java-body>
-    
-    <element name="xs:annotation">
-      bi = new BindInfo($runtime.copyLocator());
-      $runtime.currentBindInfo = bi;
-      
-      <p:ignore><ref name="anyAttributes"/></p:ignore>
-      <zeroOrMore>
-        <choice>
-          <element name="xs:appinfo">
-            <p:ignore><ref name="anyAttributes"/></p:ignore>
-            <zeroOrMore>
-              <choice>
-                <group>
-                  result = <ref name="declaration" />
-                  bi.addDecl(result);
-                </group>
-                <element>
-                  <anyName><except>
-                    <nsName ns="&XJCURI;"/>
-                    <nsName /><!-- JAXB namespace URI -->
-                    <nsName ns="http://www.w3.org/2001/XMLSchema" />
-                  </except></anyName>
-
-                  if($runtime.isExtensionURI($uri)) {
-                    // parse this sub-tree as an extension
-                    try {
-                      sax2dom = new SAX2DOMEx();
-                    } catch( ParserConfigurationException e ) {
-                      throw new Error(e); // impossible
-                    }
-                    $runtime.redirectSubtree(sax2dom,$uri,$localName,$qname);
-                  } else {
-                    // ignore this sub-tree
-                    sax2dom = null;
-                    $runtime.redirectSubtree(new DefaultHandler(),$uri,$localName,$qname);
-                  }
-                  <empty/>
-                  <p:ignore><ref name="anyContents"/></p:ignore>
-                  if(sax2dom!=null) {
-                    bi.addDecl(new BIXPluginCustomization(((Document)sax2dom.getDOM()).getDocumentElement(),$runtime.copyLocator()));
-                  }
-                </element>
-                <text/>
-              </choice>
-            </zeroOrMore>
-          </element>
-          <!-- ignore documentations -->
-          <element name="xs:documentation">
-            <p:ignore><ref name="anyAttributes"/></p:ignore>
-            <zeroOrMore>
-              <choice>
-                <group>
-                  msg = <text />
-                  bi.appendDocumentation($runtime.truncateDocComment(msg),true);
-                </group>
-                <group>
-                  <element>
-                    <anyName />
-                    w = new StringWriter();
-                    DataWriter xw = new DataWriter(w,"UTF-8");
-                    xw.setXmlDecl(false);
-                    $runtime.redirectSubtree(xw,$uri,$localName,$qname);
-                    <empty/>
-                    <p:ignore><ref name="anyContents"/></p:ignore>
-                  </element>
-                  <![CDATA[
-                  bi.appendDocumentation("<pre>"+
-                    $runtime.escapeMarkup($runtime.truncateDocComment(w.toString()))+
-                    "</pre>",
-                    false );
-                  w=null;
-                  ]]>
-                </group>
-              </choice>
-            </zeroOrMore>
-          </element>
-        </choice>
-      </zeroOrMore>
-    </element>
-  </define>
-  
-  
-  
-  <!--
-  
-    Individual customization declarations
-  
-  -->
-  
-  <define name="declaration"
-    cc:return-type="BIDeclaration" cc:return-value="result">
-    
-    <cc:java-body>
-      private BIDeclaration result;
-    </cc:java-body>
-    <!-- result field will have the parsed object -->
-    <choice>
-      result = <ref name="globalBindings" />
-      result = <ref name="schemaBindings" />
-      result = <ref name="class"/>
-      result = <ref name="conversion"/>
-      result = <ref name="property"/>
-      result = <ref name="typesafeEnum"/>
-      result = <ref name="enumMember"/>
-      <!-- result = <ref name="idSymbolSpace"/-->
-      <!-- result = <ref name="dom"/-->
-    </choice>
-  </define>
-  
-  
-  <define name="globalBindings"
-    cc:return-type="BIGlobalBinding" cc:return-value="makeResult()">
-    
-    <cc:java-body>
-      private Locator loc;
-      private Map globalConvs = new HashMap();
-      private NameConverter nameConverter = NameConverter.standard;
-      private String enableJavaNamingConvention = "true";
-      private String fixedAttrToConstantProperty = "false";
-      private String needIsSetMethod = "false";
-      private String simpleTypeSubstitution = "false";
-      private boolean flattenClasses = false;
-      private Set enumBaseTypes = new HashSet();
-      private int defaultEnumSizeCap = 256;
-      private boolean generateEnumMemberName = false;
-      private boolean choiceContentPropertyWithModelGroupBinding = false;
-      private boolean xSmartWildcardDefaultBinding = false;
-      private boolean xSimpleMode;
-      private boolean generateValueClass = true;
-      private boolean generateElementClass = false;
-      private boolean generateMixedExtensions = false;
-
-      public BIGlobalBinding makeResult() {
-        if( enumBaseTypes.size()==0 )
-          enumBaseTypes.add(new QName(WellKnownNamespace.XML_SCHEMA,"NCName")); // defaults to NCName
-        
-        return new BIGlobalBinding(
-          globalConvs,nameConverter,
-          choiceContentPropertyWithModelGroupBinding,
-          generateValueClass,
-          generateElementClass,
-          $runtime.parseBoolean(enableJavaNamingConvention),
-          $runtime.parseBoolean(fixedAttrToConstantProperty),
-          $runtime.parseBoolean(needIsSetMethod),
-          $runtime.parseBoolean(simpleTypeSubstitution),
-          generateEnumMemberName,
-          flattenClasses,
-          enumBaseTypes,
-          defaultEnumSizeCap,
-          ct,
-          serializable,
-          xSuperClass,
-          xSuperInterface,
-          xSimpleMode,
-          xSmartWildcardDefaultBinding,
-          loc);
-      }
-    </cc:java-body>
-    <element name="globalBindings">
-      loc = $runtime.copyLocator();
-      
-      <optional>
-        <attribute name="underscoreBinding">
-          <choice>
-            <value>asWordSeparator</value><!-- default -->
-            <group>
-              <value>asCharInWord</value>
-              nameConverter = NameConverter.jaxrpcCompatible;
-            </group>
-          </choice>
-        </attribute>
-      </optional>
-      
-      <optional>
-        <attribute name="enableJavaNamingConventions">
-          enableJavaNamingConvention = <data type="boolean"/>
-        </attribute>
-      </optional>
-      
-      <optional>
-        <attribute name="fixedAttributeAsConstantProperty">
-          fixedAttrToConstantProperty = <data type="boolean"/>
-        </attribute>
-      </optional>
-      
-      <optional>
-        <attribute name="generateIsSetMethod">
-          needIsSetMethod = <data type="boolean"/>
-        </attribute>
-      </optional>
-
-      <optional>
-        <attribute name="mapSimpleTypeDef">
-          simpleTypeSubstitution = <data type="boolean"/>
-        </attribute>
-      </optional>
-
-      <optional>
-        <attribute name="localScoping">
-          <choice>
-            <group>
-              <value>nested</value>
-              flattenClasses = false;
-            </group>
-            <group>
-              <value>toplevel</value>
-              flattenClasses = true;
-            </group>
-          </choice>
-        </attribute>
-      </optional>
-
-      <optional>
-        <attribute name="collectionType">
-          ct = <ref name="collectionType" />
-        </attribute>
-      </optional>
-      
-      <optional>
-        <attribute name="typesafeEnumMemberName">
-          <choice>
-            <value>generateError</value> <!-- default -->
-            <group>
-              <value>generateName</value>
-              generateEnumMemberName = true;
-            </group>
-          </choice>
-        </attribute>
-      </optional>
-      
-      <optional>
-        <attribute name="typesafeEnumBase">
-          <list>
-            <oneOrMore>
-              value = <data type="QName"/>
-              QName qn = $runtime.parseQName(value);
-              enumBaseTypes.add( qn );
-            </oneOrMore>
-          </list>
-        </attribute>
-      </optional>
-
-      <optional>
-        <attribute name="typesafeEnumMaxMembers">
-          <list>
-            <oneOrMore>
-              value = <data type="int"/>
-              defaultEnumSizeCap = Integer.parseInt(value);
-            </oneOrMore>
-          </list>
-        </attribute>
-      </optional>
-
-
-      <optional>
-        <attribute name="choiceContentProperty">
-          value = <data type="boolean"/>
-          choiceContentPropertyWithModelGroupBinding = $runtime.parseBoolean(value);
-        </attribute>
-      </optional>
-
-      <optional>
-        <attribute name="generateValueClass">
-          value = <data type="boolean"/>
-          generateValueClass = $runtime.parseBoolean(value);
-        </attribute>
-      </optional>
-
-      <optional>
-        <attribute name="generateElementClass">
-          value = <data type="boolean"/>
-          generateElementClass = $runtime.parseBoolean(value);
-        </attribute>
-      </optional>
-
-      <optional>
-        <attribute name="generateMixedExtensions">
-          value = <data type="boolean"/>
-          generateMixedExtensions = $runtime.parseBoolean(value);
-        </attribute>
-      </optional>
-
-      <!-- unimplemented attributes -->
-      <optional>
-        <attribute name="enableValidation">
-          value = <data type="boolean"/>
-          if( $runtime.parseBoolean(value)==true )
-            $runtime.reportUnsupportedFeature("enableValidation");
-        </attribute>
-      </optional>
-      <optional>
-        <attribute name="enableFailFastCheck">
-          value = <data type="boolean"/>
-          if( $runtime.parseBoolean(value)==true )
-            $runtime.reportUnsupportedFeature("enableFailFastCheck");
-        </attribute>
-      </optional>
-      
-      <!-- body -->
-      <zeroOrMore>
-        <choice>
-          <element name="javaType">
-            <attribute name="xmlType">
-              xmlType = <data type="QName"/>
-            </attribute>
-            conv = <ref name="conversionBody" />
-            
-            globalConvs.put( $runtime.parseQName(xmlType), conv );
-          </element>
-          <element name="serializable">
-            <optional>
-              <attribute name="uid">
-                serialuid = <data type="long"/>
-              </attribute>
-            </optional>
-            if(serialuid!=null)
-              serializable = new BISerializable(Long.parseLong(serialuid));
-            else
-              serializable = new BISerializable(null);
-          </element>
-
-          <!-- global vendor extensions -->
-          serializable = <ref name="serializable"/>
-          xSuperClass = <ref name="superClass"/>
-          xSuperInterface = <ref name="superInterface"/>
-          <ref name="typeSubstitution" />
-          <element name="xjc:smartWildcardDefaultBinding">
-            <!--
-              changes the default binding of wildcards so that unknown elements will be
-              bound to DOM. This feature is not publicly available, and we may change it
-              later.
-            -->
-            xSmartWildcardDefaultBinding = true;
-            <empty />
-          </element>
-
-          <element name="xjc:simple">
-            xSimpleMode = true;
-            <empty />
-          </element>
-
-          <!--
-            light-weight runtime. we no longer support them,
-            but we don't issue an error when we see them.
-          -->
-          <element name="xjc:noMarshaller">
-            <empty />
-          </element>
-          <element name="xjc:noUnmarshaller">
-            <empty />
-          </element>
-          <element name="xjc:noValidator">
-            <empty />
-          </element>
-          <element name="xjc:noValidatingUnmarshaller">
-            <empty />
-          </element>
-        </choice>
-      </zeroOrMore>
-    </element>
-  </define>
-  
-  
-  <define name="schemaBindings"
-    cc:return-type="BISchemaBinding" cc:return-value="makeResult()">
-    
-    <cc:java-body>
-      private Locator loc;
-      public BISchemaBinding makeResult() {
-        return new BISchemaBinding(packageName,javadoc,tt,et,at,mt,nt,loc);
-      }
-    </cc:java-body>
-    
-    <element name="schemaBindings">
-      loc = $runtime.copyLocator();
-      
-      <optional>
-        <element name="package">
-          <optional>
-            packageName = <attribute name="name"/>
-          </optional>
-          <optional>
-            javadoc = <ref name="javadoc"/>
-          </optional>
-        </element>
-      </optional>
-      
-      <optional>
-        <element name="nameXmlTransform">
-          <!-- use newer version of RELAXNGCC and wrap them by <interleave> -->
-          <zeroOrMore>
-            <choice>
-              <element name="typeName">
-                tt = <ref name="nameXmlTransformRule"/>
-              </element>
-              <element name="elementName">
-                et = <ref name="nameXmlTransformRule"/>
-              </element>
-              <element name="attributeName">
-                at = <ref name="nameXmlTransformRule"/>
-              </element>
-              <element name="modelGroupName">
-                mt = <ref name="nameXmlTransformRule"/>
-              </element>
-              <element name="anonymousTypeName">
-                nt = <ref name="nameXmlTransformRule"/>
-              </element>
-            </choice>
-          </zeroOrMore>
-        </element>
-      </optional>
-    </element>
-  </define>
-  
-  <define name="nameXmlTransformRule"
-    cc:return-type="BISchemaBinding.NamingRule"
-    cc:return-value="new BISchemaBinding.NamingRule(prefix,suffix)">
-    
-    <cc:java-body>
-      private String prefix="";
-      private String suffix="";
-    </cc:java-body>
-    
-    
-    <optional>
-      <attribute name="prefix">
-        prefix = <data type="NCName"/>
-      </attribute>
-    </optional>
-    <optional>
-      <attribute name="suffix">
-        suffix = <data type="NCName"/>
-      </attribute>
-    </optional>
-  </define>
-  
-  
-  
-  <define name="javadoc" cc:return-type="String" cc:return-value="javadoc">
-      <element name="javadoc">
-        javadoc = <text />
-        javadoc = $runtime.truncateDocComment(javadoc);
-      </element>
-  </define>
-  
-  <define name="collectionType" cc:class="CollectionTypeState"
-    cc:return-type="FieldRenderer" cc:return-value="r">
-    <cc:java-body>
-      private FieldRenderer r = null;
-    </cc:java-body>
-    type = <data type="token"/>
-    
-    if( type.equals("indexed") )
-      r = FieldRenderer.ARRAY;
-    else
-      try {
-        r = new UntypedListFieldRenderer( $runtime.codeModel.ref(type) );
-      } catch( ClassNotFoundException e ) {
-        throw new NoClassDefFoundError(e.getMessage());
-      }
-  </define>
-  
-  
-  
-  <define name="class" cc:class="BIClassState"
-    cc:return-type="BIClass" cc:return-value="makeResult()">
-    
-    <cc:java-body>
-      private Locator loc;
-      public BIClass makeResult() {
-        return new BIClass(loc,name,implClass,javadoc);
-      }
-    </cc:java-body>
-    
-    <element name="class">
-      loc = $runtime.copyLocator();
-      <optional>
-        javadoc = <ref name="javadoc"/>
-      </optional>
-      <optional>
-        <attribute name="name">
-          name = <data type="identifier" datatypeLibrary="http://java.sun.com/xml/ns/relaxng/java-datatypes"/>
-        </attribute>
-      </optional>
-      <optional>
-        implClass = <attribute name="implClass"/>
-      </optional>
-    </element>
-  </define>
-  
-  <define name="property"
-    cc:return-type="BIProperty" cc:return-value="makeResult()">
-    
-    <cc:java-body>
-      private Locator loc;
-      private Boolean isConst = null;
-      private Boolean isSet = null;
-      private Boolean genElemProp = null;
-
-      public BIProperty makeResult() throws SAXException {
-        JType baseTypeRef = null;
-        if(baseType!=null)
-          baseTypeRef = $runtime.getType(baseType);
-          
-        return new BIProperty(loc,name,javadoc,baseTypeRef,conv,ct,isConst,isSet,genElemProp);
-      }
-    </cc:java-body>
-    
-    <element name="property">
-      loc = $runtime.copyLocator();
-      <optional>
-        name = <attribute name="name"/>
-      </optional>
-      <optional>
-        baseType = <attribute name="baseType"/>
-      </optional>
-      <optional>
-        <attribute name="collectionType">
-          ct = <ref name="collectionType" />
-        </attribute>
-      </optional>
-      <optional>
-        <attribute name="fixedAttributeAsConstantProperty">
-          isConstStr = <data type="boolean"/>
-          isConst = $runtime.parseBoolean(isConstStr)?Boolean.TRUE:Boolean.FALSE;
-        </attribute>
-      </optional>
-      <optional>
-        <attribute name="generateIsSetMethod">
-          isSetStr = <data type="boolean"/>
-          isSet = $runtime.parseBoolean(isSetStr)?Boolean.TRUE:Boolean.FALSE;
-        </attribute>
-      </optional>
-      <optional>
-        <attribute name="generateElementProperty">
-          genElemPropStr = <data type="boolean"/>
-          genElemProp = $runtime.parseBoolean(genElemPropStr)?Boolean.TRUE:Boolean.FALSE;
-        </attribute>
-      </optional>
-      <optional>
-        <attribute name="generateFailFastSetterMethod">
-          failFast = <data type="boolean"/>
-        </attribute>
-        if( $runtime.parseBoolean(failFast) ) {
-          $runtime.reportUnimplementedFeature("generateFailFastSetterMethod");
-        }
-      </optional>
-
-
-      <interleave>
-        <optional>
-          javadoc = <ref name="javadoc"/>
-        </optional>
-        <optional>
-          <element name="baseType">
-            conv = <ref name="conversion"/>
-          </element>
-        </optional>
-      </interleave>
-    </element>
-  </define>
-  
-  <define name="conversion"
-    cc:return-type="BIConversion" cc:return-value="r">
-    <element name="javaType">
-      r = <ref name="conversionBody"/>
-    </element>
-  </define>
-  
-  
-  <define name="conversionBody"
-    cc:return-type="BIConversion" cc:return-value="makeResult()">
-    
-    <cc:java-import>
-      import com.sun.tools.internal.xjc.generator.util.WhitespaceNormalizer;
-    </cc:java-import>
-    <cc:java-body><![CDATA[
-      public BIConversion makeResult() throws SAXException {
-        return new BIConversion.User( $runtime.copyLocator(), parse, print, $runtime.getType(type) );
-      }
-
-      // initialize with default values.
-      private String type  = "java.lang.String"; // in case a schema has an error
-      private String parse = null;
-      private String print = null;
-      private boolean context = false;
-    ]]></cc:java-body>
-    
-    
-    <optional>
-      parse = <attribute name="parseMethod" />
-    </optional>
-    <optional>
-      print = <attribute name="printMethod" />
-    </optional>
-    <attribute name="name" cc:alias="type"/>
-    <optional>
-      <attribute name="hasNsContext">
-        _context = <data type="boolean"/>
-        context = $runtime.parseBoolean(_context);
-      </attribute>
-    </optional>
-  </define>
-  
-  
-  <!-- type safe enum customization -->
-  <define name="typesafeEnum"
-    cc:return-type="BIEnum" cc:return-value="makeResult()">
-    
-    <cc:java-import>
-      import java.util.HashMap;
-    </cc:java-import>
-    <cc:java-body>
-      private HashMap members = new HashMap();
-      private boolean dontBind = false;
-      private Locator loc,loc2;
-      
-      private BIEnum makeResult() {
-        return new BIEnum(loc,dontBind,name,javadoc,members);
-      }
-    </cc:java-body>
-    
-    <element name="typesafeEnumClass">
-      loc = $runtime.copyLocator();
-      <choice>
-        <attribute name="map">
-          <value>false</value>
-          dontBind = true;
-        </attribute>
-        <group>
-          <optional>
-            name = <attribute name="name"/>
-          </optional>
-          <optional>
-            javadoc = <ref name="javadoc" />
-          </optional>
-          <zeroOrMore>
-            jname = null;
-            javadoc = null;
-            <element name="typesafeEnumMember">
-              loc2 = $runtime.copyLocator();
-              <optional>
-                jname = <attribute name="name"/>
-              </optional>
-              value = <attribute name="value"/>
-              <optional>
-                javadoc = <ref name="javadoc" />
-              </optional>
-              members.put( value, new BIEnumMember(loc2,jname,javadoc) );
-            </element>
-          </zeroOrMore>
-        </group>
-      </choice>
-    </element>
-  </define>
-  
-  
-  <!-- stand-alone type safe enum member customization -->
-  <!--
-     Note that only the name attribute is allowed here, and the same element
-     under the typesafeEnumClass is handled differently.
-  -->
-  <define name="enumMember"
-    cc:return-type="BIEnumMember" cc:return-value="makeResult()">
-    <cc:java-body>
-      private Locator loc;
-      private BIEnumMember makeResult() {
-        return new BIEnumMember(loc,name,javadoc);
-      }
-    </cc:java-body>
-  
-    <element name="typesafeEnumMember">
-      loc = $runtime.copyLocator();
-      name = <attribute name="name"/>
-      <optional>
-        javadoc = <ref name="javadoc" />
-      </optional>
-    </element>
-  </define>
-  
-  
-  <!-- XJC-exntension: root class support -->
-  <define name="superClass" cc:return-type="JDefinedClass" cc:return-value="makeResult()">
-    <cc:java-body>
-      private JDefinedClass makeResult() {
-        try {
-          JDefinedClass c = $runtime.codeModel._class(name);
-          c.hide();
-          return c;
-        } catch( JClassAlreadyExistsException e ) {
-          return e.getExistingClass();
-        }
-      }
-    </cc:java-body>
-    
-    <element name="xjc:superClass">
-      name = <attribute name="name" />
-    </element>
-  </define>
-  
-  <!-- XJC-exntension: root interface support -->
-  <define name="superInterface" cc:return-type="JDefinedClass" cc:return-value="makeResult()">
-    <cc:java-body>
-      private JDefinedClass makeResult() {
-        try {
-          JDefinedClass c = $runtime.codeModel._class(name,ClassType.INTERFACE);
-          c.hide();
-          return c;
-        } catch( JClassAlreadyExistsException e ) {
-          return e.getExistingClass();
-        }
-      }
-    </cc:java-body>
-
-    <element name="xjc:superInterface">
-      name = <attribute name="name" />
-    </element>
-  </define>
-
-  <!-- XJC-exntension: serialization support -->
-  <define name="serializable" cc:return-type="BISerializable" cc:return-value="makeResult()">
-    <cc:java-body>
-      private long uid = 1;
-      private BISerializable makeResult() {
-        return new BISerializable(uid);
-      }
-    </cc:java-body>
-    
-    <element name="xjc:serializable">
-//      loc = $runtime.copyLocator();
-      <optional>
-        <attribute name="uid">
-          v = <data type="long"/>
-          uid = Long.parseLong(v);
-        </attribute>
-      </optional>
-    </element>
-  </define>
-  
-  
-  <!-- XJC extension: type substitution -->
-  <define name="typeSubstitution" cc:return-type="boolean" cc:return-value="true">
-    <element name="xjc:typeSubstitution">
-      <attribute name="type"><value>complex</value></attribute>
-    </element>
-  </define>
-  
-  
-  <!-- XJC extension: ID symbol space support -->
-  <!--define name="idSymbolSpace" cc:return-type="BIXIdSymbolSpace" cc:return-value="makeResult()">
-    <cc:java-body>
-      private Locator loc;
-      private BIXIdSymbolSpace makeResult() {
-        return new BIXIdSymbolSpace(loc,name);
-      }
-    </cc:java-body>
-    
-    <element name="xjc:idSymbolSpace">
-      loc = $runtime.copyLocator();
-      name = <attribute name="name"/>
-    </element>
-  </define-->
-  
-  
-  <!-- XJC extension: DOM support -->
-  <!--define name="dom" cc:return-type="BIXDom" cc:return-value="makeResult()">
-    <cc:java-import>
-      import com.sun.tools.internal.xjc.grammar.ext.*;
-    </cc:java-import>
-    <cc:java-body>
-      private String factoryName = "w3c";
-      private Locator loc;
-      private BIXDom makeResult() {
-        try {
-          return new BIXDom(DOMItemFactory.getInstance(factoryName),loc);
-        } catch( DOMItemFactory.UndefinedNameException e ) {
-          throw new InternalError(); // impossible since we use validation to reject incorrect values
-        }
-      }
-    </cc:java-body>
-    
-    <element name="xjc:dom">
-      loc = $runtime.copyLocator();
-      <optional>
-        <attribute name="type">
-          <choice>
-            factoryName = <value>dom4j</value>
-            factoryName = <value>w3c</value>
-          </choice>
-        </attribute>
-      </optional>
-    </element>
-  </define-->
-  
-  
-  
-  
-  
-  
-  <p:ignore>
-    <!-- these patterns are ignored when using RelaxNGCC -->
-    <define name="anyContents">
-      <zeroOrMore>
-        <choice>
-          <text/>
-          <ref name="anyAttributes"/>
-          <element>
-            <anyName/>
-            <ref name="anyContents"/>
-          </element>
-        </choice>
-      </zeroOrMore>
-    </define>
-    
-    <define name="anyAttributes">
-      <zeroOrMore>
-        <attribute>
-          <anyName/>
-          <text/>
-        </attribute>
-      </zeroOrMore>
-    </define>
-  </p:ignore>
-</grammar>
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/xmlschema-for-jaxb.rng	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1579 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<grammar xmlns="http://relaxng.org/ns/structure/1.0"
-      datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
-      ns="http://www.w3.org/2001/XMLSchema"
-      xmlns:xs="http://www.w3.org/2001/XMLSchema"
-      xmlns:doc="http://www.jenitennison.com/doc"
-      xmlns:txw="http://java.sun.com/txw">
-
-<doc:p>
-  RELAX NG schema for XML Schema by <doc:link 
-  href="mailto:mail@jenitennison.com">Jeni Tennison</doc:link>. Based on 
-  <doc:link href="http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/">XML 
-  Schema Part I: Structures Recommendation</doc:link> and <doc:link 
-  href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/">XML Schema Part 
-  II: Datatypes</doc:link>.
-</doc:p>
-<doc:changes date="2001-11-24">
-  <doc:p>
-    Amended to comply with 10 August 2001 Tutorial.
-  </doc:p>
-  <doc:change>Removed key attributes.</doc:change>
-  <doc:change>Replaced not element with except elements.</doc:change>
-  <doc:change>
-    Replaced multiple consecutive optional attributes to use the 
-    zeroOrMore/choice pattern.
-  </doc:change>
-  <doc:change>
-    Removed interleave elements inside list elements (which are no longer 
-    permitted).
-  </doc:change>
-</doc:changes>
-
-<define name="openAttrs" txw:mode="inherit">
-  <doc:p>
-    This allows any number of attributes that are not in the XML Schema 
-    namespace or are in no namespace.  This is somewhat more complicated than 
-    the XML Schema anyAttribute equivalent. 
-  </doc:p>
-  <!-- KK don't care -->
-  <empty/>
-  <!--zeroOrMore>
-    <attribute>
-      <anyName>
-        <except>
-          <nsName />
-          <nsName ns="" />
-          <name>xml:lang</name>
-        </except>
-      </anyName>
-      <text />
-    </attribute>
-  </zeroOrMore-->
-</define>
-
-<define name="annotated" txw:mode="inherit">
-  <doc:p>
-    This allows any number of attributes that are not in the XML Schema 
-    namespace or are in no namespace, an optional id attribute of type ID, 
-    and an optional annotation element.  This is used as the basis for many 
-    element content models.
-  </doc:p>
-  <ref name="openAttrs" />
-  <optional>
-    <attribute name="id">
-      <data type="ID" />
-    </attribute>
-  </optional>
-  <optional>
-    <ref name="annotation" />
-  </optional>
-</define>
-
-<define name="schemaTop" txw:mode="inline">
-  <doc:p>
-    This gives the content model of the top level of the schema.
-  </doc:p>
-  <choice>
-    <ref name="redefinable" />
-    <ref name="topLevelElement" />
-    <ref name="topLevelAttribute" />
-    <!--ref name="notation" /-->
-  </choice>
-</define>
-
-<define name="redefinable" txw:mode="inline">
-  <doc:p>
-    This gives the components that can be redefined within the redefine 
-    element.  They also occur at the top level of the schema.
-  </doc:p>
-  <choice>
-    <ref name="simpleTypeHost" />
-    <ref name="complexTypeHost" />
-    <!--ref name="namedGroup" />
-    <ref name="namedAttributeGroup" /-->
-  </choice>
-</define>
-
-<define name="formChoice">
-  <doc:p>
-    This gives the values for the various form attributes: 
-    elementFormDefault and attributeFormDefault on the schema element, and
-    the form attributes on the element and attribute elements.
-  </doc:p>
-  <choice>
-    <value>qualified</value>
-    <value>unqualified</value>
-  </choice>
-</define>
-
-<!-- KK: merge the two -->
-<define name="reducedDerivationControl">
-  <doc:p>
-    This gives the values that can be taken in the lists used to control
-    derivation by extension or restriction (this is 'reduced' derivation
-    because some derivation can involve substitution).  This RELAX NG schema, 
-    like the XML Schema Recommendation here, allows the keywords 'extension' and 
-    'restriction' to be repeated any number of times.
-  </doc:p>
-  <list>
-    <oneOrMore>
-      <choice>
-        <value>extension</value>
-        <value>restriction</value>
-      </choice>
-    </oneOrMore>
-  </list>
-</define>
-
-<define name="derivationSet">
-  <doc:p>
-    This specifies the possible values for attributes that control derivation.
-  </doc:p>
-  <choice>
-    <value>#all</value>
-    <ref name="reducedDerivationControl" />
-  </choice>
-</define>
-
-<start>
-  <doc:p>
-    This is the beginning point for the schema, and defines the schema 
-    element.
-  </doc:p>
-  <element name="schema" 
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-schema">
-    <ref name="openAttrs" />
-    <zeroOrMore>
-      <choice>
-        <attribute name="version">
-          <data type="token" />
-        </attribute>
-        <attribute name="finalDefault">
-          <ref name="derivationSet" />
-        </attribute>
-        <attribute name="blockDefault">
-          <ref name="blockSet" />
-        </attribute>
-        <attribute name="attributeFormDefault">
-          <ref name="formChoice" />
-        </attribute>
-        <attribute name="elementFormDefault">
-          <ref name="formChoice" />
-        </attribute>
-        <attribute name="id">
-          <data type="ID" />
-        </attribute>
-        <attribute name="xml:lang">
-          <data type="language" />
-        </attribute>
-        <attribute name="targetNamespace">
-          <data type="anyURI" />
-        </attribute>
-      </choice>
-    </zeroOrMore>
-    <zeroOrMore>
-      <choice>
-        <!--ref name="include" /-->
-        <ref name="import" />
-        <!--ref name="redefine" /-->
-        <ref name="annotation" />
-      </choice>
-    </zeroOrMore>
-    <zeroOrMore>
-      <choice>
-        <ref name="schemaTop" />
-        <ref name="annotation" />
-      </choice>
-    </zeroOrMore>
-  </element>
-</start>
-
-<define name="allNNI">
-  <doc:p>
-    This gives the value type for the maxOccurs attribute, which may be a 
-    non-negative number or the keyword 'unbounded'.
-  </doc:p>
-  <choice>
-    <data type="nonNegativeInteger" />
-    <value type="token">unbounded</value>
-  </choice>
-</define>
-
-<define name="occurs" txw:mode="inherit">
-  <doc:p>
-    This specifies the occurs attributes, minOccurs and maxOccurs, as they 
-    are normally used.
-  </doc:p>
-  <zeroOrMore>
-    <choice>
-      <attribute name="minOccurs">
-        <data type="nonNegativeInteger" />
-      </attribute>
-      <attribute name="maxOccurs">
-        <ref name="allNNI" />
-      </attribute>
-    </choice>
-  </zeroOrMore>
-</define>
-
-<define name="typeDefParticle" txw:mode="inline">
-  <doc:p>
-    This gives the possible content of complex types.
-  </doc:p>
-  <choice>
-    <!--ref name="groupRef" /-->
-    <ref name="all" />
-    <ref name="choice" />
-    <ref name="sequence" />
-  </choice>
-</define>
-
-<define name="nestedParticle" txw:mode="inline">
-  <doc:p>
-    This gives the particles that can make up a model group.
-  </doc:p>
-  <choice>
-    <ref name="localElement" />
-    <!--ref name="groupRef" /-->
-    <ref name="choice" />
-    <ref name="sequence" />
-    <ref name="any" />
-  </choice>
-</define>
-
-<define name="fixedOrDefault" txw:mode="inline">
-  <doc:p>
-    This specifies the relationship between fixed and default attributes on 
-    element and attribute elements - if one is present, then the other cannot 
-    be.  This is a constraint that cannot be specified using XML Schema.
-  </doc:p>
-  <choice>
-    <empty />
-    <attribute name="fixed" />
-    <attribute name="default" />
-  </choice>
-</define>
-
-<define name="attributeType" txw:mode="inherit">
-  <doc:p>
-    This specifies the relationship between the type attribute and the 
-    simpleType element child of attribute elements - if one is present, then 
-    the other cannot be, although it is possible for neither to be allowed.
-  </doc:p>
-  <choice>
-    <empty />
-    <attribute name="type">
-      <data type="QName" />
-    </attribute>
-    <ref name="simpleTypeHost" />
-  </choice>
-</define>
-
-<define name="localAttribute">
-  <doc:p>
-    This describes attribute elements when used in a local context.  They 
-    have an optional use attribute, possibly a fixed or default attribute, 
-    and then can either have a ref attribute (referring to a top-level 
-    attribute) or a name attribute with an optional form attribute and 
-    specifying an attribute type.
-  </doc:p>
-  <element name="attribute" 
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-attribute">
-    <ref name="annotated" />
-    <optional>
-      <attribute name="use">
-        <choice>
-          <value type="token">optional</value>
-          <value type="token">prohibited</value>
-          <value type="token">required</value>
-        </choice>
-      </attribute>
-    </optional>
-    <ref name="fixedOrDefault" />
-    <choice>
-      <attribute name="ref">
-        <data type="QName" />
-      </attribute>
-      <group>
-        <attribute name="name">
-          <data type="NCName" />
-        </attribute>
-        <optional>
-          <attribute name="form">
-            <ref name="formChoice" />
-          </attribute>
-        </optional>        
-        <ref name="attributeType" />
-      </group>
-    </choice>
-  </element>
-</define>
-
-<define name="topLevelAttribute">
-  <doc:p>
-    This describes attribute elements when used at the top level of the 
-    schema.  They must have a name, may have a fixed or default attribute, 
-    and specify their type through a type attribute or child simpleType 
-    element.  The name attribute of each attribute element that appears at 
-    the top level of the schema is unique.
-  </doc:p>
-  <element name="attribute"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-attribute">
-    <ref name="annotated" />
-    <attribute name="name">
-      <data type="NCName" />
-    </attribute>
-    <ref name="fixedOrDefault" />
-    <ref name="attributeType" />
-  </element>
-</define>
-
-<define name="attrDecls" txw:mode="inherit">
-  <doc:p>
-    This gives the model group for specifying the attributes in a complex 
-    type, an extension or restriction.
-  </doc:p>
-  <zeroOrMore>
-    <choice>
-      <ref name="localAttribute" />
-      <!--ref name="attributeGroupRef" /-->
-    </choice>
-  </zeroOrMore>
-  <optional>
-    <ref name="anyAttribute" />
-  </optional>
-</define>
-
-<define name="anyAttribute">
-  <doc:p>
-    This specifies the anyAttribute wildcard.
-  </doc:p>
-  <element name="anyAttribute"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute">
-    <ref name="wildcard" />
-  </element>
-</define>
-
-<define name="complexTypeModel" txw:mode="inherit">
-  <doc:p>
-    This specifies the content of a complexType element.  As children, it can 
-    have a simpleContent, a complexContent or a model group.  Only if it has 
-    one of the latter two, may it have a mixed attribute.  This latter 
-    constraint is something that cannot be specified in XML Schema.
-  </doc:p>
-  <choice>
-    <ref name="simpleContent" />
-    <group>
-      <optional>
-        <attribute name="mixed">
-          <data type="boolean" />
-        </attribute>
-      </optional>
-      <choice>
-        <ref name="complexContent" />
-        <group>
-          <optional>
-            <ref name="typeDefParticle" />
-          </optional>
-          <ref name="attrDecls" />
-        </group>
-      </choice>
-    </group>
-  </choice>
-</define>
-
-<define name="complexTypeHost" txw:mode="inherit">
-  <ref name="typeHost" />
-  <ref name="complexType" />
-</define>
-
-<define name="typeHost" txw:mode="inherit"><empty/><empty/></define>
-
-<define name="complexType" txw:mode="inherit">
-  <element name="complexType"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexType">
-    <doc:p>
-      This specifies the basic content of a complexType element.
-    </doc:p>
-    <ref name="annotated" />
-    <ref name="complexTypeModel" />
-    <optional>
-      <attribute name="name">
-        <data type="NCName" />
-      </attribute>
-    </optional>
-    <zeroOrMore>
-      <choice>
-        <attribute name="abstract">
-          <data type="boolean" />
-        </attribute>
-        <attribute name="block">
-          <ref name="derivationSet" />
-        </attribute>
-        <attribute name="final">
-          <ref name="derivationSet" />
-        </attribute>
-      </choice>
-    </zeroOrMore>
-  </element>
-</define>
-
-<define name="complexRestriction">
-  <doc:p>
-    This describes a restriction element within a complexContent element 
-    (i.e. one that restricts a complex type).  It has a base attribute, may 
-    contain a model group and may contain attribute declarations of various 
-    sorts.
-  </doc:p>
-  <element name="restriction"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexContent::restriction">
-    <ref name="annotated" />
-    <attribute name="base">
-      <data type="QName" />
-    </attribute>
-    <optional>
-      <ref name="typeDefParticle" />
-    </optional>
-    <ref name="attrDecls" />
-  </element>
-</define>
-
-<define name="extensionType">
-  <doc:p>
-    This specifies the basic model for an extension element: adding a 
-    required base attribute to the model used for most components.
-  </doc:p>
-  <ref name="annotated" />
-  <attribute name="base">
-    <data type="QName" />
-  </attribute>
-</define>
-
-<define name="complexExtension">
-  <doc:p>
-    This describes an extension element within a complexContent element 
-    (i.e. one that restricts a complex type).  It may contain a model group 
-    and may contain attribute declarations of various sorts.
-  </doc:p>
-  <element name="extension"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexContent::extension">
-    <ref name="extensionType" />
-    <optional>
-      <ref name="typeDefParticle" />
-    </optional>
-    <ref name="attrDecls" />
-  </element>
-</define>
-
-<define name="complexContent">
-  <doc:p>
-    This describes a complexContent element.  It may have a mixed attribute, 
-    and either a restriction or extension element as content.
-  </doc:p>
-  <element name="complexContent"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-complexContent">
-    <ref name="annotated" />
-    <optional>
-      <attribute name="mixed">
-        <data type="boolean" />
-      </attribute>
-    </optional>
-    <choice>
-      <ref name="complexRestriction" />
-      <ref name="complexExtension" />
-    </choice>
-  </element>
-</define>
-
-<define name="simpleRestriction">
-  <doc:p>
-    This describes a restriction element that appears within a simpleContent 
-    or simpleType element (i.e. one that restricts a simple type).  Its 
-    content follows the simple restriction model that is detailed below, and 
-    may include attribute declarations.
-  </doc:p>
-  <element name="restriction"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleContent::restriction">
-    <ref name="annotated" />
-    <ref name="simpleRestrictionModel" />
-    <ref name="attrDecls" />
-  </element>
-</define>
-
-<define name="simpleExtension">
-  <doc:p>
-    This describes an extension element that appears within a simpleContent 
-    element (i.e. one that extends a simple type).  Like other extensions, it 
-    has a base type, but it can only be used to add attributes.
-  </doc:p>
-  <element name="extension"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleContent::extension">
-    <ref name="extensionType" />
-    <ref name="attrDecls" />
-  </element>
-</define>
-
-<define name="simpleContent">
-  <doc:p>
-    This describes a simpleContent element, whose content can either hold a 
-    restriction or extension element.
-  </doc:p>
-  <element name="simpleContent"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleContent">
-    <ref name="annotated" />
-    <choice>
-      <ref name="simpleRestriction" />
-      <ref name="simpleExtension" />
-    </choice>
-  </element>
-</define>
-
-<define name="blockSet">
-  <doc:p>
-    This gives the possible values for block attributes on element elements, 
-    which includes substitution amongst the list of possible values.  This 
-    RELAX NG schema, like the XML Schema Recommendation, allows each of the 
-    keywords 'extension', 'restriction' and 'substitution' to occur more than 
-    once within the list.
-  </doc:p>
-  <choice>
-    <value type="token">#all</value>
-    <list>
-      <oneOrMore>
-        <choice>
-          <value>extension</value>
-          <value>restriction</value>
-          <value>substitution</value>
-        </choice>
-      </oneOrMore>
-    </list>
-  </choice>
-</define>
-
-<define name="element" txw:mode="inherit">
-  <doc:p>
-    This describes the basic content model of an element element.  It is 
-    annotated, may have a fixed or default attribute, and may have nillable 
-    and/or block attributes.  Its type may be specified through a type 
-    attribute, a local simple type or a local complex type - the choice 
-    between these methods is something that cannot be indicated with XML 
-    Schema.  This content is optionally followed by some identify constraints.
-  </doc:p>
-  <ref name="annotated" />
-  <ref name="fixedOrDefault" />
-  <zeroOrMore>
-    <choice>
-      <attribute name="nillable">
-        <data type="boolean" />
-      </attribute>
-      <attribute name="block">
-        <ref name="blockSet" />
-      </attribute>
-    </choice>
-  </zeroOrMore>
-  <choice>
-    <empty />
-    <attribute name="type">
-      <data type="QName" />
-    </attribute>
-    <ref name="simpleTypeHost" />
-    <ref name="complexTypeHost" />
-  </choice>
-  <!--zeroOrMore>
-    <ref name="identityConstraint" />
-  </zeroOrMore-->
-</define>
-
-<define name="topLevelElement">
-  <doc:p>
-    This describes an element element that appears at the top level of the 
-    schema.  On top of the basic content for an element element, it has to 
-    have a name, which is a unique identifier in the element symbol space.  It 
-    may have substitutionGroup, abstract and/or final attributes.
-  </doc:p>
-  <element name="element"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-element">
-    <ref name="element" />
-    <attribute name="name">
-      <data type="NCName" />
-    </attribute>
-    <zeroOrMore>
-      <choice>
-        <attribute name="substitutionGroup">
-          <data type="QName" />
-        </attribute>
-        <attribute name="abstract">
-          <data type="boolean" />
-        </attribute>
-        <attribute name="final">
-          <ref name="derivationSet" />
-        </attribute>
-      </choice>
-    </zeroOrMore>
-  </element>
-</define>
-
-<define name="localElement">
-  <doc:p>
-    This describes an element element that appears locally, within a 
-    complexType or group element.  It may have minOccurs and/or maxOccurs 
-    attributes.  If it has a ref attribute, then that&apos;s all it can 
-    have.  Otherwise, it must have a name and specifies its type in the same 
-    way as the basic element content model described above.  It may in this 
-    case also have a form element.  These constraints on local elements 
-    cannot be described within XML Schema.
-  </doc:p>
-  <element name="element"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-element">
-    <ref name="occurs" />
-    <choice>
-      <attribute name="ref">
-        <data type="QName" />
-      </attribute>
-      <group>
-        <ref name="element" />
-        <attribute name="name">
-          <data type="NCName" />
-        </attribute>
-        <optional>
-          <attribute name="form">
-            <ref name="formChoice" />
-          </attribute>
-        </optional>
-      </group>
-    </choice>
-  </element>
-</define>
-
-<!--define name="namedGroup">
-  <doc:p>
-    This describes an group element that appears at the top level of the 
-    schema.  It must have a name attribute, and must have one of an all, 
-    choice or sequence element child.
-  </doc:p>
-  <element name="group"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-group">
-    <ref name="annotated" />
-    <attribute name="name">
-      <data type="NCName" />
-    </attribute>
-    <choice>
-      <element name="all">
-        <ref name="simpleExplicitGroup" />  <!- - RS - relaxed all content model - ->
-      </element>
-      <element name="choice">
-        <ref name="simpleExplicitGroup" />
-      </element>
-      <element name="sequence">
-        <ref name="simpleExplicitGroup" />
-      </element>
-    </choice>
-  </element>
-</define-->
-
-<!--define name="groupRef">
-  <doc:p>
-    This describes group element that occurs locally, referring to a 
-    top-level named group.  It may have occurrence attributes, and must have 
-    a ref attribute.
-  </doc:p>
-  <element name="group"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-group">
-    <ref name="annotated" />
-    <ref name="occurs" />
-    <attribute name="ref">
-      <data type="QName" />
-    </attribute>
-  </element>
-</define-->
-
-<define name="explicitGroup" txw:mode="inherit">
-  <doc:p>
-    This gives the content of a model group (not a group element) in the 
-    normal run of things.  It has occurrence attributes and any number of 
-    particles within it.
-  </doc:p>
-  <ref name="annotated" />
-  <ref name="occurs" />
-  <zeroOrMore>
-    <ref name="nestedParticle" />
-  </zeroOrMore>
-</define>
-
-<define name="simpleExplicitGroup">
-  <doc:p>
-    This gives the content of a model group (not a group element) within a 
-    named group - it differs from the above in that it doesn&apos;t have any 
-    occurrence attributes.
-  </doc:p>
-  <ref name="annotated" />
-  <zeroOrMore>
-    <ref name="nestedParticle" />
-  </zeroOrMore>
-</define>
-
-<define name="all">
-  <doc:p>
-    This describes an all element that appears outside a named group (i.e. as 
-    the content of a complexType element).  It has the standard model for an 
-    all element, but adds minOccurs and maxOccurs attributes which can only 
-    take certain values.
-  </doc:p>
-  <element name="all"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-all">
-    <ref name="explicitGroup" />
-  </element>
-</define>
-
-<define name="choice">
-  <doc:p>
-    This describes a choice element that appears outside a named group.
-  </doc:p>
-  <element name="choice"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-choice">
-    <ref name="explicitGroup" />
-  </element>
-</define>
-
-<define name="sequence">
-  <doc:p>
-    This describes a sequence element that appears outside a named group.
-  </doc:p>
-  <element name="sequence"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-sequence">
-    <ref name="explicitGroup" />
-  </element>
-</define>
-
-<define name="wildcard" txw:mode="inherit">
-  <doc:p>
-    This describes a wildcard element (i.e. any or anyAttribute).  The 
-    namespace attribute can take a list URIs interspersed with the keywords 
-    '##targetNamespace' and/or '##local'.  This RELAX NG schema, like the XML 
-    Schema Recommendation, allows the keywords to be specified more than once 
-    each within the list, if they&apos;re given.  This model also specifies the 
-    processContents attribute.
-  </doc:p>
-  <ref name="annotated" />
-  <zeroOrMore>
-    <choice>
-      <attribute name="namespace">
-        <choice>
-          <value type="token">##any</value>
-          <value type="token">##other</value>
-          <list>
-            <zeroOrMore>
-              <choice>
-                <data type="anyURI" />
-                <value>##targetNamespace</value>
-                <value>##local</value>
-              </choice>
-            </zeroOrMore>
-          </list>
-        </choice>
-      </attribute>
-      <attribute name="processContents">
-        <choice>
-          <value type="token">lax</value>
-          <value type="token">skip</value>
-          <value type="token">strict</value>
-        </choice>
-      </attribute>
-    </choice>
-  </zeroOrMore>
-</define>
-
-<define name="any">
-  <doc:p>
-    This describes an any element as a wildcard.
-  </doc:p>
-  <element name="any"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-any">
-    <ref name="wildcard" />
-    <ref name="occurs" />
-  </element>
-</define>
-
-<!--define name="namedAttributeGroup">
-  <doc:p>
-    This describes an attributeGroup element as it appears at the top level 
-    of the schema.  It must have a name attribute, and then contains 
-    attribute declarations.
-  </doc:p>
-  <element name="attributeGroup"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup">
-    <ref name="annotated" />
-    <attribute name="name">
-      <data type="NCName" />
-    </attribute>
-    <ref name="attrDecls" />
-  </element>
-</define-->
-
-<!--define name="attributeGroupRef">
-  <doc:p>
-    This describes an attributeGroup element as it appears within a complex 
-    type.  It must have a ref attribute.
-  </doc:p>
-  <element name="attributeGroup"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup">
-    <ref name="annotated" />
-    <attribute name="ref">
-      <data type="QName" />
-    </attribute>
-  </element>
-</define-->
-
-<!--define name="include">
-  <doc:p>
-    This describes an include element, which must have a schemaLocation 
-    attribute.
-  </doc:p>
-  <element name="include"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-include">
-    <ref name="annotated" />
-    <attribute name="schemaLocation">
-      <data type="anyURI" />
-    </attribute>
-  </element>
-</define-->
-
-<!--define name="redefine">
-  <doc:p>
-    This describes a redefine element, which must have a schemaLocation 
-    attribute and can then contain any mix of annotations and redefinable 
-    components.
-  </doc:p>
-  <element name="redefine"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-redefine">
-    <ref name="openAttrs" />
-    <optional>
-      <attribute name="id">
-        <data type="ID" />
-      </attribute>
-    </optional>
-    <attribute name="schemaLocation">
-      <data type="anyURI" />
-    </attribute>
-    <zeroOrMore>
-      <choice>
-        <ref name="annotation" />
-        <ref name="redefinable" />
-      </choice>
-    </zeroOrMore>
-  </element>
-</define-->
-
-<define name="import">
-  <doc:p>
-    This describes an import element that&apos;s used when its parent schema 
-    element specifies a targetNamespace.  In these cases, the namespace 
-    attribute on the import element is optional.
-  </doc:p>
-  <element name="import"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-import">
-	  <ref name="annotated" />
-	  <optional>
-	    <attribute name="schemaLocation">
-	      <data type="anyURI" />
-	    </attribute>
-	  </optional>
-    <optional>
-      <attribute name="namespace">
-        <data type="anyURI" />
-      </attribute>
-    </optional>
-  </element>
-</define>
-
-<!--define name="selector">
-  <doc:p>
-    This describes a selector element.  The xpath attribute is a simplified 
-    XPath - the regular expression given here is the one from the XML Schema 
-    for XML Schema.
-  </doc:p>
-  <element name="selector"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-selector">
-    <ref name="annotated" />
-    <attribute name="xpath">
-      <data type="token">
-        <param name="pattern">(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*</param>
-      </data>
-    </attribute>
-  </element>
-</define>
-
-<define name="field">
-  <doc:p>
-    This describes a field element.  The xpath attribute is a simplified 
-    XPath - the regular expression given here is the one from the XML Schema 
-    for XML Schema.
-  </doc:p>
-  <element name="field"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-field">
-    <ref name="annotated" />
-    <attribute name="xpath">
-      <data type="token">
-        <param name="pattern">(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*</param>
-      </data>
-    </attribute>
-  </element>
-</define>
-
-<define name="keybase" txw:mode="inherit">
-  <doc:p>
-    This gives the basic content for identity constraints - a name attribute 
-    that uniquely identifies the identity constraint, a selector element and 
-    one or more field elements.
-  </doc:p>
-  <ref name="annotated" />
-  <attribute name="name">
-    <data type="NCName" />
-  </attribute>
-  <ref name="selector" />
-  <oneOrMore>
-    <ref name="field" />
-  </oneOrMore>
-</define>
-
-<define name="identityConstraint" txw:mode="inline">
-  <doc:p>
-    This gives a model group for the three identity constraint elements, used 
-    within the content of element elements.
-  </doc:p>
-  <choice>
-    <ref name="unique" />
-    <ref name="key" />
-    <ref name="keyref" />
-  </choice>
-</define>
-
-<define name="unique">
-  <doc:p>
-    This describes a unique element.
-  </doc:p>
-  <element name="unique"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-unique">
-    <ref name="keybase" />
-  </element>  
-</define>
-
-<define name="key">
-  <doc:p>
-    This describes a key element.
-  </doc:p>
-  <element name="key"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-key">
-    <ref name="keybase" />
-  </element>
-</define>
-
-<define name="keyref">
-  <doc:p>
-    This describes a keyref element.
-  </doc:p>
-  <element name="keyref"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-keyref">
-    <ref name="keybase" />
-    <attribute name="refer">
-      <data type="QName" />
-    </attribute>
-  </element>
-</define-->
-
-<!--define name="notation">
-  <doc:p>
-    This describes a notation element.  The names of notation elements are 
-    unique in the notation symbol space.  The public attribute is required, 
-    and the system attribute is optional.
-  </doc:p>
-  <element name="notation"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-notation">
-    <ref name="annotated" />
-    <attribute name="name">
-      <data type="NCName" />
-    </attribute>
-    <attribute name="public">
-      <data type="token" />
-    </attribute>
-    <optional>
-      <attribute name="system">
-        <data type="anyURI" />
-      </attribute>
-    </optional>
-  </element>
-</define-->
-
-<define name="appinfoContent">
-  <doc:p>
-    This is designed to describe the content of the appinfo elements in the 
-    schema.  At the moment this allows any mixed content without validation.  
-    Note that this is fairly complex compared to the XML Schema equivalent, 
-    which would be a single any element.
-  </doc:p>
-  <ref name="anyContent" />
-</define>
-
-<define name="anyContent">
-  <empty/>  <!-- KK don't care -->
-  <!--mixed>
-    <zeroOrMore>
-      <element>
-        <anyName />
-        <zeroOrMore>
-          <attribute>
-            <anyName />
-          </attribute>
-        </zeroOrMore>
-        <ref name="anyContent" />
-        <empty />
-      </element>
-    </zeroOrMore>
-  </mixed-->
-</define>
-
-<define name="appinfo">
-  <doc:p>
-    This describes an appinfo element.  It has an optional source attribute 
-    and can currently contain anything at all.
-  </doc:p>
-  <element name="appinfo"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-appinfo">
-    <optional>
-      <attribute name="source">
-        <data type="anyURI" />
-      </attribute>
-    </optional>
-    <ref name="appinfoContent" />
-  </element>
-</define>
-
-<define name="documentationContent">
-  <doc:p>
-    This is designed to describe the content of the documentation elements in 
-    the schema.  At the moment this allows any mixed content without 
-    validation.  Note that this is fairly complex compared to the XML Schema 
-    equivalent, which would be a single any element.
-  </doc:p>
-  <ref name="anyContent" />
-</define>
-
-<define name="documentation">
-  <doc:p>
-    This describes a documentation element.  It has optional source 
-    and xml:lang attributes and can currently contain anything at all.
-  </doc:p>
-  <element name="documentation"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-documentation">
-    <zeroOrMore>
-      <choice>
-        <attribute name="source">
-          <data type="anyURI" />
-        </attribute>
-        <attribute name="xml:lang">
-          <data type="language" />
-        </attribute>
-      </choice>
-    </zeroOrMore>
-    <ref name="documentationContent" />
-  </element>
-</define>
-
-<define name="annotation">
-  <doc:p>
-    This describes an annotation element.  It can have any attributes, may 
-    have an id attribute, and contains any number of documentation or appinfo 
-    elements.
-  </doc:p>
-  <element name="annotation"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-annotation">
-    <ref name="openAttrs" />
-    <optional>
-      <attribute name="id">
-        <data type="ID" />
-      </attribute>
-    </optional>
-    <zeroOrMore>
-      <choice>
-        <ref name="documentation" />
-        <ref name="appinfo" />
-      </choice>
-    </zeroOrMore>
-  </element>
-</define>
-
-<define name="simpleDerivation" txw:mode="inline">
-  <doc:p>
-    This gives the various types of derivation of simple types.
-  </doc:p>
-  <choice>
-    <ref name="simpleRestriction" />
-    <ref name="list" />
-    <ref name="union" />
-  </choice>
-</define>
-
-<define name="simpleDerivationSet">
-  <doc:p>
-    This specifies the values of the final attribute for simple types.  This 
-    RELAX NG schema for XML Schema, like the XML Schema Recommendation, allows 
-    the keywords 'list', 'union' and 'restriction' to appear more than once 
-    within the list.
-  </doc:p>
-  <choice>
-    <value type="token">#all</value>
-    <list>
-      <zeroOrMore>
-        <choice>
-          <value>list</value>
-          <value>union</value>
-          <value>restriction</value>
-        </choice>
-      </zeroOrMore>
-    </list>
-  </choice>
-</define>
-
-<define name="simpleTypeHost" txw:mode="inherit">
-  <ref name="typeHost" />
-  <ref name="simpleType" />
-</define>
-
-<define name="simpleType" txw:mode="inherit">
-  <doc:p>
-    This gives the basic content of a simple type.
-  </doc:p>
-  <element name="simpleType"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-simpleType">
-    <ref name="annotated" />
-    <ref name="simpleDerivation" />
-    <optional>
-      <attribute name="name">
-        <data type="NCName" />
-      </attribute>
-    </optional>
-    <optional>
-      <attribute name="final">
-        <ref name="simpleDerivationSet" />
-      </attribute>
-    </optional>
-  </element>
-</define>
-
-<!--define name="rangeFacets" txw:mode="inherit">
-  <doc:p>
-    This describes the relationship between the various range facets.  Only 
-    one of minExclusive and minInclusive can be present, and only one of 
-    maxExclusive and maxInclusive can be present.  This is a constraint that 
-    can&apos;t easily be expressed using XML Schema.  This RELAX NG schema 
-    for XML Schema is a little more restrictive than the XML Schema 
-    Recommendation in that it also forces there to be a maximum of one of 
-    each of these types of facets.
-  </doc:p>
-  <interleave>
-    <optional>
-      <choice>
-        <ref name="minExclusive" />
-        <ref name="minInclusive" />
-      </choice>
-    </optional>    
-    <optional>
-      <choice>
-        <ref name="maxExclusive" />
-        <ref name="maxInclusive" />
-      </choice>
-    </optional>
-  </interleave>
-</define>
-
-<define name="digitFacets" txw:mode="inherit">
-  <doc:p>
-    This specifies optional totalDigits and fractionDigits elements.  This 
-    RELAX NG schema for XML Schema is a little more restrictive than the XML 
-    Schema Recommendation in that it also forces there to be a maximum of one 
-    of each of these types of facets.
-  </doc:p>
-  <optional>
-    <ref name="totalDigits" />
-  </optional>
-  <optional>
-    <ref name="fractionDigits" />
-  </optional>
-</define>
-
-<define name="lengthFacets" txw:mode="inherit">
-  <doc:p>
-    This specifies optional length, minLength and maxLength elements.  This 
-    RELAX NG schema for XML Schema is a little more restrictive than the XML 
-    Schema Recommendation in that it also forces there to be a maximum of one 
-    of each of these types of facets, and says that if a length element is 
-    given, then neither minLength nor maxLength should be present.
-  </doc:p>
-  <choice>
-    <ref name="length" />
-    <interleave>
-      <optional>
-        <ref name="minLength" />
-      </optional>
-      <optional>
-        <ref name="maxLength" />        
-      </optional>
-    </interleave>
-  </choice>
-</define>
-
-<define name="commonFacets" txw:mode="inherit">
-  <doc:p>
-    This specifies zero or more enumeration or pattern elements and an 
-    optional whiteSpace element.  This RELAX NG schema for XML Schema is a 
-    little more restrictive than the XML Schema Recommendation in that it 
-    also forces there to be a maximum of one whiteSpace element within the 
-    facets.  Note that the whiteSpace facet is constrained to have a value of 
-    'collapse'.
-  </doc:p>
-  <zeroOrMore>
-    <ref name="enumeration" />
-  </zeroOrMore>
-  <optional>
-    <ref name="whiteSpaceCollapse" />
-  </optional>
-  <zeroOrMore>
-    <ref name="pattern" />
-  </zeroOrMore>
-</define-->
-
-<define name="simpleRestrictionModel">
-  <doc:p>
-    This specifies the types of facets that are valid in restrictions on the 
-    built-in data types.  This can only perform rudimentary checking, but 
-    should be enough in most circumstances.  Note that for xs:anySimpleType 
-    and xs:string, the whiteSpace facet can take any value, for 
-    xs:normalizedString it can be 'replace' or 'collapse', and for all other 
-    built-in types it has to be 'collapse'.
-  </doc:p>
-  <choice>
-    <attribute name="base">
-      <data type="QName" />
-    </attribute>
-    <ref name="simpleTypeHost" />
-  </choice>
-  <interleave>
-    <!--ref name="rangeFacets" />
-    <ref name="digitFacets" />
-    <ref name="lengthFacets" />
-    <optional>
-      <ref name="whiteSpace" />
-    </optional-->
-    <zeroOrMore>
-      <ref name="enumeration" />
-    </zeroOrMore>
-    <!--zeroOrMore>
-      <ref name="pattern" />
-    </zeroOrMore-->
-  </interleave>
-</define>
-
-<define name="list">
-  <doc:p>
-    This describes a list element.  It can either specify a local simple type 
-    or have a itemType attribute.  This constraint cannot be expressed in XML 
-    Schema.
-  </doc:p>
-  <element name="list"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-list">
-    <ref name="annotated" />
-    <choice>      
-      <ref name="simpleTypeHost" />
-      <attribute name="itemType">
-        <data type="QName" />
-      </attribute>
-    </choice>
-  </element>
-</define>
-
-<define name="union">
-  <doc:p>
-    This describes a union element.  If the memberTypes attribute is missing 
-    or empty, then it must contain one or more simpleType elements; if 
-    it&apos;s present, then it can contain simpleType elements or list simple 
-    types in the memberTypes attribute.  This constraint cannot be expressed 
-    in XML Schema.
-  </doc:p>
-  <element name="union"
-        doc:href="http://www.w3.org/TR/xmlschema-1/#element-union">
-    <ref name="annotated" />
-    <choice>
-      <group>
-        <attribute name="memberTypes">
-          <list>
-            <oneOrMore>
-              <data type="QName" />
-            </oneOrMore>
-          </list>
-        </attribute>
-        <zeroOrMore>
-          <ref name="simpleTypeHost" />
-        </zeroOrMore>
-      </group>
-      <group>
-        <optional>
-          <attribute name="memberTypes">
-            <empty />
-          </attribute>
-        </optional>
-        <oneOrMore>
-          <ref name="simpleTypeHost" />
-        </oneOrMore>
-      </group>
-    </choice>
-  </element>
-</define>
-
-<define name="facet" txw:mode="inherit">
-  <doc:p>
-    This is the basic content of a facet.  It has an optional fixed attribute.
-  </doc:p>
-  <ref name="annotated" />
-  <optional>
-    <attribute name="fixed">
-      <data type="boolean" />
-    </attribute>
-  </optional>
-</define>
-
-<define name="noFixedFacet" txw:mode="inherit">
-  <doc:p>
-    This is the content of a facet that cannot be fixed (enumeration or 
-    pattern).  It has a value attribute that can take any kind of value.
-  </doc:p>
-  <ref name="annotated" />
-  <attribute name="value" />
-</define>
-
-<!--define name="rangeFacet">
-  <doc:p>
-    This is the content of a range facet.  The value must be one of the data 
-    types shown (as these are the only types of data that accept ranges).  I 
-    haven&apos;t gone so far as to indicate the data type of the value 
-    attribute of a range facet according to the base type as this would be 
-    very complicated (although it would be possible in RELAX NG).
-  </doc:p>
-  <ref name="facet" />
-  <attribute name="value">
-    <choice>
-      <data type="decimal" />
-      <data type="float" />
-      <data type="double" />
-      <data type="duration" />
-      <data type="dateTime" />
-      <data type="time" />
-      <data type="date" />
-      <data type="gYearMonth" />
-      <data type="gYear" />
-      <data type="gMonthDay" />
-      <data type="gMonth" />
-      <data type="gDay" />
-    </choice>
-  </attribute>
-</define>
-
-<define name="minExclusive">
-  <doc:p>
-    This describes a minExclusive element.
-  </doc:p>
-  <element name="minExclusive"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minExclusive">
-    <ref name="rangeFacet" />
-  </element>
-</define>
-
-<define name="minInclusive">
-  <doc:p>
-    This describes a minInclusive element.
-  </doc:p>
-  <element name="minInclusive"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minInclusive">
-    <ref name="rangeFacet" />
-  </element>
-</define>
-
-<define name="maxExclusive">
-  <doc:p>
-    This describes a maxExclusive element.
-  </doc:p>
-  <element name="maxExclusive"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxExclusive">
-    <ref name="rangeFacet" />
-  </element>
-</define>
-
-<define name="maxInclusive">
-  <doc:p>
-    This describes a maxInclusive element.
-  </doc:p>
-  <element name="maxInclusive"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxInclusive">
-    <ref name="rangeFacet" />
-  </element>
-</define>
-
-<define name="numFacet">
-  <doc:p>
-    This is the content of a numerical facet.
-  </doc:p>
-  <ref name="facet" />
-  <attribute name="value">
-    <data type="nonNegativeInteger" />
-  </attribute>
-</define>
-
-<define name="totalDigits">
-  <doc:p>
-    This describes a totalDigits element.  The value attribute must take a 
-    positive integer.
-  </doc:p>
-  <element name="totalDigits"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-totalDigits">
-    <ref name="facet" />
-    <attribute name="value">
-      <data type="positiveInteger" />
-    </attribute>
-  </element>
-</define>
-
-<define name="fractionDigits">
-  <doc:p>
-    This describes a fractionDigits element.
-  </doc:p>
-  <element name="fractionDigits"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-fractionDigits">
-    <ref name="numFacet" />
-  </element>
-</define>
-
-<define name="length">
-  <doc:p>
-    This describes a length element.
-  </doc:p>
-  <element name="length"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-length">
-    <ref name="numFacet" />
-  </element>
-</define>
-
-<define name="minLength">
-  <doc:p>
-    This describes a minLength element.
-  </doc:p>
-  <element name="minLength"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-minLength">
-    <ref name="numFacet" />
-  </element>
-</define>
-
-<define name="maxLength">
-  <doc:p>
-    This describes a maxLength element.
-  </doc:p>
-  <element name="maxLength"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-maxLength">
-    <ref name="numFacet" />
-  </element>
-</define-->
-
-<define name="enumeration">
-  <doc:p>
-    This describes an enumeration element.
-  </doc:p>
-  <element name="enumeration"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-enumeration">
-    <ref name="noFixedFacet" />
-  </element>
-</define>
-
-<!--define name="whiteSpace">
-  <doc:p>
-    This describes a whiteSpace element that can take any of the permitted 
-    values.
-  </doc:p>
-  <element name="whiteSpace"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace">
-    <ref name="facet" />
-    <attribute name="value">
-      <choice>
-        <value type="token">preserve</value>
-        <value type="token">replace</value>
-        <value type="token">collapse</value>
-      </choice>
-    </attribute>
-  </element>
-</define>
-
-<define name="whiteSpaceReplaceOrCollapse">
-  <doc:p>
-    This describes a whiteSpace element that can only take the values 
-    'replace' or 'collapse'.
-  </doc:p>
-  <element name="whiteSpace"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace">
-    <ref name="facet" />
-    <attribute name="value">
-      <choice>
-        <value type="token">replace</value>
-        <value type="token">collapse</value>
-      </choice>
-    </attribute>
-  </element>
-</define>
-
-<define name="whiteSpaceCollapse">
-  <doc:p>
-    This describes a whiteSpace element that can only take the value 
-    'collapse'.
-  </doc:p>
-  <element name="whiteSpace"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-whiteSpace">
-    <ref name="facet" />
-    <attribute name="value">
-      <value type="token">collapse</value>
-    </attribute>
-  </element>
-</define>
-
-<define name="pattern">
-  <doc:p>
-    This describes a pattern element.
-  </doc:p>
-  <element name="pattern"
-        doc:href="http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#element-pattern">
-    <ref name="noFixedFacet" />
-  </element>
-</define-->
-
-</grammar>
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java	Tue May 27 16:39:05 2014 -0600
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/AttachmentPartImpl.java	Wed Jul 05 19:42:29 2017 +0200
@@ -582,7 +582,8 @@
                     mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
                     mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler");
                     mailMap.addMailcap("application/fastinfoset;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.FastInfosetDataContentHandler");
-                    mailMap.addMailcap("multipart/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");
+                    // this handler seems to be not used according VCS history ...
+                    // mailMap.addMailcap("multipart/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.MultipartDataContentHandler");
                     mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.ImageDataContentHandler");
                     mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.messaging.saaj.soap.StringDataContentHandler");
                 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/CompactSyntax.jj	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1963 +0,0 @@
-options {
-  STATIC = false;
-  UNICODE_INPUT = true;
-  JAVA_UNICODE_ESCAPE = true;
-}
-
-PARSER_BEGIN(CompactSyntax)
-
-package com.sun.xml.internal.rngom.parse.compact;
-
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.List;
-
-import com.sun.xml.internal.rngom.ast.builder.Annotations;
-import com.sun.xml.internal.rngom.ast.builder.BuildException;
-import com.sun.xml.internal.rngom.ast.builder.CommentList;
-import com.sun.xml.internal.rngom.ast.builder.DataPatternBuilder;
-import com.sun.xml.internal.rngom.ast.builder.Div;
-import com.sun.xml.internal.rngom.ast.builder.ElementAnnotationBuilder;
-import com.sun.xml.internal.rngom.ast.builder.Grammar;
-import com.sun.xml.internal.rngom.ast.builder.GrammarSection;
-import com.sun.xml.internal.rngom.ast.builder.Include;
-import com.sun.xml.internal.rngom.ast.builder.IncludedGrammar;
-import com.sun.xml.internal.rngom.ast.builder.NameClassBuilder;
-import com.sun.xml.internal.rngom.ast.builder.SchemaBuilder;
-import com.sun.xml.internal.rngom.ast.builder.Scope;
-import com.sun.xml.internal.rngom.ast.om.Location;
-import com.sun.xml.internal.rngom.ast.om.ParsedElementAnnotation;
-import com.sun.xml.internal.rngom.ast.om.ParsedNameClass;
-import com.sun.xml.internal.rngom.ast.om.ParsedPattern;
-import com.sun.xml.internal.rngom.parse.Context;
-import com.sun.xml.internal.rngom.parse.IllegalSchemaException;
-import com.sun.xml.internal.rngom.parse.Parseable;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.LocatorImpl;
-
-import com.sun.xml.internal.rngom.util.Localizer;
-import com.sun.xml.internal.rngom.xml.util.WellKnownNamespaces;
-
-
-public class CompactSyntax implements Context {
-  private static final int IN_ELEMENT = 0;
-  private static final int IN_ATTRIBUTE = 1;
-  private static final int IN_ANY_NAME = 2;
-  private static final int IN_NS_NAME = 4;
-
-  private String defaultNamespace;
-  private String compatibilityPrefix = null;
-  private SchemaBuilder sb;
-  private NameClassBuilder ncb;
-  private String sourceUri;
-  /**
-   * This is what we are parsing right now.
-   */
-  private CompactParseable parseable;
-  private ErrorHandler eh;
-  private final Hashtable namespaceTable = new Hashtable();
-  private final Hashtable datatypesTable = new Hashtable();
-  private boolean hadError = false;
-  private static final Localizer localizer = new Localizer(new Localizer(Parseable.class),CompactSyntax.class);
-  private final Hashtable attributeNameTable = new Hashtable();
-  private boolean annotationsIncludeElements = false;
-  
-  /**
-   * String that represents the inherited namespace.
-   * 
-   * <p>
-   * HACK: we always allocate a new String instance so that
-   * we can distinguish inherited value from the explicitly
-   * given value.
-   */
-  private /*final*/ String inheritedNs; // essentially final but JavaCC don't let us declare it as so.
-  
-  final class LocatedString {
-    private final String str;
-    private final Token tok;
-
-    LocatedString(String str, Token tok) {
-      this.str = str;
-      this.tok = tok;
-    }
-
-    String getString() {
-      return str;
-    }
-
-    Location getLocation() {
-      return makeLocation(tok);
-    }
-
-    Token getToken() {
-      return tok;
-    }
-
-  }
-
-  public CompactSyntax(CompactParseable parseable, Reader r, String sourceUri, SchemaBuilder sb, ErrorHandler eh, String inheritedNs) {
-    this(r);
-    this.sourceUri = sourceUri;
-    this.parseable = parseable;
-    this.sb = sb;
-    this.ncb = sb.getNameClassBuilder();
-    this.eh = eh;
-    // this causes the root pattern to have non-null annotations
-    // which is useful because it gives a context to trang
-    this.topLevelComments = sb.makeCommentList();
-    this.inheritedNs = defaultNamespace = new String(inheritedNs);
-  }
-
-  ParsedPattern parse(Scope scope) throws IllegalSchemaException {
-    try {
-      ParsedPattern p = Input(scope);
-      if (!hadError)
-        return p;
-    }
-    catch (ParseException e) {
-      error("syntax_error", e.getMessage(), e.currentToken.next);
-    }
-    catch (EscapeSyntaxException e) {
-      reportEscapeSyntaxException(e);
-    }
-    throw new IllegalSchemaException();
-  }
-
-  ParsedPattern parseInclude(IncludedGrammar g) throws IllegalSchemaException {
-    try {
-      ParsedPattern p = IncludedGrammar(g);
-      if (!hadError)
-        return p;
-    }
-    catch (ParseException e) {
-      error("syntax_error", e.getMessage(), e.currentToken.next);
-    }
-    catch (EscapeSyntaxException e) {
-      reportEscapeSyntaxException(e);
-    }
-    throw new IllegalSchemaException();
-  }
-
-  private void checkNsName(int context, LocatedString ns) {
-    if ((context & IN_NS_NAME) != 0)
-      error("ns_name_except_contains_ns_name", ns.getToken());
-  }
-
-  private void checkAnyName(int context, Token t) {
-    if ((context & IN_NS_NAME) != 0)
-      error("ns_name_except_contains_any_name", t);
-    if ((context & IN_ANY_NAME) != 0)
-      error("any_name_except_contains_any_name", t);
-  }
-
-  private void error(String key, Token tok) {
-    doError(localizer.message(key), tok);
-  }
-
-  private void error(String key, String arg, Token tok) {
-    doError(localizer.message(key, arg), tok);
-  }
-
-  private void error(String key, String arg1, String arg2, Token tok) {
-    doError(localizer.message(key, arg1, arg2), tok);
-  }
-
-  private void doError(String message, Token tok) {
-    hadError = true;
-    if (eh != null) {
-      LocatorImpl loc = new LocatorImpl();
-      loc.setLineNumber(tok.beginLine);
-      loc.setColumnNumber(tok.beginColumn);
-      loc.setSystemId(sourceUri);
-      try {
-	eh.error(new SAXParseException(message, loc));
-      }
-      catch (SAXException se) {
-	throw new BuildException(se);
-      }
-    }
-  }
-
-  private void reportEscapeSyntaxException(EscapeSyntaxException e) {
-    if (eh != null) {
-      LocatorImpl loc = new LocatorImpl();
-      loc.setLineNumber(e.getLineNumber());
-      loc.setColumnNumber(e.getColumnNumber());
-      loc.setSystemId(sourceUri);
-      try {
-	eh.error(new SAXParseException(localizer.message(e.getKey()), loc));
-      }
-      catch (SAXException se) {
-	throw new BuildException(se);
-      }
-    }
-  }
-
-  private static String unquote(String s) {
-    if (s.length() >= 6 && s.charAt(0) == s.charAt(1)) {
-      s = s.replace('\u0000', '\n');
-      return s.substring(3, s.length() - 3);
-    }
-    else
-      return s.substring(1, s.length() - 1);
-  }
-
-  Location makeLocation(Token t) {
-    return sb.makeLocation(sourceUri, t.beginLine, t.beginColumn);
-  }
-
-  private static ParsedPattern[] addPattern(ParsedPattern[] patterns, int i, ParsedPattern p) {
-    if (i >= patterns.length) {
-      ParsedPattern[] oldPatterns = patterns;
-      patterns = new ParsedPattern[oldPatterns.length*2];
-      System.arraycopy(oldPatterns, 0, patterns, 0, oldPatterns.length);
-    }
-    patterns[i] = p;
-    return patterns;
-  }
-
-  String getCompatibilityPrefix() {
-    if (compatibilityPrefix == null) {
-      compatibilityPrefix = "a";
-      while (namespaceTable.get(compatibilityPrefix) != null)
-        compatibilityPrefix = compatibilityPrefix + "a";
-    }
-    return compatibilityPrefix;
-  }
-
-  public String resolveNamespacePrefix(String prefix) {
-    String result = (String)namespaceTable.get(prefix);
-    if (result.length() == 0)
-      return null;
-    return result;
-  }
-
-  public Enumeration prefixes() {
-    return namespaceTable.keys();
-  }
-
-  public String getBaseUri() {
-    return sourceUri;
-  }
-
-  public boolean isUnparsedEntity(String entityName) {
-    return false;
-  }
-
-  public boolean isNotation(String notationName) {
-    return false;
-  }
-
-  public Context copy() {
-    return this;
-  }
-
-  private Context getContext() {
-    return this;
-  }
-
-  private CommentList getComments() {
-    return getComments(getTopLevelComments());
-  }
-
-  private CommentList topLevelComments;
-
-  private CommentList getTopLevelComments() {
-    CommentList tem = topLevelComments;
-    topLevelComments = null;
-    return tem;
-  }
-
-  private void noteTopLevelComments() {
-    topLevelComments = getComments(topLevelComments);
-  }
-
-  private void topLevelComments(GrammarSection section) {
-    section.topLevelComment(getComments(null));
-  }
-
-  private Token lastCommentSourceToken = null;
-
-  private CommentList getComments(CommentList comments) {
-    Token nextToken = getToken(1);
-    if (lastCommentSourceToken != nextToken) {
-      if (lastCommentSourceToken == null)
-        lastCommentSourceToken = token;
-      do {
-	lastCommentSourceToken = lastCommentSourceToken.next;
-	Token t = lastCommentSourceToken.specialToken;
-	if (t != null) {
-	  while (t.specialToken != null)
-	    t = t.specialToken;
-	  if (comments == null)
-	    comments = sb.makeCommentList();
-	  for (; t != null; t = t.next) {
-            String s = mungeComment(t.image);
-            Location loc = makeLocation(t);
-            if (t.next != null
-                && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE) {
-              StringBuffer buf = new StringBuffer(s);
-              do {
-                t = t.next;
-                buf.append('\n');
-                buf.append(mungeComment(t.image));
-              } while (t.next != null
-                       && t.next.kind == CompactSyntaxConstants.SINGLE_LINE_COMMENT_CONTINUE);
-              s = buf.toString();
-            }
-	    comments.addComment(s, loc);
-          }
-	}
-      } while (lastCommentSourceToken != nextToken);
-    }
-    return comments;
-  }
-
-  private ParsedPattern afterComments(ParsedPattern p) {
-    CommentList comments = getComments(null);
-    if (comments == null)
-      return p;
-    return sb.commentAfter(p, comments);
-  }
-
-  private ParsedNameClass afterComments(ParsedNameClass nc) {
-    CommentList comments = getComments(null);
-    if (comments == null)
-      return nc;
-    return ncb.commentAfter(nc, comments);
-  }
-
-  private static String mungeComment(String image) {
-    int i = image.indexOf('#') + 1;
-    while (i < image.length() && image.charAt(i) == '#')
-      i++;
-    if (i < image.length() && image.charAt(i) == ' ')
-      i++;
-    return image.substring(i);
-  }
-
-  private Annotations getCommentsAsAnnotations() {
-    CommentList comments = getComments();
-    if (comments == null)
-      return null;
-    return sb.makeAnnotations(comments, getContext());
-  }
-
-  private Annotations addCommentsToChildAnnotations(Annotations a) {
-    CommentList comments = getComments();
-    if (comments == null)
-      return a;
-    if (a == null)
-      a = sb.makeAnnotations(null, getContext());
-    a.addComment(comments);
-    return a;
-  }
-
-  private Annotations addCommentsToLeadingAnnotations(Annotations a) {
-    CommentList comments = getComments();
-    if (comments == null)
-      return a;
-    if (a == null)
-      return sb.makeAnnotations(comments, getContext());
-    a.addLeadingComment(comments);
-    return a;
-  }
-
-  private Annotations getTopLevelCommentsAsAnnotations() {
-    CommentList comments = getTopLevelComments();
-    if (comments == null)
-      return null;
-    return sb.makeAnnotations(comments, getContext());
-  }
-
-  private void clearAttributeList() {
-    attributeNameTable.clear();
-  }
-
-  private void addAttribute(Annotations a, String ns, String localName, String prefix, String value, Token tok) {
-    String key = ns + "#" + localName;
-    if (attributeNameTable.get(key) != null)
-      error("duplicate_attribute", ns, localName, tok);
-    else {
-      attributeNameTable.put(key, key);
-      a.addAttribute(ns, localName, prefix, value, makeLocation(tok));
-    }
-  }
-
-  private void checkExcept(Token[] except) {
-    if (except[0] != null)
-      error("except_missing_parentheses", except[0]);
-  }
-
-  private String lookupPrefix(String prefix, Token t) {
-    String ns = (String)namespaceTable.get(prefix);
-    if (ns == null) {
-      error("undeclared_prefix", prefix, t);
-      return "#error";
-    }
-    return ns;
-  }
-  private String lookupDatatype(String prefix, Token t) {
-    String ns = (String)datatypesTable.get(prefix);
-    if (ns == null) {
-      error("undeclared_prefix", prefix, t);
-      return ""; // XXX
-    }
-    return ns;
-  }
-  private String resolve(String str) {
-    try {
-     return new URL(new URL(sourceUri), str).toString();
-    }
-    catch (MalformedURLException e) { }
-    return str;
-  }
-}
-
-PARSER_END(CompactSyntax)
-
-ParsedPattern Input(Scope scope) :
-{
-  ParsedPattern p;
-}
-{
-  Preamble()
-  (LOOKAHEAD(TopLevelLookahead()) p = TopLevelGrammar(scope)
-   | p = Expr(true, scope, null, null) { p = afterComments(p); } <EOF>)
-  { return p; }
-}
-
-void TopLevelLookahead() :
-{}
-{
-  <PREFIXED_NAME> "["
-  | Identifier() ("[" | "=" | "&=" | "|=")
-  | LookaheadGrammarKeyword()
-  | LookaheadBody() LookaheadAfterAnnotations()
-  | LookaheadDocumentation() (LookaheadBody())? LookaheadAfterAnnotations()
-}
-
-void LookaheadAfterAnnotations() :
-{}
-{
-  Identifier() ("=" | "&=" | "|=")
-  | LookaheadGrammarKeyword()
-}
-
-void LookaheadGrammarKeyword() :
-{}
-{
-  "start" | "div" | "include"
-}
-
-void LookaheadDocumentation() :
-{}
-{
-  ((<DOCUMENTATION> | <DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT>) (<DOCUMENTATION_CONTINUE>)*)+
-}
-
-void LookaheadBody() :
-{}
-{
-  "["
-   (<PREFIXED_NAME> | UnprefixedName() | "=" | <LITERAL> | "~" | LookaheadBody() )*
-  "]"
-}
-
-ParsedPattern IncludedGrammar(IncludedGrammar g) :
-{
-  Annotations a;
-  ParsedPattern p;
-}
-{
-  Preamble()
-  (LOOKAHEAD(TopLevelLookahead()) a = GrammarBody(g, g, getTopLevelCommentsAsAnnotations())
-   | a = Annotations() "grammar" "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}")
-  { p = afterComments(g.endIncludedGrammar(sb.makeLocation(sourceUri, 1, 1), a)); }
-  <EOF>
-  { return p; }
-}
-
-ParsedPattern TopLevelGrammar(Scope scope) :
-{
-  Annotations a = getTopLevelCommentsAsAnnotations();
-  Grammar g;
-  ParsedPattern p;
-}
-{
-  { g = sb.makeGrammar(scope); }
-  a = GrammarBody(g, g, a)
-  { p = afterComments(g.endGrammar(sb.makeLocation(sourceUri, 1, 1), a)); }
-  <EOF>
-  { return p; }
-}
-
-void Preamble() :
-{}
-{
-  (NamespaceDecl() | DatatypesDecl())*
-  {
-    namespaceTable.put("xml", WellKnownNamespaces.XML);
-    if (datatypesTable.get("xsd") == null)
-      datatypesTable.put("xsd", WellKnownNamespaces.XML_SCHEMA_DATATYPES);
-  }
-}
-
-void NamespaceDecl() :
-{
-  LocatedString prefix = null;
-  boolean isDefault = false;
-  String namespaceName;
-}
-{
-  { noteTopLevelComments(); }
-  (("namespace" prefix = UnprefixedName())
-    | ("default" { isDefault = true; }
-      "namespace" (prefix = UnprefixedName())?))
-  "="
-  namespaceName = NamespaceName()
-  {
-    if (isDefault)
-      defaultNamespace = namespaceName;
-    if (prefix != null) {
-      if (prefix.getString().equals("xmlns"))
-        error("xmlns_prefix", prefix.getToken());
-      else if (prefix.getString().equals("xml")) {
-        if (!namespaceName.equals(WellKnownNamespaces.XML))
-          error("xml_prefix_bad_uri", prefix.getToken());
-      }
-      else if (namespaceName.equals(WellKnownNamespaces.XML))
-        error("xml_uri_bad_prefix", prefix.getToken());
-      else {
-        if (namespaceName.equals(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS))
-          compatibilityPrefix = prefix.getString();
-        namespaceTable.put(prefix.getString(), namespaceName);
-      }
-    }
-  }
-}
-
-String NamespaceName() :
-{
-  String r;
-}
-{
-  (r = Literal() | "inherit" { r = this.inheritedNs; })
-  { return r; }
-}
-
-void DatatypesDecl() :
-{
-  LocatedString prefix;
-  String uri;
-}
-{
-  { noteTopLevelComments(); }
-  "datatypes" prefix = UnprefixedName() "=" uri = Literal()
-  {
-    datatypesTable.put(prefix.getString(), uri);
-  }
-}
-
-ParsedPattern AnnotatedPrimaryExpr(boolean topLevel, Scope scope, Token[] except) :
-{
-  Annotations a;
-  ParsedPattern p;
-  ParsedElementAnnotation e;
-  Token t;
-}
-{
-  a = Annotations()
-  p = PrimaryExpr(topLevel, scope, a, except)
-  ( t = <FANNOTATE> e = AnnotationElement(false) {
-       if (topLevel)
-         error("top_level_follow_annotation", t);
-       else
-         p = sb.annotateAfter(p, e);
-     })*
-  { return p; }
-}
-
-
-ParsedPattern PrimaryExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) :
-{
-  ParsedPattern p;
-}
-{
-  (p = ElementExpr(scope, a)
-   | p = AttributeExpr(scope, a)
-   | p = GrammarExpr(scope, a)
-   | p = ExternalRefExpr(scope, a)
-   | p = ListExpr(scope, a)
-   | p = MixedExpr(scope, a)
-   | p = ParenExpr(topLevel, scope, a)
-   | p = IdentifierExpr(scope, a)
-   | p = ParentExpr(scope, a)
-   | p = DataExpr(topLevel, scope, a, except)
-   | p = ValueExpr(topLevel, a)
-   | p = TextExpr(a)
-   | p = EmptyExpr(a)
-   | p = NotAllowedExpr(a))
-  { return p; }
-}
-
-ParsedPattern EmptyExpr(Annotations a) :
-{
-  Token t;
-}
-{
-  t = "empty"
-  { return sb.makeEmpty(makeLocation(t), a); }
-}
-
-ParsedPattern TextExpr(Annotations a) :
-{
-  Token t;
-}
-{
-  t = "text"
-  { return sb.makeText(makeLocation(t), a); }
-}
-
-ParsedPattern NotAllowedExpr(Annotations a) :
-{
-  Token t;
-}
-{
-  t = "notAllowed"
-  { return sb.makeNotAllowed(makeLocation(t), a); }
-}
-
-ParsedPattern Expr(boolean topLevel, Scope scope, Token t, Annotations a) :
-{
-  List patterns = new ArrayList();
-  ParsedPattern p;
-  boolean[] hadOccur = new boolean[1];
-  Token[] except = new Token[1];
-}
-{
-  p = UnaryExpr(topLevel, scope, hadOccur, except)
-  { patterns.add(p); }
-  (
-   { checkExcept(except); }
-   (t = "|" p = UnaryExpr(topLevel, scope, null, except)
-     { patterns.add(p); checkExcept(except); } )+
-    { p = sb.makeChoice(patterns, makeLocation(t), a); }
-    | (t = "&" p = UnaryExpr(topLevel, scope, null, except)
-     { patterns.add(p); checkExcept(except); } )+
-    { p = sb.makeInterleave(patterns, makeLocation(t), a); }
-    | (t = "," p = UnaryExpr(topLevel, scope, null, except)
-     { patterns.add(p); checkExcept(except); } )+
-    { p = sb.makeGroup(patterns, makeLocation(t), a); }
-  )?
-  {
-    if (patterns.size() == 1 && a != null) {
-      if (hadOccur[0])
-        p = sb.annotate(p, a);
-      else
-        p = sb.makeGroup(patterns, makeLocation(t), a);
-    }
-    return p;
-  }
-}
-
-ParsedPattern UnaryExpr(boolean topLevel, Scope scope, boolean[] hadOccur, Token[] except) :
-{
-  ParsedPattern p;
-  Token t;
-  ParsedElementAnnotation e;
-}
-{
-  p = AnnotatedPrimaryExpr(topLevel, scope, except)
-  (
-   {
-     if (hadOccur != null) hadOccur[0] = true;
-     p = afterComments(p);
-   }
-   (t = "+" { checkExcept(except); p = sb.makeOneOrMore(p, makeLocation(t), null); }
-    | t = "?" { checkExcept(except); p = sb.makeOptional(p, makeLocation(t), null); }
-    | t = "*" { checkExcept(except); p = sb.makeZeroOrMore(p, makeLocation(t), null); })
-   ( t = <FANNOTATE> e = AnnotationElement(false) {
-        if (topLevel)
-          error("top_level_follow_annotation", t);
-        else
-          p = sb.annotateAfter(p, e);
-     } )*
-  )?
-  { return p; }
-}
-
-ParsedPattern ElementExpr(Scope scope, Annotations a) :
-{
-  Token t;
-  ParsedNameClass nc;
-  ParsedPattern p;
-}
-{
-  t = "element"
-  nc = NameClass(IN_ELEMENT, null)
-  "{"
-  p = Expr(false, scope, null, null)
-  { p = afterComments(p); }
-  "}"
-  { return sb.makeElement(nc, p, makeLocation(t), a); }
-}
-
-ParsedPattern AttributeExpr(Scope scope, Annotations a) :
-{
-  Token t;
-  ParsedNameClass nc;
-  ParsedPattern p;
-}
-{
-  t = "attribute"
-  nc = NameClass(IN_ATTRIBUTE, null)
-  "{"
-  p = Expr(false, scope, null, null)
-  { p = afterComments(p); }
-  "}"
-  { return sb.makeAttribute(nc, p, makeLocation(t), a); }
-}
-
-ParsedNameClass NameClass(int context, Annotations[] pa) :
-{
-  Annotations a;
-  ParsedNameClass nc;
-}
-{
-  a = Annotations()
-  (nc = PrimaryNameClass(context, a) nc = AnnotateAfter(nc) nc = NameClassAlternatives(context, nc, pa)
-   | nc = AnyNameExceptClass(context, a, pa)
-   | nc = NsNameExceptClass(context, a, pa))
-  { return nc; }
-}
-
-ParsedNameClass AnnotateAfter(ParsedNameClass nc) :
-{
-  ParsedElementAnnotation e;
-}
-{
-  ( <FANNOTATE> e = AnnotationElement(false) { nc = ncb.annotateAfter(nc, e); })*
-  { return nc; }
-}
-
-ParsedNameClass NameClassAlternatives(int context, ParsedNameClass nc, Annotations[] pa) :
-{
-  Token t;
-  ParsedNameClass[] nameClasses;
-  int nNameClasses;
-}
-{
-  (
-    {
-      nameClasses = new ParsedNameClass[2];
-      nameClasses[0] = nc;
-      nNameClasses = 1;
-    }
-    (t = "|" nc = BasicNameClass(context) nc = AnnotateAfter(nc)
-    {
-      if (nNameClasses >= nameClasses.length) {
-	ParsedNameClass[] oldNameClasses = nameClasses;
-	nameClasses = new ParsedNameClass[oldNameClasses.length*2];
-	System.arraycopy(oldNameClasses, 0, nameClasses, 0, oldNameClasses.length);
-      }
-      nameClasses[nNameClasses++] = nc;
-    })+
-    {
-      Annotations a;
-      if (pa == null)
-        a = null;
-      else {
-        a = pa[0];
-        pa[0] = null;
-      }
-      nc = ncb.makeChoice(Arrays.asList(nameClasses).subList(0,nNameClasses), makeLocation(t), a);
-    }
-  )?
-  { return nc; }
-}
-
-ParsedNameClass BasicNameClass(int context) :
-{
-  Annotations a;
-  ParsedNameClass nc;
-}
-{
-  a = Annotations()
-  (nc = PrimaryNameClass(context, a)
-   | nc = OpenNameClass(context, a))
-  { return nc; }
-}
-
-ParsedNameClass PrimaryNameClass(int context, Annotations a) :
-{
-  ParsedNameClass nc;
-}
-{
-  (nc = UnprefixedNameClass(context, a)
-   | nc = PrefixedNameClass(a)
-   | nc = ParenNameClass(context, a))
-  { return nc; }
-}
-
-ParsedNameClass OpenNameClass(int context, Annotations a) :
-{
-  Token t;
-  LocatedString ns;
-}
-{
-  ns = NsName() { checkNsName(context, ns); return ncb.makeNsName(ns.getString(), ns.getLocation(), a); }
-  | t = "*" { checkAnyName(context, t); return ncb.makeAnyName(makeLocation(t), a); }
-}
-
-
-ParsedNameClass UnprefixedNameClass(int context, Annotations a) :
-{
-  LocatedString name;
-}
-{
-  name = UnprefixedName()
-  {
-    String ns;
-    if ((context & (IN_ATTRIBUTE|IN_ELEMENT)) == IN_ATTRIBUTE)
-      ns = "";
-    else
-      ns = defaultNamespace;
-    return ncb.makeName(ns, name.getString(), null, name.getLocation(), a);
-  }
-}
-
-ParsedNameClass PrefixedNameClass(Annotations a) :
-{
-  Token t;
-}
-{
-  t = <PREFIXED_NAME>
-  {
-    String qn = t.image;
-    int colon = qn.indexOf(':');
-    String prefix = qn.substring(0, colon);
-    return ncb.makeName(lookupPrefix(prefix, t), qn.substring(colon + 1), prefix, makeLocation(t), a);
-  }
-}
-
-ParsedNameClass NsNameExceptClass(int context, Annotations a, Annotations[] pa) :
-{
-  LocatedString ns;
-  ParsedNameClass nc;
-}
-{
-  ns = NsName()
-  { checkNsName(context, ns); }
-  (nc = ExceptNameClass(context | IN_NS_NAME)
-   { nc = ncb.makeNsName(ns.getString(), nc, ns.getLocation(), a); }
-   nc = AnnotateAfter(nc)
-  | { nc = ncb.makeNsName(ns.getString(), ns.getLocation(), a); }
-    nc = AnnotateAfter(nc)
-    nc = NameClassAlternatives(context, nc, pa))
-  { return nc; }
-}
-
-LocatedString NsName() :
-{
-  Token t;
-}
-{
-  t = <PREFIX_STAR>
-  {
-    String qn = t.image;
-    String prefix = qn.substring(0, qn.length() - 2);
-    return new LocatedString(lookupPrefix(prefix, t), t);
-  }
-}
-
-ParsedNameClass AnyNameExceptClass(int context, Annotations a, Annotations[] pa) :
-{
-  Token t;
-  ParsedNameClass nc;
-}
-{
-  t = "*"
-  { checkAnyName(context, t); }
-  (nc = ExceptNameClass(context | IN_ANY_NAME)
-   { nc = ncb.makeAnyName(nc, makeLocation(t), a); }
-   nc = AnnotateAfter(nc)
-  | { nc = ncb.makeAnyName(makeLocation(t), a); }
-    nc = AnnotateAfter(nc)
-    nc = NameClassAlternatives(context, nc, pa))
-  { return nc; }
-}
-
-ParsedNameClass ParenNameClass(int context, Annotations a) :
-{
-  Token t;
-  ParsedNameClass nc;
-  Annotations[] pa = new Annotations[]{ a };
-}
-{
-  t = "(" nc = NameClass(context, pa) { nc = afterComments(nc); } ")"
-  {
-    if (pa[0] != null)
-      nc = ncb.makeChoice(Collections.singletonList(nc), makeLocation(t), pa[0]);
-    return nc;
-  }
-}
-
-ParsedNameClass ExceptNameClass(int context) :
-{
-  ParsedNameClass nc;
-}
-{
-  "-" nc = BasicNameClass(context)
-  { return nc; }
-}
-
-ParsedPattern ListExpr(Scope scope, Annotations a) :
-{
-  Token t;
-  ParsedPattern p;
-}
-{
-  t = "list"
-  "{"
-  p = Expr(false, scope, null, null)
-  { p = afterComments(p); }
-  "}"
-  { return sb.makeList(p, makeLocation(t), a); }
-}
-
-ParsedPattern MixedExpr(Scope scope, Annotations a) :
-{
-  Token t;
-  ParsedPattern p;
-}
-{
-  t = "mixed"
-  "{"
-  p = Expr(false, scope, null, null)
-  { p = afterComments(p); }
-  "}"
-  { return sb.makeMixed(p, makeLocation(t), a); }
-}
-
-ParsedPattern GrammarExpr(Scope scope, Annotations a) :
-{
-  Token t;
-  Grammar g;
-}
-{
-  t = "grammar" { g = sb.makeGrammar(scope); }
-  "{" a = GrammarBody(g, g, a) { topLevelComments(g); } "}"
-  { return g.endGrammar(makeLocation(t), a); }
-}
-
-ParsedPattern ParenExpr(boolean topLevel, Scope scope, Annotations a) :
-{
-  Token t;
-  ParsedPattern p;
-}
-{
-  t = "(" p = Expr(topLevel, scope, t, a) { p = afterComments(p); } ")"
-  { return p; }
-}
-
-Annotations GrammarBody(GrammarSection section, Scope scope, Annotations a) :
-{
-  ParsedElementAnnotation e;
-}
-{
-  (LOOKAHEAD(2) e = AnnotationElementNotKeyword()
-   { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })*
-  (GrammarComponent(section, scope))*
-  { return a; }
-}
-
-void GrammarComponent(GrammarSection section, Scope scope) :
-{
-  ParsedElementAnnotation e;
-  Annotations a;
-}
-{
-  (a = Annotations()
-   (Definition(section, scope, a)
-    | Include(section, scope, a)
-    | Div(section, scope, a)))
-  (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })*
-}
-
-void Definition(GrammarSection section, Scope scope, Annotations a) :
-{}
-{
-  (Define(section, scope, a) | Start(section, scope, a))
-}
-
-void Start(GrammarSection section, Scope scope, Annotations a) :
-{
-  Token t;
-  GrammarSection.Combine combine;
-  ParsedPattern p;
-}
-{
-  t = "start" combine = AssignOp() p = Expr(false, scope, null, null)
-  { section.define(GrammarSection.START, combine, p, makeLocation(t), a); }
-}
-
-void Define(GrammarSection section, Scope scope, Annotations a) :
-{
-  LocatedString name;
-  GrammarSection.Combine combine;
-  ParsedPattern p;
-}
-{
-  name = Identifier() combine = AssignOp() p = Expr(false, scope, null, null)
-  { section.define(name.getString(), combine, p, name.getLocation(), a); }
-}
-
-GrammarSection.Combine AssignOp() :
-{}
-{
-  "=" { return null; }
-  | "|=" { return GrammarSection.COMBINE_CHOICE; }
-  | "&=" { return GrammarSection.COMBINE_INTERLEAVE; }
-}
-
-void Include(GrammarSection section, Scope scope, Annotations a) :
-{
-  Token t;
-  String href;
-  String ns;
-  Include include = section.makeInclude();
-}
-{
-  t = "include" href = Literal()
-  ns = Inherit()
-  ("{" a = IncludeBody(include, scope, a) { topLevelComments(include); } "}")?
-  {
-    try {
-      include.endInclude(parseable, resolve(href), ns, makeLocation(t), a);
-    }
-    catch (IllegalSchemaException e) { }
-  }
-}
-
-Annotations IncludeBody(GrammarSection section, Scope scope, Annotations a) :
-{
-  ParsedElementAnnotation e;
-}
-{
-  (LOOKAHEAD(2) e = AnnotationElementNotKeyword()
-   { if (a == null) a = sb.makeAnnotations(null, getContext()); a.addElement(e); })*
-  (IncludeComponent(section, scope))*
-  { return a; }
-}
-
-
-void IncludeComponent(GrammarSection section, Scope scope) :
-{
-  ParsedElementAnnotation e;
-  Annotations a;
-}
-{
-  (a = Annotations() (Definition(section, scope, a)
-                      | IncludeDiv(section, scope, a)))
-  (LOOKAHEAD(2) e = AnnotationElementNotKeyword() { section.topLevelAnnotation(e); })*
-}
-
-void Div(GrammarSection section, Scope scope, Annotations a) :
-{
-  Token t;
-  Div div = section.makeDiv();
-}
-{
-  t = "div" "{" a = GrammarBody(div, scope, a) { topLevelComments(div); } "}"
-  { div.endDiv(makeLocation(t), a); }
-}
-
-void IncludeDiv(GrammarSection section, Scope scope, Annotations a) :
-{
-  Token t;
-  Div div = section.makeDiv();
-}
-{
-  t = "div" "{" a = IncludeBody(div, scope, a) { topLevelComments(div); } "}"
-  { div.endDiv(makeLocation(t), a); }
-}
-
-ParsedPattern ExternalRefExpr(Scope scope, Annotations a) :
-{
-  Token t;
-  String href;
-  String ns;
-}
-{
-  t = "external" href = Literal()
-  ns = Inherit()
-  {
-    try {
-      return sb.makeExternalRef(parseable, resolve(href), ns, scope, makeLocation(t), a);
-    }
-    catch (IllegalSchemaException e) {
-      return sb.makeErrorPattern();
-    }
-  }
-}
-
-String Inherit() :
-{
-  String ns = null;
-}
-{
-  ("inherit" "=" ns = Prefix())?
-  {
-    if (ns == null)
-      ns = defaultNamespace;
-    return ns;
-  }
-}
-
-ParsedPattern ParentExpr(Scope scope, Annotations a) :
-{
-  LocatedString name;
-}
-{
-  "parent" { a = addCommentsToChildAnnotations(a); } name = Identifier()
-  {
-    if(scope==null) {
-      error("parent_ref_outside_grammar",name.getToken());
-      return sb.makeErrorPattern();
-    } else {
-      return scope.makeParentRef(name.getString(), name.getLocation(), a);
-    }
-  }
-}
-
-ParsedPattern IdentifierExpr(Scope scope, Annotations a) :
-{
-  LocatedString name;
-}
-{
-  name = Identifier()
-  {
-    if(scope==null) {
-      error("ref_outside_grammar",name.getToken());
-      return sb.makeErrorPattern();
-    } else {
-      return scope.makeRef(name.getString(), name.getLocation(), a);
-    }
-  }
-}
-
-ParsedPattern ValueExpr(boolean topLevel, Annotations a) :
-{
-  LocatedString s;
-}
-{
-  s = LocatedLiteral()
-  {
-    if (topLevel && annotationsIncludeElements) {
-      error("top_level_follow_annotation", s.getToken());
-      a = null;
-    }
-    return sb.makeValue("", "token", s.getString(), getContext(), defaultNamespace, s.getLocation(), a);
-  }
-}
-
-ParsedPattern DataExpr(boolean topLevel, Scope scope, Annotations a, Token[] except) :
-{
-  Token datatypeToken;
-  Location loc;
-  String datatype;
-  String datatypeUri = null;
-  String s = null;
-  ParsedPattern e = null;
-  DataPatternBuilder dpb;
-}
-{
-  datatypeToken = DatatypeName()
-  {
-    datatype = datatypeToken.image;
-    loc = makeLocation(datatypeToken);
-    int colon = datatype.indexOf(':');
-    if (colon < 0)
-      datatypeUri = "";
-    else {
-      String prefix = datatype.substring(0, colon);
-      datatypeUri = lookupDatatype(prefix, datatypeToken);
-      datatype = datatype.substring(colon + 1);
-    }
-  }
-  ((s = Literal()
-    {
-      if (topLevel && annotationsIncludeElements) {
-        error("top_level_follow_annotation", datatypeToken);
-        a = null;
-      }
-      return sb.makeValue(datatypeUri, datatype, s, getContext(), defaultNamespace, loc, a);
-    }
-  )
-  | ( { dpb = sb.makeDataPatternBuilder(datatypeUri, datatype, loc); }
-      ( (Params(dpb) (e = Except(scope, except))?)
-        | (e = Except(scope, except))?)
-      { return e == null ? dpb.makePattern(loc, a) : dpb.makePattern(e, loc, a); }))
-}
-
-Token DatatypeName() :
-{
-  Token t;
-}
-{
-  (t = "string" | t = "token" | t = <PREFIXED_NAME>)
-  { return t; }
-}
-
-LocatedString Identifier() :
-{
-  LocatedString s;
-  Token t;
-}
-{
-  (t = <IDENTIFIER> { s = new LocatedString(t.image, t); }
-  | t = <ESCAPED_IDENTIFIER> { s = new LocatedString(t.image.substring(1), t); })
-  { return s; }
-}
-
-String Prefix() :
-{
-  Token t;
-  String prefix;
-}
-{
-  (t = <IDENTIFIER> { prefix = t.image; }
-  | t = <ESCAPED_IDENTIFIER> { prefix = t.image.substring(1); }
-  | t = Keyword() { prefix = t.image; })
-  { return lookupPrefix(prefix, t); }
-}
-
-LocatedString UnprefixedName() :
-{
-  LocatedString s;
-  Token t;
-}
-{
-  (s = Identifier()
-   | t = Keyword() { s = new LocatedString(t.image, t); })
-  { return s; }
-}
-
-void Params(DataPatternBuilder dpb) :
-{}
-{
-  "{" (Param(dpb))* "}"
-}
-
-void Param(DataPatternBuilder dpb) :
-{
-  LocatedString name;
-  Annotations a;
-  String value;
-}
-{
-  a = Annotations() name = UnprefixedName() "=" { a = addCommentsToLeadingAnnotations(a); } value = Literal()
-  { dpb.addParam(name.getString(), value, getContext(), defaultNamespace, name.getLocation(), a); }
-}
-
-ParsedPattern Except(Scope scope, Token[] except) :
-{
-  Annotations a;
-  ParsedPattern p;
-  Token t;
-  Token[] innerExcept = new Token[1];
-}
-{
-  t = "-" a = Annotations() p = PrimaryExpr(false, scope, a, innerExcept)
-  {
-    checkExcept(innerExcept);
-    except[0] = t;
-    return p;
-  }
-}
-
-ParsedElementAnnotation Documentation() :
-{
-  CommentList comments = getComments();
-  ElementAnnotationBuilder eab;
-  Token t;
-}
-{
-  (t = <DOCUMENTATION> | t = <DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT>)
-  {
-    eab = sb.makeElementAnnotationBuilder(WellKnownNamespaces.RELAX_NG_COMPATIBILITY_ANNOTATIONS,
-                                          "documentation",
-                                          getCompatibilityPrefix(),
-                                          makeLocation(t),
-                                          comments,
-                                          getContext());
-    eab.addText(mungeComment(t.image), makeLocation(t), null);
-  }
-  (t = <DOCUMENTATION_CONTINUE> { eab.addText("\n" + mungeComment(t.image), makeLocation(t), null); })*
-  { return eab.makeElementAnnotation(); }
-}
-
-Annotations Annotations() :
-{
-  CommentList comments = getComments();
-  Annotations a = null;
-  ParsedElementAnnotation e;
-}
-{
-  ( { a = sb.makeAnnotations(comments, getContext()); }
-    (e = Documentation() { a.addElement(e); })+
-    {
-      comments = getComments();
-      if (comments != null)
-        a.addLeadingComment(comments);
-    }
-  )?
-  ("[" { if (a == null) a = sb.makeAnnotations(comments, getContext()); clearAttributeList(); annotationsIncludeElements = false; }
-       (LOOKAHEAD(2) PrefixedAnnotationAttribute(a, false) )*
-       ( e = AnnotationElement(false) { a.addElement(e); annotationsIncludeElements = true; } )*
-       { a.addComment(getComments()); }
-  "]")?
-  {
-    if (a == null && comments != null)
-      a = sb.makeAnnotations(comments, getContext());
-    return a;
-  }
-}
-
-void AnnotationAttribute(Annotations a) :
-{}
-{
-  PrefixedAnnotationAttribute(a, true) | UnprefixedAnnotationAttribute(a)
-}
-
-void PrefixedAnnotationAttribute(Annotations a, boolean nested) :
-{
-  Token t;
-  String value;
-}
-{
-  t = <PREFIXED_NAME> "=" value = Literal()
-  {
-    String qn = t.image;
-    int colon = qn.indexOf(':');
-    String prefix = qn.substring(0, colon);
-    String ns = lookupPrefix(prefix, t);
-    if (ns == this.inheritedNs)
-      error("inherited_annotation_namespace", t);
-    else if (ns.length() == 0 && !nested)
-      error("unqualified_annotation_attribute", t);
-    else if (ns.equals(WellKnownNamespaces.RELAX_NG) && !nested)
-      error("relax_ng_namespace", t);
-    /*else if (ns.length() == 0
-             && qn.length() - colon - 1 == 5
-             && qn.regionMatches(colon + 1, "xmlns", 0, 5))
-      error("xmlns_annotation_attribute", t);*/
-    else if (ns.equals(WellKnownNamespaces.XMLNS))
-      error("xmlns_annotation_attribute_uri", t);
-    else {
-      if (ns.length() == 0)
-	prefix = null;
-      addAttribute(a, ns, qn.substring(colon + 1), prefix, value, t);
-    }
-  }
-}
-
-void UnprefixedAnnotationAttribute(Annotations a) :
-{
-  LocatedString name;
-  String value;
-}
-{
-  name = UnprefixedName() "=" value = Literal()
-  {
-    if (name.getString().equals("xmlns"))
-      error("xmlns_annotation_attribute", name.getToken());
-    else
-      addAttribute(a, "", name.getString(), null, value, name.getToken());
-  }
-}
-
-ParsedElementAnnotation AnnotationElement(boolean nested) :
-{
-  ParsedElementAnnotation a;
-}
-{
-  (a = PrefixedAnnotationElement(nested)
-   | a = UnprefixedAnnotationElement())
-  { return a; }
-}
-
-ParsedElementAnnotation AnnotationElementNotKeyword() :
-{
-  ParsedElementAnnotation a;
-}
-{
-  (a = PrefixedAnnotationElement(false)
-   | a = IdentifierAnnotationElement())
-  { return a; }
-}
-
-ParsedElementAnnotation PrefixedAnnotationElement(boolean nested) :
-{
-  CommentList comments = getComments();
-  Token t;
-  ElementAnnotationBuilder eab;
-}
-{
-  t = <PREFIXED_NAME>
-  {
-    String qn = t.image;
-    int colon = qn.indexOf(':');
-    String prefix = qn.substring(0, colon);
-    String ns = lookupPrefix(prefix, t);
-    if (ns == this.inheritedNs) {
-      error("inherited_annotation_namespace", t);
-      ns = "";
-    }
-    else if (!nested && ns.equals(WellKnownNamespaces.RELAX_NG)) {
-      error("relax_ng_namespace", t);
-      ns = "";
-    }
-    else {
-      if (ns.length() == 0)
-        prefix = null;
-    }
-    eab = sb.makeElementAnnotationBuilder(ns, qn.substring(colon + 1), prefix,
-					  makeLocation(t), comments, getContext());
-  }
-  AnnotationElementContent(eab)
-  { return eab.makeElementAnnotation(); }
-}
-
-ParsedElementAnnotation UnprefixedAnnotationElement() :
-{
-  CommentList comments = getComments();
-  LocatedString name;
-  ElementAnnotationBuilder eab;
-}
-{
-  name = UnprefixedName()
-  {
-    eab = sb.makeElementAnnotationBuilder("", name.getString(), null,
-                                          name.getLocation(), comments, getContext());
-  }
-  AnnotationElementContent(eab)
-  { return eab.makeElementAnnotation(); }
-}
-
-ParsedElementAnnotation IdentifierAnnotationElement() :
-{
-  CommentList comments = getComments();
-  LocatedString name;
-  ElementAnnotationBuilder eab;
-}
-{
-  name = Identifier()
-  {
-    eab = sb.makeElementAnnotationBuilder("", name.getString(), null,
-                                          name.getLocation(), comments, getContext());
-  }
-  AnnotationElementContent(eab)
-  { return eab.makeElementAnnotation(); }
-}
-
-void AnnotationElementContent(ElementAnnotationBuilder eab) :
-{
-  ParsedElementAnnotation e;
-}
-{
-  "[" { clearAttributeList(); }
-  (LOOKAHEAD(2) AnnotationAttribute(eab))*
-  ((AnnotationElementLiteral(eab)
-    ("~" AnnotationElementLiteral(eab))*)
-   | e = AnnotationElement(true) { eab.addElement(e); })*
-  { eab.addComment(getComments()); }
-  "]"
-}
-
-void AnnotationElementLiteral(ElementAnnotationBuilder eab) :
-{
-  Token t;
-  CommentList comments = getComments();
-}
-{
-  t = <LITERAL> { eab.addText(unquote(t.image), makeLocation(t), comments); }
-}
-
-String Literal() :
-{
-  Token t;
-  String s;
-  StringBuffer buf;
-}
-{
-  t = <LITERAL>
-  {
-    s = unquote(t.image);
-  }
-  (
-    { buf = new StringBuffer(s); }
-    ("~" t = <LITERAL> { buf.append(unquote(t.image)); })+
-    { s = buf.toString(); }
-  )?
-  { return s; }
-}
-
-LocatedString LocatedLiteral() :
-{
-  Token t;
-  Token t2;
-  String s;
-  StringBuffer buf;
-}
-{
-  t = <LITERAL>
-  {
-    s = unquote(t.image);
-  }
-  (
-    { buf = new StringBuffer(s); }
-    ("~" t2 = <LITERAL> { buf.append(unquote(t2.image)); })+
-    { s = buf.toString(); }
-  )?
-  { return new LocatedString(s, t); }
-}
-
-Token Keyword() :
-{
-  Token t;
-}
-{
-  (t = "element"
-  | t = "attribute"
-  | t = "namespace"
-  | t = "list"
-  | t = "mixed"
-  | t = "grammar"
-  | t = "empty"
-  | t = "text"
-  | t = "parent"
-  | t = "external"
-  | t = "notAllowed"
-  | t = "start"
-  | t = "include"
-  | t = "default"
-  | t = "inherit"
-  | t = "string"
-  | t = "token"
-  | t = "datatypes"
-  | t = "div")
-  { return t; }
-}
-
-<*>
-SKIP: {
-  < #NEWLINE : [ "\u0000", "\n" ] >
-  | < #NOT_NEWLINE : ~[ "\u0000", "\n" ] >
-  | < WS: ([ "\u0000", " ", "\n", "\t" ])+ > : DEFAULT
-}
-
-TOKEN :
-{
-  < DOCUMENTATION: "##" (<NOT_NEWLINE>)* > : AFTER_DOCUMENTATION
-}
-
-<AFTER_DOCUMENTATION>
-TOKEN :
-{
-  < DOCUMENTATION_CONTINUE: <NEWLINE> ([" ", "\t"])* <DOCUMENTATION> >
-}
-
-SPECIAL_TOKEN:
-{
-  < SINGLE_LINE_COMMENT: "#" (<NOT_NEWLINE>)* > : AFTER_SINGLE_LINE_COMMENT
-}
-
-<AFTER_SINGLE_LINE_COMMENT>
-TOKEN :
-{
-  < DOCUMENTATION_AFTER_SINGLE_LINE_COMMENT: <NEWLINE> ([" ", "\t"])* <DOCUMENTATION> > : AFTER_DOCUMENTATION
-}
-
-<AFTER_SINGLE_LINE_COMMENT>
-SPECIAL_TOKEN :
-{
-  < SINGLE_LINE_COMMENT_CONTINUE: <NEWLINE> ([" ", "\t"])* <SINGLE_LINE_COMMENT> >
-}
-
-TOKEN :
-{
-  < #BASE_CHAR : [
-    "\u0041" - "\u005a",
-    "\u0061" - "\u007a",
-    "\u00c0" - "\u00d6",
-    "\u00d8" - "\u00f6",
-    "\u00f8" - "\u00ff",
-    "\u0100" - "\u0131",
-    "\u0134" - "\u013e",
-    "\u0141" - "\u0148",
-    "\u014a" - "\u017e",
-    "\u0180" - "\u01c3",
-    "\u01cd" - "\u01f0",
-    "\u01f4" - "\u01f5",
-    "\u01fa" - "\u0217",
-    "\u0250" - "\u02a8",
-    "\u02bb" - "\u02c1",
-    "\u0386",
-    "\u0388" - "\u038a",
-    "\u038c",
-    "\u038e" - "\u03a1",
-    "\u03a3" - "\u03ce",
-    "\u03d0" - "\u03d6",
-    "\u03da",
-    "\u03dc",
-    "\u03de",
-    "\u03e0",
-    "\u03e2" - "\u03f3",
-    "\u0401" - "\u040c",
-    "\u040e" - "\u044f",
-    "\u0451" - "\u045c",
-    "\u045e" - "\u0481",
-    "\u0490" - "\u04c4",
-    "\u04c7" - "\u04c8",
-    "\u04cb" - "\u04cc",
-    "\u04d0" - "\u04eb",
-    "\u04ee" - "\u04f5",
-    "\u04f8" - "\u04f9",
-    "\u0531" - "\u0556",
-    "\u0559",
-    "\u0561" - "\u0586",
-    "\u05d0" - "\u05ea",
-    "\u05f0" - "\u05f2",
-    "\u0621" - "\u063a",
-    "\u0641" - "\u064a",
-    "\u0671" - "\u06b7",
-    "\u06ba" - "\u06be",
-    "\u06c0" - "\u06ce",
-    "\u06d0" - "\u06d3",
-    "\u06d5",
-    "\u06e5" - "\u06e6",
-    "\u0905" - "\u0939",
-    "\u093d",
-    "\u0958" - "\u0961",
-    "\u0985" - "\u098c",
-    "\u098f" - "\u0990",
-    "\u0993" - "\u09a8",
-    "\u09aa" - "\u09b0",
-    "\u09b2",
-    "\u09b6" - "\u09b9",
-    "\u09dc" - "\u09dd",
-    "\u09df" - "\u09e1",
-    "\u09f0" - "\u09f1",
-    "\u0a05" - "\u0a0a",
-    "\u0a0f" - "\u0a10",
-    "\u0a13" - "\u0a28",
-    "\u0a2a" - "\u0a30",
-    "\u0a32" - "\u0a33",
-    "\u0a35" - "\u0a36",
-    "\u0a38" - "\u0a39",
-    "\u0a59" - "\u0a5c",
-    "\u0a5e",
-    "\u0a72" - "\u0a74",
-    "\u0a85" - "\u0a8b",
-    "\u0a8d",
-    "\u0a8f" - "\u0a91",
-    "\u0a93" - "\u0aa8",
-    "\u0aaa" - "\u0ab0",
-    "\u0ab2" - "\u0ab3",
-    "\u0ab5" - "\u0ab9",
-    "\u0abd",
-    "\u0ae0",
-    "\u0b05" - "\u0b0c",
-    "\u0b0f" - "\u0b10",
-    "\u0b13" - "\u0b28",
-    "\u0b2a" - "\u0b30",
-    "\u0b32" - "\u0b33",
-    "\u0b36" - "\u0b39",
-    "\u0b3d",
-    "\u0b5c" - "\u0b5d",
-    "\u0b5f" - "\u0b61",
-    "\u0b85" - "\u0b8a",
-    "\u0b8e" - "\u0b90",
-    "\u0b92" - "\u0b95",
-    "\u0b99" - "\u0b9a",
-    "\u0b9c",
-    "\u0b9e" - "\u0b9f",
-    "\u0ba3" - "\u0ba4",
-    "\u0ba8" - "\u0baa",
-    "\u0bae" - "\u0bb5",
-    "\u0bb7" - "\u0bb9",
-    "\u0c05" - "\u0c0c",
-    "\u0c0e" - "\u0c10",
-    "\u0c12" - "\u0c28",
-    "\u0c2a" - "\u0c33",
-    "\u0c35" - "\u0c39",
-    "\u0c60" - "\u0c61",
-    "\u0c85" - "\u0c8c",
-    "\u0c8e" - "\u0c90",
-    "\u0c92" - "\u0ca8",
-    "\u0caa" - "\u0cb3",
-    "\u0cb5" - "\u0cb9",
-    "\u0cde",
-    "\u0ce0" - "\u0ce1",
-    "\u0d05" - "\u0d0c",
-    "\u0d0e" - "\u0d10",
-    "\u0d12" - "\u0d28",
-    "\u0d2a" - "\u0d39",
-    "\u0d60" - "\u0d61",
-    "\u0e01" - "\u0e2e",
-    "\u0e30",
-    "\u0e32" - "\u0e33",
-    "\u0e40" - "\u0e45",
-    "\u0e81" - "\u0e82",
-    "\u0e84",
-    "\u0e87" - "\u0e88",
-    "\u0e8a",
-    "\u0e8d",
-    "\u0e94" - "\u0e97",
-    "\u0e99" - "\u0e9f",
-    "\u0ea1" - "\u0ea3",
-    "\u0ea5",
-    "\u0ea7",
-    "\u0eaa" - "\u0eab",
-    "\u0ead" - "\u0eae",
-    "\u0eb0",
-    "\u0eb2" - "\u0eb3",
-    "\u0ebd",
-    "\u0ec0" - "\u0ec4",
-    "\u0f40" - "\u0f47",
-    "\u0f49" - "\u0f69",
-    "\u10a0" - "\u10c5",
-    "\u10d0" - "\u10f6",
-    "\u1100",
-    "\u1102" - "\u1103",
-    "\u1105" - "\u1107",
-    "\u1109",
-    "\u110b" - "\u110c",
-    "\u110e" - "\u1112",
-    "\u113c",
-    "\u113e",
-    "\u1140",
-    "\u114c",
-    "\u114e",
-    "\u1150",
-    "\u1154" - "\u1155",
-    "\u1159",
-    "\u115f" - "\u1161",
-    "\u1163",
-    "\u1165",
-    "\u1167",
-    "\u1169",
-    "\u116d" - "\u116e",
-    "\u1172" - "\u1173",
-    "\u1175",
-    "\u119e",
-    "\u11a8",
-    "\u11ab",
-    "\u11ae" - "\u11af",
-    "\u11b7" - "\u11b8",
-    "\u11ba",
-    "\u11bc" - "\u11c2",
-    "\u11eb",
-    "\u11f0",
-    "\u11f9",
-    "\u1e00" - "\u1e9b",
-    "\u1ea0" - "\u1ef9",
-    "\u1f00" - "\u1f15",
-    "\u1f18" - "\u1f1d",
-    "\u1f20" - "\u1f45",
-    "\u1f48" - "\u1f4d",
-    "\u1f50" - "\u1f57",
-    "\u1f59",
-    "\u1f5b",
-    "\u1f5d",
-    "\u1f5f" - "\u1f7d",
-    "\u1f80" - "\u1fb4",
-    "\u1fb6" - "\u1fbc",
-    "\u1fbe",
-    "\u1fc2" - "\u1fc4",
-    "\u1fc6" - "\u1fcc",
-    "\u1fd0" - "\u1fd3",
-    "\u1fd6" - "\u1fdb",
-    "\u1fe0" - "\u1fec",
-    "\u1ff2" - "\u1ff4",
-    "\u1ff6" - "\u1ffc",
-    "\u2126",
-    "\u212a" - "\u212b",
-    "\u212e",
-    "\u2180" - "\u2182",
-    "\u3041" - "\u3094",
-    "\u30a1" - "\u30fa",
-    "\u3105" - "\u312c",
-    "\uac00" - "\ud7a3"
-    ] >
-  | < #IDEOGRAPHIC : [
-    "\u4e00" - "\u9fa5",
-    "\u3007",
-    "\u3021" - "\u3029"
-    ] >
-  | < #LETTER : (<BASE_CHAR> | <IDEOGRAPHIC>) >
-  | < #COMBINING_CHAR : [
-    "\u0300" - "\u0345",
-    "\u0360" - "\u0361",
-    "\u0483" - "\u0486",
-    "\u0591" - "\u05a1",
-    "\u05a3" - "\u05b9",
-    "\u05bb" - "\u05bd",
-    "\u05bf",
-    "\u05c1" - "\u05c2",
-    "\u05c4",
-    "\u064b" - "\u0652",
-    "\u0670",
-    "\u06d6" - "\u06dc",
-    "\u06dd" - "\u06df",
-    "\u06e0" - "\u06e4",
-    "\u06e7" - "\u06e8",
-    "\u06ea" - "\u06ed",
-    "\u0901" - "\u0903",
-    "\u093c",
-    "\u093e" - "\u094c",
-    "\u094d",
-    "\u0951" - "\u0954",
-    "\u0962" - "\u0963",
-    "\u0981" - "\u0983",
-    "\u09bc",
-    "\u09be",
-    "\u09bf",
-    "\u09c0" - "\u09c4",
-    "\u09c7" - "\u09c8",
-    "\u09cb" - "\u09cd",
-    "\u09d7",
-    "\u09e2" - "\u09e3",
-    "\u0a02",
-    "\u0a3c",
-    "\u0a3e",
-    "\u0a3f",
-    "\u0a40" - "\u0a42",
-    "\u0a47" - "\u0a48",
-    "\u0a4b" - "\u0a4d",
-    "\u0a70" - "\u0a71",
-    "\u0a81" - "\u0a83",
-    "\u0abc",
-    "\u0abe" - "\u0ac5",
-    "\u0ac7" - "\u0ac9",
-    "\u0acb" - "\u0acd",
-    "\u0b01" - "\u0b03",
-    "\u0b3c",
-    "\u0b3e" - "\u0b43",
-    "\u0b47" - "\u0b48",
-    "\u0b4b" - "\u0b4d",
-    "\u0b56" - "\u0b57",
-    "\u0b82" - "\u0b83",
-    "\u0bbe" - "\u0bc2",
-    "\u0bc6" - "\u0bc8",
-    "\u0bca" - "\u0bcd",
-    "\u0bd7",
-    "\u0c01" - "\u0c03",
-    "\u0c3e" - "\u0c44",
-    "\u0c46" - "\u0c48",
-    "\u0c4a" - "\u0c4d",
-    "\u0c55" - "\u0c56",
-    "\u0c82" - "\u0c83",
-    "\u0cbe" - "\u0cc4",
-    "\u0cc6" - "\u0cc8",
-    "\u0cca" - "\u0ccd",
-    "\u0cd5" - "\u0cd6",
-    "\u0d02" - "\u0d03",
-    "\u0d3e" - "\u0d43",
-    "\u0d46" - "\u0d48",
-    "\u0d4a" - "\u0d4d",
-    "\u0d57",
-    "\u0e31",
-    "\u0e34" - "\u0e3a",
-    "\u0e47" - "\u0e4e",
-    "\u0eb1",
-    "\u0eb4" - "\u0eb9",
-    "\u0ebb" - "\u0ebc",
-    "\u0ec8" - "\u0ecd",
-    "\u0f18" - "\u0f19",
-    "\u0f35",
-    "\u0f37",
-    "\u0f39",
-    "\u0f3e",
-    "\u0f3f",
-    "\u0f71" - "\u0f84",
-    "\u0f86" - "\u0f8b",
-    "\u0f90" - "\u0f95",
-    "\u0f97",
-    "\u0f99" - "\u0fad",
-    "\u0fb1" - "\u0fb7",
-    "\u0fb9",
-    "\u20d0" - "\u20dc",
-    "\u20e1",
-    "\u302a" - "\u302f",
-    "\u3099",
-    "\u309a"
-    ] >
-  | < #DIGIT : [
-    "\u0030" - "\u0039",
-    "\u0660" - "\u0669",
-    "\u06f0" - "\u06f9",
-    "\u0966" - "\u096f",
-    "\u09e6" - "\u09ef",
-    "\u0a66" - "\u0a6f",
-    "\u0ae6" - "\u0aef",
-    "\u0b66" - "\u0b6f",
-    "\u0be7" - "\u0bef",
-    "\u0c66" - "\u0c6f",
-    "\u0ce6" - "\u0cef",
-    "\u0d66" - "\u0d6f",
-    "\u0e50" - "\u0e59",
-    "\u0ed0" - "\u0ed9",
-    "\u0f20" - "\u0f29"
-    ] >
-  | < #EXTENDER : [
-    "\u00b7",
-    "\u02d0",
-    "\u02d1",
-    "\u0387",
-    "\u0640",
-    "\u0e46",
-    "\u0ec6",
-    "\u3005",
-    "\u3031" - "\u3035",
-    "\u309d" - "\u309e",
-    "\u30fc" - "\u30fe"
-    ] >
-  | < #NMSTART : (<LETTER> | "_") >
-  | < #NMCHAR : (<LETTER> | <COMBINING_CHAR> | <EXTENDER> | <DIGIT> | "." | "-" | "_") >
-  | < #NCNAME: <NMSTART> (<NMCHAR>)* >
-}
-
-TOKEN :
-{
-  < IDENTIFIER: <NCNAME> >
-  | < ESCAPED_IDENTIFIER: "\\" <NCNAME> >
-  | < PREFIX_STAR: <NCNAME> ":*" >
-  | < PREFIXED_NAME: <NCNAME> ":" <NCNAME> >
-  | < LITERAL : ("\"" (~["\u0000", "\""])* "\"")
-                | ("'" (~["\u0000", "'"])* "'")
-                | ("\"\"\"" (~["\""]
-                             | ("\"" ~["\""])
-                             | ("\"\"" ~["\""]))* "\"\"\"")
-                | ("'''" (~["'"]
-                             | ("'" ~["'"])
-                             | ("''" ~["'"]))* "'''") >
-  | < FANNOTATE : ">>" >
-}
-
-/* This avoids lexical errors from JavaCC. */
-<*>
-TOKEN :
-{
-  < ILLEGAL_CHAR : [ "\u0000" - "\u0008", "\u000b" - "\uffff" ] >
-}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/pacakge-info.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * {@link SEIStub} and its supporting code.
- */
-package com.sun.xml.internal.ws.client.sei;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/package-info.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * {@link SEIStub} and its supporting code.
+ */
+package com.sun.xml.internal.ws.client.sei;
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/server/DefaultResourceInjector.java	Tue May 27 16:39:05 2014 -0600
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/server/DefaultResourceInjector.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
  */
 public final class DefaultResourceInjector extends ResourceInjector {
     public void inject(@NotNull WSWebServiceContext context, @NotNull Object instance) {
-        InjectionPlan.buildInjectionPlan(
+        InjectionPlan.<Object, WebServiceContext>buildInjectionPlan(
             instance.getClass(),WebServiceContext.class,false).inject(instance,context);
     }
 
--- a/jdk/.hgtags	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/.hgtags	Wed Jul 05 19:42:29 2017 +0200
@@ -256,3 +256,4 @@
 47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
 83d9bc20973de232cae45b139fdff8a4549c130f jdk9-b12
 c7c8002d02721e02131d104549ebeb8b379fb8d2 jdk9-b13
+5c7a17a81afd0906b53ee31d95a3211c96ff6b25 jdk9-b14
--- a/jdk/make/CompileJavaClasses.gmk	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/CompileJavaClasses.gmk	Wed Jul 05 19:42:29 2017 +0200
@@ -38,7 +38,7 @@
 
 ##########################################################################################
 
-EXCLUDES += com/sun/pept \
+EXCLUDES += \
     com/sun/tools/example/trace \
     com/sun/tools/example/debug/bdi \
     com/sun/tools/example/debug/event \
--- a/jdk/make/CopyIntoClasses.gmk	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/CopyIntoClasses.gmk	Wed Jul 05 19:42:29 2017 +0200
@@ -111,20 +111,8 @@
   ALL_META-INF_DIRS := $(ALL_META-INF_DIRS_share)
 endif
 
-ifndef OPENJDK
-  ALL_META-INF_DIRS += $(JDK_TOPDIR)/src/closed/share/classes/sun/java2d/cmm/kcms/META-INF
-endif
-
 SRC_SERVICES_FILES := $(wildcard $(addsuffix /services/*, $(ALL_META-INF_DIRS)))
 
-ifdef OPENJDK
-  SRC_SERVICES_FILES := $(filter-out %sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES))
-  SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/kcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
-else
-  SRC_SERVICES_FILES := $(filter-out %sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine, $(SRC_SERVICES_FILES))
-  SRC_SERVICES_FILES := $(filter-out %sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider, $(SRC_SERVICES_FILES))
-endif
-
 # The number of services files are relatively few. If the increase in numbers, then
 # we have to use ListPathsSafelyNow here.
 # Change $(JDK_TOPDIR)/src/.../META-INF/services/yyyy into $(JDK_OUTPUTDIR)/classes/META-INF/services/yyyy
--- a/jdk/make/lib/Awt2dLibraries.gmk	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Wed Jul 05 19:42:29 2017 +0200
@@ -318,7 +318,7 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
+  LIBAWT_FILES += awt_LoadLibrary.c
   LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
 endif
 
@@ -606,7 +606,6 @@
         debug_mem.c \
         debug_trace.c \
         debug_util.c \
-        awt_Plugin.c \
         gnome_interface.c \
         gtk2_interface.c \
         swing_GTKEngine.c \
@@ -657,17 +656,34 @@
 
 ##########################################################################################
 
+LIBLCMS_DIR := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms
+
+ifeq ($(USE_EXTERNAL_LCMS), true)
+  # If we're using an external library, we'll just need the wrapper part.
+  # By including it explicitely, all other files will be excluded.
+  BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
+  BUILD_LIBLCMS_HEADERS :=
+else
+  BUILD_LIBLCMS_INCLUDE_FILES :=
+  # If we're using the bundled library, we'll need to include it in the
+  # include path explicitly. Otherwise the system headers will be used.
+  BUILD_LIBLCMS_HEADERS := -I$(LIBLCMS_DIR)
+endif
+
 # TODO: Update awt lib path when awt is converted
 $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
     LIBRARY := lcms, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
+    SRC := $(LIBLCMS_DIR), \
+    INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
     LANG := C, \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
         $(SHARED_LIBRARY_FLAGS) \
         -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
-        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
+        -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+        $(BUILD_LIBLCMS_HEADERS) \
+        $(LCMS_CFLAGS), \
     CFLAGS_solaris := -xc99=no_lib, \
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
@@ -675,10 +691,10 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
     LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
-    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
-    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
-    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
-    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm,\
+    LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
+    LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm $(LCMS_LIBS), \
+    LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm $(LCMS_LIBS), \
+    LDFLAGS_SUFFIX_aix := -lm -lawt -ljava -ljvm $(LCMS_LIBS),\
     VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
     RC_FLAGS := $(RC_FLAGS) \
         -D "JDK_FNAME=lcms.dll" \
--- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -249,11 +249,6 @@
 		Java_sun_awt_motif_XsessionWMcommand;
 		Java_sun_awt_motif_XsessionWMcommand_New;
 
-		# Java Plugin
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		AWTCountFonts;
--- a/jdk/make/mapfiles/libawt/mapfile-vers	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/mapfiles/libawt/mapfile-vers	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -173,13 +173,6 @@
 		Java_sun_awt_motif_XsessionWMcommand;
 		Java_sun_awt_motif_XsessionWMcommand_New;
 
-		# Java Plugin
-                # This is in awt_LoadLibrary.c and falls through to libmawt.
-                # Evidently plugin needs this for backward compatability.
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		GrPrim_Sg2dGetCompInfo;
--- a/jdk/make/mapfiles/libawt/mapfile-vers-linux	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/mapfiles/libawt/mapfile-vers-linux	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -152,13 +152,6 @@
                 # Evidently CDE needs this for backward compatability.
 		Java_sun_awt_motif_XsessionWMcommand;
 
-		# Java Plugin
-                # This is in awt_LoadLibrary.c and falls through to libmawt.
-                # Evidently plugin needs this for backward compatability.
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		GrPrim_Sg2dGetCompInfo;
@@ -283,11 +276,6 @@
 		# CDE private entry point
 		Java_sun_awt_motif_XsessionWMcommand;
 
-		# Java Plugin
-		getAwtLockFunctions;
-		getAwtData;
-		getAwtDisplay;
-
 		# libfontmanager entry points
 		AWTIsHeadless;
 		AWTCountFonts;
--- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -449,12 +449,6 @@
         awt_Lock;
         awt_GetComponent;
 
-        # Java Plugin
-        # This is in awt_LoadLibrary.c and falls through to libmawt.
-        # Evidently plugin needs this for backward compatability.
-        getAwtLockFunctions;
-        getAwtData;
-        getAwtDisplay;
         #XAWT entry point for CDE
         Java_sun_awt_motif_XsessionWMcommand;
         Java_sun_awt_motif_XsessionWMcommand_New;
--- a/jdk/make/mapfiles/libjava/mapfile-vers	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/mapfiles/libjava/mapfile-vers	Wed Jul 05 19:42:29 2017 +0200
@@ -270,7 +270,10 @@
                 Java_sun_misc_Version_getJvmVersionInfo;
                 Java_sun_misc_Version_getJvmSpecialVersion;
 		Java_sun_misc_VM_latestUserDefinedLoader;
-                Java_sun_misc_VM_isSetUID;
+                Java_sun_misc_VM_getuid;
+                Java_sun_misc_VM_geteuid;
+                Java_sun_misc_VM_getgid;
+                Java_sun_misc_VM_getegid;
                 Java_sun_misc_VM_initialize;
 		Java_sun_misc_VMSupport_initAgentProperties;
 		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
--- a/jdk/make/mapfiles/libjpeg/mapfile-vers-closed	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/mapfiles/libjpeg/mapfile-vers-closed	Wed Jul 05 19:42:29 2017 +0200
@@ -31,10 +31,6 @@
 
 		Java_sun_awt_image_JPEGImageDecoder_initIDs;
 		Java_sun_awt_image_JPEGImageDecoder_readImage;
-		Java_sun_awt_image_codec_JPEGImageDecoderImpl_initDecoder;
-		Java_sun_awt_image_codec_JPEGImageDecoderImpl_readJPEGStream;
-		Java_sun_awt_image_codec_JPEGImageEncoderImpl_initEncoder;
-		Java_sun_awt_image_codec_JPEGImageEncoderImpl_writeJPEGStream;
 
                 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs;
                 Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader;
--- a/jdk/make/profile-rtjar-includes.txt	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/make/profile-rtjar-includes.txt	Wed Jul 05 19:42:29 2017 +0200
@@ -239,6 +239,4 @@
     META-INF/services/javax.sound.sampled.spi.AudioFileReader \
     META-INF/services/javax.sound.sampled.spi.AudioFileWriter \
     META-INF/services/javax.sound.sampled.spi.FormatConversionProvider \
-    META-INF/services/javax.sound.sampled.spi.MixerProvider \
-    META-INF/services/sun.java2d.cmm.PCMM \
-    META-INF/services/sun.java2d.pipe.RenderingEngine
+    META-INF/services/javax.sound.sampled.spi.MixerProvider
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Wed Jul 05 19:42:29 2017 +0200
@@ -121,6 +121,10 @@
     public void show() {
         final int startItemCount = comboBox.getItemCount();
 
+        if (startItemCount == 0) {
+            return;
+        }
+
         final Rectangle popupBounds = adjustPopupAndGetBounds();
         if (popupBounds == null) return; // null means don't show
 
--- a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java	Wed Jul 05 19:42:29 2017 +0200
@@ -46,10 +46,8 @@
 import com.apple.laf.AquaIcon.SystemIcon;
 import com.apple.laf.AquaUtils.RecyclableObject;
 import com.apple.laf.AquaUtils.RecyclableSingleton;
-import java.util.Arrays;
-import java.util.List;
-import sun.awt.image.MultiResolutionBufferedImage;
 import sun.awt.image.MultiResolutionImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 public class AquaImageFactory {
     public static IconUIResource getConfirmImageIcon() {
@@ -57,7 +55,7 @@
 
         return new IconUIResource(new AquaIcon.CachingScalingIcon(kAlertIconSize, kAlertIconSize) {
             Image createImage() {
-                return getThisApplicationsIcon(kAlertIconSize, kAlertIconSize);
+                return getGenericJavaIcon();
             }
         });
     }
@@ -83,24 +81,6 @@
         return getAppIconCompositedOn(lockIcon);
     }
 
-    static Image getThisApplicationsIcon(final int width, final int height) {
-        final String path = getPathToThisApplication();
-
-        if (path == null) {
-            return getGenericJavaIcon();
-        }
-
-        if (path.endsWith("/Home/bin")) {
-            return getGenericJavaIcon();
-        }
-
-        if (path.startsWith("/usr/bin")) {
-            return getGenericJavaIcon();
-        }
-
-        return AquaUtils.getCImageCreator().createImageOfFile(path, height, width);
-    }
-
     static Image getGenericJavaIcon() {
         return java.security.AccessController.doPrivileged(new PrivilegedAction<Image>() {
             public Image run() {
@@ -125,9 +105,9 @@
     private static final int kAlertIconSize = 64;
     static IconUIResource getAppIconCompositedOn(final Image background) {
 
-        if (background instanceof MultiResolutionBufferedImage) {
+        if (background instanceof MultiResolutionCachedImage) {
             int width = background.getWidth(null);
-            Image mrIconImage = ((MultiResolutionBufferedImage) background).map(
+            Image mrIconImage = ((MultiResolutionCachedImage) background).map(
                     rv -> getAppIconImageCompositedOn(rv, rv.getWidth(null) / width));
             return new IconUIResource(new ImageIcon(mrIconImage));
         }
@@ -144,7 +124,7 @@
         final Icon smallAppIconScaled = new AquaIcon.CachingScalingIcon(
                 kAlertSubIconSize, kAlertSubIconSize) {
                     Image createImage() {
-                        return getThisApplicationsIcon(kAlertSubIconSize, kAlertSubIconSize);
+                        return getGenericJavaIcon();
                     }
                 };
 
@@ -306,21 +286,7 @@
     private static Image getNSIcon(String imageName) {
         Image icon = Toolkit.getDefaultToolkit()
                 .getImage("NSImage://" + imageName);
-
-        if (icon instanceof MultiResolutionImage) {
-            return icon;
-        }
-
-        int w = icon.getWidth(null);
-        int h = icon.getHeight(null);
-
-        Dimension[] sizes = new Dimension[]{
-            new Dimension(w, h), new Dimension(2 * w, 2 * h)
-        };
-
-        return new MultiResolutionBufferedImage(icon, sizes, (width, height) ->
-                AquaUtils.getCImageCreator().createImageFromName(
-                        imageName, width, height));
+        return icon;
     }
 
     public static class NineSliceMetrics {
@@ -530,4 +496,4 @@
     public static Color getSelectionInactiveForegroundColorUIResource() {
         return new SystemColorProxy(LWCToolkit.getAppleColor(LWCToolkit.INACTIVE_SELECTION_FOREGROUND_COLOR));
     }
-}
\ No newline at end of file
+}
--- a/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaPainter.java	Wed Jul 05 19:42:29 2017 +0200
@@ -174,11 +174,7 @@
                                                         bounds, controlState);
             Image img = cache.getImage(key);
             if (img == null) {
-
-                Image baseImage = createImage(imgX, imgY, imgW, imgH, bounds,
-                                              control, controlState);
-
-                img = new MultiResolutionBufferedImage(baseImage,
+                img = new MultiResolutionCachedImage(imgW, imgH,
                         (rvWidth, rvHeight) -> createImage(imgX, imgY,
                          rvWidth, rvHeight, bounds, control, controlState));
 
--- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java	Wed Jul 05 19:42:29 2017 +0200
@@ -48,7 +48,7 @@
 import sun.swing.SwingUtilities2;
 
 import com.apple.laf.AquaImageFactory.SlicedImageControl;
-import sun.awt.image.MultiResolutionBufferedImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 final class AquaUtils {
 
@@ -124,8 +124,8 @@
 
     static Image generateLightenedImage(final Image image, final int percent) {
         final GrayFilter filter = new GrayFilter(true, percent);
-        return (image instanceof MultiResolutionBufferedImage)
-                ? ((MultiResolutionBufferedImage) image).map(
+        return (image instanceof MultiResolutionCachedImage)
+                ? ((MultiResolutionCachedImage) image).map(
                         rv -> generateLightenedImage(rv, filter))
                 : generateLightenedImage(image, filter);
     }
--- a/jdk/src/macosx/classes/sun/font/CFontManager.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/font/CFontManager.java	Wed Jul 05 19:42:29 2017 +0200
@@ -40,7 +40,7 @@
 
 import sun.awt.FontConfiguration;
 import sun.awt.HeadlessToolkit;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.lwawt.macosx.*;
 
 public class CFontManager extends SunFontManager {
--- a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -171,7 +171,9 @@
             SwingUtilities.invokeLater(() -> {
                 JPopupMenu popupMenu = getPopupMenu();
                 // Need to override the invoker for proper grab handling
-                if (popupMenu != null && popupMenu.getInvoker() != getTarget()) {
+                if (popupMenu != null
+                        && popupMenu.isShowing()
+                        && popupMenu.getInvoker() != getTarget()) {
                     // The popup is now visible with correct location
                     // Save it and restore after toggling visibility and changing invoker
                     Point loc = popupMenu.getLocationOnScreen();
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -63,8 +63,6 @@
 import javax.swing.SwingUtilities;
 import javax.swing.RepaintManager;
 
-import sun.lwawt.macosx.CDropTarget;
-
 import com.sun.java.swing.SwingUtilities3;
 
 public abstract class LWComponentPeer<T extends Component, D extends JComponent>
@@ -137,7 +135,7 @@
     private final Object dropTargetLock = new Object();
 
     private int fNumDropTargets = 0;
-    private CDropTarget fDropTarget = null;
+    private PlatformDropTarget fDropTarget = null;
 
     private final PlatformComponent platformComponent;
 
@@ -1063,11 +1061,11 @@
                 // if it's the first (or last) one for the component. Otherwise this call is a no-op.
                 if (++fNumDropTargets == 1) {
                     // Having a non-null drop target would be an error but let's check just in case:
-                    if (fDropTarget != null)
-                        System.err.println("CComponent.addDropTarget(): current drop target is non-null.");
-
+                    if (fDropTarget != null) {
+                        throw new IllegalStateException("Current drop target is not null");
+                    }
                     // Create a new drop target:
-                    fDropTarget = CDropTarget.createDropTarget(dt, target, this);
+                    fDropTarget = LWToolkit.getLWToolkit().createDropTarget(dt, target, this);
                 }
             }
         }
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,6 +28,7 @@
 import java.awt.*;
 import java.awt.List;
 import java.awt.datatransfer.*;
+import java.awt.dnd.DropTarget;
 import java.awt.image.*;
 import java.awt.peer.*;
 import java.security.*;
@@ -35,7 +36,7 @@
 
 import sun.awt.*;
 import sun.print.*;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 import static sun.lwawt.LWWindowPeer.PeerType;
 
@@ -440,6 +441,10 @@
 
     protected abstract FileDialogPeer createFileDialogPeer(FileDialog target);
 
+    protected abstract PlatformDropTarget createDropTarget(DropTarget dropTarget,
+                                                           Component component,
+                                                           LWComponentPeer<?, ?> peer);
+
     // ---- UTILITY METHODS ---- //
 
     /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/macosx/classes/sun/lwawt/PlatformDropTarget.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.lwawt;
+
+public interface PlatformDropTarget {
+
+    /**
+     * Release native dragging destination, if any
+     */
+    void dispose();
+}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -31,6 +31,7 @@
 
 import java.io.*;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.text.Normalizer;
 import java.text.Normalizer.Form;
 import java.util.*;
@@ -126,7 +127,7 @@
 
             if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass()))
             {
-                String charset = getDefaultTextCharset();
+                String charset = Charset.defaultCharset().name();
                 if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
                     try {
                         charset = new String((byte[])transferable.getTransferData(javaTextEncodingFlavor), "UTF-8");
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDropTarget.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,54 +25,37 @@
 
 package sun.lwawt.macosx;
 
-import java.awt.Component;
-import java.awt.peer.ComponentPeer;
+import sun.lwawt.LWComponentPeer;
+import sun.lwawt.PlatformDropTarget;
+
+import java.awt.*;
 import java.awt.dnd.DropTarget;
 
-import sun.lwawt.LWComponentPeer;
-import sun.lwawt.PlatformWindow;
-
 
-public final class CDropTarget {
-
-    Component        fComponent;
-    ComponentPeer    fPeer;
-    DropTarget        fDropTarget;
-    private long    fNativeDropTarget;
+final class CDropTarget implements PlatformDropTarget {
+    private long fNativeDropTarget;
 
-    public static CDropTarget createDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) {
-        return new CDropTarget(dropTarget, component, peer);
-    }
-
-    private CDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer) {
-        super();
-
-        fDropTarget = dropTarget;
-        fComponent = component;
-        fPeer = peer;
-
-        long nativePeer = CPlatformWindow.getNativeViewPtr(((LWComponentPeer) peer).getPlatformWindow());
+    CDropTarget(DropTarget dropTarget, Component component, LWComponentPeer<?, ?> peer) {
+        long nativePeer = CPlatformWindow.getNativeViewPtr(peer.getPlatformWindow());
         if (nativePeer == 0L) return; // Unsupported for a window without a native view (plugin)
 
         // Create native dragging destination:
-        fNativeDropTarget = this.createNativeDropTarget(dropTarget, component, peer, nativePeer);
+        fNativeDropTarget = createNativeDropTarget(dropTarget, component, nativePeer);
         if (fNativeDropTarget == 0) {
             throw new IllegalStateException("CDropTarget.createNativeDropTarget() failed.");
         }
     }
 
-    public DropTarget getDropTarget() {
-        return fDropTarget;
-    }
-
+    @Override
     public void dispose() {
-        // Release native dragging destination, if any:
         if (fNativeDropTarget != 0) {
-            this.releaseNativeDropTarget(fNativeDropTarget);
+            releaseNativeDropTarget(fNativeDropTarget);
             fNativeDropTarget = 0;
         }
     }
 
-    protected native long createNativeDropTarget(DropTarget dropTarget, Component component, ComponentPeer peer, long nativePeer);
+    protected native long createNativeDropTarget(DropTarget dropTarget,
+                                                 Component component,
+                                                 long nativePeer);
     protected native void releaseNativeDropTarget(long nativeDropTarget);
 }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CImage.java	Wed Jul 05 19:42:29 2017 +0200
@@ -32,7 +32,7 @@
 import java.util.Arrays;
 import java.util.List;
 import sun.awt.image.MultiResolutionImage;
-import sun.awt.image.MultiResolutionBufferedImage;
+import sun.awt.image.MultiResolutionCachedImage;
 
 import sun.awt.image.SunWritableRaster;
 
@@ -62,41 +62,41 @@
         // This is used to create a CImage with an NSImage pointer. It MUST be a CFRetained
         // NSImage, and the CImage takes ownership of the non-GC retain. If callers need the
         // NSImage themselves, they MUST call retain on the NSImage themselves.
-        public BufferedImage createImageUsingNativeSize(final long image) {
+        public Image createImageUsingNativeSize(final long image) {
             if (image == 0) return null;
             final Dimension2D size = nativeGetNSImageSize(image);
-            return createBufferedImage(image, size.getWidth(), size.getHeight());
+            return createImage(image, size.getWidth(), size.getHeight());
         }
 
         // the width and height passed in as a parameter could differ than the width and the height of the NSImage (image), in that case, the image will be scaled
-        BufferedImage createBufferedImage(long image, double width, double height) {
+        Image createImage(long image, double width, double height) {
             if (image == 0) throw new Error("Unable to instantiate CImage with null native image reference.");
             return createImageWithSize(image, width, height);
         }
 
-        public BufferedImage createImageWithSize(final long image, final double width, final double height) {
+        public Image createImageWithSize(final long image, final double width, final double height) {
             final CImage img = new CImage(image);
             img.resize(width, height);
             return img.toImage();
         }
 
         // This is used to create a CImage that represents the icon of the given file.
-        public BufferedImage createImageOfFile(final String file, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
+        public Image createImageOfFile(final String file, final int width, final int height) {
+            return createImage(nativeCreateNSImageOfFileFromLaunchServices(file), width, height);
         }
 
-        public BufferedImage createImageFromFile(final String file, final double width, final double height) {
+        public Image createImageFromFile(final String file, final double width, final double height) {
             final long image = nativeCreateNSImageFromFileContents(file);
             nativeSetNSImageSize(image, width, height);
-            return createBufferedImage(image, width, height);
+            return createImage(image, width, height);
         }
 
-        public BufferedImage createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
+        public Image createSystemImageFromSelector(final String iconSelector, final int width, final int height) {
+            return createImage(nativeCreateNSImageFromIconSelector(getSelectorAsInt(iconSelector)), width, height);
         }
 
         public Image createImageFromName(final String name, final int width, final int height) {
-            return createBufferedImage(nativeCreateNSImageFromImageName(name), width, height);
+            return createImage(nativeCreateNSImageFromImageName(name), width, height);
         }
 
         public Image createImageFromName(final String name) {
@@ -232,7 +232,7 @@
     }
 
     /** @return A MultiResolution image created from nsImagePtr, or null. */
-    private BufferedImage toImage() {
+    private Image toImage() {
         if (ptr == 0) return null;
 
         final Dimension2D size = nativeGetNSImageSize(ptr);
@@ -243,11 +243,11 @@
                 = nativeGetNSImageRepresentationSizes(ptr,
                         size.getWidth(), size.getHeight());
 
-        BufferedImage baseImage = toImage(w, h, w, h);
-
-        return sizes == null || sizes.length < 2 ? baseImage
-                : new MultiResolutionBufferedImage(baseImage, sizes,
-                        (width, height) -> toImage(w, h, width, height));
+        return sizes == null || sizes.length < 2 ?
+                new MultiResolutionCachedImage(w, h, (width, height)
+                        -> toImage(w, h, width, height))
+                : new MultiResolutionCachedImage(w, h, sizes, (width, height)
+                        -> toImage(w, h, width, height));
     }
 
     private BufferedImage toImage(int srcWidth, int srcHeight, int dstWidth, int dstHeight) {
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CWarningWindow.java	Wed Jul 05 19:42:29 2017 +0200
@@ -309,6 +309,10 @@
     @Override
     public void dispose() {
         cancelTasks();
+        SurfaceData surfaceData = contentView.getSurfaceData();
+        if (surfaceData != null) {
+            surfaceData.invalidate();
+        }
         super.dispose();
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -611,19 +611,20 @@
     }
 
     /**
-     * Kicks an event over to the appropriate eventqueue and waits for it to
+     * Kicks an event over to the appropriate event queue and waits for it to
      * finish To avoid deadlocking, we manually run the NSRunLoop while waiting
      * Any selector invoked using ThreadUtilities performOnMainThread will be
      * processed in doAWTRunLoop The InvocationEvent will call
      * LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
-     * runloop Does not dispatch native events while in the loop
+     * run loop. Does not dispatch native events while in the loop
      */
     public static void invokeAndWait(Runnable runnable, Component component)
             throws InvocationTargetException {
-        final long mediator = createAWTRunLoopMediator();
+        Objects.requireNonNull(component, "Null component provided to invokeAndWait");
 
+        long mediator = createAWTRunLoopMediator();
         InvocationEvent invocationEvent =
-                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(),
+                new InvocationEvent(component,
                         runnable,
                         () -> {
                             if (mediator != 0) {
@@ -632,49 +633,42 @@
                         },
                         true);
 
-        if (component != null) {
-            AppContext appContext = SunToolkit.targetToAppContext(component);
-            SunToolkit.postEvent(appContext, invocationEvent);
-
-            // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
-            SunToolkit.flushPendingEvents(appContext);
-        } else {
-            // This should be the equivalent to EventQueue.invokeAndWait
-            ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
-        }
-
+        AppContext appContext = SunToolkit.targetToAppContext(component);
+        SunToolkit.postEvent(appContext, invocationEvent);
+        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
+        SunToolkit.flushPendingEvents(appContext);
         doAWTRunLoop(mediator, false);
 
-        Throwable eventException = invocationEvent.getException();
-        if (eventException != null) {
-            if (eventException instanceof UndeclaredThrowableException) {
-                eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
-            }
-            throw new InvocationTargetException(eventException);
-        }
+        checkException(invocationEvent);
     }
 
     public static void invokeLater(Runnable event, Component component)
             throws InvocationTargetException {
-        final InvocationEvent invocationEvent =
-                new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);
+        Objects.requireNonNull(component, "Null component provided to invokeLater");
+
+        InvocationEvent invocationEvent = new InvocationEvent(component, event);
 
-        if (component != null) {
-            final AppContext appContext = SunToolkit.targetToAppContext(component);
-            SunToolkit.postEvent(appContext, invocationEvent);
+        AppContext appContext = SunToolkit.targetToAppContext(component);
+        SunToolkit.postEvent(SunToolkit.targetToAppContext(component), invocationEvent);
+        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
+        SunToolkit.flushPendingEvents(appContext);
 
-            // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
-            SunToolkit.flushPendingEvents(appContext);
-        } else {
-            // This should be the equivalent to EventQueue.invokeAndWait
-            ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
-        }
+        checkException(invocationEvent);
+    }
 
-        final Throwable eventException = invocationEvent.getException();
+    /**
+     * Checks if exception occurred while {@code InvocationEvent} was processed and rethrows it as
+     * an {@code InvocationTargetException}
+     *
+     * @param event the event to check for an exception
+     * @throws InvocationTargetException if exception occurred when event was processed
+     */
+    private static void checkException(InvocationEvent event) throws InvocationTargetException {
+        Throwable eventException = event.getException();
         if (eventException == null) return;
 
         if (eventException instanceof UndeclaredThrowableException) {
-            throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
+            eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
         }
         throw new InvocationTargetException(eventException);
     }
@@ -686,11 +680,6 @@
      */
     native static void performOnMainThreadAfterDelay(Runnable r, long delay);
 
-    // This exists purely to get around permissions issues with getSystemEventQueueImpl
-    EventQueue getSystemEventQueueForInvokeAndWait() {
-        return getSystemEventQueueImpl();
-    }
-
 // DnD support
 
     @Override
@@ -712,7 +701,14 @@
         return (T)dgr;
     }
 
-// InputMethodSupport Method
+    @Override
+    protected PlatformDropTarget createDropTarget(DropTarget dropTarget,
+                                                  Component component,
+                                                  LWComponentPeer<?, ?> peer) {
+        return new CDropTarget(dropTarget, component, peer);
+    }
+
+    // InputMethodSupport Method
     /**
      * Returns the default keyboard locale of the underlying operating system
      */
--- a/jdk/src/macosx/native/sun/awt/AWTView.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/AWTView.m	Wed Jul 05 19:42:29 2017 +0200
@@ -27,6 +27,7 @@
 
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
 #import <JavaRuntimeSupport/JavaRuntimeSupport.h>
+#import "jni_util.h"
 
 #import "ThreadUtilities.h"
 #import "AWTView.h"
@@ -391,14 +392,12 @@
                                   (jint)absP.x, (jint)absP.y,
                                   [event deltaY],
                                   [event deltaX]);
-    if (jEvent == nil) {
-        // Unable to create event by some reason.
-        return;
-    }
+    CHECK_NULL(jEvent);
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverMouseEvent, jc_PlatformView, "deliverMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, m_cPlatformView, jm_deliverMouseEvent, jEvent);
+    (*env)->DeleteLocalRef(env, jEvent);
 }
 
 - (void) resetTrackingArea {
@@ -447,20 +446,22 @@
 
     static JNF_CLASS_CACHE(jc_NSEvent, "sun/lwawt/macosx/NSEvent");
     static JNF_CTOR_CACHE(jctor_NSEvent, jc_NSEvent, "(IISLjava/lang/String;)V");
-    jobject jevent = JNFNewObject(env, jctor_NSEvent,
+    jobject jEvent = JNFNewObject(env, jctor_NSEvent,
                                   [event type],
                                   [event modifierFlags],
                                   [event keyCode],
                                   characters);
+    CHECK_NULL(jEvent);
 
     static JNF_CLASS_CACHE(jc_PlatformView, "sun/lwawt/macosx/CPlatformView");
     static JNF_MEMBER_CACHE(jm_deliverKeyEvent, jc_PlatformView,
                             "deliverKeyEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
-    JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jevent);
+    JNFCallVoidMethod(env, m_cPlatformView, jm_deliverKeyEvent, jEvent);
 
     if (characters != NULL) {
         (*env)->DeleteLocalRef(env, characters);
     }
+    (*env)->DeleteLocalRef(env, jEvent);
 }
 
 -(void) deliverResize: (NSRect) rect {
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Wed Jul 05 19:42:29 2017 +0200
@@ -261,7 +261,8 @@
 
 // returns id for the topmost window under mouse
 + (NSInteger) getTopmostWindowUnderMouseID {
-
+    NSInteger result = -1;
+    
     NSRect screenRect = [[NSScreen mainScreen] frame];
     NSPoint nsMouseLocation = [NSEvent mouseLocation];
     CGPoint cgMouseLocation = CGPointMake(nsMouseLocation.x, screenRect.size.height - nsMouseLocation.y);
@@ -274,11 +275,13 @@
             CGRect rect;
             CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[window objectForKey:(id)kCGWindowBounds], &rect);
             if (CGRectContainsPoint(rect, cgMouseLocation)) {
-                return [[window objectForKey:(id)kCGWindowNumber] integerValue];
+                result = [[window objectForKey:(id)kCGWindowNumber] integerValue];
+                break;
             }
         }
     }
-    return -1;
+    [windows release];
+    return result;
 }
 
 // checks that this window is under the mouse cursor and this point is not overlapped by others windows
--- a/jdk/src/macosx/native/sun/awt/CDropTarget.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/CDropTarget.h	Wed Jul 05 19:42:29 2017 +0200
@@ -48,7 +48,7 @@
 + (CDropTarget *) currentDropTarget;
 
 // Common methods:
-- (id)init:(jobject)dropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control;
+- (id)init:(jobject)dropTarget component:(jobject)jcomponent control:(id)control;
 - (void)controlModelControlValid;
 - (void)removeFromView:(JNIEnv *)env;
 
--- a/jdk/src/macosx/native/sun/awt/CDropTarget.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/CDropTarget.m	Wed Jul 05 19:42:29 2017 +0200
@@ -65,7 +65,7 @@
     return sCurrentDropTarget;
 }
 
-- (id)init:(jobject)jdropTarget component:(jobject)jcomponent peer:(jobject)jpeer control:(id)control
+- (id)init:(jobject)jdropTarget component:(jobject)jcomponent control:(id)control
 {
     self = [super init];
     DLog2(@"[CDropTarget init]: %@\n", self);
@@ -714,13 +714,13 @@
  * Signature: (Ljava/awt/dnd/DropTarget;Ljava/awt/Component;Ljava/awt/peer/ComponentPeer;J)J
  */
 JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CDropTarget_createNativeDropTarget
-  (JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jobject jpeer, jlong jnativepeer)
+  (JNIEnv *env, jobject jthis, jobject jdroptarget, jobject jcomponent, jlong jnativepeer)
 {
     CDropTarget* dropTarget = nil;
 
 JNF_COCOA_ENTER(env);
     id controlObj = (id) jlong_to_ptr(jnativepeer);
-    dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent peer:jpeer control:controlObj];
+    dropTarget = [[CDropTarget alloc] init:jdroptarget component:jcomponent control:controlObj];
 JNF_COCOA_EXIT(env);
 
     return ptr_to_jlong(dropTarget);
--- a/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/CGraphicsDevice.m	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,8 @@
             CFArrayAppendValue(validModes, cRef);
         }
     }
-
+    CFRelease(allModes);
+    
     CGDisplayModeRef currentMode = CGDisplayCopyDisplayMode(displayID);
 
     BOOL containsCurrentMode = NO;
@@ -81,6 +82,7 @@
     if (!containsCurrentMode) {
         CFArrayAppendValue(validModes, currentMode);
     }
+    CGDisplayModeRelease(currentMode);
 
     return validModes;
 }
@@ -154,14 +156,12 @@
 Java_sun_awt_CGraphicsDevice_nativeGetXResolution
   (JNIEnv *env, jclass class, jint displayID)
 {
-    // TODO: this is the physically correct answer, but we probably want
-    // to use NSScreen API instead...
+    // CGDisplayScreenSize can return 0 if displayID is invalid
     CGSize size = CGDisplayScreenSize(displayID);
     CGRect rect = CGDisplayBounds(displayID);
     // 1 inch == 25.4 mm
     jfloat inches = size.width / 25.4f;
-    jfloat dpi = rect.size.width / inches;
-    return dpi;
+    return inches > 0 ? rect.size.width / inches : 72;
 }
 
 /*
@@ -173,14 +173,12 @@
 Java_sun_awt_CGraphicsDevice_nativeGetYResolution
   (JNIEnv *env, jclass class, jint displayID)
 {
-    // TODO: this is the physically correct answer, but we probably want
-    // to use NSScreen API instead...
+    // CGDisplayScreenSize can return 0 if displayID is invalid
     CGSize size = CGDisplayScreenSize(displayID);
     CGRect rect = CGDisplayBounds(displayID);
     // 1 inch == 25.4 mm
     jfloat inches = size.height / 25.4f;
-    jfloat dpi = rect.size.height / inches;
-    return dpi;
+    return inches > 0 ? rect.size.height / inches : 72;
 }
 
 /*
@@ -235,17 +233,19 @@
 {
     JNF_COCOA_ENTER(env);
     CFArrayRef allModes = getAllValidDisplayModes(displayID);
-
     CGDisplayModeRef closestMatch = getBestModeForParameters(allModes, (int)w, (int)h, (int)bpp, (int)refrate);
+    
     __block CGError retCode = kCGErrorSuccess;
     if (closestMatch != NULL) {
-        [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+        CGDisplayModeRetain(closestMatch);
+        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
             CGDisplayConfigRef config;
             retCode = CGBeginDisplayConfiguration(&config);
             if (retCode == kCGErrorSuccess) {
                 CGConfigureDisplayWithDisplayMode(config, displayID, closestMatch, NULL);
                 retCode = CGCompleteDisplayConfiguration(config, kCGConfigureForAppOnly);
             }
+            CGDisplayModeRelease(closestMatch);
         }];
     } else {
         [JNFException raise:env as:kIllegalArgumentException reason:"Invalid display mode"];
@@ -253,8 +253,7 @@
 
     if (retCode != kCGErrorSuccess){
         [JNFException raise:env as:kIllegalArgumentException reason:"Unable to set display mode!"];
-    }    
-
+    }
     CFRelease(allModes);
     JNF_COCOA_EXIT(env);
 }
--- a/jdk/src/macosx/native/sun/awt/CImage.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/CImage.m	Wed Jul 05 19:42:29 2017 +0200
@@ -76,17 +76,17 @@
 
 static NSBitmapImageRep* CImage_CreateImageRep(JNIEnv *env, jintArray buffer, jint width, jint height)
 {
-    NSBitmapImageRep* imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
-                                                                         pixelsWide:width
-                                                                         pixelsHigh:height
-                                                                      bitsPerSample:8
-                                                                    samplesPerPixel:4
-                                                                           hasAlpha:YES
-                                                                           isPlanar:NO
-                                                                     colorSpaceName:NSDeviceRGBColorSpace
-                                                                       bitmapFormat:NSAlphaFirstBitmapFormat
-                                                                        bytesPerRow:width*4 // TODO: use explicit scanStride
-                                                                       bitsPerPixel:32];
+    NSBitmapImageRep* imageRep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
+                                                                          pixelsWide:width
+                                                                          pixelsHigh:height
+                                                                       bitsPerSample:8
+                                                                     samplesPerPixel:4
+                                                                            hasAlpha:YES
+                                                                            isPlanar:NO
+                                                                      colorSpaceName:NSDeviceRGBColorSpace
+                                                                        bitmapFormat:NSAlphaFirstBitmapFormat
+                                                                         bytesPerRow:width*4 // TODO: use explicit scanStride
+                                                                        bitsPerPixel:32] autorelease];
 
     jint *imgData = (jint *)[imageRep bitmapData];
     if (imgData == NULL) return 0L;
@@ -115,9 +115,8 @@
     
     NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height);
     if (imageRep) {
-        NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] retain];
+        NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
         [nsImage addRepresentation:imageRep];
-        [imageRep release];
         result = ptr_to_jlong(nsImage);
     }
 
@@ -160,7 +159,7 @@
         (*env)->ReleaseIntArrayElements(env, widths, ws, JNI_ABORT);
     }
     if ([reps count]) {
-        NSImage *nsImage = [[[NSImage alloc] initWithSize:NSMakeSize(0, 0)] retain];
+        NSImage *nsImage = [[NSImage alloc] initWithSize:NSMakeSize(0, 0)];
         [nsImage addRepresentations: reps];
         result = ptr_to_jlong(nsImage);
     }
@@ -184,7 +183,7 @@
 
     IconRef iconRef;
     if (noErr == GetIconRef(kOnSystemDisk, kSystemIconsCreator, selector, &iconRef)) {
-        image = [[[NSImage alloc] initWithIconRef:iconRef] retain];
+        image = [[NSImage alloc] initWithIconRef:iconRef];
         ReleaseIconRef(iconRef);
     }
 
@@ -206,7 +205,7 @@
 JNF_COCOA_ENTER(env);
 
     NSString *path = JNFNormalizedNSStringForPath(env, file);
-    image = [[[NSImage alloc] initByReferencingFile:path] retain];
+    image = [[NSImage alloc] initByReferencingFile:path];
 
 JNF_COCOA_EXIT(env);
 
@@ -435,7 +434,7 @@
 
     JNF_COCOA_ENTER(env);
 
-    NSBitmapImageRep* imageRep = [CImage_CreateImageRep(env, buffer, width, height) autorelease];
+    NSBitmapImageRep* imageRep = CImage_CreateImageRep(env, buffer, width, height);
     if (imageRep) {
         NSData *tiffImage = [imageRep TIFFRepresentation];
         jsize tiffSize = (jsize)[tiffImage length];
--- a/jdk/src/macosx/native/sun/awt/CTrayIcon.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/CTrayIcon.m	Wed Jul 05 19:42:29 2017 +0200
@@ -25,6 +25,7 @@
 
 #import <AppKit/AppKit.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import "jni_util.h"
 
 #import "CTrayIcon.h"
 #import "ThreadUtilities.h"
@@ -146,14 +147,12 @@
                                   (jint)absP.x, (jint)absP.y,
                                   [event deltaY],
                                   [event deltaX]);
-    if (jEvent == nil) {
-        // Unable to create event by some reason.
-        return;
-    }
+    CHECK_NULL(jEvent);
 
     static JNF_CLASS_CACHE(jc_TrayIcon, "sun/lwawt/macosx/CTrayIcon");
     static JNF_MEMBER_CACHE(jm_handleMouseEvent, jc_TrayIcon, "handleMouseEvent", "(Lsun/lwawt/macosx/NSEvent;)V");
     JNFCallVoidMethod(env, peer, jm_handleMouseEvent, jEvent);
+    (*env)->DeleteLocalRef(env, jEvent);
 }
 
 @end //AWTTrayIcon
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -157,61 +157,6 @@
 JNF_COCOA_EXIT(env);
 }
 
-static JNF_CLASS_CACHE(jc_Component, "java/awt/Component");
-static JNF_MEMBER_CACHE(jf_Component_appContext, jc_Component, "appContext", "Lsun/awt/AppContext;");
-static JNF_CLASS_CACHE(jc_MenuComponent, "java/awt/MenuComponent");
-static JNF_MEMBER_CACHE(jf_MenuComponent_appContext, jc_MenuComponent, "appContext", "Lsun/awt/AppContext;");
-
-/*
- * Class:     sun_awt_SunToolkit
- * Method:    getAppContext
- * Signature: (Ljava/awt/Object;)Lsun/awt/AppContext;
- */
-JNIEXPORT jobject JNICALL
-Java_sun_awt_SunToolkit_getAppContext
-(JNIEnv *env, jclass cls, jobject obj)
-{
-    jobject appContext = NULL;
-
-JNF_COCOA_ENTER(env);
-
-    if (JNFIsInstanceOf(env, obj, &jc_Component)) {
-        appContext = JNFGetObjectField(env, obj, jf_Component_appContext);
-    } else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) {
-        appContext = JNFGetObjectField(env, obj, jf_MenuComponent_appContext);
-    }
-
-JNF_COCOA_EXIT(env);
-
-    return appContext;
-}
-
-/*
- * Class:     sun_awt_SunToolkit
- * Method:    setAppContext
- * Signature: (Ljava/lang/Object;Lsun/awt/AppContext;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_SunToolkit_setAppContext
-(JNIEnv *env, jclass cls, jobject obj, jobject appContext)
-{
-    jboolean isComponent;
-
-JNF_COCOA_ENTER(env);
-
-    if (JNFIsInstanceOf(env, obj, &jc_Component)) {
-        JNFSetObjectField(env, obj, jf_Component_appContext, appContext);
-        isComponent = JNI_TRUE;
-    } else if (JNFIsInstanceOf(env, obj, &jc_MenuComponent)) {
-        JNFSetObjectField(env, obj, jf_MenuComponent_appContext, appContext);
-        isComponent = JNI_FALSE;
-    }
-
-JNF_COCOA_EXIT(env);
-
-    return isComponent;
-}
-
 /*
  * Class:     sun_lwawt_macosx_LWCToolkit
  * Method:    beep
--- a/jdk/src/macosx/native/sun/awt/awt.m	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/awt/awt.m	Wed Jul 05 19:42:29 2017 +0200
@@ -435,7 +435,7 @@
         forceEmbeddedMode = YES;
     }
     JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
-    jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/misc/ThreadGroupUtils");
+    jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/awt/util/ThreadGroupUtils");
     jmethodID sjm_getRootThreadGroup = (*env)->GetStaticMethodID(env, jc_ThreadGroupUtils, "getRootThreadGroup", "()Ljava/lang/ThreadGroup;");
     jobject rootThreadGroup = (*env)->CallStaticObjectMethod(env, jc_ThreadGroupUtils, sjm_getRootThreadGroup);
     [ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, rootThreadGroup)];
--- a/jdk/src/macosx/native/sun/osxapp/AWT_debug.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/macosx/native/sun/osxapp/AWT_debug.h	Wed Jul 05 19:42:29 2017 +0200
@@ -32,9 +32,10 @@
 #define kInternalError "java/lang/InternalError"
 
 #define AWT_DEBUG_LOG(str) \
-    NSLog(@"Cocoa AWT: %@ %@", str, [NSThread callStackSymbols])
+    NSLog(@"\tCocoa AWT: %@ %@", str, [NSThread callStackSymbols])
 
 #define AWT_DEBUG_BUG_REPORT_MESSAGE \
-    NSLog(@"\tPlease file a bug report at http://java.net/jira/browse/MACOSX_PORT with this message and a reproducible test case.")
+    NSLog(@"\tPlease file a bug report at http://bugreport.java.com/bugreport \
+with this message and a reproducible test case.")
 
 #endif
--- a/jdk/src/share/bin/java.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/bin/java.c	Wed Jul 05 19:42:29 2017 +0200
@@ -739,6 +739,9 @@
     if (s == NULL)
         return;
     s = JLI_WildcardExpandClasspath(s);
+    if (sizeof(format) - 2 + JLI_StrLen(s) < JLI_StrLen(s))
+        // s is became corrupted after expanding wildcards
+        return;
     def = JLI_MemAlloc(sizeof(format)
                        - 2 /* strlen("%s") */
                        + JLI_StrLen(s));
@@ -1358,9 +1361,11 @@
         if (s) {
             s = (char *) JLI_WildcardExpandClasspath(s);
             /* 40 for -Denv.class.path= */
-            envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
-            sprintf(envcp, "-Denv.class.path=%s", s);
-            AddOption(envcp, NULL);
+            if (JLI_StrLen(s) + 40 > JLI_StrLen(s)) { // Safeguard from overflow
+                envcp = (char *)JLI_MemAlloc(JLI_StrLen(s) + 40);
+                sprintf(envcp, "-Denv.class.path=%s", s);
+                AddOption(envcp, NULL);
+            }
         }
     }
 
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHParameters.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -131,14 +131,14 @@
     protected String engineToString() {
         String LINE_SEP = System.getProperty("line.separator");
 
-        StringBuffer strbuf
-            = new StringBuffer("SunJCE Diffie-Hellman Parameters:"
+        StringBuilder sb
+            = new StringBuilder("SunJCE Diffie-Hellman Parameters:"
                                + LINE_SEP + "p:" + LINE_SEP
                                + Debug.toHexString(this.p)
                                + LINE_SEP + "g:" + LINE_SEP
                                + Debug.toHexString(this.g));
         if (this.l != 0)
-            strbuf.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
-        return strbuf.toString();
+            sb.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
+        return sb.toString();
     }
 }
--- a/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/crypto/provider/DHPublicKey.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -260,8 +260,8 @@
     public String toString() {
         String LINE_SEP = System.getProperty("line.separator");
 
-        StringBuffer strbuf
-            = new StringBuffer("SunJCE Diffie-Hellman Public Key:"
+        StringBuilder sb
+            = new StringBuilder("SunJCE Diffie-Hellman Public Key:"
                                + LINE_SEP + "y:" + LINE_SEP
                                + Debug.toHexString(this.y)
                                + LINE_SEP + "p:" + LINE_SEP
@@ -269,8 +269,8 @@
                                + LINE_SEP + "g:" + LINE_SEP
                                + Debug.toHexString(this.g));
         if (this.l != 0)
-            strbuf.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
-        return strbuf.toString();
+            sb.append(LINE_SEP + "l:" + LINE_SEP + "    " + this.l);
+        return sb.toString();
     }
 
     private void parseKeyBits() throws InvalidKeyException {
--- a/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/crypto/provider/OAEPParameters.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -238,7 +238,7 @@
     }
 
     protected String engineToString() {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append("MD: " + mdName + "\n");
         sb.append("MGF: MGF1" + mgfSpec.getDigestAlgorithm() + "\n");
         sb.append("PSource: PSpecified " +
--- a/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java	Wed Jul 05 19:42:29 2017 +0200
@@ -664,6 +664,12 @@
             try {
                 while (true) {
                     int chunkLength = stream.readInt();
+
+                    // verify the chunk length first
+                    if (chunkLength < 0 || chunkLength + 4 < 0) {
+                        throw new IIOException("Invalid chunk length " + chunkLength);
+                    }
+
                     int chunkType = stream.readInt();
 
                     if (chunkType == IDAT_TYPE) {
@@ -692,7 +698,7 @@
 
                 // verify the chunk length
                 if (chunkLength < 0) {
-                    throw new IIOException("Invalid chunk lenght " + chunkLength);
+                    throw new IIOException("Invalid chunk length " + chunkLength);
                 };
 
                 try {
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1683,6 +1683,7 @@
      * adjustments that windows/metal do.  This is because gtk doesn't
      * provide margins/insets for checkbox/radiobuttons.
      */
+    @SuppressWarnings("fallthrough")
     private static class GnomeLayoutStyle extends DefaultLayoutStyle {
         private static GnomeLayoutStyle INSTANCE = new GnomeLayoutStyle();
 
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -2409,6 +2409,7 @@
 
     // Windows LayoutStyle.  From:
     // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch14e.asp
+    @SuppressWarnings("fallthrough")
     private class WindowsLayoutStyle extends DefaultLayoutStyle {
         @Override
         public int getPreferredGap(JComponent component1,
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsScrollBarUI.java	Wed Jul 05 19:42:29 2017 +0200
@@ -51,6 +51,8 @@
 public class WindowsScrollBarUI extends BasicScrollBarUI {
     private Grid thumbGrid;
     private Grid highlightGrid;
+    private Dimension horizontalThumbSize;
+    private Dimension verticalThumbSize;
 
     /**
      * Creates a UI for a JScrollBar.
@@ -65,11 +67,32 @@
     protected void installDefaults() {
         super.installDefaults();
 
-        if (XPStyle.getXP() != null) {
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null) {
             scrollbar.setBorder(null);
+            horizontalThumbSize = getSize(scrollbar, xp, Part.SBP_THUMBBTNHORZ);
+            verticalThumbSize = getSize(scrollbar, xp, Part.SBP_THUMBBTNVERT);
+        } else {
+            horizontalThumbSize = null;
+            verticalThumbSize = null;
         }
     }
 
+    private static Dimension getSize(Component component, XPStyle xp, Part part) {
+        Skin skin = xp.getSkin(component, part);
+        return new Dimension(skin.getWidth(), skin.getHeight());
+    }
+
+    @Override
+    protected Dimension getMinimumThumbSize() {
+        if ((horizontalThumbSize == null) || (verticalThumbSize == null)) {
+            return super.getMinimumThumbSize();
+        }
+        return JScrollBar.HORIZONTAL == scrollbar.getOrientation()
+                ? horizontalThumbSize
+                : verticalThumbSize;
+    }
+
     public void uninstallUI(JComponent c) {
         super.uninstallUI(c);
         thumbGrid = highlightGrid = null;
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Wed Jul 05 19:42:29 2017 +0200
@@ -182,7 +182,6 @@
                 if (sortOrder != null) {
                      switch(sortOrder) {
                      case ASCENDING:
-                         /* falls through */
                      case DESCENDING:
                          switch (state) {
                          case NORMAL:
@@ -197,6 +196,7 @@
                          default:
                              /* do nothing */
                          }
+                         break;
                      default :
                          /* do nothing */
                      }
--- a/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/jndi/ldap/Connection.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -459,10 +459,10 @@
                             // will be woken up before readTimeout only if reply is
                             // available
                             ldr.wait(readTimeout);
-                            waited = true;
                         } else {
                             ldr.wait(15 * 1000); // 15 second timeout
                         }
+                        waited = true;
                     } else {
                         break;
                     }
@@ -474,7 +474,7 @@
         }
 
         if ((rber == null) && waited) {
-            removeRequest(ldr);
+            abandonRequest(ldr, null);
             throw new NamingException("LDAP response read timed out, timeout used:"
                             + readTimeout + "ms." );
 
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractLine.java	Wed Jul 05 19:42:29 2017 +0200
@@ -48,7 +48,7 @@
     protected Control[] controls;
     AbstractMixer mixer;
     private boolean open     = false;
-    private final Vector listeners = new Vector();
+    private final Vector<Object> listeners = new Vector<>();
 
     /**
      * Contains event dispatcher per thread group.
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMidiDevice.java	Wed Jul 05 19:42:29 2017 +0200
@@ -70,7 +70,7 @@
 
     /** List of Receivers and Transmitters that opened the device implicitely.
      */
-    private List openKeepingObjects;
+    private List<Object> openKeepingObjects;
 
     /**
      * This is the device handle returned from native code
@@ -284,6 +284,7 @@
     }
 
 
+    @SuppressWarnings("unchecked") // Cast of result of clone
     public final List<Receiver> getReceivers() {
         List<Receiver> recs;
         synchronized (traRecLock) {
@@ -313,6 +314,7 @@
     }
 
 
+    @SuppressWarnings("unchecked") // Cast of result of clone
     public final List<Transmitter> getTransmitters() {
         List<Transmitter> tras;
         synchronized (traRecLock) {
@@ -372,9 +374,9 @@
 
     /** Return the list of objects that have opened the device implicitely.
      */
-    private synchronized List getOpenKeepingObjects() {
+    private synchronized List<Object> getOpenKeepingObjects() {
         if (openKeepingObjects == null) {
-            openKeepingObjects = new ArrayList();
+            openKeepingObjects = new ArrayList<>();
         }
         return openKeepingObjects;
     }
--- a/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/AbstractMixer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -90,13 +90,13 @@
     /**
      * Source lines (ports) currently open
      */
-    private final Vector sourceLines = new Vector();
+    private final Vector<Line> sourceLines = new Vector<>();
 
 
     /**
      * Target lines currently open.
      */
-    private final Vector targetLines = new Vector();
+    private final Vector<Line> targetLines = new Vector<>();
 
 
     /**
@@ -151,7 +151,7 @@
     public final Line.Info[] getSourceLineInfo(Line.Info info) {
 
         int i;
-        Vector vec = new Vector();
+        Vector<Line.Info> vec = new Vector<>();
 
         for (i = 0; i < sourceLineInfo.length; i++) {
 
@@ -162,7 +162,7 @@
 
         Line.Info[] returnedArray = new Line.Info[vec.size()];
         for (i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vec.elementAt(i);
+            returnedArray[i] = vec.elementAt(i);
         }
 
         return returnedArray;
@@ -172,7 +172,7 @@
     public final Line.Info[] getTargetLineInfo(Line.Info info) {
 
         int i;
-        Vector vec = new Vector();
+        Vector<Line.Info> vec = new Vector<>();
 
         for (i = 0; i < targetLineInfo.length; i++) {
 
@@ -183,7 +183,7 @@
 
         Line.Info[] returnedArray = new Line.Info[vec.size()];
         for (i = 0; i < returnedArray.length; i++) {
-            returnedArray[i] = (Line.Info)vec.elementAt(i);
+            returnedArray[i] = vec.elementAt(i);
         }
 
         return returnedArray;
@@ -231,7 +231,7 @@
             localLines = new Line[sourceLines.size()];
 
             for (int i = 0; i < localLines.length; i++) {
-                localLines[i] = (Line)sourceLines.elementAt(i);
+                localLines[i] = sourceLines.elementAt(i);
             }
         }
 
@@ -248,7 +248,7 @@
             localLines = new Line[targetLines.size()];
 
             for (int i = 0; i < localLines.length; i++) {
-                localLines[i] = (Line)targetLines.elementAt(i);
+                localLines[i] = targetLines.elementAt(i);
             }
         }
 
@@ -453,7 +453,8 @@
             return;
         }
 
-        Vector localSourceLines = (Vector)sourceLines.clone();
+        @SuppressWarnings("unchecked")
+        Vector<Line> localSourceLines = (Vector<Line>)sourceLines.clone();
         for (int i = 0; i < localSourceLines.size(); i++) {
 
             // if any other open line is running, return
@@ -468,7 +469,8 @@
             }
         }
 
-        Vector localTargetLines = (Vector)targetLines.clone();
+        @SuppressWarnings("unchecked")
+        Vector<Line> localTargetLines = (Vector<Line>)targetLines.clone();
         for (int i = 0; i < localTargetLines.size(); i++) {
 
             // if any other open line is running, return
--- a/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/AlawCodec.java	Wed Jul 05 19:42:29 2017 +0200
@@ -213,7 +213,7 @@
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
 
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat format;
 
         if ( AudioFormat.Encoding.PCM_SIGNED.equals(inputFormat.getEncoding())) {
@@ -248,7 +248,7 @@
 
         AudioFormat[] formatArray = new AudioFormat[formats.size()];
         for (int i = 0; i < formatArray.length; i++) {
-            formatArray[i] = (AudioFormat)(formats.elementAt(i));
+            formatArray[i] = formats.elementAt(i);
         }
         return formatArray;
     }
--- a/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/AudioSynthesizerPropertyInfo.java	Wed Jul 05 19:42:29 2017 +0200
@@ -68,7 +68,7 @@
      * The <code>valueClass</code> field specifies class
      * used in <code>value</code> field.
      */
-    public Class valueClass = null;
+    public Class<?> valueClass = null;
     /**
      * An array of possible values if the value for the field
      * <code>AudioSynthesizerPropertyInfo.value</code> may be selected
--- a/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/DirectAudioDevice.java	Wed Jul 05 19:42:29 2017 +0200
@@ -94,7 +94,7 @@
     }
 
     private DirectDLI createDataLineInfo(boolean isSource) {
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat[] hardwareFormatArray = null;
         AudioFormat[] formatArray = null;
 
@@ -107,7 +107,7 @@
                 int formatArraySize = size;
                 hardwareFormatArray = new AudioFormat[size];
                 for (int i = 0; i < size; i++) {
-                    AudioFormat format = (AudioFormat)formats.elementAt(i);
+                    AudioFormat format = formats.elementAt(i);
                     hardwareFormatArray[i] = format;
                     int bits = format.getSampleSizeInBits();
                     boolean isSigned = format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED);
@@ -265,7 +265,7 @@
         return ((DirectAudioDeviceProvider.DirectAudioDeviceInfo) getMixerInfo()).getMaxSimulLines();
     }
 
-    private static void addFormat(Vector v, int bits, int frameSizeInBytes, int channels, float sampleRate,
+    private static void addFormat(Vector<AudioFormat> v, int bits, int frameSizeInBytes, int channels, float sampleRate,
                                   int encoding, boolean signed, boolean bigEndian) {
         AudioFormat.Encoding enc = null;
         switch (encoding) {
@@ -338,7 +338,7 @@
     private static final class DirectDLI extends DataLine.Info {
         final AudioFormat[] hardwareFormats;
 
-        private DirectDLI(Class clazz, AudioFormat[] formatArray,
+        private DirectDLI(Class<?> clazz, AudioFormat[] formatArray,
                           AudioFormat[] hardwareFormatArray,
                           int minBuffer, int maxBuffer) {
             super(clazz, formatArray, minBuffer, maxBuffer);
@@ -1457,7 +1457,7 @@
 
     } // class DirectBAOS
 
-
+    @SuppressWarnings("rawtypes")
     private static native void nGetFormats(int mixerIndex, int deviceID,
                                            boolean isSource, Vector formats);
 
--- a/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/EventDispatcher.java	Wed Jul 05 19:42:29 2017 +0200
@@ -57,7 +57,7 @@
     /**
      * List of events
      */
-    private final ArrayList eventQueue = new ArrayList();
+    private final ArrayList<EventInfo> eventQueue = new ArrayList<>();
 
 
     /**
@@ -186,7 +186,7 @@
             }
             if (eventQueue.size() > 0) {
                 // Remove the event from the queue and dispatch it to the listeners.
-                eventInfo = (EventInfo) eventQueue.remove(0);
+                eventInfo = eventQueue.remove(0);
             }
 
         } // end of synchronized
@@ -230,7 +230,7 @@
     /**
      * Send audio and MIDI events.
      */
-    void sendAudioEvents(Object event, List listeners) {
+    void sendAudioEvents(Object event, List<Object> listeners) {
         if ((listeners == null)
             || (listeners.size() == 0)) {
             // nothing to do
@@ -392,7 +392,7 @@
          * @param event the event to be dispatched
          * @param listeners listener list; will be copied
          */
-        EventInfo(Object event, List listeners) {
+        EventInfo(Object event, List<Object> listeners) {
             this.event = event;
             this.listeners = listeners.toArray();
         }
--- a/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/JDK13Services.java	Wed Jul 05 19:42:29 2017 +0200
@@ -118,7 +118,7 @@
         (the part before the hash sign), if available. If the property is
         not set or the value has no provider class name part, null is returned.
      */
-    public static synchronized String getDefaultProviderClassName(Class typeClass) {
+    public static synchronized String getDefaultProviderClassName(Class<?> typeClass) {
         String value = null;
         String defaultProviderSpec = getDefaultProvider(typeClass);
         if (defaultProviderSpec != null) {
@@ -144,7 +144,7 @@
         part after the hash sign), if available. If the property is not set
         or the value has no instance name part, null is returned.
      */
-    public static synchronized String getDefaultInstanceName(Class typeClass) {
+    public static synchronized String getDefaultInstanceName(Class<?> typeClass) {
         String value = null;
         String defaultProviderSpec = getDefaultProvider(typeClass);
         if (defaultProviderSpec != null) {
@@ -165,7 +165,7 @@
         @return The complete value of the property, if available.
         If the property is not set, null is returned.
      */
-    private static synchronized String getDefaultProvider(Class typeClass) {
+    private static synchronized String getDefaultProvider(Class<?> typeClass) {
         if (!SourceDataLine.class.equals(typeClass)
                 && !TargetDataLine.class.equals(typeClass)
                 && !Clip.class.equals(typeClass)
--- a/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiInDeviceProvider.java	Wed Jul 05 19:42:29 2017 +0200
@@ -106,9 +106,9 @@
      * the new instance will not reflect that state...
      */
     static final class MidiInDeviceInfo extends AbstractMidiDeviceProvider.Info {
-        private final Class providerClass;
+        private final Class<?> providerClass;
 
-        private MidiInDeviceInfo(int index, Class providerClass) {
+        private MidiInDeviceInfo(int index, Class<?> providerClass) {
             super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
             this.providerClass = providerClass;
         }
--- a/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiOutDeviceProvider.java	Wed Jul 05 19:42:29 2017 +0200
@@ -104,9 +104,9 @@
      * the new instance will not reflect that state...
      */
     static final class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info {
-        private final Class providerClass;
+        private final Class<?> providerClass;
 
-        private MidiOutDeviceInfo(int index, Class providerClass) {
+        private MidiOutDeviceInfo(int index, Class<?> providerClass) {
             super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index);
             this.providerClass = providerClass;
         }
--- a/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/MidiUtils.java	Wed Jul 05 19:42:29 2017 +0200
@@ -295,7 +295,7 @@
 
 
         public synchronized void refresh(Sequence seq) {
-            ArrayList list = new ArrayList();
+            ArrayList<MidiEvent> list = new ArrayList<>();
             Track[] tracks = seq.getTracks();
             if (tracks.length > 0) {
                 // tempo events only occur in track 0
@@ -313,7 +313,7 @@
             int size = list.size() + 1;
             firstTempoIsFake = true;
             if ((size > 1)
-                && (((MidiEvent) list.get(0)).getTick() == 0)) {
+                && (list.get(0).getTick() == 0)) {
                 // do not need to add an initial tempo event at the beginning
                 size--;
                 firstTempoIsFake = false;
@@ -328,7 +328,7 @@
                 e++;
             }
             for (int i = 0; i < list.size(); i++, e++) {
-                MidiEvent evt = (MidiEvent) list.get(i);
+                MidiEvent evt = list.get(i);
                 ticks[e] = evt.getTick();
                 tempos[e] = getTempoMPQ(evt.getMessage());
             }
--- a/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/PCMtoPCMCodec.java	Wed Jul 05 19:42:29 2017 +0200
@@ -91,7 +91,7 @@
         // filter out targetEncoding from the old getOutputFormats( sourceFormat ) method
 
         AudioFormat[] formats = getOutputFormats( sourceFormat );
-        Vector newFormats = new Vector();
+        Vector<AudioFormat> newFormats = new Vector<>();
         for(int i=0; i<formats.length; i++ ) {
             if( formats[i].getEncoding().equals( targetEncoding ) ) {
                 newFormats.addElement( formats[i] );
@@ -101,7 +101,7 @@
         AudioFormat[] formatArray = new AudioFormat[newFormats.size()];
 
         for (int i = 0; i < formatArray.length; i++) {
-            formatArray[i] = (AudioFormat)(newFormats.elementAt(i));
+            formatArray[i] = newFormats.elementAt(i);
         }
 
         return formatArray;
@@ -181,7 +181,7 @@
     /*  public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat format;
 
         int sampleSize = inputFormat.getSampleSizeInBits();
@@ -335,7 +335,7 @@
 
             for (int i = 0; i < formatArray.length; i++) {
 
-                formatArray[i] = (AudioFormat)(formats.elementAt(i));
+                formatArray[i] = formats.elementAt(i);
             }
         }
 
--- a/jdk/src/share/classes/com/sun/media/sound/PortMixer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/PortMixer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -253,12 +253,12 @@
             long newID = ((PortMixer) mixer).getID();
             if ((id == 0) || (newID != id) || (controls.length == 0)) {
                 id = newID;
-                Vector vector = new Vector();
+                Vector<Control> vector = new Vector<>();
                 synchronized (vector) {
                     nGetControls(id, portIndex, vector);
                     controls = new Control[vector.size()];
                     for (int i = 0; i < controls.length; i++) {
-                        controls[i] = (Control) vector.elementAt(i);
+                        controls[i] = vector.elementAt(i);
                     }
                 }
             } else {
@@ -494,6 +494,7 @@
     private static native String nGetPortName(long id, int portIndex);
 
     // fills the vector with the controls for this port
+    @SuppressWarnings("rawtypes")
     private static native void nGetControls(long id, int portIndex, Vector vector);
 
     // getters/setters for controls
--- a/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -122,7 +122,7 @@
     /**
      * List of tracks to which we're recording
      */
-    private final List recordingTracks = new ArrayList();
+    private final List<RecordingTrack> recordingTracks = new ArrayList<>();
 
 
     private long loopStart = 0;
@@ -133,13 +133,13 @@
     /**
      * Meta event listeners
      */
-    private final ArrayList metaEventListeners = new ArrayList();
+    private final ArrayList<Object> metaEventListeners = new ArrayList<>();
 
 
     /**
      * Control change listeners
      */
-    private final ArrayList controllerEventListeners = new ArrayList();
+    private final ArrayList<ControllerListElement> controllerEventListeners = new ArrayList<>();
 
 
     /** automatic connection support */
@@ -645,7 +645,7 @@
             boolean flag = false;
             for(int i=0; i < controllerEventListeners.size(); i++) {
 
-                cve = (ControllerListElement) controllerEventListeners.get(i);
+                cve = controllerEventListeners.get(i);
 
                 if (cve.listener.equals(listener)) {
                     cve.addControllers(controllers);
@@ -669,7 +669,7 @@
             ControllerListElement cve = null;
             boolean flag = false;
             for (int i=0; i < controllerEventListeners.size(); i++) {
-                cve = (ControllerListElement) controllerEventListeners.get(i);
+                cve = controllerEventListeners.get(i);
                 if (cve.listener.equals(listener)) {
                     cve.removeControllers(controllers);
                     flag = true;
@@ -940,9 +940,9 @@
         }
         ShortMessage msg = (ShortMessage) message;
         int controller = msg.getData1();
-        List sendToListeners = new ArrayList();
+        List<Object> sendToListeners = new ArrayList<>();
         for (int i = 0; i < size; i++) {
-            ControllerListElement cve = (ControllerListElement) controllerEventListeners.get(i);
+            ControllerListElement cve = controllerEventListeners.get(i);
             for(int j = 0; j < cve.controllers.length; j++) {
                 if (cve.controllers[j] == controller) {
                     sendToListeners.add(cve.listener);
@@ -1213,13 +1213,13 @@
             this.channel = channel;
         }
 
-        static RecordingTrack get(List recordingTracks, Track track) {
+        static RecordingTrack get(List<RecordingTrack> recordingTracks, Track track) {
 
             synchronized(recordingTracks) {
                 int size = recordingTracks.size();
 
                 for (int i = 0; i < size; i++) {
-                    RecordingTrack current = (RecordingTrack)recordingTracks.get(i);
+                    RecordingTrack current = recordingTracks.get(i);
                     if (current.track == track) {
                         return current;
                     }
@@ -1228,12 +1228,12 @@
             return null;
         }
 
-        static Track get(List recordingTracks, int channel) {
+        static Track get(List<RecordingTrack> recordingTracks, int channel) {
 
             synchronized(recordingTracks) {
                 int size = recordingTracks.size();
                 for (int i = 0; i < size; i++) {
-                    RecordingTrack current = (RecordingTrack)recordingTracks.get(i);
+                    RecordingTrack current = recordingTracks.get(i);
                     if ((current.channel == channel) || (current.channel == -1)) {
                         return current.track;
                     }
--- a/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/SoftSynthesizer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -949,7 +949,7 @@
             Object v = (info == null) ? null : info.get(item2.name);
             v = (v != null) ? v : storedProperties.getProperty(item2.name);
             if (v != null) {
-                Class c = (item2.valueClass);
+                Class<?> c = (item2.valueClass);
                 if (c.isInstance(v))
                     item2.value = v;
                 else if (v instanceof String) {
--- a/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/media/sound/UlawCodec.java	Wed Jul 05 19:42:29 2017 +0200
@@ -198,7 +198,7 @@
     /*  public AudioFormat[] getOutputFormats(AudioFormat inputFormat) { */
     private AudioFormat[] getOutputFormats(AudioFormat inputFormat) {
 
-        Vector formats = new Vector();
+        Vector<AudioFormat> formats = new Vector<>();
         AudioFormat format;
 
         if ((inputFormat.getSampleSizeInBits() == 16)
@@ -235,7 +235,7 @@
 
         AudioFormat[] formatArray = new AudioFormat[formats.size()];
         for (int i = 0; i < formatArray.length; i++) {
-            formatArray[i] = (AudioFormat)(formats.elementAt(i));
+            formatArray[i] = formats.elementAt(i);
         }
         return formatArray;
     }
--- a/jdk/src/share/classes/com/sun/pept/Delegate.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "Delegate.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept;
-
-import com.sun.pept.presentation.MessageStruct;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface Delegate {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a MessageStruct with ...
- * </p>
- */
-    public MessageStruct getMessageStruct();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param message ...
- * </p>
- */
-    public void send(MessageStruct message);
-
-} // end Delegate
--- a/jdk/src/share/classes/com/sun/pept/encoding/Decoder.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "Decoder.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.encoding;
-
-import com.sun.pept.ept.MessageInfo;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface Decoder {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageInfo ...
- * </p>
- */
-    public void decode(MessageInfo messageInfo);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageInfo ...
- * </p>
- */
-    public void receiveAndDecode(MessageInfo messageInfo);
-
-} // end Decoder
--- a/jdk/src/share/classes/com/sun/pept/encoding/Encoder.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "Encoder.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.encoding;
-
-import com.sun.pept.ept.MessageInfo;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Arun Gupta
- * </p>
- */
-public interface Encoder {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageInfo ...
- * </p>
- */
-    public void encodeAndSend(MessageInfo messageInfo);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a ByteBuffer with ...
- * </p><p>
- * @param messageInfo ...
- * </p>
- */
-    public ByteBuffer encode(MessageInfo messageInfo);
-
-} // end Encoder
--- a/jdk/src/share/classes/com/sun/pept/ept/Acceptor.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "Acceptor.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.ept;
-
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface Acceptor extends EPTFactory {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p>
- */
-    public void accept();
-
-} // end Acceptor
--- a/jdk/src/share/classes/com/sun/pept/ept/ContactInfo.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "ContactInfo.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.ept;
-
-import com.sun.pept.transport.Connection;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface ContactInfo extends EPTFactory {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Connection with ...
- * </p><p>
- * @param messageInfo ...
- * </p>
- */
-    public Connection getConnection(MessageInfo messageInfo);
-
-} // end ContactInfo
--- a/jdk/src/share/classes/com/sun/pept/ept/ContactInfoList.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "ContactInfoList.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.ept;
-
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface ContactInfoList {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a ContactInfoListIterator with ...
- * </p>
- */
-    public ContactInfoListIterator iterator();
-
-} // end ContactInfoList
--- a/jdk/src/share/classes/com/sun/pept/ept/ContactInfoListIterator.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "ContactInfoListIterator.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.ept;
-
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface ContactInfoListIterator {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a boolean with ...
- * </p>
- */
-    public boolean hasNext();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a ContactInfo with ...
- * </p>
- */
-    public ContactInfo next();
-
-} // end ContactInfoListIterator
--- a/jdk/src/share/classes/com/sun/pept/ept/EPTFactory.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "EPTFactory.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.ept;
-
-import com.sun.pept.encoding.Decoder;
-import com.sun.pept.encoding.Encoder;
-import com.sun.pept.presentation.TargetFinder;
-import com.sun.pept.protocol.Interceptors;
-import com.sun.pept.protocol.MessageDispatcher;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface EPTFactory {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a MessageDispatcher with ...
- * </p><p>
- * @param messageInfo ...
- * </p>
- */
-    public MessageDispatcher getMessageDispatcher(MessageInfo messageInfo);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Encoder with ...
- * </p><p>
- * @param messageInfo ...
- * </p>
- */
-    public Encoder getEncoder(MessageInfo messageInfo);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Decoder with ...
- * </p><p>
- * @param messageInfo ...
- * </p>
- */
-    public Decoder getDecoder(MessageInfo messageInfo);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Interceptors with ...
- * </p><p>
- * @param x ...
- * </p>
- */
-    public Interceptors getInterceptors(MessageInfo x);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a TargetFinder with ...
- * </p><p>
- * @param x ...
- * </p>
- */
-    public TargetFinder getTargetFinder(MessageInfo x);
-
-} // end EPTFactory
--- a/jdk/src/share/classes/com/sun/pept/ept/MessageInfo.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "MessageInfo.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.ept;
-
-import com.sun.pept.encoding.Decoder;
-import com.sun.pept.encoding.Encoder;
-import com.sun.pept.presentation.MessageStruct;
-import com.sun.pept.protocol.MessageDispatcher;
-import com.sun.pept.transport.Connection;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface MessageInfo extends MessageStruct {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a EPTFactory with ...
- * </p>
- */
-    public EPTFactory getEPTFactory();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a MessageDispatcher with ...
- * </p>
- */
-    public MessageDispatcher getMessageDispatcher();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Encoder with ...
- * </p>
- */
-    public Encoder getEncoder();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Decoder with ...
- * </p>
- */
-    public Decoder getDecoder();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Connection with ...
- * </p>
- */
-    public Connection getConnection();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param eptFactory ...
- * </p>
- */
-    public void setEPTFactory(EPTFactory eptFactory);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageDispatcher ...
- * </p>
- */
-    public void setMessageDispatcher(MessageDispatcher messageDispatcher);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param encoder ...
- * </p>
- */
-    public void setEncoder(Encoder encoder);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param decoder ...
- * </p>
- */
-    public void setDecoder(Decoder decoder);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param connection ...
- * </p>
- */
-    public void setConnection(Connection connection);
-
-} // end MessageInfo
--- a/jdk/src/share/classes/com/sun/pept/presentation/MessageStruct.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "MessageStruct.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.presentation;
-
-import java.util.*;
-import java.lang.reflect.Method;
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface MessageStruct {
-
-  ///////////////////////////////////////
-  //attributes
-
-
-/**
- * <p>
- * Represents ...
- * </p>
- */
-    public static final int NORMAL_RESPONSE = 0;
-
-/**
- * <p>
- * Represents ...
- * </p>
- */
-    public static final int CHECKED_EXCEPTION_RESPONSE = 1;
-
-/**
- * <p>
- * Represents ...
- * </p>
- */
-    public static final int UNCHECKED_EXCEPTION_RESPONSE = 2;
-
-/**
- * <p>
- * Represents ...
- * </p>
- */
-    public static final int REQUEST_RESPONSE_MEP = 1;
-
-/**
- * <p>
- * Represents ...
- * </p>
- */
-    public static final int ONE_WAY_MEP = 2;
-
-/**
- * <p>
- * Represents ...
- * </p>
- */
-    public static final int ASYNC_POLL_MEP = 3;
-
-/**
- * <p>
- * Represents ...
- * </p>
- */
-    public static final int ASYNC_CALLBACK_MEP = 4;
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @param data ...
- * </p><p>
- *
- * </p>
- */
-    public void setData(Object[] data);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Object[] with ...
- * </p>
- */
-    public Object[] getData();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param name ...
- * </p><p>
- * @param value ...
- * </p>
- */
-    public void setMetaData(Object name, Object value);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Object with ...
- * </p><p>
- * @param name ...
- * </p>
- */
-    public Object getMetaData(Object name);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageExchangePattern ...
- * </p>
- */
-    public void setMEP(int messageExchangePattern);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a int with ...
- * </p>
- */
-    public int getMEP();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a int with ...
- * </p>
- */
-    public int getResponseType();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param responseType ...
- * </p>
- */
-    public void setResponseType(int responseType);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Object with ...
- * </p>
- */
-    public Object getResponse();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param response ...
- * </p>
- */
-    public void setResponse(Object response);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param method ...
- * </p>
- */
-    public void setMethod(Method method);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Method with ...
- * </p>
- */
-    public Method getMethod();
-
-} // end MessageStruct
--- a/jdk/src/share/classes/com/sun/pept/presentation/Stub.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "Stub.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.presentation;
-
-import com.sun.pept.Delegate;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface Stub {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param delegate ...
- * </p>
- */
-    public void _setDelegate(Delegate delegate);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Delegate with ...
- * </p>
- */
-    public Delegate _getDelegate();
-
-} // end Stub
--- a/jdk/src/share/classes/com/sun/pept/presentation/TargetFinder.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "TargetFinder.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.presentation;
-
-import com.sun.pept.ept.MessageInfo;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface TargetFinder {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Tie with ...
- * </p><p>
- * @param x ...
- * </p>
- */
-    public Tie findTarget(MessageInfo x);
-
-} // end TargetFinder
--- a/jdk/src/share/classes/com/sun/pept/presentation/Tie.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/** Java interface "Tie.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.presentation;
-
-import com.sun.pept.ept.MessageInfo;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface Tie {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param servant ...
- * </p>
- */
-    public void _setServant(Object servant);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a Object with ...
- * </p>
- */
-    public Object _getServant();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageInfo ...
- * </p>
- */
-    public void _invoke(MessageInfo messageInfo);
-
-} // end Tie
--- a/jdk/src/share/classes/com/sun/pept/protocol/Interceptors.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * $Id: Interceptors.java,v 1.1 2005/05/23 22:09:18 bbissett Exp $
- */
-
-/** Java interface "Interceptors.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.protocol;
-
-import com.sun.pept.ept.MessageInfo;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface Interceptors {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageInfo ...
- * </p>
- */
-    public void interceptMessage(MessageInfo messageInfo);
-
-} // end Interceptors
--- a/jdk/src/share/classes/com/sun/pept/protocol/MessageDispatcher.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * $Id: MessageDispatcher.java,v 1.1 2005/05/23 22:09:18 bbissett Exp $
- */
-
-/** Java interface "MessageDispatcher.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.protocol;
-
-import com.sun.pept.ept.MessageInfo;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface MessageDispatcher {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageInfo ...
- * </p>
- */
-    public void send(MessageInfo messageInfo);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param messageInfo ...
- * </p>
- */
-    public void receive(MessageInfo messageInfo);
-
-} // end MessageDispatcher
--- a/jdk/src/share/classes/com/sun/pept/transport/Connection.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * $Id: Connection.java,v 1.2 2005/07/23 04:09:58 kohlert Exp $
- */
-
-/** Java interface "Connection.java" generated from Poseidon for UML.
- *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
- *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
- */
-package com.sun.pept.transport;
-
-import com.sun.pept.ept.EPTFactory;
-import java.nio.ByteBuffer;
-import java.util.*;
-
-/**
- * <p>
- *
- * @author Dr. Harold Carr
- * </p>
- */
-public interface Connection {
-
-  ///////////////////////////////////////
-  // operations
-
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p><p>
- *
- * @param byteBuffer ...
- * </p>
- */
-    public void write(ByteBuffer byteBuffer);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a EPTFactory with ...
- * </p>
- */
-    public EPTFactory getEPTFactory();
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * @return a int with ...
- * </p><p>
- * @param byteBuffer ...
- * </p>
- */
-    public int read(ByteBuffer byteBuffer);
-/**
- * <p>
- * Does ...
- * </p><p>
- *
- * </p>
- */
-    public ByteBuffer readUntilEnd();
-
-} // end Connection
--- a/jdk/src/share/classes/com/sun/tools/hat/MANIFEST.mf	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: com.sun.tools.hat.Main
--- a/jdk/src/share/classes/com/sun/tools/hat/README.txt	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
---------------
-This HAT source originally came from the http://hat.dev.java.net site.
-
-The utility has been named 'jhat' in the JDK, it is basically the same tool.
-
-Q: Where do I make changes? In the JDK or hat.dev.java.net?
-
-A: It depends on whether the change is intended for the JDK jhat version only,
-   or expected to be given back to the java.net project.
-   In general, we should putback changes to the java.net project and
-   bringover those changes to the JDK.
-
-Q: I want to build just jhat.jar instead of building entire JDK. What should I do?
-
-A: Use ant makefile (build.xml) in the current directory. This builds just the
-jhat sources and creates jhat.jar under ./build directory.
-
-To run the built jhat.jar, you can use the command:
-
-    java -jar build/jhat.jar heap_dump
--- a/jdk/src/share/classes/com/sun/tools/hat/build.xml	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<!-- 
-
- The Original Code is HAT. The Initial Developer of the
- Original Code is Bill Foote, with contributions from others
- at JavaSoft/Sun.
-
--->
-
-<!-- This is an Ant project file to build Heap Analysis Tool (HAT).
-     For more information on Ant, please see http://ant.apache.org/ 
-
-     To build jhat.jar, run ant in current directory. jhat.jar is
-     built in ./build directory.
--->
-
-<project name="Java Heap Analysis Tool" default="all" basedir=".">
-
-  <!-- Property Definitions -->
-
-  <property name="app.name" value="jhat"/>
-  <property name="src.dir"  value="."/>
-  <property name="build.dir"  value="build"/>
-  <property name="classes.dir"  value="${build.dir}/classes"/>
-  <property name="dist.jar" value="${app.name}.jar"/>
-
-  <target name="prepare">
-    <mkdir dir="${build.dir}"/>
-    <mkdir dir="${classes.dir}"/>
-  </target>
-
-  <target name="clean">
-     <delete dir="${build.dir}"/>
-  </target>
-
-  <target name="compile" depends="prepare" description="Compiles the sources">
-    <javac srcdir="${src.dir}" destdir="${classes.dir}"
-           debug="on" deprecation="on">
-    </javac>
-
-  </target>
-
-  <target name="deploy" depends="compile" description="Creates a deployment bundle">
-    <delete file="${build.dir}/${dist.jar}" />
-    <mkdir dir="${classes.dir}/com/sun/tools/hat/resources" />
-    <copy todir="${classes.dir}/com/sun/tools/hat/resources">
-      <fileset dir="${src.dir}/resources" includes="*" />
-    </copy>
-
-    <jar jarfile="${build.dir}/${dist.jar}"
-         manifest="${src.dir}/MANIFEST.mf" basedir="${classes.dir}"/>
-  </target>
-
-  <target name="all" depends="deploy" description="Builds sources and deployment jar"/>
-
-</project>
--- a/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketAttachingConnector.java	Wed Jul 05 19:42:29 2017 +0200
@@ -44,12 +44,7 @@
     public SocketAttachingConnector() {
         super(new SocketTransportService());
 
-        String defaultHostName;
-        try {
-            defaultHostName = InetAddress.getLocalHost().getHostName();
-        } catch (UnknownHostException e) {
-            defaultHostName = "";
-        }
+        String defaultHostName = "localhost";
 
         addStringArgument(
             ARG_HOST,
--- a/jdk/src/share/classes/com/sun/tools/jdi/SocketTransportService.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/com/sun/tools/jdi/SocketTransportService.java	Wed Jul 05 19:42:29 2017 +0200
@@ -198,13 +198,17 @@
         String host;
         String portStr;
         if (splitIndex < 0) {
-            host = InetAddress.getLocalHost().getHostName();
+            host = "localhost";
             portStr = address;
         } else {
             host = address.substring(0, splitIndex);
             portStr = address.substring(splitIndex+1);
         }
 
+        if (host.equals("*")) {
+            host = InetAddress.getLocalHost().getHostName();
+        }
+
         int port;
         try {
             port = Integer.decode(portStr).intValue();
@@ -215,7 +219,6 @@
 
 
         // open TCP connection to VM
-
         InetSocketAddress sa = new InetSocketAddress(host, port);
         Socket s = new Socket();
         try {
--- a/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/AWTKeyStroke.java	Wed Jul 05 19:42:29 2017 +0200
@@ -86,7 +86,8 @@
      * Must be called under locked AWTKeyStro
      */
     private static Class<AWTKeyStroke> getAWTKeyStrokeClass() {
-        Class<AWTKeyStroke> clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+        @SuppressWarnings("unchecked")
+        Class<AWTKeyStroke> clazz = (Class<AWTKeyStroke>)AppContext.getAppContext().get(AWTKeyStroke.class);
         if (clazz == null) {
             clazz = AWTKeyStroke.class;
             AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
@@ -182,6 +183,7 @@
             throw new IllegalArgumentException("subclass cannot be null");
         }
         synchronized (AWTKeyStroke.class) {
+            @SuppressWarnings("unchecked")
             Class<AWTKeyStroke> keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
             if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){
                 // Already registered
@@ -192,7 +194,7 @@
             throw new ClassCastException("subclass is not derived from AWTKeyStroke");
         }
 
-        Constructor ctor = getCtor(subclass);
+        Constructor<?> ctor = getCtor(subclass);
 
         String couldNotInstantiate = "subclass could not be instantiated";
 
@@ -227,12 +229,12 @@
        threat as accessible flag is set only for this Constructor object,
        not for Class constructor.
      */
-    private static Constructor getCtor(final Class clazz)
+    private static Constructor<?> getCtor(final Class<?> clazz)
     {
-        Constructor ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor>() {
-            public Constructor run() {
+        Constructor<?> ctor = AccessController.doPrivileged(new PrivilegedAction<Constructor<?>>() {
+            public Constructor<?> run() {
                 try {
-                    Constructor ctor = clazz.getDeclaredConstructor((Class[]) null);
+                    Constructor<?> ctor = clazz.getDeclaredConstructor((Class<?>[]) null);
                     if (ctor != null) {
                         ctor.setAccessible(true);
                     }
@@ -249,6 +251,7 @@
     private static synchronized AWTKeyStroke getCachedStroke
         (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
     {
+        @SuppressWarnings("unchecked")
         Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
         AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);
 
--- a/jdk/src/share/classes/java/awt/CardLayout.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/CardLayout.java	Wed Jul 05 19:42:29 2017 +0200
@@ -560,6 +560,7 @@
     /**
      * Reads serializable fields from stream.
      */
+    @SuppressWarnings("unchecked")
     private void readObject(ObjectInputStream s)
         throws ClassNotFoundException, IOException
     {
--- a/jdk/src/share/classes/java/awt/Component.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/Component.java	Wed Jul 05 19:42:29 2017 +0200
@@ -6184,7 +6184,7 @@
     /**
      * Parameter types of coalesceEvents(AWTEvent,AWTEVent).
      */
-    private static final Class[] coalesceEventsParams = {
+    private static final Class<?>[] coalesceEventsParams = {
         AWTEvent.class, AWTEvent.class
     };
 
--- a/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/GraphicsEnvironment.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,18 +95,18 @@
         String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null));
         try {
 //          long t0 = System.currentTimeMillis();
-            Class<GraphicsEnvironment> geCls;
+            Class<?> geCls;
             try {
                 // First we try if the bootclassloader finds the requested
                 // class. This way we can avoid to run in a privileged block.
-                geCls = (Class<GraphicsEnvironment>)Class.forName(nm);
+                geCls = Class.forName(nm);
             } catch (ClassNotFoundException ex) {
                 // If the bootclassloader fails, we try again with the
                 // application classloader.
                 ClassLoader cl = ClassLoader.getSystemClassLoader();
-                geCls = (Class<GraphicsEnvironment>)Class.forName(nm, true, cl);
+                geCls = Class.forName(nm, true, cl);
             }
-            ge = geCls.newInstance();
+            ge = (GraphicsEnvironment)geCls.newInstance();
 //          long t1 = System.currentTimeMillis();
 //          System.out.println("GE creation took " + (t1-t0)+ "ms.");
             if (isHeadless()) {
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java	Wed Jul 05 19:42:29 2017 +0200
@@ -348,6 +348,7 @@
      * Component of those Windows that has no such array of its own explicitly
      * set.
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private Set<AWTKeyStroke>[] defaultFocusTraversalKeys = new Set[4];
 
     /**
@@ -422,7 +423,7 @@
             targetSet.add(AWTKeyStroke.getAWTKeyStroke(tokens.nextToken()));
         }
         return (targetSet.isEmpty())
-            ? Collections.EMPTY_SET
+            ? Collections.emptySet()
             : Collections.unmodifiableSet(targetSet);
     }
 
@@ -436,7 +437,7 @@
                 work_set.add(defaultFocusTraversalKeyStrokes[i][j]);
             }
             defaultFocusTraversalKeys[i] = (work_set.isEmpty())
-                ? Collections.EMPTY_SET
+                ? Collections.emptySet()
                 : Collections.unmodifiableSet(work_set);
         }
         initPeer();
@@ -1750,11 +1751,12 @@
      * @see #addKeyEventDispatcher
      * @see #removeKeyEventDispatcher
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     protected synchronized java.util.List<KeyEventDispatcher>
         getKeyEventDispatchers()
     {
         return (keyEventDispatchers != null)
-            ? (java.util.List)keyEventDispatchers.clone()
+            ? (java.util.List<KeyEventDispatcher>)keyEventDispatchers.clone()
             : null;
     }
 
@@ -1841,11 +1843,12 @@
      * @see #addKeyEventPostProcessor
      * @see #removeKeyEventPostProcessor
      */
+    @SuppressWarnings("unchecked") // Cast of result of clone
     protected java.util.List<KeyEventPostProcessor>
         getKeyEventPostProcessors()
     {
         return (keyEventPostProcessors != null)
-            ? (java.util.List)keyEventPostProcessors.clone()
+            ? (java.util.List<KeyEventPostProcessor>)keyEventPostProcessors.clone()
             : null;
     }
 
@@ -1907,8 +1910,7 @@
      * javax.swing.JComponent.runInputVerifier() using reflection.
      */
     static synchronized Component getMostRecentFocusOwner(Window window) {
-        WeakReference<Component> weakValue =
-            (WeakReference)mostRecentFocusOwners.get(window);
+        WeakReference<Component> weakValue = mostRecentFocusOwners.get(window);
         return weakValue == null ? null : weakValue.get();
     }
 
--- a/jdk/src/share/classes/java/awt/Menu.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/Menu.java	Wed Jul 05 19:42:29 2017 +0200
@@ -66,7 +66,7 @@
 
         AWTAccessor.setMenuAccessor(
             new AWTAccessor.MenuAccessor() {
-                public Vector<MenuComponent> getItems(Menu menu) {
+                public Vector<MenuItem> getItems(Menu menu) {
                     return menu.items;
                 }
             });
@@ -78,7 +78,7 @@
      * @serial
      * @see #countItems()
      */
-    Vector<MenuComponent> items = new Vector<>();
+    Vector<MenuItem> items = new Vector<>();
 
     /**
      * This field indicates whether the menu has the
@@ -252,7 +252,7 @@
      * be called on the toolkit thread.
      */
     final MenuItem getItemImpl(int index) {
-        return (MenuItem)items.elementAt(index);
+        return items.elementAt(index);
     }
 
     /**
@@ -544,7 +544,7 @@
       // HeadlessException will be thrown from MenuComponent's readObject
       s.defaultReadObject();
       for(int i = 0; i < items.size(); i++) {
-        MenuItem item = (MenuItem)items.elementAt(i);
+        MenuItem item = items.elementAt(i);
         item.parent = this;
       }
     }
--- a/jdk/src/share/classes/java/awt/SystemTray.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/SystemTray.java	Wed Jul 05 19:42:29 2017 +0200
@@ -259,7 +259,9 @@
         Vector<TrayIcon> icons = null;
         synchronized (this) {
             oldArray = systemTray.getTrayIcons();
-            icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
+            @SuppressWarnings("unchecked")
+            Vector<TrayIcon> tmp = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
+            icons = tmp;
             if (icons == null) {
                 icons = new Vector<TrayIcon>(3);
                 AppContext.getAppContext().put(TrayIcon.class, icons);
@@ -304,6 +306,7 @@
         TrayIcon[] oldArray = null, newArray = null;
         synchronized (this) {
             oldArray = systemTray.getTrayIcons();
+            @SuppressWarnings("unchecked")
             Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
             // TrayIcon with no peer is not contained in the array.
             if (icons == null || !icons.remove(trayIcon)) {
@@ -335,6 +338,7 @@
      * @see TrayIcon
      */
     public TrayIcon[] getTrayIcons() {
+        @SuppressWarnings("unchecked")
         Vector<TrayIcon> icons = (Vector<TrayIcon>)AppContext.getAppContext().get(TrayIcon.class);
         if (icons != null) {
             return icons.toArray(new TrayIcon[icons.size()]);
--- a/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/datatransfer/MimeTypeParameterList.java	Wed Jul 05 19:42:29 2017 +0200
@@ -296,14 +296,14 @@
     /**
      * @return a clone of this object
      */
-
+    @SuppressWarnings("unchecked") // Cast from clone
      public Object clone() {
          MimeTypeParameterList newObj = null;
          try {
              newObj = (MimeTypeParameterList)super.clone();
          } catch (CloneNotSupportedException cannotHappen) {
          }
-         newObj.parameters = (Hashtable)parameters.clone();
+         newObj.parameters = (Hashtable<String, String>)parameters.clone();
          return newObj;
      }
 
--- a/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/datatransfer/SystemFlavorMap.java	Wed Jul 05 19:42:29 2017 +0200
@@ -38,13 +38,14 @@
 import java.net.MalformedURLException;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
-import java.util.WeakHashMap;
 
 import sun.awt.AppContext;
 import sun.awt.datatransfer.DataTransferer;
@@ -102,19 +103,11 @@
     private static final String HTML_TEXT_BASE_TYPE = "text/html";
 
     /**
-     * This constant is passed to flavorToNativeLookup() to indicate that a
-     * a native should be synthesized, stored, and returned by encoding the
-     * DataFlavor's MIME type in case if the DataFlavor is not found in
-     * 'flavorToNative' map.
-     */
-    private static final boolean SYNTHESIZE_IF_NOT_FOUND = true;
-
-    /**
      * Maps native Strings to Lists of DataFlavors (or base type Strings for
      * text DataFlavors).
      * Do not use the field directly, use getNativeToFlavor() instead.
      */
-    private final Map<String, List<DataFlavor>> nativeToFlavor = new HashMap<>();
+    private final Map<String, LinkedHashSet<DataFlavor>> nativeToFlavor = new HashMap<>();
 
     /**
      * Accessor to nativeToFlavor map.  Since we use lazy initialization we must
@@ -123,7 +116,7 @@
      *
      * @return nativeToFlavor
      */
-    private Map<String, List<DataFlavor>> getNativeToFlavor() {
+    private Map<String, LinkedHashSet<DataFlavor>> getNativeToFlavor() {
         if (!isMapInitialized) {
             initSystemFlavorMap();
         }
@@ -135,7 +128,7 @@
      * native Strings.
      * Do not use the field directly, use getFlavorToNative() instead.
      */
-    private final Map<DataFlavor, List<String>> flavorToNative = new HashMap<>();
+    private final Map<DataFlavor, LinkedHashSet<String>> flavorToNative = new HashMap<>();
 
     /**
      * Accessor to flavorToNative map.  Since we use lazy initialization we must
@@ -144,7 +137,7 @@
      *
      * @return flavorToNative
      */
-    private synchronized Map<DataFlavor, List<String>> getFlavorToNative() {
+    private synchronized Map<DataFlavor, LinkedHashSet<String>> getFlavorToNative() {
         if (!isMapInitialized) {
             initSystemFlavorMap();
         }
@@ -152,21 +145,44 @@
     }
 
     /**
+     * Maps a text DataFlavor primary mime-type to the native. Used only to store
+     * standard mappings registered in the flavormap.properties
+     * Do not use this field directly, use getTextTypeToNative() instead.
+     */
+    private Map<String, LinkedHashSet<String>> textTypeToNative = new HashMap<>();
+
+    /**
      * Shows if the object has been initialized.
      */
     private boolean isMapInitialized = false;
 
     /**
+     * An accessor to textTypeToNative map.  Since we use lazy initialization we
+     * must use this accessor instead of direct access to the field which may not
+     * be initialized yet. This method will initialize the field if needed.
+     *
+     * @return textTypeToNative
+     */
+    private synchronized Map<String, LinkedHashSet<String>> getTextTypeToNative() {
+        if (!isMapInitialized) {
+            initSystemFlavorMap();
+            // From this point the map should not be modified
+            textTypeToNative = Collections.unmodifiableMap(textTypeToNative);
+        }
+        return textTypeToNative;
+    }
+
+    /**
      * Caches the result of getNativesForFlavor(). Maps DataFlavors to
-     * SoftReferences which reference Lists of String natives.
+     * SoftReferences which reference LinkedHashSet of String natives.
      */
-    private Map<DataFlavor, SoftReference<List<String>>> getNativesForFlavorCache = new HashMap<>();
+    private final SoftCache<DataFlavor, String> nativesForFlavorCache = new SoftCache<>();
 
     /**
      * Caches the result getFlavorsForNative(). Maps String natives to
-     * SoftReferences which reference Lists of DataFlavors.
+     * SoftReferences which reference LinkedHashSet of DataFlavors.
      */
-    private Map<String, SoftReference<List<DataFlavor>>> getFlavorsForNativeCache = new HashMap<>();
+    private final SoftCache<String, DataFlavor> flavorsForNativeCache = new SoftCache<>();
 
     /**
      * Dynamic mapping generation used for text mappings should not be applied
@@ -174,7 +190,7 @@
      * explicitly specified with setFlavorsForNative() or
      * setNativesForFlavor(). This keeps all such keys.
      */
-    private Set disabledMappingGenerationKeys = new HashSet();
+    private Set<Object> disabledMappingGenerationKeys = new HashSet<>();
 
     /**
      * Returns the default FlavorMap for this thread's ClassLoader.
@@ -404,7 +420,7 @@
                         flavor = new DataFlavor(value);
                     } catch (Exception e) {
                         try {
-                            flavor = new DataFlavor(value, (String)null);
+                            flavor = new DataFlavor(value, null);
                         } catch (Exception ee) {
                             ee.printStackTrace();
                             continue;
@@ -412,11 +428,11 @@
                     }
 
                     final LinkedHashSet<DataFlavor> dfs = new LinkedHashSet<>();
-
                     dfs.add(flavor);
 
                     if ("text".equals(flavor.getPrimaryType())) {
                         dfs.addAll(convertMimeTypeToDataFlavors(value));
+                        store(flavor.mimeType.getBaseType(), key, getTextTypeToNative());
                     }
 
                     for (DataFlavor df : dfs) {
@@ -505,10 +521,10 @@
      * the appropriate Map location, but rather will be appended to a List
      * stored in that location.
      */
-    private <H, L> void store(H hashed, L listed, Map<H, List<L>> map) {
-        List<L> list = map.get(hashed);
+    private <H, L> void store(H hashed, L listed, Map<H, LinkedHashSet<L>> map) {
+        LinkedHashSet<L> list = map.get(hashed);
         if (list == null) {
-            list = new ArrayList<>(1);
+            list = new LinkedHashSet<>(1);
             map.put(hashed, list);
         }
         if (!list.contains(listed)) {
@@ -522,17 +538,16 @@
      * case, a new DataFlavor is synthesized, stored, and returned, if and
      * only if the specified native is encoded as a Java MIME type.
      */
-    private List<DataFlavor> nativeToFlavorLookup(String nat) {
-        List<DataFlavor> flavors = getNativeToFlavor().get(nat);
+    private LinkedHashSet<DataFlavor> nativeToFlavorLookup(String nat) {
+        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
 
         if (nat != null && !disabledMappingGenerationKeys.contains(nat)) {
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
-                List<DataFlavor> platformFlavors =
+                LinkedHashSet<DataFlavor> platformFlavors =
                         transferer.getPlatformMappingsForNative(nat);
                 if (!platformFlavors.isEmpty()) {
                     if (flavors != null) {
-                        platformFlavors.removeAll(new HashSet<>(flavors));
                         // Prepending the platform-specific mappings ensures
                         // that the flavors added with
                         // addFlavorForUnencodedNative() are at the end of
@@ -558,24 +573,22 @@
             }
 
             if (flavor != null) {
-                flavors = new ArrayList<>(1);
+                flavors = new LinkedHashSet<>(1);
                 getNativeToFlavor().put(nat, flavors);
                 flavors.add(flavor);
-                getFlavorsForNativeCache.remove(nat);
-                getFlavorsForNativeCache.remove(null);
+                flavorsForNativeCache.remove(nat);
 
-                List<String> natives = getFlavorToNative().get(flavor);
+                LinkedHashSet<String> natives = getFlavorToNative().get(flavor);
                 if (natives == null) {
-                    natives = new ArrayList<>(1);
+                    natives = new LinkedHashSet<>(1);
                     getFlavorToNative().put(flavor, natives);
                 }
                 natives.add(nat);
-                getNativesForFlavorCache.remove(flavor);
-                getNativesForFlavorCache.remove(null);
+                nativesForFlavorCache.remove(flavor);
             }
         }
 
-        return (flavors != null) ? flavors : new ArrayList<>(0);
+        return (flavors != null) ? flavors : new LinkedHashSet<>(0);
     }
 
     /**
@@ -586,18 +599,18 @@
      * encoding the DataFlavor's MIME type. Otherwise an empty List is returned
      * and 'flavorToNative' remains unaffected.
      */
-    private List<String> flavorToNativeLookup(final DataFlavor flav,
-                                              final boolean synthesize) {
-        List<String> natives = getFlavorToNative().get(flav);
+    private LinkedHashSet<String> flavorToNativeLookup(final DataFlavor flav,
+                                                       final boolean synthesize) {
+
+        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
 
         if (flav != null && !disabledMappingGenerationKeys.contains(flav)) {
             DataTransferer transferer = DataTransferer.getInstance();
             if (transferer != null) {
-                List<String> platformNatives =
+                LinkedHashSet<String> platformNatives =
                     transferer.getPlatformMappingsForFlavor(flav);
                 if (!platformNatives.isEmpty()) {
                     if (natives != null) {
-                        platformNatives.removeAll(new HashSet<>(natives));
                         // Prepend the platform-specific mappings to ensure
                         // that the natives added with
                         // addUnencodedNativeForFlavor() are at the end of
@@ -612,26 +625,25 @@
         if (natives == null) {
             if (synthesize) {
                 String encoded = encodeDataFlavor(flav);
-                natives = new ArrayList<>(1);
+                natives = new LinkedHashSet<>(1);
                 getFlavorToNative().put(flav, natives);
                 natives.add(encoded);
-                getNativesForFlavorCache.remove(flav);
-                getNativesForFlavorCache.remove(null);
 
-                List<DataFlavor> flavors = getNativeToFlavor().get(encoded);
+                LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(encoded);
                 if (flavors == null) {
-                    flavors = new ArrayList<>(1);
+                    flavors = new LinkedHashSet<>(1);
                     getNativeToFlavor().put(encoded, flavors);
                 }
                 flavors.add(flav);
-                getFlavorsForNativeCache.remove(encoded);
-                getFlavorsForNativeCache.remove(null);
+
+                nativesForFlavorCache.remove(flav);
+                flavorsForNativeCache.remove(encoded);
             } else {
-                natives = new ArrayList<>(0);
+                natives = new LinkedHashSet<>(0);
             }
         }
 
-        return natives;
+        return new LinkedHashSet<>(natives);
     }
 
     /**
@@ -659,103 +671,63 @@
      * @see #encodeDataFlavor
      * @since 1.4
      */
+    @Override
     public synchronized List<String> getNativesForFlavor(DataFlavor flav) {
-        List<String> retval = null;
-
-        // Check cache, even for null flav
-        SoftReference<List<String>> ref = getNativesForFlavorCache.get(flav);
-        if (ref != null) {
-            retval = ref.get();
-            if (retval != null) {
-                // Create a copy, because client code can modify the returned
-                // list.
-                return new ArrayList<>(retval);
-            }
+        LinkedHashSet<String> retval = nativesForFlavorCache.check(flav);
+        if (retval != null) {
+            return new ArrayList<>(retval);
         }
 
         if (flav == null) {
-            retval = new ArrayList<>(getNativeToFlavor().keySet());
+            retval = new LinkedHashSet<>(getNativeToFlavor().keySet());
         } else if (disabledMappingGenerationKeys.contains(flav)) {
             // In this case we shouldn't synthesize a native for this flavor,
             // since its mappings were explicitly specified.
-            retval = flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
+            retval = flavorToNativeLookup(flav, false);
         } else if (DataTransferer.isFlavorCharsetTextType(flav)) {
+            retval = new LinkedHashSet<>(0);
 
             // For text/* flavors, flavor-to-native mappings specified in
             // flavormap.properties are stored per flavor's base type.
             if ("text".equals(flav.getPrimaryType())) {
-                retval = getAllNativesForType(flav.mimeType.getBaseType());
-                if (retval != null) {
-                    // To prevent the List stored in the map from modification.
-                    retval = new ArrayList(retval);
+                LinkedHashSet<String> textTypeNatives =
+                        getTextTypeToNative().get(flav.mimeType.getBaseType());
+                if (textTypeNatives != null) {
+                    retval.addAll(textTypeNatives);
                 }
             }
 
             // Also include text/plain natives, but don't duplicate Strings
-            List<String> textPlainList = getAllNativesForType(TEXT_PLAIN_BASE_TYPE);
-
-            if (textPlainList != null && !textPlainList.isEmpty()) {
-                // To prevent the List stored in the map from modification.
-                // This also guarantees that removeAll() is supported.
-                textPlainList = new ArrayList<>(textPlainList);
-                if (retval != null && !retval.isEmpty()) {
-                    // Use HashSet to get constant-time performance for search.
-                    textPlainList.removeAll(new HashSet<>(retval));
-                    retval.addAll(textPlainList);
-                } else {
-                    retval = textPlainList;
-                }
+            LinkedHashSet<String> textTypeNatives =
+                    getTextTypeToNative().get(TEXT_PLAIN_BASE_TYPE);
+            if (textTypeNatives != null) {
+                retval.addAll(textTypeNatives);
             }
 
-            if (retval == null || retval.isEmpty()) {
-                retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
+            if (retval.isEmpty()) {
+                retval = flavorToNativeLookup(flav, true);
             } else {
                 // In this branch it is guaranteed that natives explicitly
                 // listed for flav's MIME type were added with
                 // addUnencodedNativeForFlavor(), so they have lower priority.
-                List<String> explicitList =
-                    flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
-
-                // flavorToNativeLookup() never returns null.
-                // It can return an empty List, however.
-                if (!explicitList.isEmpty()) {
-                    // To prevent the List stored in the map from modification.
-                    // This also guarantees that removeAll() is supported.
-                    explicitList = new ArrayList<>(explicitList);
-                    // Use HashSet to get constant-time performance for search.
-                    explicitList.removeAll(new HashSet<>(retval));
-                    retval.addAll(explicitList);
-                }
+                retval.addAll(flavorToNativeLookup(flav, false));
             }
         } else if (DataTransferer.isFlavorNoncharsetTextType(flav)) {
-            retval = getAllNativesForType(flav.mimeType.getBaseType());
+            retval = getTextTypeToNative().get(flav.mimeType.getBaseType());
 
             if (retval == null || retval.isEmpty()) {
-                retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
+                retval = flavorToNativeLookup(flav, true);
             } else {
                 // In this branch it is guaranteed that natives explicitly
                 // listed for flav's MIME type were added with
                 // addUnencodedNativeForFlavor(), so they have lower priority.
-                List<String> explicitList =
-                    flavorToNativeLookup(flav, !SYNTHESIZE_IF_NOT_FOUND);
-
-                // flavorToNativeLookup() never returns null.
-                // It can return an empty List, however.
-                if (!explicitList.isEmpty()) {
-                    // To prevent the List stored in the map from modification.
-                    // This also guarantees that add/removeAll() are supported.
-                    retval = new ArrayList<>(retval);
-                    explicitList = new ArrayList<>(explicitList);
-                    // Use HashSet to get constant-time performance for search.
-                    explicitList.removeAll(new HashSet<>(retval));
-                    retval.addAll(explicitList);
-                }
+                retval.addAll(flavorToNativeLookup(flav, false));
             }
         } else {
-            retval = flavorToNativeLookup(flav, SYNTHESIZE_IF_NOT_FOUND);
+            retval = flavorToNativeLookup(flav, true);
         }
 
-        getNativesForFlavorCache.put(flav, new SoftReference<>(retval));
+        nativesForFlavorCache.put(flav, retval);
         // Create a copy, because client code can modify the returned list.
         return new ArrayList<>(retval);
     }
@@ -791,62 +763,38 @@
      * @see #encodeJavaMIMEType
      * @since 1.4
      */
+    @Override
     public synchronized List<DataFlavor> getFlavorsForNative(String nat) {
-
-        // Check cache, even for null nat
-        SoftReference<List<DataFlavor>> ref = getFlavorsForNativeCache.get(nat);
-        if (ref != null) {
-            List<DataFlavor> retval = ref.get();
-            if (retval != null) {
-                return new ArrayList<>(retval);
-            }
+        LinkedHashSet<DataFlavor> returnValue = flavorsForNativeCache.check(nat);
+        if (returnValue != null) {
+            return new ArrayList<>(returnValue);
+        } else {
+            returnValue = new LinkedHashSet<>();
         }
 
-        final LinkedHashSet <DataFlavor> returnValue =
-            new LinkedHashSet<>();
-
         if (nat == null) {
-            final List<String> natives = getNativesForFlavor(null);
-
-            for (String n : natives)
-            {
-                final List<DataFlavor> flavors = getFlavorsForNative(n);
-
-                for (DataFlavor df : flavors)
-                {
-                    returnValue.add(df);
-                }
+            for (String n : getNativesForFlavor(null)) {
+                returnValue.addAll(getFlavorsForNative(n));
             }
         } else {
-
-            final List<DataFlavor> flavors = nativeToFlavorLookup(nat);
-
+            final LinkedHashSet<DataFlavor> flavors = nativeToFlavorLookup(nat);
             if (disabledMappingGenerationKeys.contains(nat)) {
-                return flavors;
+                return new ArrayList<>(flavors);
             }
 
-            final List<DataFlavor> flavorsAndBaseTypes =
-                nativeToFlavorLookup(nat);
+            final LinkedHashSet<DataFlavor> flavorsWithSynthesized =
+                    nativeToFlavorLookup(nat);
 
-            for (DataFlavor df : flavorsAndBaseTypes) {
+            for (DataFlavor df : flavorsWithSynthesized) {
                 returnValue.add(df);
                 if ("text".equals(df.getPrimaryType())) {
-                    try {
-                        returnValue.addAll(
-                                convertMimeTypeToDataFlavors(
-                                        new MimeType(df.getMimeType()
-                                        ).getBaseType()));
-                    } catch (MimeTypeParseException e) {
-                        e.printStackTrace();
-                    }
+                    String baseType = df.mimeType.getBaseType();
+                    returnValue.addAll(convertMimeTypeToDataFlavors(baseType));
                 }
             }
-
         }
-
-        final List<DataFlavor> arrayList = new ArrayList<>(returnValue);
-        getFlavorsForNativeCache.put(nat, new SoftReference<>(arrayList));
-        return new ArrayList<>(arrayList);
+        flavorsForNativeCache.put(nat, returnValue);
+        return new ArrayList<>(returnValue);
     }
 
     private static Set<DataFlavor> convertMimeTypeToDataFlavors(
@@ -862,7 +810,6 @@
         } catch (MimeTypeParseException mtpe) {
             // Cannot happen, since we checked all mappings
             // on load from flavormap.properties.
-            assert(false);
         }
 
         if (DataTransferer.doesSubtypeSupportCharset(subType, null)) {
@@ -941,10 +888,10 @@
     }
 
     private static final String [] htmlDocumntTypes =
-        new String [] {"all", "selection", "fragment"};
+            new String [] {"all", "selection", "fragment"};
 
-    private static LinkedHashSet<String> handleHtmlMimeTypes(
-        String baseType, String mimeType) {
+    private static LinkedHashSet<String> handleHtmlMimeTypes(String baseType,
+                                                             String mimeType) {
 
         LinkedHashSet<String> returnValues = new LinkedHashSet<>();
 
@@ -981,14 +928,14 @@
      * @see #getNativesForFlavor
      * @see #encodeDataFlavor
      */
-    public synchronized Map<DataFlavor,String>
-        getNativesForFlavors(DataFlavor[] flavors)
+    @Override
+    public synchronized Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors)
     {
         // Use getNativesForFlavor to generate extra natives for text flavors
         // and stringFlavor
 
         if (flavors == null) {
-            List flavor_list = getFlavorsForNative(null);
+            List<DataFlavor> flavor_list = getFlavorsForNative(null);
             flavors = new DataFlavor[flavor_list.size()];
             flavor_list.toArray(flavors);
         }
@@ -1027,15 +974,14 @@
      * @see #getFlavorsForNative
      * @see #encodeJavaMIMEType
      */
-    public synchronized Map<String,DataFlavor>
-        getFlavorsForNatives(String[] natives)
+    @Override
+    public synchronized Map<String,DataFlavor> getFlavorsForNatives(String[] natives)
     {
         // Use getFlavorsForNative to generate extra flavors for text natives
-
         if (natives == null) {
-            List native_list = getNativesForFlavor(null);
-            natives = new String[native_list.size()];
-            native_list.toArray(natives);
+            List<String> nativesList = getNativesForFlavor(null);
+            natives = new String[nativesList.size()];
+            nativesList.toArray(natives);
         }
 
         Map<String, DataFlavor> retval = new HashMap<>(natives.length, 1.0f);
@@ -1044,7 +990,6 @@
             DataFlavor flav = (flavors.isEmpty())? null : flavors.get(0);
             retval.put(aNative, flav);
         }
-
         return retval;
     }
 
@@ -1070,20 +1015,16 @@
      */
     public synchronized void addUnencodedNativeForFlavor(DataFlavor flav,
                                                          String nat) {
-        if (flav == null || nat == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flav, "Null flavor not permitted");
 
-        List<String> natives = getFlavorToNative().get(flav);
+        LinkedHashSet<String> natives = getFlavorToNative().get(flav);
         if (natives == null) {
-            natives = new ArrayList<>(1);
+            natives = new LinkedHashSet<>(1);
             getFlavorToNative().put(flav, natives);
-        } else if (natives.contains(nat)) {
-            return;
         }
         natives.add(nat);
-        getNativesForFlavorCache.remove(flav);
-        getNativesForFlavorCache.remove(null);
+        nativesForFlavorCache.remove(flav);
     }
 
     /**
@@ -1116,18 +1057,15 @@
      */
     public synchronized void setNativesForFlavor(DataFlavor flav,
                                                  String[] natives) {
-        if (flav == null || natives == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(natives, "Null natives not permitted");
+        Objects.requireNonNull(flav, "Null flavors not permitted");
 
         getFlavorToNative().remove(flav);
         for (String aNative : natives) {
             addUnencodedNativeForFlavor(flav, aNative);
         }
         disabledMappingGenerationKeys.add(flav);
-        // Clear the cache to handle the case of empty natives.
-        getNativesForFlavorCache.remove(flav);
-        getNativesForFlavorCache.remove(null);
+        nativesForFlavorCache.remove(flav);
     }
 
     /**
@@ -1150,20 +1088,16 @@
      */
     public synchronized void addFlavorForUnencodedNative(String nat,
                                                          DataFlavor flav) {
-        if (nat == null || flav == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flav, "Null flavor not permitted");
 
-        List<DataFlavor> flavors = getNativeToFlavor().get(nat);
+        LinkedHashSet<DataFlavor> flavors = getNativeToFlavor().get(nat);
         if (flavors == null) {
-            flavors = new ArrayList<>(1);
+            flavors = new LinkedHashSet<>(1);
             getNativeToFlavor().put(nat, flavors);
-        } else if (flavors.contains(flav)) {
-            return;
         }
         flavors.add(flav);
-        getFlavorsForNativeCache.remove(nat);
-        getFlavorsForNativeCache.remove(null);
+        flavorsForNativeCache.remove(nat);
     }
 
     /**
@@ -1195,18 +1129,15 @@
      */
     public synchronized void setFlavorsForNative(String nat,
                                                  DataFlavor[] flavors) {
-        if (nat == null || flavors == null) {
-            throw new NullPointerException("null arguments not permitted");
-        }
+        Objects.requireNonNull(nat, "Null native not permitted");
+        Objects.requireNonNull(flavors, "Null flavors not permitted");
 
         getNativeToFlavor().remove(nat);
         for (DataFlavor flavor : flavors) {
             addFlavorForUnencodedNative(nat, flavor);
         }
         disabledMappingGenerationKeys.add(nat);
-        // Clear the cache to handle the case of empty flavors.
-        getFlavorsForNativeCache.remove(nat);
-        getFlavorsForNativeCache.remove(null);
+        flavorsForNativeCache.remove(nat);
     }
 
     /**
@@ -1307,17 +1238,29 @@
             : null;
     }
 
-    private List<String> getAllNativesForType(String type) {
-        Set<String> retval = null;
-        for (DataFlavor dataFlavor : convertMimeTypeToDataFlavors(type)) {
-            List<String> natives = getFlavorToNative().get(dataFlavor);
-            if (natives != null && !natives.isEmpty()) {
-                if (retval == null) {
-                    retval = new LinkedHashSet<>();
-                }
-                retval.addAll(natives);
+    private static final class SoftCache<K, V> {
+        Map<K, SoftReference<LinkedHashSet<V>>> cache;
+
+        public void put(K key, LinkedHashSet<V> value) {
+            if (cache == null) {
+                cache = new HashMap<>(1);
             }
+            cache.put(key, new SoftReference<>(value));
         }
-        return retval == null ? null : new ArrayList<>(retval);
+
+        public void remove(K key) {
+            if (cache == null) return;
+            cache.remove(null);
+            cache.remove(key);
+        }
+
+        public LinkedHashSet<V> check(K key) {
+            if (cache == null) return null;
+            SoftReference<LinkedHashSet<V>> ref = cache.get(key);
+            if (ref != null) {
+                return ref.get();
+            }
+            return null;
+        }
     }
 }
--- a/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/dnd/DragGestureEvent.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -357,6 +357,7 @@
         action = newAction;
 
         // Pre-1.4 support. 'events' was previously non-transient
+        @SuppressWarnings("rawtypes")
         List newEvents;
         try {
             newEvents = (List)f.get("events", null);
--- a/jdk/src/share/classes/java/awt/geom/Area.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/geom/Area.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -97,9 +97,9 @@
  * @since 1.2
  */
 public class Area implements Shape, Cloneable {
-    private static Vector EmptyCurves = new Vector();
+    private static Vector<Curve> EmptyCurves = new Vector<>();
 
-    private Vector curves;
+    private Vector<Curve> curves;
 
     /**
      * Default constructor which creates an empty area.
@@ -127,8 +127,8 @@
         }
     }
 
-    private static Vector pathToCurves(PathIterator pi) {
-        Vector curves = new Vector();
+    private static Vector<Curve> pathToCurves(PathIterator pi) {
+        Vector<Curve> curves = new Vector<>();
         int windingRule = pi.getWindingRule();
         // coords array is big enough for holding:
         //     coordinates returned from currentSegment (6)
@@ -334,7 +334,7 @@
      * @since 1.2
      */
     public void reset() {
-        curves = new Vector();
+        curves = new Vector<>();
         invalidateBounds();
     }
 
@@ -357,9 +357,9 @@
      * @since 1.2
      */
     public boolean isPolygonal() {
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            if (((Curve) enum_.nextElement()).getOrder() > 1) {
+            if (enum_.nextElement().getOrder() > 1) {
                 return false;
             }
         }
@@ -381,8 +381,8 @@
         if (size > 3) {
             return false;
         }
-        Curve c1 = (Curve) curves.get(1);
-        Curve c2 = (Curve) curves.get(2);
+        Curve c1 = curves.get(1);
+        Curve c2 = curves.get(2);
         if (c1.getOrder() != 1 || c2.getOrder() != 1) {
             return false;
         }
@@ -411,10 +411,10 @@
         if (curves.size() < 3) {
             return true;
         }
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         enum_.nextElement(); // First Order0 "moveto"
         while (enum_.hasMoreElements()) {
-            if (((Curve) enum_.nextElement()).getOrder() == 0) {
+            if (enum_.nextElement().getOrder() == 0) {
                 return false;
             }
         }
@@ -431,11 +431,11 @@
         }
         Rectangle2D r = new Rectangle2D.Double();
         if (curves.size() > 0) {
-            Curve c = (Curve) curves.get(0);
+            Curve c = curves.get(0);
             // First point is always an order 0 curve (moveto)
             r.setRect(c.getX0(), c.getY0(), 0, 0);
             for (int i = 1; i < curves.size(); i++) {
-                ((Curve) curves.get(i)).enlarge(r);
+                curves.get(i).enlarge(r);
             }
         }
         return (cachedBounds = r);
@@ -507,7 +507,7 @@
         if (other == null) {
             return false;
         }
-        Vector c = new AreaOp.XorOp().calculate(this.curves, other.curves);
+        Vector<Curve> c = new AreaOp.XorOp().calculate(this.curves, other.curves);
         return c.isEmpty();
     }
 
@@ -555,10 +555,10 @@
         if (!getCachedBounds().contains(x, y)) {
             return false;
         }
-        Enumeration enum_ = curves.elements();
+        Enumeration<Curve> enum_ = curves.elements();
         int crossings = 0;
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             crossings += c.crossingsFor(x, y);
         }
         return ((crossings & 1) == 1);
@@ -658,16 +658,16 @@
 
 class AreaIterator implements PathIterator {
     private AffineTransform transform;
-    private Vector curves;
+    private Vector<Curve> curves;
     private int index;
     private Curve prevcurve;
     private Curve thiscurve;
 
-    public AreaIterator(Vector curves, AffineTransform at) {
+    public AreaIterator(Vector<Curve> curves, AffineTransform at) {
         this.curves = curves;
         this.transform = at;
         if (curves.size() >= 1) {
-            thiscurve = (Curve) curves.get(0);
+            thiscurve = curves.get(0);
         }
     }
 
@@ -689,7 +689,7 @@
             prevcurve = thiscurve;
             index++;
             if (index < curves.size()) {
-                thiscurve = (Curve) curves.get(index);
+                thiscurve = curves.get(index);
                 if (thiscurve.getOrder() != 0 &&
                     prevcurve.getX1() == thiscurve.getX0() &&
                     prevcurve.getY1() == thiscurve.getY0())
--- a/jdk/src/share/classes/java/awt/image/BufferedImage.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/BufferedImage.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
     ColorModel colorModel;
     WritableRaster raster;
     OffScreenImageSource osis;
-    Hashtable properties;
+    Hashtable<?, ?> properties;
 
     boolean    isAlphaPremultiplied;// If true, alpha has been premultiplied in
     // color channels
@@ -1106,7 +1106,7 @@
     public ImageProducer getSource() {
         if (osis == null) {
             if (properties == null) {
-                properties = new Hashtable();
+                properties = new Hashtable<>();
             }
             osis = new OffScreenImageSource(this, properties);
         }
--- a/jdk/src/share/classes/java/awt/image/CropImageFilter.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/CropImageFilter.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,6 +79,7 @@
      * with the filtering operation.
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         p.put("croprect", new Rectangle(cropX, cropY, cropW, cropH));
         super.setProperties(p);
--- a/jdk/src/share/classes/java/awt/image/FilteredImageSource.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/FilteredImageSource.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
         filter = imgf;
     }
 
-    private Hashtable proxies;
+    private Hashtable<ImageConsumer, ImageFilter> proxies;
 
     /**
      * Adds the specified <code>ImageConsumer</code>
@@ -94,7 +94,7 @@
      */
     public synchronized void addConsumer(ImageConsumer ic) {
         if (proxies == null) {
-            proxies = new Hashtable();
+            proxies = new Hashtable<>();
         }
         if (!proxies.containsKey(ic)) {
             ImageFilter imgf = filter.getFilterInstance(ic);
@@ -137,7 +137,7 @@
      */
     public synchronized void removeConsumer(ImageConsumer ic) {
         if (proxies != null) {
-            ImageFilter imgf = (ImageFilter) proxies.get(ic);
+            ImageFilter imgf =  proxies.get(ic);
             if (imgf != null) {
                 src.removeConsumer(imgf);
                 proxies.remove(ic);
@@ -173,9 +173,9 @@
      */
     public void startProduction(ImageConsumer ic) {
         if (proxies == null) {
-            proxies = new Hashtable();
+            proxies = new Hashtable<>();
         }
-        ImageFilter imgf = (ImageFilter) proxies.get(ic);
+        ImageFilter imgf = proxies.get(ic);
         if (imgf == null) {
             imgf = filter.getFilterInstance(ic);
             proxies.put(ic, imgf);
@@ -200,7 +200,7 @@
      */
     public void requestTopDownLeftRightResend(ImageConsumer ic) {
         if (proxies != null) {
-            ImageFilter imgf = (ImageFilter) proxies.get(ic);
+            ImageFilter imgf = proxies.get(ic);
             if (imgf != null) {
                 imgf.resendTopDownLeftRight(src);
             }
--- a/jdk/src/share/classes/java/awt/image/ImageFilter.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/ImageFilter.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,6 +104,7 @@
      * @exception NullPointerException if <code>props</code> is null
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         Object o = p.get("filters");
         if (o == null) {
--- a/jdk/src/share/classes/java/awt/image/MemoryImageSource.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/MemoryImageSource.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,8 +111,8 @@
     Object pixels;
     int pixeloffset;
     int pixelscan;
-    Hashtable properties;
-    Vector theConsumers = new Vector();
+    Hashtable<?, ?> properties;
+    Vector<ImageConsumer> theConsumers = new Vector<>();
     boolean animating;
     boolean fullbuffers;
 
@@ -197,7 +197,7 @@
     }
 
     private void initialize(int w, int h, ColorModel cm,
-                            Object pix, int off, int scan, Hashtable props) {
+                            Object pix, int off, int scan, Hashtable<?,?> props) {
         width = w;
         height = h;
         model = cm;
@@ -205,7 +205,7 @@
         pixeloffset = off;
         pixelscan = scan;
         if (props == null) {
-            props = new Hashtable();
+            props = new Hashtable<>();
         }
         properties = props;
     }
@@ -343,9 +343,9 @@
     public synchronized void setAnimated(boolean animated) {
         this.animating = animated;
         if (!animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
                 if (isConsumer(ic)) {
                     ic.imageComplete(ImageConsumer.IMAGEERROR);
@@ -376,9 +376,9 @@
         }
         this.fullbuffers = fullbuffers;
         if (animating) {
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 ic.setHints(fullbuffers
                             ? (ImageConsumer.TOPDOWNLEFTRIGHT |
                                ImageConsumer.COMPLETESCANLINES)
@@ -474,9 +474,9 @@
             if ((w <= 0 || h <= 0) && !framenotify) {
                 return;
             }
-            Enumeration enum_ = theConsumers.elements();
+            Enumeration<ImageConsumer> enum_ = theConsumers.elements();
             while (enum_.hasMoreElements()) {
-                ImageConsumer ic = (ImageConsumer) enum_.nextElement();
+                ImageConsumer ic = enum_.nextElement();
                 if (w > 0 && h > 0) {
                     sendPixels(ic, x, y, w, h);
                 }
--- a/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/ReplicateScaleFilter.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,6 +121,7 @@
      * with the filtering operation.
      */
     public void setProperties(Hashtable<?,?> props) {
+        @SuppressWarnings("unchecked")
         Hashtable<Object,Object> p = (Hashtable<Object,Object>)props.clone();
         String key = "rescale";
         String val = destWidth + "x" + destHeight;
--- a/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/renderable/ParameterBlock.java	Wed Jul 05 19:42:29 2017 +0200
@@ -153,6 +153,7 @@
      *
      * @return an Object clone of the <code>ParameterBlock</code>.
      */
+    @SuppressWarnings("unchecked") // casts from clone
     public Object clone() {
         ParameterBlock theClone;
 
@@ -164,10 +165,10 @@
         }
 
         if (sources != null) {
-            theClone.setSources((Vector)sources.clone());
+            theClone.setSources((Vector<Object>)sources.clone());
         }
         if (parameters != null) {
-            theClone.setParameters((Vector)parameters.clone());
+            theClone.setParameters((Vector<Object>)parameters.clone());
         }
         return (Object) theClone;
     }
@@ -280,7 +281,7 @@
 
     /** Clears the list of source images. */
     public void removeSources() {
-        sources = new Vector();
+        sources = new Vector<>();
     }
 
     /**
@@ -313,7 +314,7 @@
 
     /** Clears the list of parameters. */
     public void removeParameters() {
-        parameters = new Vector();
+        parameters = new Vector<>();
     }
 
     /**
@@ -696,9 +697,9 @@
      * of the parameters.
      * @return an array of <code>Class</code> objects.
      */
-    public Class [] getParamClasses() {
+    public Class<?>[] getParamClasses() {
         int numParams = getNumParameters();
-        Class [] classes = new Class[numParams];
+        Class<?>[] classes = new Class<?>[numParams];
         int i;
 
         for (i = 0; i < numParams; i++) {
--- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageOp.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,11 +87,11 @@
         return getRenderableSources();
     }
 
-    private Vector getRenderableSources() {
-        Vector sources = null;
+    private Vector<RenderableImage> getRenderableSources() {
+        Vector<RenderableImage> sources = null;
 
         if (paramBlock.getNumSources() > 0) {
-            sources = new Vector();
+            sources = new Vector<>();
             int i = 0;
             while (i < paramBlock.getNumSources()) {
                 Object o = paramBlock.getSource(i);
@@ -314,19 +314,19 @@
         // contains RenderableImage sources, they will be replaced by
         // RenderedImages.
         ParameterBlock renderedParamBlock = (ParameterBlock)paramBlock.clone();
-        Vector sources = getRenderableSources();
+        Vector<? extends Object> sources = getRenderableSources();
 
         try {
             // This assumes that if there is no renderable source, that there
             // is a rendered source in paramBlock
 
             if (sources != null) {
-                Vector renderedSources = new Vector();
+                Vector<Object> renderedSources = new Vector<>();
                 for (int i = 0; i < sources.size(); i++) {
                     rcOut = myCRIF.mapRenderContext(i, renderContext,
                                                     paramBlock, this);
                     RenderedImage rdrdImage =
-                       ((RenderableImage)sources.elementAt(i)).createRendering(rcOut);
+                        ((RenderableImage)sources.elementAt(i)).createRendering(rcOut);
                     if (rdrdImage == null) {
                         return null;
                     }
--- a/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
     RenderContext rc;
 
     /** A Vector of image consumers. */
-    Vector ics = new Vector();
+    Vector<ImageConsumer> ics = new Vector<>();
 
     /**
      * Constructs a new RenderableImageProducer from a RenderableImage
@@ -177,12 +177,12 @@
         int width = raster.getWidth();
         int height = raster.getHeight();
 
-        Enumeration icList;
+        Enumeration<ImageConsumer> icList;
         ImageConsumer ic;
         // Set up the ImageConsumers
         icList = ics.elements();
         while (icList.hasMoreElements()) {
-            ic = (ImageConsumer)icList.nextElement();
+            ic = icList.nextElement();
             ic.setDimensions(width,height);
             ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT |
                         ImageConsumer.COMPLETESCANLINES |
@@ -204,7 +204,7 @@
             // Now send the scanline to the Consumers
             icList = ics.elements();
             while (icList.hasMoreElements()) {
-                ic = (ImageConsumer)icList.nextElement();
+                ic = icList.nextElement();
                 ic.setPixels(0, j, width, 1, colorModel, pix, 0, width);
             }
         }
@@ -212,7 +212,7 @@
         // Now tell the consumers we're done.
         icList = ics.elements();
         while (icList.hasMoreElements()) {
-            ic = (ImageConsumer)icList.nextElement();
+            ic = icList.nextElement();
             ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
         }
     }
--- a/jdk/src/share/classes/java/awt/print/Book.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/print/Book.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
     /**
      * The set of pages that make up the Book.
      */
-    private Vector mPages;
+    private Vector<BookPage> mPages;
 
  /* Instance Methods */
 
@@ -55,7 +55,7 @@
      *  Creates a new, empty <code>Book</code>.
      */
     public Book() {
-        mPages = new Vector();
+        mPages = new Vector<>();
     }
 
     /**
@@ -167,7 +167,7 @@
     private BookPage getPage(int pageIndex)
         throws ArrayIndexOutOfBoundsException
     {
-        return (BookPage) mPages.elementAt(pageIndex);
+        return mPages.elementAt(pageIndex);
     }
 
     /**
--- a/jdk/src/share/classes/java/awt/print/PrinterJob.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/awt/print/PrinterJob.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,9 +74,9 @@
         if (security != null) {
             security.checkPrintJobAccess();
         }
-        return (PrinterJob) java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
-            public Object run() {
+        return java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<PrinterJob>() {
+            public PrinterJob run() {
                 String nm = System.getProperty("java.awt.printerjob", null);
                 try {
                     return (PrinterJob)Class.forName(nm).newInstance();
--- a/jdk/src/share/classes/java/beans/MethodDescriptor.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/beans/MethodDescriptor.java	Wed Jul 05 19:42:29 2017 +0200
@@ -162,6 +162,16 @@
                 : null;
     }
 
+    private static Method resolve(Method oldMethod, Method newMethod) {
+        if (oldMethod == null) {
+            return newMethod;
+        }
+        if (newMethod == null) {
+            return oldMethod;
+        }
+        return !oldMethod.isSynthetic() && newMethod.isSynthetic() ? oldMethod : newMethod;
+    }
+
     /*
      * Package-private constructor
      * Merge two method descriptors.  Where they conflict, give the
@@ -173,8 +183,7 @@
     MethodDescriptor(MethodDescriptor x, MethodDescriptor y) {
         super(x, y);
 
-        Method method = y.methodRef.get();
-        this.methodRef.set(null != method ? method : x.methodRef.get());
+        this.methodRef.set(resolve(x.methodRef.get(), y.methodRef.get()));
         params = x.params;
         if (y.params != null) {
             params = y.params;
--- a/jdk/src/share/classes/java/lang/ClassValue.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/ClassValue.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,6 @@
 
 package java.lang;
 
-import java.lang.ClassValue.ClassValueMap;
 import java.util.WeakHashMap;
 import java.lang.ref.WeakReference;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -375,10 +374,10 @@
         synchronized (CRITICAL_SECTION) {  // private object to avoid deadlocks
             // happens about once per type
             if ((map = type.classValueMap) == null)
-                type.classValueMap = map = new ClassValueMap(type);
+                type.classValueMap = map = new ClassValueMap();
         }
-            return map;
-        }
+        return map;
+    }
 
     static <T> Entry<T> makeEntry(Version<T> explicitVersion, T value) {
         // Note that explicitVersion might be different from this.version.
@@ -398,12 +397,11 @@
 
     // The following class could also be top level and non-public:
 
-    /** A backing map for all ClassValues, relative a single given type.
+    /** A backing map for all ClassValues.
      *  Gives a fully serialized "true state" for each pair (ClassValue cv, Class type).
      *  Also manages an unserialized fast-path cache.
      */
     static class ClassValueMap extends WeakHashMap<ClassValue.Identity, Entry<?>> {
-        private final Class<?> type;
         private Entry<?>[] cacheArray;
         private int cacheLoad, cacheLoadLimit;
 
@@ -413,11 +411,10 @@
          */
         private static final int INITIAL_ENTRIES = 32;
 
-        /** Build a backing map for ClassValues, relative the given type.
+        /** Build a backing map for ClassValues.
          *  Also, create an empty cache array and install it on the class.
          */
-        ClassValueMap(Class<?> type) {
-            this.type = type;
+        ClassValueMap() {
             sizeCache(INITIAL_ENTRIES);
         }
 
--- a/jdk/src/share/classes/java/lang/Process.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/Process.java	Wed Jul 05 19:42:29 2017 +0200
@@ -262,4 +262,18 @@
             return true;
         }
     }
+
+    /**
+     * Returns the native process id of the subprocess.
+     * The native process id is an identification number that the operating
+     * system assigns to the process.
+     *
+     * @return the native process id of the subprocess
+     * @throws UnsupportedOperationException if the Process implementation
+     *     does not support this operation
+     * @since 1.9
+     */
+    public long getPid() {
+        throw new UnsupportedOperationException();
+    }
 }
--- a/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,11 +26,10 @@
 package java.lang.invoke;
 
 import static jdk.internal.org.objectweb.asm.Opcodes.*;
-import static java.lang.invoke.LambdaForm.basicTypes;
-import static java.lang.invoke.MethodHandleNatives.Constants.REF_invokeStatic;
+import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 
-import java.lang.invoke.LambdaForm.Name;
 import java.lang.invoke.LambdaForm.NamedFunction;
 import java.lang.invoke.MethodHandles.Lookup;
 import java.lang.reflect.Field;
@@ -61,22 +60,22 @@
     // BMH API and internals
     //
 
-    static MethodHandle bindSingle(MethodType type, LambdaForm form, char xtype, Object x) {
+    static MethodHandle bindSingle(MethodType type, LambdaForm form, BasicType xtype, Object x) {
         // for some type signatures, there exist pre-defined concrete BMH classes
         try {
             switch (xtype) {
-            case 'L':
+            case L_TYPE:
                 if (true)  return bindSingle(type, form, x);  // Use known fast path.
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('L').constructor[0].invokeBasic(type, form, x);
-            case 'I':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('I').constructor[0].invokeBasic(type, form, ValueConversions.widenSubword(x));
-            case 'J':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('J').constructor[0].invokeBasic(type, form, (long) x);
-            case 'F':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('F').constructor[0].invokeBasic(type, form, (float) x);
-            case 'D':
-                return (BoundMethodHandle) SpeciesData.EMPTY.extendWithType('D').constructor[0].invokeBasic(type, form, (double) x);
-            default : throw new InternalError("unexpected xtype: " + xtype);
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(L_TYPE).constructor[0].invokeBasic(type, form, x);
+            case I_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(I_TYPE).constructor[0].invokeBasic(type, form, ValueConversions.widenSubword(x));
+            case J_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(J_TYPE).constructor[0].invokeBasic(type, form, (long) x);
+            case F_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(F_TYPE).constructor[0].invokeBasic(type, form, (float) x);
+            case D_TYPE:
+                return (BoundMethodHandle) SpeciesData.EMPTY.extendWith(D_TYPE).constructor[0].invokeBasic(type, form, (double) x);
+            default : throw newInternalError("unexpected xtype: " + xtype);
             }
         } catch (Throwable t) {
             throw newInternalError(t);
@@ -87,23 +86,23 @@
             return new Species_L(type, form, x);
     }
 
-    MethodHandle cloneExtend(MethodType type, LambdaForm form, char xtype, Object x) {
+    MethodHandle cloneExtend(MethodType type, LambdaForm form, BasicType xtype, Object x) {
         try {
             switch (xtype) {
-            case 'L': return cloneExtendL(type, form, x);
-            case 'I': return cloneExtendI(type, form, ValueConversions.widenSubword(x));
-            case 'J': return cloneExtendJ(type, form, (long) x);
-            case 'F': return cloneExtendF(type, form, (float) x);
-            case 'D': return cloneExtendD(type, form, (double) x);
+            case L_TYPE: return copyWithExtendL(type, form, x);
+            case I_TYPE: return copyWithExtendI(type, form, ValueConversions.widenSubword(x));
+            case J_TYPE: return copyWithExtendJ(type, form, (long) x);
+            case F_TYPE: return copyWithExtendF(type, form, (float) x);
+            case D_TYPE: return copyWithExtendD(type, form, (double) x);
             }
         } catch (Throwable t) {
             throw newInternalError(t);
         }
-        throw new InternalError("unexpected type: " + xtype);
+        throw newInternalError("unexpected type: " + xtype);
     }
 
     @Override
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
+    MethodHandle bindArgument(int pos, BasicType basicType, Object value) {
         MethodType type = type().dropParameterTypes(pos, pos+1);
         LambdaForm form = internalForm().bind(1+pos, speciesData());
         return cloneExtend(type, form, basicType, value);
@@ -111,9 +110,9 @@
 
     @Override
     MethodHandle dropArguments(MethodType srcType, int pos, int drops) {
-        LambdaForm form = internalForm().addArguments(pos, srcType.parameterList().subList(pos, pos+drops));
+        LambdaForm form = internalForm().addArguments(pos, srcType.parameterList().subList(pos, pos + drops));
         try {
-             return clone(srcType, form);
+             return copyWith(srcType, form);
          } catch (Throwable t) {
              throw newInternalError(t);
          }
@@ -122,26 +121,23 @@
     @Override
     MethodHandle permuteArguments(MethodType newType, int[] reorder) {
         try {
-             return clone(newType, form.permuteArguments(1, reorder, basicTypes(newType.parameterList())));
+             return copyWith(newType, form.permuteArguments(1, reorder, basicTypes(newType.parameterList())));
          } catch (Throwable t) {
              throw newInternalError(t);
          }
     }
 
-    static final String EXTENSION_TYPES = "LIJFD";
-    static final byte INDEX_L = 0, INDEX_I = 1, INDEX_J = 2, INDEX_F = 3, INDEX_D = 4;
-    static byte extensionIndex(char type) {
-        int i = EXTENSION_TYPES.indexOf(type);
-        if (i < 0)  throw new InternalError();
-        return (byte) i;
-    }
-
     /**
      * Return the {@link SpeciesData} instance representing this BMH species. All subclasses must provide a
      * static field containing this value, and they must accordingly implement this method.
      */
     /*non-public*/ abstract SpeciesData speciesData();
 
+    /**
+     * Return the number of fields in this BMH.  Equivalent to speciesData().fieldCount().
+     */
+    /*non-public*/ abstract int fieldCount();
+
     @Override
     final Object internalProperties() {
         return "/BMH="+internalValues();
@@ -159,38 +155,33 @@
     /*non-public*/ final Object arg(int i) {
         try {
             switch (speciesData().fieldType(i)) {
-            case 'L': return argL(i);
-            case 'I': return argI(i);
-            case 'F': return argF(i);
-            case 'D': return argD(i);
-            case 'J': return argJ(i);
+            case L_TYPE: return          speciesData().getters[i].invokeBasic(this);
+            case I_TYPE: return (int)    speciesData().getters[i].invokeBasic(this);
+            case J_TYPE: return (long)   speciesData().getters[i].invokeBasic(this);
+            case F_TYPE: return (float)  speciesData().getters[i].invokeBasic(this);
+            case D_TYPE: return (double) speciesData().getters[i].invokeBasic(this);
             }
         } catch (Throwable ex) {
             throw newInternalError(ex);
         }
-        throw new InternalError("unexpected type: " + speciesData().types+"."+i);
+        throw new InternalError("unexpected type: " + speciesData().typeChars+"."+i);
     }
-    /*non-public*/ final Object argL(int i) throws Throwable { return          speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final int    argI(int i) throws Throwable { return (int)    speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final float  argF(int i) throws Throwable { return (float)  speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final double argD(int i) throws Throwable { return (double) speciesData().getters[i].invokeBasic(this); }
-    /*non-public*/ final long   argJ(int i) throws Throwable { return (long)   speciesData().getters[i].invokeBasic(this); }
 
     //
     // cloning API
     //
 
-    /*non-public*/ abstract BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int    narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long   narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float  narg) throws Throwable;
-    /*non-public*/ abstract BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable;
+    /*non-public*/ abstract BoundMethodHandle copyWith(MethodType mt, LambdaForm lf);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int    narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long   narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float  narg);
+    /*non-public*/ abstract BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg);
 
     // The following is a grossly irregular hack:
     @Override MethodHandle reinvokerTarget() {
         try {
-            return (MethodHandle) argL(0);
+            return (MethodHandle) arg(0);
         } catch (Throwable ex) {
             throw newInternalError(ex);
         }
@@ -203,7 +194,7 @@
     private  // make it private to force users to access the enclosing class first
     static final class Species_L extends BoundMethodHandle {
         final Object argL0;
-        /*non-public*/ Species_L(MethodType mt, LambdaForm lf, Object argL0) {
+        private Species_L(MethodType mt, LambdaForm lf, Object argL0) {
             super(mt, lf);
             this.argL0 = argL0;
         }
@@ -213,140 +204,95 @@
         /*non-public*/ SpeciesData speciesData() {
             return SPECIES_DATA;
         }
-        /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class);
         @Override
-        /*non-public*/ final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable {
+        /*non-public*/ int fieldCount() {
+            return 1;
+        }
+        /*non-public*/ static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("L", Species_L.class);
+        /*non-public*/ static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0) {
+            return new Species_L(mt, lf, argL0);
+        }
+        @Override
+        /*non-public*/ final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
             return new Species_L(mt, lf, argL0);
         }
         @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, narg);
-        }
-        @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, narg);
-        }
-        @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, narg);
-        }
-        @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(L_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
         @Override
-        /*non-public*/ final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, narg);
-        }
-    }
-
-/*
-    static final class Species_LL extends BoundMethodHandle {
-        final Object argL0;
-        final Object argL1;
-        public Species_LL(MethodType mt, LambdaForm lf, Object argL0, Object argL1) {
-            super(mt, lf);
-            this.argL0 = argL0;
-            this.argL1 = argL1;
-        }
-        @Override
-        public SpeciesData speciesData() {
-            return SPECIES_DATA;
-        }
-        public static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LL", Species_LL.class);
-        @Override
-        public final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable {
-            return new Species_LL(mt, lf, argL0, argL1);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(I_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
         @Override
-        public final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, argL1, narg);
-        }
-    }
-
-    static final class Species_JL extends BoundMethodHandle {
-        final long argJ0;
-        final Object argL1;
-        public Species_JL(MethodType mt, LambdaForm lf, long argJ0, Object argL1) {
-            super(mt, lf);
-            this.argJ0 = argJ0;
-            this.argL1 = argL1;
+        /*non-public*/ final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(J_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
         @Override
-        public SpeciesData speciesData() {
-            return SPECIES_DATA;
-        }
-        public static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("JL", Species_JL.class);
-        @Override public final long   argJ0() { return argJ0; }
-        @Override public final Object argL1() { return argL1; }
-        @Override
-        public final BoundMethodHandle clone(MethodType mt, LambdaForm lf) throws Throwable {
-            return new Species_JL(mt, lf, argJ0, argL1);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(F_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
         @Override
-        public final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
-        }
-        @Override
-        public final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) throws Throwable {
-            return (BoundMethodHandle) SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argJ0, argL1, narg);
+        /*non-public*/ final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
+            try {
+                return (BoundMethodHandle) SPECIES_DATA.extendWith(D_TYPE).constructor[0].invokeBasic(mt, lf, argL0, narg);
+            } catch (Throwable ex) {
+                throw uncaughtException(ex);
+            }
         }
     }
-*/
 
     //
     // BMH species meta-data
     //
 
     /**
-     * Meta-data wrapper for concrete BMH classes.
+     * Meta-data wrapper for concrete BMH types.
+     * Each BMH type corresponds to a given sequence of basic field types (LIJFD).
+     * The fields are immutable; their values are fully specified at object construction.
+     * Each BMH type supplies an array of getter functions which may be used in lambda forms.
+     * A BMH is constructed by cloning a shorter BMH and adding one or more new field values.
+     * As a degenerate and common case, the "shorter BMH" can be missing, and contributes zero prior fields.
      */
     static class SpeciesData {
-        final String                             types;
+        final String                             typeChars;
+        final BasicType[]                        typeCodes;
         final Class<? extends BoundMethodHandle> clazz;
         // Bootstrapping requires circular relations MH -> BMH -> SpeciesData -> MH
         // Therefore, we need a non-final link in the chain.  Use array elements.
         final MethodHandle[]                     constructor;
         final MethodHandle[]                     getters;
+        final NamedFunction[]                    nominalGetters;
         final SpeciesData[]                      extensions;
 
         /*non-public*/ int fieldCount() {
-            return types.length();
+            return typeCodes.length;
         }
-        /*non-public*/ char fieldType(int i) {
-            return types.charAt(i);
+        /*non-public*/ BasicType fieldType(int i) {
+            return typeCodes[i];
+        }
+        /*non-public*/ char fieldTypeChar(int i) {
+            return typeChars.charAt(i);
         }
 
         public String toString() {
-            return "SpeciesData["+(isPlaceholder() ? "<placeholder>" : clazz.getSimpleName())+":"+types+"]";
+            return "SpeciesData["+(isPlaceholder() ? "<placeholder>" : clazz.getSimpleName())+":"+typeChars+"]";
         }
 
         /**
@@ -354,45 +300,46 @@
          * represents a MH bound to a generic invoker, which in turn forwards to the corresponding
          * getter.
          */
-        Name getterName(Name mhName, int i) {
-            MethodHandle mh = getters[i];
-            assert(mh != null) : this+"."+i;
-            return new Name(mh, mhName);
-        }
-
         NamedFunction getterFunction(int i) {
-            return new NamedFunction(getters[i]);
+            return nominalGetters[i];
         }
 
         static final SpeciesData EMPTY = new SpeciesData("", BoundMethodHandle.class);
 
         private SpeciesData(String types, Class<? extends BoundMethodHandle> clazz) {
-            this.types = types;
+            this.typeChars = types;
+            this.typeCodes = basicTypes(types);
             this.clazz = clazz;
             if (!INIT_DONE) {
-                this.constructor = new MethodHandle[1];
+                this.constructor = new MethodHandle[1];  // only one ctor
                 this.getters = new MethodHandle[types.length()];
+                this.nominalGetters = new NamedFunction[types.length()];
             } else {
                 this.constructor = Factory.makeCtors(clazz, types, null);
                 this.getters = Factory.makeGetters(clazz, types, null);
+                this.nominalGetters = Factory.makeNominalGetters(types, null, this.getters);
             }
-            this.extensions = new SpeciesData[EXTENSION_TYPES.length()];
+            this.extensions = new SpeciesData[ARG_TYPE_LIMIT];
         }
 
         private void initForBootstrap() {
             assert(!INIT_DONE);
             if (constructor[0] == null) {
+                String types = typeChars;
                 Factory.makeCtors(clazz, types, this.constructor);
                 Factory.makeGetters(clazz, types, this.getters);
+                Factory.makeNominalGetters(types, this.nominalGetters, this.getters);
             }
         }
 
-        private SpeciesData(String types) {
+        private SpeciesData(String typeChars) {
             // Placeholder only.
-            this.types = types;
+            this.typeChars = typeChars;
+            this.typeCodes = basicTypes(typeChars);
             this.clazz = null;
             this.constructor = null;
             this.getters = null;
+            this.nominalGetters = null;
             this.extensions = null;
         }
         private boolean isPlaceholder() { return clazz == null; }
@@ -401,18 +348,15 @@
         static { CACHE.put("", EMPTY); }  // make bootstrap predictable
         private static final boolean INIT_DONE;  // set after <clinit> finishes...
 
-        SpeciesData extendWithType(char type) {
-            int i = extensionIndex(type);
-            SpeciesData d = extensions[i];
-            if (d != null)  return d;
-            extensions[i] = d = get(types+type);
-            return d;
+        SpeciesData extendWith(byte type) {
+            return extendWith(BasicType.basicType(type));
         }
 
-        SpeciesData extendWithIndex(byte index) {
-            SpeciesData d = extensions[index];
+        SpeciesData extendWith(BasicType type) {
+            int ord = type.ordinal();
+            SpeciesData d = extensions[ord];
             if (d != null)  return d;
-            extensions[index] = d = get(types+EXTENSION_TYPES.charAt(index));
+            extensions[ord] = d = get(typeChars+type.basicTypeChar());
             return d;
         }
 
@@ -456,8 +400,6 @@
         static {
             // pre-fill the BMH speciesdata cache with BMH's inner classes
             final Class<BoundMethodHandle> rootCls = BoundMethodHandle.class;
-            SpeciesData d0 = BoundMethodHandle.SPECIES_DATA;  // trigger class init
-            assert(d0 == null || d0 == lookupCache("")) : d0;
             try {
                 for (Class<?> c : rootCls.getDeclaredClasses()) {
                     if (rootCls.isAssignableFrom(c)) {
@@ -465,7 +407,7 @@
                         SpeciesData d = Factory.speciesDataFromConcreteBMHClass(cbmh);
                         assert(d != null) : cbmh.getName();
                         assert(d.clazz == cbmh);
-                        assert(d == lookupCache(d.types));
+                        assert(d == lookupCache(d.typeChars));
                     }
                 }
             } catch (Throwable e) {
@@ -516,11 +458,10 @@
         static final String BMHSPECIES_DATA_GFC_SIG = "(" + JLS_SIG + JLC_SIG + ")" + SPECIES_DATA_SIG;
         static final String MYSPECIES_DATA_SIG = "()" + SPECIES_DATA_SIG;
         static final String VOID_SIG   = "()V";
+        static final String INT_SIG    = "()I";
 
         static final String SIG_INCIPIT = "(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;";
 
-        static final Class<?>[] TYPES = new Class<?>[] { Object.class, int.class, long.class, float.class, double.class };
-
         static final String[] E_THROWABLE = new String[] { "java/lang/Throwable" };
 
         /**
@@ -551,31 +492,35 @@
          *     final Object argL0;
          *     final Object argL1;
          *     final int argI2;
-         *     Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
+         *     private Species_LLI(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
          *         super(mt, lf);
          *         this.argL0 = argL0;
          *         this.argL1 = argL1;
          *         this.argI2 = argI2;
          *     }
          *     final SpeciesData speciesData() { return SPECIES_DATA; }
+         *     final int fieldCount() { return 3; }
          *     static final SpeciesData SPECIES_DATA = SpeciesData.getForClass("LLI", Species_LLI.class);
-         *     final BoundMethodHandle clone(MethodType mt, LambdaForm lf) {
-         *         return SPECIES_DATA.constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2);
+         *     static BoundMethodHandle make(MethodType mt, LambdaForm lf, Object argL0, Object argL1, int argI2) {
+         *         return new Species_LLI(mt, lf, argL0, argL1, argI2);
          *     }
-         *     final BoundMethodHandle cloneExtendL(MethodType mt, LambdaForm lf, Object narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_L).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWith(MethodType mt, LambdaForm lf) {
+         *         return new Species_LLI(mt, lf, argL0, argL1, argI2);
+         *     }
+         *     final BoundMethodHandle copyWithExtendL(MethodType mt, LambdaForm lf, Object narg) {
+         *         return SPECIES_DATA.extendWith(L_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
-         *     final BoundMethodHandle cloneExtendI(MethodType mt, LambdaForm lf, int narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_I).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWithExtendI(MethodType mt, LambdaForm lf, int narg) {
+         *         return SPECIES_DATA.extendWith(I_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
-         *     final BoundMethodHandle cloneExtendJ(MethodType mt, LambdaForm lf, long narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_J).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWithExtendJ(MethodType mt, LambdaForm lf, long narg) {
+         *         return SPECIES_DATA.extendWith(J_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
-         *     final BoundMethodHandle cloneExtendF(MethodType mt, LambdaForm lf, float narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_F).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     final BoundMethodHandle copyWithExtendF(MethodType mt, LambdaForm lf, float narg) {
+         *         return SPECIES_DATA.extendWith(F_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
-         *     final BoundMethodHandle cloneExtendD(MethodType mt, LambdaForm lf, double narg) {
-         *         return SPECIES_DATA.extendWithIndex(INDEX_D).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
+         *     public final BoundMethodHandle copyWithExtendD(MethodType mt, LambdaForm lf, double narg) {
+         *         return SPECIES_DATA.extendWith(D_TYPE).constructor[0].invokeBasic(mt, lf, argL0, argL1, argI2, narg);
          *     }
          * }
          * </pre>
@@ -586,8 +531,9 @@
         static Class<? extends BoundMethodHandle> generateConcreteBMHClass(String types) {
             final ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
 
-            final String className  = SPECIES_PREFIX_PATH + types;
-            final String sourceFile = SPECIES_PREFIX_NAME + types;
+            String shortTypes = LambdaForm.shortenSignature(types);
+            final String className  = SPECIES_PREFIX_PATH + shortTypes;
+            final String sourceFile = SPECIES_PREFIX_NAME + shortTypes;
             final int NOT_ACC_PUBLIC = 0;  // not ACC_PUBLIC
             cw.visit(V1_6, NOT_ACC_PUBLIC + ACC_FINAL + ACC_SUPER, className, null, BMH, null);
             cw.visitSource(sourceFile, null);
@@ -606,11 +552,11 @@
             MethodVisitor mv;
 
             // emit constructor
-            mv = cw.visitMethod(NOT_ACC_PUBLIC, "<init>", makeSignature(types, true), null, null);
+            mv = cw.visitMethod(ACC_PRIVATE, "<init>", makeSignature(types, true), null, null);
             mv.visitCode();
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitVarInsn(ALOAD, 1);
-            mv.visitVarInsn(ALOAD, 2);
+            mv.visitVarInsn(ALOAD, 0); // this
+            mv.visitVarInsn(ALOAD, 1); // type
+            mv.visitVarInsn(ALOAD, 2); // form
 
             mv.visitMethodInsn(INVOKESPECIAL, BMH, "<init>", makeSignature("", true), false);
 
@@ -647,39 +593,73 @@
             mv.visitMaxs(0, 0);
             mv.visitEnd();
 
-            // emit clone()
-            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "clone", makeSignature("", false), null, E_THROWABLE);
+            // emit implementation of fieldCount()
+            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "fieldCount", INT_SIG, null, null);
+            mv.visitCode();
+            int fc = types.length();
+            if (fc <= (ICONST_5 - ICONST_0)) {
+                mv.visitInsn(ICONST_0 + fc);
+            } else {
+                mv.visitIntInsn(SIPUSH, fc);
+            }
+            mv.visitInsn(IRETURN);
+            mv.visitMaxs(0, 0);
+            mv.visitEnd();
+            // emit make()  ...factory method wrapping constructor
+            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_STATIC, "make", makeSignature(types, false), null, null);
             mv.visitCode();
-            // return speciesData().constructor[0].invokeBasic(mt, lf, argL0, ...)
-            // obtain constructor
-            mv.visitVarInsn(ALOAD, 0);
-            mv.visitFieldInsn(GETSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG);
-            mv.visitFieldInsn(GETFIELD, SPECIES_DATA, "constructor", "[" + MH_SIG);
-            mv.visitInsn(ICONST_0);
-            mv.visitInsn(AALOAD);
+            // make instance
+            mv.visitTypeInsn(NEW, className);
+            mv.visitInsn(DUP);
+            // load mt, lf
+            mv.visitVarInsn(ALOAD, 0);  // type
+            mv.visitVarInsn(ALOAD, 1);  // form
+            // load factory method arguments
+            for (int i = 0, j = 0; i < types.length(); ++i, ++j) {
+                // i counts the arguments, j counts corresponding argument slots
+                char t = types.charAt(i);
+                mv.visitVarInsn(typeLoadOp(t), j + 2); // parameters start at 3
+                if (t == 'J' || t == 'D') {
+                    ++j; // adjust argument register access
+                }
+            }
+
+            // finally, invoke the constructor and return
+            mv.visitMethodInsn(INVOKESPECIAL, className, "<init>", makeSignature(types, true), false);
+            mv.visitInsn(ARETURN);
+            mv.visitMaxs(0, 0);
+            mv.visitEnd();
+
+            // emit copyWith()
+            mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "copyWith", makeSignature("", false), null, null);
+            mv.visitCode();
+            // make instance
+            mv.visitTypeInsn(NEW, className);
+            mv.visitInsn(DUP);
             // load mt, lf
             mv.visitVarInsn(ALOAD, 1);
             mv.visitVarInsn(ALOAD, 2);
             // put fields on the stack
             emitPushFields(types, className, mv);
             // finally, invoke the constructor and return
-            mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types, false), false);
+            mv.visitMethodInsn(INVOKESPECIAL, className, "<init>", makeSignature(types, true), false);
             mv.visitInsn(ARETURN);
             mv.visitMaxs(0, 0);
             mv.visitEnd();
 
-            // for each type, emit cloneExtendT()
-            for (Class<?> c : TYPES) {
-                char t = Wrapper.basicTypeChar(c);
-                mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "cloneExtend" + t, makeSignature(String.valueOf(t), false), null, E_THROWABLE);
+            // for each type, emit copyWithExtendT()
+            for (BasicType type : BasicType.ARG_TYPES) {
+                int ord = type.ordinal();
+                char btChar = type.basicTypeChar();
+                mv = cw.visitMethod(NOT_ACC_PUBLIC + ACC_FINAL, "copyWithExtend" + btChar, makeSignature(String.valueOf(btChar), false), null, E_THROWABLE);
                 mv.visitCode();
-                // return SPECIES_DATA.extendWithIndex(extensionIndex(t)).constructor[0].invokeBasic(mt, lf, argL0, ..., narg)
+                // return SPECIES_DATA.extendWith(t).constructor[0].invokeBasic(mt, lf, argL0, ..., narg)
                 // obtain constructor
                 mv.visitFieldInsn(GETSTATIC, className, "SPECIES_DATA", SPECIES_DATA_SIG);
-                int iconstInsn = ICONST_0 + extensionIndex(t);
+                int iconstInsn = ICONST_0 + ord;
                 assert(iconstInsn <= ICONST_5);
                 mv.visitInsn(iconstInsn);
-                mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWithIndex", BMHSPECIES_DATA_EWI_SIG, false);
+                mv.visitMethodInsn(INVOKEVIRTUAL, SPECIES_DATA, "extendWith", BMHSPECIES_DATA_EWI_SIG, false);
                 mv.visitFieldInsn(GETFIELD, SPECIES_DATA, "constructor", "[" + MH_SIG);
                 mv.visitInsn(ICONST_0);
                 mv.visitInsn(AALOAD);
@@ -689,9 +669,9 @@
                 // put fields on the stack
                 emitPushFields(types, className, mv);
                 // put narg on stack
-                mv.visitVarInsn(typeLoadOp(t), 3);
+                mv.visitVarInsn(typeLoadOp(btChar), 3);
                 // finally, invoke the constructor and return
-                mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + t, false), false);
+                mv.visitMethodInsn(INVOKEVIRTUAL, MH, "invokeBasic", makeSignature(types + btChar, false), false);
                 mv.visitInsn(ARETURN);
                 mv.visitMaxs(0, 0);
                 mv.visitEnd();
@@ -730,7 +710,7 @@
             case 'J': return LLOAD;
             case 'F': return FLOAD;
             case 'D': return DLOAD;
-            default : throw new InternalError("unrecognized type " + t);
+            default : throw newInternalError("unrecognized type " + t);
             }
         }
 
@@ -771,10 +751,19 @@
 
         static MethodHandle[] makeCtors(Class<? extends BoundMethodHandle> cbmh, String types, MethodHandle mhs[]) {
             if (mhs == null)  mhs = new MethodHandle[1];
+            if (types.equals(""))  return mhs;  // hack for empty BMH species
             mhs[0] = makeCbmhCtor(cbmh, types);
             return mhs;
         }
 
+        static NamedFunction[] makeNominalGetters(String types, NamedFunction[] nfs, MethodHandle[] getters) {
+            if (nfs == null)  nfs = new NamedFunction[types.length()];
+            for (int i = 0; i < nfs.length; ++i) {
+                nfs[i] = new NamedFunction(getters[i]);
+            }
+            return nfs;
+        }
+
         //
         // Auxiliary methods.
         //
@@ -808,52 +797,11 @@
 
         static MethodHandle makeCbmhCtor(Class<? extends BoundMethodHandle> cbmh, String types) {
             try {
-                return linkConstructor(LOOKUP.findConstructor(cbmh, MethodType.fromMethodDescriptorString(makeSignature(types, true), null)));
+                return LOOKUP.findStatic(cbmh, "make", MethodType.fromMethodDescriptorString(makeSignature(types, false), null));
             } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | TypeNotPresentException e) {
                 throw newInternalError(e);
             }
         }
-
-        /**
-         * Wrap a constructor call in a {@link LambdaForm}.
-         *
-         * If constructors ({@code <init>} methods) are called in LFs, problems might arise if the LFs
-         * are turned into bytecode, because the call to the allocator is routed through an MH, and the
-         * verifier cannot find a {@code NEW} instruction preceding the {@code INVOKESPECIAL} to
-         * {@code <init>}. To avoid this, we add an indirection by invoking {@code <init>} through
-         * {@link MethodHandle#linkToSpecial}.
-         *
-         * The last {@link LambdaForm.Name Name} in the argument's form is expected to be the {@code void}
-         * result of the {@code <init>} invocation. This entry is replaced.
-         */
-        private static MethodHandle linkConstructor(MethodHandle cmh) {
-            final LambdaForm lf = cmh.form;
-            final int initNameIndex = lf.names.length - 1;
-            final Name initName = lf.names[initNameIndex];
-            final MemberName ctorMN = initName.function.member;
-            final MethodType ctorMT = ctorMN.getInvocationType();
-
-            // obtain function member (call target)
-            // linker method type replaces initial parameter (BMH species) with BMH to avoid naming a species (anonymous class!)
-            final MethodType linkerMT = ctorMT.changeParameterType(0, BoundMethodHandle.class).appendParameterTypes(MemberName.class);
-            MemberName linkerMN = new MemberName(MethodHandle.class, "linkToSpecial", linkerMT, REF_invokeStatic);
-            try {
-                linkerMN = MemberName.getFactory().resolveOrFail(REF_invokeStatic, linkerMN, null, NoSuchMethodException.class);
-                assert(linkerMN.isStatic());
-            } catch (ReflectiveOperationException ex) {
-                throw newInternalError(ex);
-            }
-            // extend arguments array
-            Object[] newArgs = Arrays.copyOf(initName.arguments, initName.arguments.length + 1);
-            newArgs[newArgs.length - 1] = ctorMN;
-            // replace function
-            final NamedFunction nf = new NamedFunction(linkerMN);
-            final Name linkedCtor = new Name(nf, newArgs);
-            linkedCtor.initIndex(initNameIndex);
-            lf.names[initNameIndex] = linkedCtor;
-            return cmh;
-        }
-
     }
 
     private static final Lookup LOOKUP = Lookup.IMPL_LOOKUP;
--- a/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java	Wed Jul 05 19:42:29 2017 +0200
@@ -31,6 +31,7 @@
 import sun.invoke.util.VerifyAccess;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import static java.lang.invoke.LambdaForm.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodTypeForm.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import java.lang.ref.WeakReference;
@@ -125,11 +126,6 @@
     }
 
     @Override
-    MethodHandle copyWith(MethodType mt, LambdaForm lf) {
-        return new DirectMethodHandle(mt, lf, member);
-    }
-
-    @Override
     String internalProperties() {
         return "/DMH="+member.toString();
     }
@@ -146,9 +142,9 @@
     }
 
     @Override
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
+    MethodHandle bindArgument(int pos, BasicType basicType, Object value) {
         // If the member needs dispatching, do so.
-        if (pos == 0 && basicType == 'L') {
+        if (pos == 0 && basicType == L_TYPE) {
             DirectMethodHandle concrete = maybeRebind(value);
             if (concrete != null)
                 return concrete.bindReceiver(value);
@@ -274,7 +270,7 @@
             result = NEW_OBJ;
         }
         names[LINKER_CALL] = new Name(linker, outArgs);
-        lambdaName += "_" + LambdaForm.basicTypeSignature(mtype);
+        lambdaName += "_" + shortenSignature(basicTypeSignature(mtype));
         LambdaForm lform = new LambdaForm(lambdaName, ARG_LIMIT, names, result);
         // This is a tricky bit of code.  Don't send it through the LF interpreter.
         lform.compileToBytecode();
--- a/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,7 @@
 package java.lang.invoke;
 
 import sun.invoke.util.VerifyAccess;
-import java.lang.invoke.LambdaForm.Name;
+import static java.lang.invoke.LambdaForm.*;
 
 import sun.invoke.util.Wrapper;
 
@@ -38,6 +38,7 @@
 import java.lang.reflect.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import sun.invoke.util.VerifyType;
 
 /**
@@ -115,7 +116,7 @@
         Name[] names = form.names;
         for (int i = 0, index = 0; i < localsMap.length; i++) {
             localsMap[i] = index;
-            index += Wrapper.forBasicType(names[i].type).stackSlots();
+            index += names[i].type.basicTypeSlots();
         }
     }
 
@@ -358,47 +359,52 @@
     /*
      * NOTE: These load/store methods use the localsMap to find the correct index!
      */
-    private void emitLoadInsn(char type, int index) {
-        int opcode;
+    private void emitLoadInsn(BasicType type, int index) {
+        int opcode = loadInsnOpcode(type);
+        mv.visitVarInsn(opcode, localsMap[index]);
+    }
+
+    private int loadInsnOpcode(BasicType type) throws InternalError {
         switch (type) {
-        case 'I':  opcode = Opcodes.ILOAD;  break;
-        case 'J':  opcode = Opcodes.LLOAD;  break;
-        case 'F':  opcode = Opcodes.FLOAD;  break;
-        case 'D':  opcode = Opcodes.DLOAD;  break;
-        case 'L':  opcode = Opcodes.ALOAD;  break;
-        default:
-            throw new InternalError("unknown type: " + type);
+            case I_TYPE: return Opcodes.ILOAD;
+            case J_TYPE: return Opcodes.LLOAD;
+            case F_TYPE: return Opcodes.FLOAD;
+            case D_TYPE: return Opcodes.DLOAD;
+            case L_TYPE: return Opcodes.ALOAD;
+            default:
+                throw new InternalError("unknown type: " + type);
         }
-        mv.visitVarInsn(opcode, localsMap[index]);
     }
     private void emitAloadInsn(int index) {
-        emitLoadInsn('L', index);
+        emitLoadInsn(L_TYPE, index);
+    }
+
+    private void emitStoreInsn(BasicType type, int index) {
+        int opcode = storeInsnOpcode(type);
+        mv.visitVarInsn(opcode, localsMap[index]);
     }
 
-    private void emitStoreInsn(char type, int index) {
-        int opcode;
+    private int storeInsnOpcode(BasicType type) throws InternalError {
         switch (type) {
-        case 'I':  opcode = Opcodes.ISTORE;  break;
-        case 'J':  opcode = Opcodes.LSTORE;  break;
-        case 'F':  opcode = Opcodes.FSTORE;  break;
-        case 'D':  opcode = Opcodes.DSTORE;  break;
-        case 'L':  opcode = Opcodes.ASTORE;  break;
-        default:
-            throw new InternalError("unknown type: " + type);
+            case I_TYPE: return Opcodes.ISTORE;
+            case J_TYPE: return Opcodes.LSTORE;
+            case F_TYPE: return Opcodes.FSTORE;
+            case D_TYPE: return Opcodes.DSTORE;
+            case L_TYPE: return Opcodes.ASTORE;
+            default:
+                throw new InternalError("unknown type: " + type);
         }
-        mv.visitVarInsn(opcode, localsMap[index]);
     }
     private void emitAstoreInsn(int index) {
-        emitStoreInsn('L', index);
+        emitStoreInsn(L_TYPE, index);
     }
 
     /**
      * Emit a boxing call.
      *
-     * @param type primitive type class to box.
+     * @param wrapper primitive type class to box.
      */
-    private void emitBoxing(Class<?> type) {
-        Wrapper wrapper = Wrapper.forPrimitiveType(type);
+    private void emitBoxing(Wrapper wrapper) {
         String owner = "java/lang/" + wrapper.wrapperType().getSimpleName();
         String name  = "valueOf";
         String desc  = "(" + wrapper.basicTypeChar() + ")L" + owner + ";";
@@ -408,10 +414,9 @@
     /**
      * Emit an unboxing call (plus preceding checkcast).
      *
-     * @param type wrapper type class to unbox.
+     * @param wrapper wrapper type class to unbox.
      */
-    private void emitUnboxing(Class<?> type) {
-        Wrapper wrapper = Wrapper.forWrapperType(type);
+    private void emitUnboxing(Wrapper wrapper) {
         String owner = "java/lang/" + wrapper.wrapperType().getSimpleName();
         String name  = wrapper.primitiveSimpleName() + "Value";
         String desc  = "()" + wrapper.basicTypeChar();
@@ -425,9 +430,12 @@
      * @param ptype type of value present on stack
      * @param pclass type of value required on stack
      */
-    private void emitImplicitConversion(char ptype, Class<?> pclass) {
+    private void emitImplicitConversion(BasicType ptype, Class<?> pclass) {
+        assert(basicType(pclass) == ptype);  // boxing/unboxing handled by caller
+        if (pclass == ptype.basicTypeClass() && ptype != L_TYPE)
+            return;   // nothing to do
         switch (ptype) {
-        case 'L':
+        case L_TYPE:
             if (VerifyType.isNullConversion(Object.class, pclass))
                 return;
             if (isStaticallyNameable(pclass)) {
@@ -441,18 +449,9 @@
                     mv.visitTypeInsn(Opcodes.CHECKCAST, OBJARY);
             }
             return;
-        case 'I':
+        case I_TYPE:
             if (!VerifyType.isNullConversion(int.class, pclass))
-                emitPrimCast(ptype, Wrapper.basicTypeChar(pclass));
-            return;
-        case 'J':
-            assert(pclass == long.class);
-            return;
-        case 'F':
-            assert(pclass == float.class);
-            return;
-        case 'D':
-            assert(pclass == double.class);
+                emitPrimCast(ptype.basicTypeWrapper(), Wrapper.forPrimitiveType(pclass));
             return;
         }
         throw new InternalError("bad implicit conversion: tc="+ptype+": "+pclass);
@@ -461,15 +460,15 @@
     /**
      * Emits an actual return instruction conforming to the given return type.
      */
-    private void emitReturnInsn(Class<?> type) {
+    private void emitReturnInsn(BasicType type) {
         int opcode;
-        switch (Wrapper.basicTypeChar(type)) {
-        case 'I':  opcode = Opcodes.IRETURN;  break;
-        case 'J':  opcode = Opcodes.LRETURN;  break;
-        case 'F':  opcode = Opcodes.FRETURN;  break;
-        case 'D':  opcode = Opcodes.DRETURN;  break;
-        case 'L':  opcode = Opcodes.ARETURN;  break;
-        case 'V':  opcode = Opcodes.RETURN;   break;
+        switch (type) {
+        case I_TYPE:  opcode = Opcodes.IRETURN;  break;
+        case J_TYPE:  opcode = Opcodes.LRETURN;  break;
+        case F_TYPE:  opcode = Opcodes.FRETURN;  break;
+        case D_TYPE:  opcode = Opcodes.DRETURN;  break;
+        case L_TYPE:  opcode = Opcodes.ARETURN;  break;
+        case V_TYPE:  opcode = Opcodes.RETURN;   break;
         default:
             throw new InternalError("unknown return type: " + type);
         }
@@ -531,7 +530,7 @@
             // avoid store/load/return and just return)
             if (i == lambdaForm.names.length - 1 && i == lambdaForm.result) {
                 // return value - do nothing
-            } else if (name.type != 'V') {
+            } else if (name.type != V_TYPE) {
                 // non-void: actually assign
                 emitStoreInsn(name.type, name.index());
             }
@@ -865,20 +864,24 @@
 
     private void emitPushArgument(Name name, int paramIndex) {
         Object arg = name.arguments[paramIndex];
-        char ptype = name.function.parameterType(paramIndex);
-        MethodType mtype = name.function.methodType();
+        Class<?> ptype = name.function.methodType().parameterType(paramIndex);
+        emitPushArgument(ptype, arg);
+    }
+
+    private void emitPushArgument(Class<?> ptype, Object arg) {
+        BasicType bptype = basicType(ptype);
         if (arg instanceof Name) {
             Name n = (Name) arg;
             emitLoadInsn(n.type, n.index());
-            emitImplicitConversion(n.type, mtype.parameterType(paramIndex));
-        } else if ((arg == null || arg instanceof String) && ptype == 'L') {
+            emitImplicitConversion(n.type, ptype);
+        } else if ((arg == null || arg instanceof String) && bptype == L_TYPE) {
             emitConst(arg);
         } else {
-            if (Wrapper.isWrapperType(arg.getClass()) && ptype != 'L') {
+            if (Wrapper.isWrapperType(arg.getClass()) && bptype != L_TYPE) {
                 emitConst(arg);
             } else {
                 mv.visitLdcInsn(constantPlaceholder(arg));
-                emitImplicitConversion('L', mtype.parameterType(paramIndex));
+                emitImplicitConversion(L_TYPE, ptype);
             }
         }
     }
@@ -888,52 +891,33 @@
      */
     private void emitReturn() {
         // return statement
-        if (lambdaForm.result == -1) {
+        Class<?> rclass = invokerType.returnType();
+        BasicType rtype = lambdaForm.returnType();
+        assert(rtype == basicType(rclass));  // must agree
+        if (rtype == V_TYPE) {
             // void
             mv.visitInsn(Opcodes.RETURN);
+            // it doesn't matter what rclass is; the JVM will discard any value
         } else {
             LambdaForm.Name rn = lambdaForm.names[lambdaForm.result];
-            char rtype = Wrapper.basicTypeChar(invokerType.returnType());
 
             // put return value on the stack if it is not already there
-            if (lambdaForm.result != lambdaForm.names.length - 1) {
+            if (lambdaForm.result != lambdaForm.names.length - 1 ||
+                    lambdaForm.result < lambdaForm.arity) {
                 emitLoadInsn(rn.type, lambdaForm.result);
             }
 
-            // potentially generate cast
-            // rtype is the return type of the invoker - generated code must conform to this
-            // rn.type is the type of the result Name in the LF
-            if (rtype != rn.type) {
-                // need cast
-                if (rtype == 'L') {
-                    // possibly cast the primitive to the correct type for boxing
-                    char boxedType = Wrapper.forWrapperType(invokerType.returnType()).basicTypeChar();
-                    if (boxedType != rn.type) {
-                        emitPrimCast(rn.type, boxedType);
-                    }
-                    // cast primitive to reference ("boxing")
-                    emitBoxing(invokerType.returnType());
-                } else {
-                    // to-primitive cast
-                    if (rn.type != 'L') {
-                        // prim-to-prim cast
-                        emitPrimCast(rn.type, rtype);
-                    } else {
-                        // ref-to-prim cast ("unboxing")
-                        throw new InternalError("no ref-to-prim (unboxing) casts supported right now");
-                    }
-                }
-            }
+            emitImplicitConversion(rtype, rclass);
 
             // generate actual return statement
-            emitReturnInsn(invokerType.returnType());
+            emitReturnInsn(rtype);
         }
     }
 
     /**
      * Emit a type conversion bytecode casting from "from" to "to".
      */
-    private void emitPrimCast(char from, char to) {
+    private void emitPrimCast(Wrapper from, Wrapper to) {
         // Here's how.
         // -   indicates forbidden
         // <-> indicates implicit
@@ -950,17 +934,15 @@
             // no cast required, should be dead code anyway
             return;
         }
-        Wrapper wfrom = Wrapper.forBasicType(from);
-        Wrapper wto   = Wrapper.forBasicType(to);
-        if (wfrom.isSubwordOrInt()) {
+        if (from.isSubwordOrInt()) {
             // cast from {byte,short,char,int} to anything
             emitI2X(to);
         } else {
             // cast from {long,float,double} to anything
-            if (wto.isSubwordOrInt()) {
+            if (to.isSubwordOrInt()) {
                 // cast to {byte,short,char,int}
                 emitX2I(from);
-                if (wto.bitWidth() < 32) {
+                if (to.bitWidth() < 32) {
                     // targets other than int require another conversion
                     emitI2X(to);
                 }
@@ -968,20 +950,26 @@
                 // cast to {long,float,double} - this is verbose
                 boolean error = false;
                 switch (from) {
-                case 'J':
-                         if (to == 'F') { mv.visitInsn(Opcodes.L2F); }
-                    else if (to == 'D') { mv.visitInsn(Opcodes.L2D); }
-                    else error = true;
+                case LONG:
+                    switch (to) {
+                    case FLOAT:   mv.visitInsn(Opcodes.L2F);  break;
+                    case DOUBLE:  mv.visitInsn(Opcodes.L2D);  break;
+                    default:      error = true;               break;
+                    }
                     break;
-                case 'F':
-                         if (to == 'J') { mv.visitInsn(Opcodes.F2L); }
-                    else if (to == 'D') { mv.visitInsn(Opcodes.F2D); }
-                    else error = true;
+                case FLOAT:
+                    switch (to) {
+                    case LONG :   mv.visitInsn(Opcodes.F2L);  break;
+                    case DOUBLE:  mv.visitInsn(Opcodes.F2D);  break;
+                    default:      error = true;               break;
+                    }
                     break;
-                case 'D':
-                         if (to == 'J') { mv.visitInsn(Opcodes.D2L); }
-                    else if (to == 'F') { mv.visitInsn(Opcodes.D2F); }
-                    else error = true;
+                case DOUBLE:
+                    switch (to) {
+                    case LONG :   mv.visitInsn(Opcodes.D2L);  break;
+                    case FLOAT:   mv.visitInsn(Opcodes.D2F);  break;
+                    default:      error = true;               break;
+                    }
                     break;
                 default:
                     error = true;
@@ -994,16 +982,16 @@
         }
     }
 
-    private void emitI2X(char type) {
+    private void emitI2X(Wrapper type) {
         switch (type) {
-        case 'B':  mv.visitInsn(Opcodes.I2B);  break;
-        case 'S':  mv.visitInsn(Opcodes.I2S);  break;
-        case 'C':  mv.visitInsn(Opcodes.I2C);  break;
-        case 'I':  /* naught */                break;
-        case 'J':  mv.visitInsn(Opcodes.I2L);  break;
-        case 'F':  mv.visitInsn(Opcodes.I2F);  break;
-        case 'D':  mv.visitInsn(Opcodes.I2D);  break;
-        case 'Z':
+        case BYTE:    mv.visitInsn(Opcodes.I2B);  break;
+        case SHORT:   mv.visitInsn(Opcodes.I2S);  break;
+        case CHAR:    mv.visitInsn(Opcodes.I2C);  break;
+        case INT:     /* naught */                break;
+        case LONG:    mv.visitInsn(Opcodes.I2L);  break;
+        case FLOAT:   mv.visitInsn(Opcodes.I2F);  break;
+        case DOUBLE:  mv.visitInsn(Opcodes.I2D);  break;
+        case BOOLEAN:
             // For compatibility with ValueConversions and explicitCastArguments:
             mv.visitInsn(Opcodes.ICONST_1);
             mv.visitInsn(Opcodes.IAND);
@@ -1012,39 +1000,24 @@
         }
     }
 
-    private void emitX2I(char type) {
+    private void emitX2I(Wrapper type) {
         switch (type) {
-        case 'J':  mv.visitInsn(Opcodes.L2I);  break;
-        case 'F':  mv.visitInsn(Opcodes.F2I);  break;
-        case 'D':  mv.visitInsn(Opcodes.D2I);  break;
-        default:   throw new InternalError("unknown type: " + type);
+        case LONG:    mv.visitInsn(Opcodes.L2I);  break;
+        case FLOAT:   mv.visitInsn(Opcodes.F2I);  break;
+        case DOUBLE:  mv.visitInsn(Opcodes.D2I);  break;
+        default:      throw new InternalError("unknown type: " + type);
         }
     }
 
-    private static String basicTypeCharSignature(String prefix, MethodType type) {
-        StringBuilder buf = new StringBuilder(prefix);
-        for (Class<?> ptype : type.parameterList())
-            buf.append(Wrapper.forBasicType(ptype).basicTypeChar());
-        buf.append('_').append(Wrapper.forBasicType(type.returnType()).basicTypeChar());
-        return buf.toString();
-    }
-
     /**
      * Generate bytecode for a LambdaForm.vmentry which calls interpretWithArguments.
      */
     static MemberName generateLambdaFormInterpreterEntryPoint(String sig) {
-        assert(LambdaForm.isValidSignature(sig));
-        //System.out.println("generateExactInvoker "+sig);
-        // compute method type
-        // first parameter and return type
-        char tret = LambdaForm.signatureReturn(sig);
-        MethodType type = MethodType.methodType(LambdaForm.typeClass(tret), MethodHandle.class);
-        // other parameter types
-        int arity = LambdaForm.signatureArity(sig);
-        for (int i = 1; i < arity; i++) {
-            type = type.appendParameterTypes(LambdaForm.typeClass(sig.charAt(i)));
-        }
-        InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("LFI", "interpret_"+tret, type);
+        assert(isValidSignature(sig));
+        String name = "interpret_"+signatureReturn(sig).basicTypeChar();
+        MethodType type = signatureType(sig);  // sig includes leading argument
+        type = type.changeParameterType(0, MethodHandle.class);
+        InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("LFI", name, type);
         return g.loadMethod(g.generateLambdaFormInterpreterEntryPointBytes());
     }
 
@@ -1066,10 +1039,10 @@
             Class<?> ptype = invokerType.parameterType(i);
             mv.visitInsn(Opcodes.DUP);
             emitIconstInsn(i);
-            emitLoadInsn(Wrapper.basicTypeChar(ptype), i);
+            emitLoadInsn(basicType(ptype), i);
             // box if primitive type
             if (ptype.isPrimitive()) {
-                emitBoxing(ptype);
+                emitBoxing(Wrapper.forPrimitiveType(ptype));
             }
             mv.visitInsn(Opcodes.AASTORE);
         }
@@ -1082,11 +1055,11 @@
         // maybe unbox
         Class<?> rtype = invokerType.returnType();
         if (rtype.isPrimitive() && rtype != void.class) {
-            emitUnboxing(Wrapper.asWrapperType(rtype));
+            emitUnboxing(Wrapper.forPrimitiveType(rtype));
         }
 
         // return statement
-        emitReturnInsn(rtype);
+        emitReturnInsn(basicType(rtype));
 
         classFileEpilogue();
         bogusMethod(invokerType);
@@ -1100,14 +1073,12 @@
      * Generate bytecode for a NamedFunction invoker.
      */
     static MemberName generateNamedFunctionInvoker(MethodTypeForm typeForm) {
-        MethodType invokerType = LambdaForm.NamedFunction.INVOKER_METHOD_TYPE;
-        String invokerName = basicTypeCharSignature("invoke_", typeForm.erasedType());
+        MethodType invokerType = NamedFunction.INVOKER_METHOD_TYPE;
+        String invokerName = "invoke_" + shortenSignature(basicTypeSignature(typeForm.erasedType()));
         InvokerBytecodeGenerator g = new InvokerBytecodeGenerator("NFI", invokerName, invokerType);
         return g.loadMethod(g.generateNamedFunctionInvokerImpl(typeForm));
     }
 
-    static int nfi = 0;
-
     private byte[] generateNamedFunctionInvokerImpl(MethodTypeForm typeForm) {
         MethodType dstType = typeForm.erasedType();
         classFilePrologue();
@@ -1133,8 +1104,8 @@
                 Class<?> sptype = dstType.basicType().wrap().parameterType(i);
                 Wrapper dstWrapper = Wrapper.forBasicType(dptype);
                 Wrapper srcWrapper = dstWrapper.isSubwordOrInt() ? Wrapper.INT : dstWrapper;  // narrow subword from int
-                emitUnboxing(srcWrapper.wrapperType());
-                emitPrimCast(srcWrapper.basicTypeChar(), dstWrapper.basicTypeChar());
+                emitUnboxing(srcWrapper);
+                emitPrimCast(srcWrapper, dstWrapper);
             }
         }
 
@@ -1148,15 +1119,15 @@
             Wrapper srcWrapper = Wrapper.forBasicType(rtype);
             Wrapper dstWrapper = srcWrapper.isSubwordOrInt() ? Wrapper.INT : srcWrapper;  // widen subword to int
             // boolean casts not allowed
-            emitPrimCast(srcWrapper.basicTypeChar(), dstWrapper.basicTypeChar());
-            emitBoxing(dstWrapper.primitiveType());
+            emitPrimCast(srcWrapper, dstWrapper);
+            emitBoxing(dstWrapper);
         }
 
         // If the return type is void we return a null reference.
         if (rtype == void.class) {
             mv.visitInsn(Opcodes.ACONST_NULL);
         }
-        emitReturnInsn(Object.class);  // NOTE: NamedFunction invokers always return a reference value.
+        emitReturnInsn(L_TYPE);  // NOTE: NamedFunction invokers always return a reference value.
 
         classFileEpilogue();
         bogusMethod(dstType);
--- a/jdk/src/share/classes/java/lang/invoke/LambdaForm.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaForm.java	Wed Jul 05 19:42:29 2017 +0200
@@ -30,14 +30,14 @@
 import java.util.Map;
 import java.util.List;
 import java.util.Arrays;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.concurrent.ConcurrentHashMap;
 import sun.invoke.util.Wrapper;
+import java.lang.reflect.Field;
+
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
-import java.lang.reflect.Field;
-import java.util.Objects;
 
 /**
  * The symbolic, non-executable form of a method handle's invocation semantics.
@@ -130,13 +130,119 @@
 
     public static final int VOID_RESULT = -1, LAST_RESULT = -2;
 
+    enum BasicType {
+        L_TYPE('L', Object.class, Wrapper.OBJECT),  // all reference types
+        I_TYPE('I', int.class,    Wrapper.INT),
+        J_TYPE('J', long.class,   Wrapper.LONG),
+        F_TYPE('F', float.class,  Wrapper.FLOAT),
+        D_TYPE('D', double.class, Wrapper.DOUBLE),  // all primitive types
+        V_TYPE('V', void.class,   Wrapper.VOID);    // not valid in all contexts
+
+        static final BasicType[] ALL_TYPES = BasicType.values();
+        static final BasicType[] ARG_TYPES = Arrays.copyOf(ALL_TYPES, ALL_TYPES.length-1);
+
+        static final int ARG_TYPE_LIMIT = ARG_TYPES.length;
+        static final int TYPE_LIMIT = ALL_TYPES.length;
+
+        private final char btChar;
+        private final Class<?> btClass;
+        private final Wrapper btWrapper;
+
+        private BasicType(char btChar, Class<?> btClass, Wrapper wrapper) {
+            this.btChar = btChar;
+            this.btClass = btClass;
+            this.btWrapper = wrapper;
+        }
+
+        char basicTypeChar() {
+            return btChar;
+        }
+        Class<?> basicTypeClass() {
+            return btClass;
+        }
+        Wrapper basicTypeWrapper() {
+            return btWrapper;
+        }
+        int basicTypeSlots() {
+            return btWrapper.stackSlots();
+        }
+
+        static BasicType basicType(byte type) {
+            return ALL_TYPES[type];
+        }
+        static BasicType basicType(char type) {
+            switch (type) {
+                case 'L': return L_TYPE;
+                case 'I': return I_TYPE;
+                case 'J': return J_TYPE;
+                case 'F': return F_TYPE;
+                case 'D': return D_TYPE;
+                case 'V': return V_TYPE;
+                // all subword types are represented as ints
+                case 'Z':
+                case 'B':
+                case 'S':
+                case 'C':
+                    return I_TYPE;
+                default:
+                    throw newInternalError("Unknown type char: '"+type+"'");
+            }
+        }
+        static BasicType basicType(Wrapper type) {
+            char c = type.basicTypeChar();
+            return basicType(c);
+        }
+        static BasicType basicType(Class<?> type) {
+            if (!type.isPrimitive())  return L_TYPE;
+            return basicType(Wrapper.forPrimitiveType(type));
+        }
+
+        static char basicTypeChar(Class<?> type) {
+            return basicType(type).btChar;
+        }
+        static BasicType[] basicTypes(List<Class<?>> types) {
+            BasicType[] btypes = new BasicType[types.size()];
+            for (int i = 0; i < btypes.length; i++) {
+                btypes[i] = basicType(types.get(i));
+            }
+            return btypes;
+        }
+        static BasicType[] basicTypes(String types) {
+            BasicType[] btypes = new BasicType[types.length()];
+            for (int i = 0; i < btypes.length; i++) {
+                btypes[i] = basicType(types.charAt(i));
+            }
+            return btypes;
+        }
+        static boolean isBasicTypeChar(char c) {
+            return "LIJFDV".indexOf(c) >= 0;
+        }
+        static boolean isArgBasicTypeChar(char c) {
+            return "LIJFD".indexOf(c) >= 0;
+        }
+
+        static { assert(checkBasicType()); }
+        private static boolean checkBasicType() {
+            for (int i = 0; i < ARG_TYPE_LIMIT; i++) {
+                assert ARG_TYPES[i].ordinal() == i;
+                assert ARG_TYPES[i] == ALL_TYPES[i];
+            }
+            for (int i = 0; i < TYPE_LIMIT; i++) {
+                assert ALL_TYPES[i].ordinal() == i;
+            }
+            assert ALL_TYPES[TYPE_LIMIT - 1] == V_TYPE;
+            assert !Arrays.asList(ARG_TYPES).contains(V_TYPE);
+            return true;
+        }
+    }
+
     LambdaForm(String debugName,
                int arity, Name[] names, int result) {
         assert(namesOK(arity, names));
         this.arity = arity;
         this.result = fixResult(result, names);
         this.names = names.clone();
-        this.debugName = debugName;
+        this.debugName = fixDebugName(debugName);
         normalize();
     }
 
@@ -168,12 +274,12 @@
         // Called only from getPreparedForm.
         assert(isValidSignature(sig));
         this.arity = signatureArity(sig);
-        this.result = (signatureReturn(sig) == 'V' ? -1 : arity);
+        this.result = (signatureReturn(sig) == V_TYPE ? -1 : arity);
         this.names = buildEmptyNames(arity, sig);
         this.debugName = "LF.zero";
         assert(nameRefsAreLegal());
         assert(isEmpty());
-        assert(sig.equals(basicTypeSignature()));
+        assert(sig.equals(basicTypeSignature())) : sig + " != " + basicTypeSignature();
     }
 
     private static Name[] buildEmptyNames(int arity, String basicTypeSignature) {
@@ -181,22 +287,53 @@
         int resultPos = arity + 1;  // skip '_'
         if (arity < 0 || basicTypeSignature.length() != resultPos+1)
             throw new IllegalArgumentException("bad arity for "+basicTypeSignature);
-        int numRes = (basicTypeSignature.charAt(resultPos) == 'V' ? 0 : 1);
+        int numRes = (basicType(basicTypeSignature.charAt(resultPos)) == V_TYPE ? 0 : 1);
         Name[] names = arguments(numRes, basicTypeSignature.substring(0, arity));
         for (int i = 0; i < numRes; i++) {
-            names[arity + i] = constantZero(arity + i, basicTypeSignature.charAt(resultPos + i));
+            Name zero = new Name(constantZero(basicType(basicTypeSignature.charAt(resultPos + i))));
+            names[arity + i] = zero.newIndex(arity + i);
         }
         return names;
     }
 
     private static int fixResult(int result, Name[] names) {
-        if (result >= 0) {
-            if (names[result].type == 'V')
-                return -1;
-        } else if (result == LAST_RESULT) {
-            return names.length - 1;
+        if (result == LAST_RESULT)
+            result = names.length - 1;  // might still be void
+        if (result >= 0 && names[result].type == V_TYPE)
+            result = VOID_RESULT;
+        return result;
+    }
+
+    private static String fixDebugName(String debugName) {
+        if (DEBUG_NAME_COUNTERS != null) {
+            int under = debugName.indexOf('_');
+            int length = debugName.length();
+            if (under < 0)  under = length;
+            String debugNameStem = debugName.substring(0, under);
+            Integer ctr;
+            synchronized (DEBUG_NAME_COUNTERS) {
+                ctr = DEBUG_NAME_COUNTERS.get(debugNameStem);
+                if (ctr == null)  ctr = 0;
+                DEBUG_NAME_COUNTERS.put(debugNameStem, ctr+1);
+            }
+            StringBuilder buf = new StringBuilder(debugNameStem);
+            buf.append('_');
+            int leadingZero = buf.length();
+            buf.append((int) ctr);
+            for (int i = buf.length() - leadingZero; i < 3; i++)
+                buf.insert(leadingZero, '0');
+            if (under < length) {
+                ++under;    // skip "_"
+                while (under < length && Character.isDigit(debugName.charAt(under))) {
+                    ++under;
+                }
+                if (under < length && debugName.charAt(under) == '_')  ++under;
+                if (under < length)
+                    buf.append('_').append(debugName, under, length);
+            }
+            return buf.toString();
         }
-        return result;
+        return debugName;
     }
 
     private static boolean namesOK(int arity, Name[] names) {
@@ -294,14 +431,14 @@
     // }
 
     /** Report the return type. */
-    char returnType() {
-        if (result < 0)  return 'V';
+    BasicType returnType() {
+        if (result < 0)  return V_TYPE;
         Name n = names[result];
         return n.type;
     }
 
     /** Report the N-th argument type. */
-    char parameterType(int n) {
+    BasicType parameterType(int n) {
         assert(n < arity);
         return names[n].type;
     }
@@ -319,15 +456,15 @@
     final String basicTypeSignature() {
         StringBuilder buf = new StringBuilder(arity() + 3);
         for (int i = 0, a = arity(); i < a; i++)
-            buf.append(parameterType(i));
-        return buf.append('_').append(returnType()).toString();
+            buf.append(parameterType(i).basicTypeChar());
+        return buf.append('_').append(returnType().basicTypeChar()).toString();
     }
     static int signatureArity(String sig) {
         assert(isValidSignature(sig));
         return sig.indexOf('_');
     }
-    static char signatureReturn(String sig) {
-        return sig.charAt(signatureArity(sig)+1);
+    static BasicType signatureReturn(String sig) {
+        return basicType(sig.charAt(signatureArity(sig)+1));
     }
     static boolean isValidSignature(String sig) {
         int arity = sig.indexOf('_');
@@ -339,27 +476,15 @@
             char c = sig.charAt(i);
             if (c == 'V')
                 return (i == siglen - 1 && arity == siglen - 2);
-            if (ALL_TYPES.indexOf(c) < 0)  return false; // must be [LIJFD]
+            if (!isArgBasicTypeChar(c))  return false; // must be [LIJFD]
         }
         return true;  // [LIJFD]*_[LIJFDV]
     }
-    static Class<?> typeClass(char t) {
-        switch (t) {
-        case 'I': return int.class;
-        case 'J': return long.class;
-        case 'F': return float.class;
-        case 'D': return double.class;
-        case 'L': return Object.class;
-        case 'V': return void.class;
-        default: assert false;
-        }
-        return null;
-    }
     static MethodType signatureType(String sig) {
         Class<?>[] ptypes = new Class<?>[signatureArity(sig)];
         for (int i = 0; i < ptypes.length; i++)
-            ptypes[i] = typeClass(sig.charAt(i));
-        Class<?> rtype = typeClass(signatureReturn(sig));
+            ptypes[i] = basicType(sig.charAt(i)).btClass;
+        Class<?> rtype = signatureReturn(sig).btClass;
         return MethodType.methodType(rtype, ptypes);
     }
 
@@ -543,21 +668,21 @@
         assert(mt.parameterCount() == arity-1);
         for (int i = 0; i < av.length; i++) {
             Class<?> pt = (i == 0 ? MethodHandle.class : mt.parameterType(i-1));
-            assert(valueMatches(sig.charAt(i), pt, av[i]));
+            assert(valueMatches(basicType(sig.charAt(i)), pt, av[i]));
         }
         return true;
     }
-    private static boolean valueMatches(char tc, Class<?> type, Object x) {
+    private static boolean valueMatches(BasicType tc, Class<?> type, Object x) {
         // The following line is needed because (...)void method handles can use non-void invokers
-        if (type == void.class)  tc = 'V';   // can drop any kind of value
+        if (type == void.class)  tc = V_TYPE;   // can drop any kind of value
         assert tc == basicType(type) : tc + " == basicType(" + type + ")=" + basicType(type);
         switch (tc) {
-        case 'I': assert checkInt(type, x)   : "checkInt(" + type + "," + x +")";   break;
-        case 'J': assert x instanceof Long   : "instanceof Long: " + x;             break;
-        case 'F': assert x instanceof Float  : "instanceof Float: " + x;            break;
-        case 'D': assert x instanceof Double : "instanceof Double: " + x;           break;
-        case 'L': assert checkRef(type, x)   : "checkRef(" + type + "," + x + ")";  break;
-        case 'V': break;  // allow anything here; will be dropped
+        case I_TYPE: assert checkInt(type, x)   : "checkInt(" + type + "," + x +")";   break;
+        case J_TYPE: assert x instanceof Long   : "instanceof Long: " + x;             break;
+        case F_TYPE: assert x instanceof Float  : "instanceof Float: " + x;            break;
+        case D_TYPE: assert x instanceof Double : "instanceof Double: " + x;           break;
+        case L_TYPE: assert checkRef(type, x)   : "checkRef(" + type + "," + x + ")";  break;
+        case V_TYPE: break;  // allow anything here; will be dropped
         default:  assert(false);
         }
         return true;
@@ -736,7 +861,7 @@
      * The first parameter to a LambdaForm, a0:L, always represents the form's method handle, so 0 is not
      * accepted as valid.
      */
-    LambdaForm bindImmediate(int pos, char basicType, Object value) {
+    LambdaForm bindImmediate(int pos, BasicType basicType, Object value) {
         // must be an argument, and the types must match
         assert pos > 0 && pos < arity && names[pos].type == basicType && Name.typesMatch(basicType, value);
 
@@ -782,8 +907,8 @@
 
     LambdaForm bind(int namePos, BoundMethodHandle.SpeciesData oldData) {
         Name name = names[namePos];
-        BoundMethodHandle.SpeciesData newData = oldData.extendWithType(name.type);
-        return bind(name, newData.getterName(names[0], oldData.fieldCount()), oldData, newData);
+        BoundMethodHandle.SpeciesData newData = oldData.extendWith(name.type);
+        return bind(name, new Name(newData.getterFunction(oldData.fieldCount()), names[0]), oldData, newData);
     }
     LambdaForm bind(Name name, Name binding,
                     BoundMethodHandle.SpeciesData oldData,
@@ -874,7 +999,7 @@
         return false;
     }
 
-    LambdaForm addArguments(int pos, char... types) {
+    LambdaForm addArguments(int pos, BasicType... types) {
         assert(pos <= arity);
         int length = names.length;
         int inTypes = types.length;
@@ -895,13 +1020,10 @@
     }
 
     LambdaForm addArguments(int pos, List<Class<?>> types) {
-        char[] basicTypes = new char[types.size()];
-        for (int i = 0; i < basicTypes.length; i++)
-            basicTypes[i] = basicType(types.get(i));
-        return addArguments(pos, basicTypes);
+        return addArguments(pos, basicTypes(types));
     }
 
-    LambdaForm permuteArguments(int skip, int[] reorder, char[] types) {
+    LambdaForm permuteArguments(int skip, int[] reorder, BasicType[] types) {
         // Note:  When inArg = reorder[outArg], outArg is fed by a copy of inArg.
         // The types are the types of the new (incoming) arguments.
         int length = names.length;
@@ -960,7 +1082,7 @@
         return new LambdaForm(debugName, arity2, names2, result2);
     }
 
-    static boolean permutedTypesMatch(int[] reorder, char[] types, Name[] names, int skip) {
+    static boolean permutedTypesMatch(int[] reorder, BasicType[] types, Name[] names, int skip) {
         int inTypes = types.length;
         int outArgs = reorder.length;
         for (int i = 0; i < outArgs; i++) {
@@ -1044,7 +1166,7 @@
                     String sig = m.getName().substring("invoke_".length());
                     int arity = LambdaForm.signatureArity(sig);
                     MethodType srcType = MethodType.genericMethodType(arity);
-                    if (LambdaForm.signatureReturn(sig) == 'V')
+                    if (LambdaForm.signatureReturn(sig) == V_TYPE)
                         srcType = srcType.changeReturnType(void.class);
                     MethodTypeForm typeForm = srcType.form();
                     typeForm.namedFunctionInvoker = DirectMethodHandle.make(m);
@@ -1134,7 +1256,7 @@
             MethodHandle mh2 = typeForm.namedFunctionInvoker;
             if (mh2 != null)  return mh2;  // benign race
             if (!mh.type().equals(INVOKER_METHOD_TYPE))
-                throw new InternalError(mh.debugString());
+                throw newInternalError(mh.debugString());
             return typeForm.namedFunctionInvoker = mh;
         }
 
@@ -1193,11 +1315,6 @@
             return true;
         }
 
-        String basicTypeSignature() {
-            //return LambdaForm.basicTypeSignature(resolvedHandle.type());
-            return LambdaForm.basicTypeSignature(methodType());
-        }
-
         MethodType methodType() {
             if (resolvedHandle != null)
                 return resolvedHandle.type();
@@ -1224,18 +1341,15 @@
             return (member == null) ? null : member.getDeclaringClass();
         }
 
-        char returnType() {
+        BasicType returnType() {
             return basicType(methodType().returnType());
         }
 
-        char parameterType(int n) {
+        BasicType parameterType(int n) {
             return basicType(methodType().parameterType(n));
         }
 
         int arity() {
-            //int siglen = member.getMethodType().parameterCount();
-            //if (!member.isStatic())  siglen += 1;
-            //return siglen;
             return methodType().parameterCount();
         }
 
@@ -1243,44 +1357,63 @@
             if (member == null)  return String.valueOf(resolvedHandle);
             return member.getDeclaringClass().getSimpleName()+"."+member.getName();
         }
-    }
 
-    void resolve() {
-        for (Name n : names) n.resolve();
+        public boolean isIdentity() {
+            return this.equals(identity(returnType()));
+        }
+
+        public boolean isConstantZero() {
+            return this.equals(constantZero(returnType()));
+        }
     }
 
-    public static char basicType(Class<?> type) {
-        char c = Wrapper.basicTypeChar(type);
-        if ("ZBSC".indexOf(c) >= 0)  c = 'I';
-        assert("LIJFDV".indexOf(c) >= 0);
-        return c;
-    }
-    public static char[] basicTypes(List<Class<?>> types) {
-        char[] btypes = new char[types.size()];
-        for (int i = 0; i < btypes.length; i++) {
-            btypes[i] = basicType(types.get(i));
-        }
-        return btypes;
-    }
     public static String basicTypeSignature(MethodType type) {
         char[] sig = new char[type.parameterCount() + 2];
         int sigp = 0;
         for (Class<?> pt : type.parameterList()) {
-            sig[sigp++] = basicType(pt);
+            sig[sigp++] = basicTypeChar(pt);
         }
         sig[sigp++] = '_';
-        sig[sigp++] = basicType(type.returnType());
+        sig[sigp++] = basicTypeChar(type.returnType());
         assert(sigp == sig.length);
         return String.valueOf(sig);
     }
+    public static String shortenSignature(String signature) {
+        // Hack to make signatures more readable when they show up in method names.
+        final int NO_CHAR = -1, MIN_RUN = 3;
+        int c0, c1 = NO_CHAR, c1reps = 0;
+        StringBuilder buf = null;
+        int len = signature.length();
+        if (len < MIN_RUN)  return signature;
+        for (int i = 0; i <= len; i++) {
+            // shift in the next char:
+            c0 = c1; c1 = (i == len ? NO_CHAR : signature.charAt(i));
+            if (c1 == c0) { ++c1reps; continue; }
+            // shift in the next count:
+            int c0reps = c1reps; c1reps = 1;
+            // end of a  character run
+            if (c0reps < MIN_RUN) {
+                if (buf != null) {
+                    while (--c0reps >= 0)
+                        buf.append((char)c0);
+                }
+                continue;
+            }
+            // found three or more in a row
+            if (buf == null)
+                buf = new StringBuilder().append(signature, 0, i - c0reps);
+            buf.append((char)c0).append(c0reps);
+        }
+        return (buf == null) ? signature : buf.toString();
+    }
 
     static final class Name {
-        final char type;
+        final BasicType type;
         private short index;
         final NamedFunction function;
         @Stable final Object[] arguments;
 
-        private Name(int index, char type, NamedFunction function, Object[] arguments) {
+        private Name(int index, BasicType type, NamedFunction function, Object[] arguments) {
             this.index = (short)index;
             this.type = type;
             this.function = function;
@@ -1292,7 +1425,7 @@
         }
         Name(MethodType functionType, Object... arguments) {
             this(new NamedFunction(functionType), arguments);
-            assert(arguments[0] instanceof Name && ((Name)arguments[0]).type == 'L');
+            assert(arguments[0] instanceof Name && ((Name)arguments[0]).type == L_TYPE);
         }
         Name(MemberName function, Object... arguments) {
             this(new NamedFunction(function), arguments);
@@ -1303,14 +1436,14 @@
             for (int i = 0; i < arguments.length; i++)
                 assert(typesMatch(function.parameterType(i), arguments[i])) : "types don't match: function.parameterType(" + i + ")=" + function.parameterType(i) + ", arguments[" + i + "]=" + arguments[i] + " in " + debugString();
         }
-        Name(int index, char type) {
+        /** Create a raw parameter of the given type, with an expected index. */
+        Name(int index, BasicType type) {
             this(index, type, null, null);
         }
-        Name(char type) {
-            this(-1, type);
-        }
+        /** Create a raw parameter of the given type. */
+        Name(BasicType type) { this(-1, type); }
 
-        char type() { return type; }
+        BasicType type() { return type; }
         int index() { return index; }
         boolean initIndex(int i) {
             if (index != i) {
@@ -1319,7 +1452,9 @@
             }
             return true;
         }
-
+        char typeChar() {
+            return type.btChar;
+        }
 
         void resolve() {
             if (function != null)
@@ -1397,18 +1532,18 @@
             return function == null;
         }
         boolean isConstantZero() {
-            return !isParam() && arguments.length == 0 && function.equals(constantZero(0, type).function);
+            return !isParam() && arguments.length == 0 && function.isConstantZero();
         }
 
         public String toString() {
-            return (isParam()?"a":"t")+(index >= 0 ? index : System.identityHashCode(this))+":"+type;
+            return (isParam()?"a":"t")+(index >= 0 ? index : System.identityHashCode(this))+":"+typeChar();
         }
         public String debugString() {
             String s = toString();
             return (function == null) ? s : s + "=" + exprString();
         }
         public String exprString() {
-            if (function == null)  return "null";
+            if (function == null)  return toString();
             StringBuilder buf = new StringBuilder(function.toString());
             buf.append("(");
             String cma = "";
@@ -1423,17 +1558,17 @@
             return buf.toString();
         }
 
-        private static boolean typesMatch(char parameterType, Object object) {
+        static boolean typesMatch(BasicType parameterType, Object object) {
             if (object instanceof Name) {
                 return ((Name)object).type == parameterType;
             }
             switch (parameterType) {
-                case 'I':  return object instanceof Integer;
-                case 'J':  return object instanceof Long;
-                case 'F':  return object instanceof Float;
-                case 'D':  return object instanceof Double;
+                case I_TYPE:  return object instanceof Integer;
+                case J_TYPE:  return object instanceof Long;
+                case F_TYPE:  return object instanceof Float;
+                case D_TYPE:  return object instanceof Double;
             }
-            assert(parameterType == 'L');
+            assert(parameterType == L_TYPE);
             return true;
         }
 
@@ -1510,7 +1645,7 @@
         @Override
         public int hashCode() {
             if (isParam())
-                return index | (type << 8);
+                return index | (type.ordinal() << 8);
             return function.hashCode() ^ Arrays.hashCode(arguments);
         }
     }
@@ -1545,10 +1680,12 @@
     }
 
     static Name argument(int which, char type) {
-        int tn = ALL_TYPES.indexOf(type);
-        if (tn < 0 || which >= INTERNED_ARGUMENT_LIMIT)
+        return argument(which, basicType(type));
+    }
+    static Name argument(int which, BasicType type) {
+        if (which >= INTERNED_ARGUMENT_LIMIT)
             return new Name(which, type);
-        return INTERNED_ARGUMENTS[tn][which];
+        return INTERNED_ARGUMENTS[type.ordinal()][which];
     }
     static Name internArgument(Name n) {
         assert(n.isParam()) : "not param: " + n;
@@ -1590,56 +1727,118 @@
             names[i] = argument(i, basicType(types.parameterType(i)));
         return names;
     }
-    static final String ALL_TYPES = "LIJFD";  // omit V, not an argument type
     static final int INTERNED_ARGUMENT_LIMIT = 10;
     private static final Name[][] INTERNED_ARGUMENTS
-            = new Name[ALL_TYPES.length()][INTERNED_ARGUMENT_LIMIT];
+            = new Name[ARG_TYPE_LIMIT][INTERNED_ARGUMENT_LIMIT];
     static {
-        for (int tn = 0; tn < ALL_TYPES.length(); tn++) {
-            for (int i = 0; i < INTERNED_ARGUMENTS[tn].length; i++) {
-                char type = ALL_TYPES.charAt(tn);
-                INTERNED_ARGUMENTS[tn][i] = new Name(i, type);
+        for (BasicType type : BasicType.ARG_TYPES) {
+            int ord = type.ordinal();
+            for (int i = 0; i < INTERNED_ARGUMENTS[ord].length; i++) {
+                INTERNED_ARGUMENTS[ord][i] = new Name(i, type);
             }
         }
     }
 
     private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory();
 
-    static Name constantZero(int which, char type) {
-        return CONSTANT_ZERO[ALL_TYPES.indexOf(type)].newIndex(which);
+    static LambdaForm identityForm(BasicType type) {
+        return LF_identityForm[type.ordinal()];
+    }
+    static LambdaForm zeroForm(BasicType type) {
+        return LF_zeroForm[type.ordinal()];
+    }
+    static NamedFunction identity(BasicType type) {
+        return NF_identity[type.ordinal()];
+    }
+    static NamedFunction constantZero(BasicType type) {
+        return NF_zero[type.ordinal()];
     }
-    private static final Name[] CONSTANT_ZERO
-            = new Name[ALL_TYPES.length()];
-    static {
-        for (int tn = 0; tn < ALL_TYPES.length(); tn++) {
-            char bt = ALL_TYPES.charAt(tn);
-            Wrapper wrap = Wrapper.forBasicType(bt);
-            MemberName zmem = new MemberName(LambdaForm.class, "zero"+bt, MethodType.methodType(wrap.primitiveType()), REF_invokeStatic);
+    private static final LambdaForm[] LF_identityForm = new LambdaForm[TYPE_LIMIT];
+    private static final LambdaForm[] LF_zeroForm = new LambdaForm[TYPE_LIMIT];
+    private static final NamedFunction[] NF_identity = new NamedFunction[TYPE_LIMIT];
+    private static final NamedFunction[] NF_zero = new NamedFunction[TYPE_LIMIT];
+    private static void createIdentityForms() {
+        for (BasicType type : BasicType.ALL_TYPES) {
+            int ord = type.ordinal();
+            char btChar = type.basicTypeChar();
+            boolean isVoid = (type == V_TYPE);
+            Class<?> btClass = type.btClass;
+            MethodType zeType = MethodType.methodType(btClass);
+            MethodType idType = isVoid ? zeType : zeType.appendParameterTypes(btClass);
+
+            // Look up some symbolic names.  It might not be necessary to have these,
+            // but if we need to emit direct references to bytecodes, it helps.
+            // Zero is built from a call to an identity function with a constant zero input.
+            MemberName idMem = new MemberName(LambdaForm.class, "identity_"+btChar, idType, REF_invokeStatic);
+            MemberName zeMem = new MemberName(LambdaForm.class, "zero_"+btChar, zeType, REF_invokeStatic);
             try {
-                zmem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, zmem, null, NoSuchMethodException.class);
+                zeMem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, zeMem, null, NoSuchMethodException.class);
+                idMem = IMPL_NAMES.resolveOrFail(REF_invokeStatic, idMem, null, NoSuchMethodException.class);
             } catch (IllegalAccessException|NoSuchMethodException ex) {
                 throw newInternalError(ex);
             }
-            NamedFunction zcon = new NamedFunction(zmem);
-            Name n = new Name(zcon).newIndex(0);
-            assert(n.type == ALL_TYPES.charAt(tn));
-            CONSTANT_ZERO[tn] = n;
-            assert(n.isConstantZero());
+
+            NamedFunction idFun = new NamedFunction(idMem);
+            LambdaForm idForm;
+            if (isVoid) {
+                Name[] idNames = new Name[] { argument(0, L_TYPE) };
+                idForm = new LambdaForm(idMem.getName(), 1, idNames, VOID_RESULT);
+            } else {
+                Name[] idNames = new Name[] { argument(0, L_TYPE), argument(1, type) };
+                idForm = new LambdaForm(idMem.getName(), 2, idNames, 1);
+            }
+            LF_identityForm[ord] = idForm;
+            NF_identity[ord] = idFun;
+
+            NamedFunction zeFun = new NamedFunction(zeMem);
+            LambdaForm zeForm;
+            if (isVoid) {
+                zeForm = idForm;
+            } else {
+                Object zeValue = Wrapper.forBasicType(btChar).zero();
+                Name[] zeNames = new Name[] { argument(0, L_TYPE), new Name(idFun, zeValue) };
+                zeForm = new LambdaForm(zeMem.getName(), 1, zeNames, 1);
+            }
+            LF_zeroForm[ord] = zeForm;
+            NF_zero[ord] = zeFun;
+
+            assert(idFun.isIdentity());
+            assert(zeFun.isConstantZero());
+            assert(new Name(zeFun).isConstantZero());
+        }
+
+        // Do this in a separate pass, so that SimpleMethodHandle.make can see the tables.
+        for (BasicType type : BasicType.ALL_TYPES) {
+            int ord = type.ordinal();
+            NamedFunction idFun = NF_identity[ord];
+            LambdaForm idForm = LF_identityForm[ord];
+            MemberName idMem = idFun.member;
+            idFun.resolvedHandle = SimpleMethodHandle.make(idMem.getInvocationType(), idForm);
+
+            NamedFunction zeFun = NF_zero[ord];
+            LambdaForm zeForm = LF_zeroForm[ord];
+            MemberName zeMem = zeFun.member;
+            zeFun.resolvedHandle = SimpleMethodHandle.make(zeMem.getInvocationType(), zeForm);
+
+            assert(idFun.isIdentity());
+            assert(zeFun.isConstantZero());
+            assert(new Name(zeFun).isConstantZero());
         }
     }
 
     // Avoid appealing to ValueConversions at bootstrap time:
-    private static int zeroI() { return 0; }
-    private static long zeroJ() { return 0; }
-    private static float zeroF() { return 0; }
-    private static double zeroD() { return 0; }
-    private static Object zeroL() { return null; }
-
-    // Put this last, so that previous static inits can run before.
-    static {
-        if (USE_PREDEFINED_INTERPRET_METHODS)
-            PREPARED_FORMS.putAll(computeInitialPreparedForms());
-    }
+    private static int identity_I(int x) { return x; }
+    private static long identity_J(long x) { return x; }
+    private static float identity_F(float x) { return x; }
+    private static double identity_D(double x) { return x; }
+    private static Object identity_L(Object x) { return x; }
+    private static void identity_V() { return; }  // same as zeroV, but that's OK
+    private static int zero_I() { return 0; }
+    private static long zero_J() { return 0; }
+    private static float zero_F() { return 0; }
+    private static double zero_D() { return 0; }
+    private static Object zero_L() { return null; }
+    private static void zero_V() { return; }
 
     /**
      * Internal marker for byte-compiled LambdaForms.
@@ -1690,7 +1889,21 @@
     static final native Object linkToInterface(Object x1, MemberName mn) throws Throwable;
  */
 
-    static { NamedFunction.initializeInvokers(); }
+    private static final HashMap<String,Integer> DEBUG_NAME_COUNTERS;
+    static {
+        if (debugEnabled())
+            DEBUG_NAME_COUNTERS = new HashMap<>();
+        else
+            DEBUG_NAME_COUNTERS = null;
+    }
+
+    // Put this last, so that previous static inits can run before.
+    static {
+        createIdentityForms();
+        if (USE_PREDEFINED_INTERPRET_METHODS)
+            PREPARED_FORMS.putAll(computeInitialPreparedForms());
+        NamedFunction.initializeInvokers();
+    }
 
     // The following hack is necessary in order to suppress TRACE_INTERPRETER
     // during execution of the static initializes of this class.
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java	Wed Jul 05 19:42:29 2017 +0200
@@ -27,10 +27,12 @@
 
 
 import java.util.*;
+import java.lang.invoke.LambdaForm.BasicType;
 import sun.invoke.util.*;
 import sun.misc.Unsafe;
 
 import static java.lang.invoke.MethodHandleStatics.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 
 /**
  * A method handle is a typed, directly executable reference to an underlying method,
@@ -729,7 +731,7 @@
      * <li>If the return type <em>T0</em> is void and <em>T1</em> a primitive,
      *     a zero value is introduced.
      * </ul>
-    * (<em>Note:</em> Both <em>T0</em> and <em>T1</em> may be regarded as static types,
+     * (<em>Note:</em> Both <em>T0</em> and <em>T1</em> may be regarded as static types,
      * because neither corresponds specifically to the <em>dynamic type</em> of any
      * actual argument or return value.)
      * <p>
@@ -1374,7 +1376,7 @@
     }
 
     /*non-public*/
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
+    MethodHandle bindArgument(int pos, BasicType basicType, Object value) {
         // Override this if it can be improved.
         return rebind().bindArgument(pos, basicType, value);
     }
@@ -1382,26 +1384,7 @@
     /*non-public*/
     MethodHandle bindReceiver(Object receiver) {
         // Override this if it can be improved.
-        return bindArgument(0, 'L', receiver);
-    }
-
-    /*non-public*/
-    MethodHandle bindImmediate(int pos, char basicType, Object value) {
-        // Bind an immediate value to a position in the arguments.
-        // This means, elide the respective argument,
-        // and replace all references to it in NamedFunction args with the specified value.
-
-        // CURRENT RESTRICTIONS
-        // * only for pos 0 and UNSAFE (position is adjusted in MHImpl to make API usable for others)
-        assert pos == 0 && basicType == 'L' && value instanceof Unsafe;
-        MethodType type2 = type.dropParameterTypes(pos, pos + 1); // adjustment: ignore receiver!
-        LambdaForm form2 = form.bindImmediate(pos + 1, basicType, value); // adjust pos to form-relative pos
-        return copyWith(type2, form2);
-    }
-
-    /*non-public*/
-    MethodHandle copyWith(MethodType mt, LambdaForm lf) {
-        throw new InternalError("copyWith: " + this.getClass());
+        return bindArgument(0, L_TYPE, receiver);
     }
 
     /*non-public*/
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java	Wed Jul 05 19:42:29 2017 +0200
@@ -412,7 +412,7 @@
 
 
         @Override
-        MethodHandle bindArgument(int pos, char basicType, Object value) {
+        MethodHandle bindArgument(int pos, BasicType basicType, Object value) {
             return asFixedArity().bindArgument(pos, basicType, value);
         }
 
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Wed Jul 05 19:42:29 2017 +0200
@@ -78,7 +78,7 @@
 
         // The JVM calls MethodHandleNatives.<clinit>.  Cascade the <clinit> calls as needed:
         MethodHandleImpl.initStatics();
-}
+    }
 
     // All compile-time constants go here.
     // There is an opportunity to check them against the JVM's idea of them.
@@ -293,6 +293,17 @@
         Class<?> caller = (Class<?>)callerObj;
         String name = nameObj.toString().intern();
         MethodType type = (MethodType)typeObj;
+        if (!TRACE_METHOD_LINKAGE)
+            return linkCallSiteImpl(caller, bootstrapMethod, name, type,
+                                    staticArguments, appendixResult);
+        return linkCallSiteTracing(caller, bootstrapMethod, name, type,
+                                   staticArguments, appendixResult);
+    }
+    static MemberName linkCallSiteImpl(Class<?> caller,
+                                       MethodHandle bootstrapMethod,
+                                       String name, MethodType type,
+                                       Object staticArguments,
+                                       Object[] appendixResult) {
         CallSite callSite = CallSite.makeSite(bootstrapMethod,
                                               name,
                                               type,
@@ -306,6 +317,30 @@
             return Invokers.linkToCallSiteMethod(type);
         }
     }
+    // Tracing logic:
+    static MemberName linkCallSiteTracing(Class<?> caller,
+                                          MethodHandle bootstrapMethod,
+                                          String name, MethodType type,
+                                          Object staticArguments,
+                                          Object[] appendixResult) {
+        Object bsmReference = bootstrapMethod.internalMemberName();
+        if (bsmReference == null)  bsmReference = bootstrapMethod;
+        Object staticArglist = (staticArguments instanceof Object[] ?
+                                java.util.Arrays.asList((Object[]) staticArguments) :
+                                staticArguments);
+        System.out.println("linkCallSite "+caller.getName()+" "+
+                           bsmReference+" "+
+                           name+type+"/"+staticArglist);
+        try {
+            MemberName res = linkCallSiteImpl(caller, bootstrapMethod, name, type,
+                                              staticArguments, appendixResult);
+            System.out.println("linkCallSite => "+res+" + "+appendixResult[0]);
+            return res;
+        } catch (Throwable ex) {
+            System.out.println("linkCallSite => throw "+ex);
+            throw ex;
+        }
+    }
 
     /**
      * The JVM wants a pointer to a MethodType.  Oblige it by finding or creating one.
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleStatics.java	Wed Jul 05 19:42:29 2017 +0200
@@ -65,6 +65,16 @@
         COMPILE_THRESHOLD         = (Integer) values[4];
     }
 
+    /** Tell if any of the debugging switches are turned on.
+     *  If this is the case, it is reasonable to perform extra checks or save extra information.
+     */
+    /*non-public*/ static boolean debugEnabled() {
+        return (DEBUG_METHOD_HANDLE_NAMES |
+                DUMP_CLASS_FILES |
+                TRACE_INTERPRETER |
+                TRACE_METHOD_LINKAGE);
+    }
+
     /*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
         if (type == null)
             type = target.type();
@@ -93,6 +103,9 @@
     }
 
     // handy shared exception makers (they simplify the common case code)
+    /*non-public*/ static InternalError newInternalError(String message) {
+        return new InternalError(message);
+    }
     /*non-public*/ static InternalError newInternalError(String message, Throwable cause) {
         return new InternalError(message, cause);
     }
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java	Wed Jul 05 19:42:29 2017 +0200
@@ -37,10 +37,11 @@
 import sun.reflect.Reflection;
 import sun.reflect.misc.ReflectUtil;
 import sun.security.util.SecurityConstants;
+import java.lang.invoke.LambdaForm.BasicType;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 import static java.lang.invoke.MethodHandleStatics.*;
 import static java.lang.invoke.MethodHandleNatives.Constants.*;
 import java.util.concurrent.ConcurrentHashMap;
-import sun.security.util.SecurityConstants;
 
 /**
  * This class consists exclusively of static methods that operate on or return
@@ -2189,12 +2190,12 @@
             Object value = values[i];
             Class<?> ptype = oldType.parameterType(pos+i);
             if (ptype.isPrimitive()) {
-                char btype = 'I';
+                BasicType btype = I_TYPE;
                 Wrapper w = Wrapper.forPrimitiveType(ptype);
                 switch (w) {
-                case LONG:    btype = 'J'; break;
-                case FLOAT:   btype = 'F'; break;
-                case DOUBLE:  btype = 'D'; break;
+                case LONG:    btype = J_TYPE; break;
+                case FLOAT:   btype = F_TYPE; break;
+                case DOUBLE:  btype = D_TYPE; break;
                 }
                 // perform unboxing and/or primitive conversion
                 value = w.convert(value, ptype);
@@ -2205,7 +2206,7 @@
             if (pos == 0) {
                 result = result.bindReceiver(value);
             } else {
-                result = result.bindArgument(pos, 'L', value);
+                result = result.bindArgument(pos, L_TYPE, value);
             }
         }
         return result;
--- a/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/lang/invoke/SimpleMethodHandle.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,7 @@
 package java.lang.invoke;
 
 import static java.lang.invoke.LambdaForm.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
+import static java.lang.invoke.LambdaForm.BasicType.*;
 
 /**
  * A method handle whose behavior is determined only by its LambdaForm.
@@ -42,7 +42,7 @@
     }
 
     @Override
-    MethodHandle bindArgument(int pos, char basicType, Object value) {
+    MethodHandle bindArgument(int pos, BasicType basicType, Object value) {
         MethodType type2 = type().dropParameterTypes(pos, pos+1);
         LambdaForm form2 = internalForm().bind(1+pos, BoundMethodHandle.SpeciesData.EMPTY);
         return BoundMethodHandle.bindSingle(type2, form2, basicType, value);
@@ -59,10 +59,4 @@
         LambdaForm form2 = internalForm().permuteArguments(1, reorder, basicTypes(newType.parameterList()));
         return new SimpleMethodHandle(newType, form2);
     }
-
-    @Override
-    MethodHandle copyWith(MethodType mt, LambdaForm lf) {
-        return new SimpleMethodHandle(mt, lf);
-    }
-
 }
--- a/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/util/DoubleSummaryStatistics.java	Wed Jul 05 19:42:29 2017 +0200
@@ -54,7 +54,7 @@
  *
  * @implNote This implementation is not thread safe. However, it is safe to use
  * {@link java.util.stream.Collectors#summarizingDouble(java.util.function.ToDoubleFunction)
- * Collectors.toDoubleStatistics()} on a parallel stream, because the parallel
+ * Collectors.summarizingDouble()} on a parallel stream, because the parallel
  * implementation of {@link java.util.stream.Stream#collect Stream.collect()}
  * provides the necessary partitioning, isolation, and merging of results for
  * safe and efficient parallel execution.
--- a/jdk/src/share/classes/java/util/IntSummaryStatistics.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/util/IntSummaryStatistics.java	Wed Jul 05 19:42:29 2017 +0200
@@ -54,7 +54,7 @@
  *
  * @implNote This implementation is not thread safe. However, it is safe to use
  * {@link java.util.stream.Collectors#summarizingInt(java.util.function.ToIntFunction)
- * Collectors.toIntStatistics()} on a parallel stream, because the parallel
+ * Collectors.summarizingInt()} on a parallel stream, because the parallel
  * implementation of {@link java.util.stream.Stream#collect Stream.collect()}
  * provides the necessary partitioning, isolation, and merging of results for
  * safe and efficient parallel execution.
--- a/jdk/src/share/classes/java/util/LongSummaryStatistics.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/util/LongSummaryStatistics.java	Wed Jul 05 19:42:29 2017 +0200
@@ -42,7 +42,7 @@
  * }</pre>
  *
  * <p>{@code LongSummaryStatistics} can be used as a
- * {@linkplain java.util.stream.Stream#collect(Collector)} reduction}
+ * {@linkplain java.util.stream.Stream#collect(Collector) reduction}
  * target for a {@linkplain java.util.stream.Stream stream}. For example:
  *
  * <pre> {@code
@@ -55,7 +55,7 @@
  *
  * @implNote This implementation is not thread safe. However, it is safe to use
  * {@link java.util.stream.Collectors#summarizingLong(java.util.function.ToLongFunction)
- * Collectors.toLongStatistics()} on a parallel stream, because the parallel
+ * Collectors.summarizingLong()} on a parallel stream, because the parallel
  * implementation of {@link java.util.stream.Stream#collect Stream.collect()}
  * provides the necessary partitioning, isolation, and merging of results for
  * safe and efficient parallel execution.
--- a/jdk/src/share/classes/java/util/TimeZone.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/java/util/TimeZone.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -591,8 +591,7 @@
     /**
      * Gets the platform defined TimeZone ID.
      **/
-    private static native String getSystemTimeZoneID(String javaHome,
-                                                     String country);
+    private static native String getSystemTimeZoneID(String javaHome);
 
     /**
      * Gets the custom time zone ID based on the GMT offset of the
@@ -650,12 +649,10 @@
         // if the time zone ID is not set (yet), perform the
         // platform to Java time zone ID mapping.
         if (zoneID == null || zoneID.isEmpty()) {
-            String country = AccessController.doPrivileged(
-                    new GetPropertyAction("user.country"));
             String javaHome = AccessController.doPrivileged(
                     new GetPropertyAction("java.home"));
             try {
-                zoneID = getSystemTimeZoneID(javaHome, country);
+                zoneID = getSystemTimeZoneID(javaHome);
                 if (zoneID == null) {
                     zoneID = GMT_ID;
                 }
--- a/jdk/src/share/classes/javax/accessibility/AccessibleContext.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/accessibility/AccessibleContext.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,6 +25,9 @@
 
 package javax.accessibility;
 
+import sun.awt.AWTAccessor;
+import sun.awt.AppContext;
+
 import java.util.Locale;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
@@ -79,6 +82,26 @@
  */
 public abstract class AccessibleContext {
 
+    /**
+     * The AppContext that should be used to dispatch events for this
+     * AccessibleContext
+     */
+    private volatile AppContext targetAppContext;
+
+    static {
+        AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() {
+            @Override
+            public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) {
+                accessibleContext.targetAppContext = appContext;
+            }
+
+            @Override
+            public AppContext getAppContext(AccessibleContext accessibleContext) {
+                return accessibleContext.targetAppContext;
+            }
+        });
+    }
+
    /**
     * Constant used to determine when the accessibleName property has
     * changed.  The old value in the PropertyChangeEvent will be the old
--- a/jdk/src/share/classes/javax/crypto/JceSecurity.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/crypto/JceSecurity.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -216,26 +216,28 @@
             new WeakHashMap<>();
 
     /*
-     * Retuns the CodeBase for the given class.
+     * Returns the CodeBase for the given class.
      */
     static URL getCodeBase(final Class<?> clazz) {
-        URL url = codeBaseCacheRef.get(clazz);
-        if (url == null) {
-            url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
-                public URL run() {
-                    ProtectionDomain pd = clazz.getProtectionDomain();
-                    if (pd != null) {
-                        CodeSource cs = pd.getCodeSource();
-                        if (cs != null) {
-                            return cs.getLocation();
+        synchronized (codeBaseCacheRef) {
+            URL url = codeBaseCacheRef.get(clazz);
+            if (url == null) {
+                url = AccessController.doPrivileged(new PrivilegedAction<URL>() {
+                    public URL run() {
+                        ProtectionDomain pd = clazz.getProtectionDomain();
+                        if (pd != null) {
+                            CodeSource cs = pd.getCodeSource();
+                            if (cs != null) {
+                                return cs.getLocation();
+                            }
                         }
+                        return NULL_URL;
                     }
-                    return NULL_URL;
-                }
-            });
-            codeBaseCacheRef.put(clazz, url);
+                });
+                codeBaseCacheRef.put(clazz, url);
+            }
+            return (url == NULL_URL) ? null : url;
         }
-        return (url == NULL_URL) ? null : url;
     }
 
     private static void setupJurisdictionPolicies() throws Exception {
--- a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileReader.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
 import javax.sound.sampled.UnsupportedAudioFileException;
 
 /**
- * Provider for audio file reading services.  Classes providing concrete
+ * Provider for audio file reading services. Classes providing concrete
  * implementations can parse the format information from one or more types of
  * audio file, and can produce audio input streams from files of these types.
  *
@@ -45,93 +45,106 @@
 public abstract class AudioFileReader {
 
     /**
-     * Obtains the audio file format of the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file readers may
+     * Obtains the audio file format of the input stream provided. The stream
+     * must point to valid audio file data. In general, audio file readers may
      * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an <code>IOException</code>.
-     * @param stream the input stream from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
+     * support it. These parsers must be able to mark the stream, read enough
+     * data to determine whether they support the stream, and, if not, reset the
+     * stream's read pointer to its original position. If the input stream does
+     * not support this, this method may fail with an {@code IOException}.
+     *
+     * @param  stream the input stream from which file format information should
+     *         be extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the stream does not point to
+     *         valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @see InputStream#markSupported
      * @see InputStream#mark
      */
-    public abstract AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioFileFormat getAudioFileFormat(InputStream stream)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains the audio file format of the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the URL provided. The URL must point to
+     * valid audio file data.
+     *
+     * @param  url the URL from which file format information should be
+     *         extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the URL does not point to valid
+     *         audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioFileFormat getAudioFileFormat(URL url)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains the audio file format of the <code>File</code> provided.  The <code>File</code> must
-     * point to valid audio file data.
-     * @param file the <code>File</code> from which file format information should be
-     * extracted
-     * @return an <code>AudioFileFormat</code> object describing the audio file format
-     * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
-     * file data recognized by the system
+     * Obtains the audio file format of the {@code File} provided.
+     * The {@code File} must point to valid audio file data.
+     *
+     * @param  file the {@code File} from which file format information
+     *         should be extracted
+     * @return an {@code AudioFileFormat} object describing the audio file
+     *         format
+     * @throws UnsupportedAudioFileException if the {@code File} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioFileFormat getAudioFileFormat(File file)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the input stream provided.  The stream must
-     * point to valid audio file data.  In general, audio file readers may
+     * Obtains an audio input stream from the input stream provided. The stream
+     * must point to valid audio file data. In general, audio file readers may
      * need to read some data from the stream before determining whether they
-     * support it.  These parsers must
-     * be able to mark the stream, read enough data to determine whether they
-     * support the stream, and, if not, reset the stream's read pointer to its original
-     * position.  If the input stream does not support this, this method may fail
-     * with an <code>IOException</code>.
-     * @param stream the input stream from which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data contained
-     * in the input stream.
-     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
-     * file data recognized by the system
+     * support it. These parsers must be able to mark the stream, read enough
+     * data to determine whether they support the stream, and, if not, reset the
+     * stream's read pointer to its original position. If the input stream does
+     * not support this, this method may fail with an {@code IOException}.
+     *
+     * @param  stream the input stream from which the {@code AudioInputStream}
+     *         should be constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         contained in the input stream.
+     * @throws UnsupportedAudioFileException if the stream does not point to
+     *         valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      * @see InputStream#markSupported
      * @see InputStream#mark
      */
-    public abstract AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioInputStream getAudioInputStream(InputStream stream)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the URL provided.  The URL must
-     * point to valid audio file data.
-     * @param url the URL for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the URL
-     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
-     * file data recognized by the system
+     * Obtains an audio input stream from the URL provided. The URL must point
+     * to valid audio file data.
+     *
+     * @param  url the URL for which the {@code AudioInputStream} should be
+     *         constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         pointed to by the URL
+     * @throws UnsupportedAudioFileException if the URL does not point to valid
+     *         audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioInputStream getAudioInputStream(URL url)
+            throws UnsupportedAudioFileException, IOException;
 
     /**
-     * Obtains an audio input stream from the <code>File</code> provided.  The <code>File</code> must
-     * point to valid audio file data.
-     * @param file the <code>File</code> for which the <code>AudioInputStream</code> should be
-     * constructed
-     * @return an <code>AudioInputStream</code> object based on the audio file data pointed
-     * to by the File
-     * @throws UnsupportedAudioFileException if the <code>File</code> does not point to valid audio
-     * file data recognized by the system
+     * Obtains an audio input stream from the {@code File} provided.
+     * The {@code File} must point to valid audio file data.
+     *
+     * @param  file the {@code File} for which the {@code AudioInputStream}
+     *         should be constructed
+     * @return an {@code AudioInputStream} object based on the audio file data
+     *         pointed to by the File
+     * @throws UnsupportedAudioFileException if the {@code File} does not point
+     *         to valid audio file data recognized by the system
      * @throws IOException if an I/O exception occurs
      */
-    public abstract AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException;
+    public abstract AudioInputStream getAudioInputStream(File file)
+            throws UnsupportedAudioFileException, IOException;
 }
--- a/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/AudioFileWriter.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,16 +26,15 @@
 package javax.sound.sampled.spi;
 
 import java.io.File;
-import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 
-import javax.sound.sampled.AudioFileFormat;
 import javax.sound.sampled.AudioInputStream;
 
+import static javax.sound.sampled.AudioFileFormat.Type;
 
 /**
- * Provider for audio file writing services.  Classes providing concrete
+ * Provider for audio file writing services. Classes providing concrete
  * implementations can write one or more types of audio file from an audio
  * stream.
  *
@@ -47,22 +46,23 @@
     /**
      * Obtains the file types for which file writing support is provided by this
      * audio file writer.
-     * @return array of file types.  If no file types are supported,
-     * an array of length 0 is returned.
+     *
+     * @return array of file types. If no file types are supported, an array of
+     *         length 0 is returned.
      */
-    public abstract AudioFileFormat.Type[] getAudioFileTypes();
-
+    public abstract Type[] getAudioFileTypes();
 
     /**
-     * Indicates whether file writing support for the specified file type is provided
-     * by this audio file writer.
-     * @param fileType the file type for which write capabilities are queried
-     * @return <code>true</code> if the file type is supported,
-     * otherwise <code>false</code>
+     * Indicates whether file writing support for the specified file type is
+     * provided by this audio file writer.
+     *
+     * @param  fileType the file type for which write capabilities are queried
+     * @return {@code true} if the file type is supported, otherwise
+     *         {@code false}
      */
-    public boolean isFileTypeSupported(AudioFileFormat.Type fileType) {
+    public boolean isFileTypeSupported(Type fileType) {
 
-        AudioFileFormat.Type types[] = getAudioFileTypes();
+        Type types[] = getAudioFileTypes();
 
         for(int i=0; i<types.length; i++) {
             if( fileType.equals( types[i] ) ) {
@@ -72,29 +72,29 @@
         return false;
     }
 
-
     /**
      * Obtains the file types that this audio file writer can write from the
      * audio input stream specified.
-     * @param stream the audio input stream for which audio file type support
-     * is queried
-     * @return array of file types.  If no file types are supported,
-     * an array of length 0 is returned.
+     *
+     * @param  stream the audio input stream for which audio file type support
+     *         is queried
+     * @return array of file types. If no file types are supported, an array of
+     *         length 0 is returned.
      */
-    public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream stream);
-
+    public abstract Type[] getAudioFileTypes(AudioInputStream stream);
 
     /**
-     * Indicates whether an audio file of the type specified can be written
-     * from the audio input stream indicated.
-     * @param fileType file type for which write capabilities are queried
-     * @param stream for which file writing support is queried
-     * @return <code>true</code> if the file type is supported for this audio input stream,
-     * otherwise <code>false</code>
+     * Indicates whether an audio file of the type specified can be written from
+     * the audio input stream indicated.
+     *
+     * @param  fileType file type for which write capabilities are queried
+     * @param  stream for which file writing support is queried
+     * @return {@code true} if the file type is supported for this audio input
+     *         stream, otherwise {@code false}
      */
-    public boolean isFileTypeSupported(AudioFileFormat.Type fileType, AudioInputStream stream) {
+    public boolean isFileTypeSupported(Type fileType, AudioInputStream stream) {
 
-        AudioFileFormat.Type types[] = getAudioFileTypes( stream );
+        Type types[] = getAudioFileTypes( stream );
 
         for(int i=0; i<types.length; i++) {
             if( fileType.equals( types[i] ) ) {
@@ -104,44 +104,44 @@
         return false;
     }
 
-
     /**
      * Writes a stream of bytes representing an audio file of the file type
-     * indicated to the output stream provided.  Some file types require that
+     * indicated to the output stream provided. Some file types require that
      * the length be written into the file header, and cannot be written from
-     * start to finish unless the length is known in advance.  An attempt
-     * to write such a file type will fail with an IOException if the length in
-     * the audio file format is
-     * {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED AudioSystem.NOT_SPECIFIED}.
-     * @param stream the audio input stream containing audio data to be
-     * written to the output stream
-     * @param fileType file type to be written to the output stream
-     * @param out stream to which the file data should be written
+     * start to finish unless the length is known in advance. An attempt to
+     * write such a file type will fail with an IOException if the length in the
+     * audio file format is {@link javax.sound.sampled.AudioSystem#NOT_SPECIFIED
+     * AudioSystem.NOT_SPECIFIED}.
+     *
+     * @param  stream the audio input stream containing audio data to be written
+     *         to the output stream
+     * @param  fileType file type to be written to the output stream
+     * @param  out stream to which the file data should be written
      * @return the number of bytes written to the output stream
      * @throws IOException if an I/O exception occurs
-     * @throws IllegalArgumentException if the file type is not supported by
-     * the system
-     * @see #isFileTypeSupported(AudioFileFormat.Type, AudioInputStream)
+     * @throws IllegalArgumentException if the file type is not supported by the
+     *         system
+     * @see #isFileTypeSupported(Type, AudioInputStream)
      * @see #getAudioFileTypes
      */
-    public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException;
-
+    public abstract int write(AudioInputStream stream, Type fileType,
+                              OutputStream out) throws IOException;
 
     /**
      * Writes a stream of bytes representing an audio file of the file format
      * indicated to the external file provided.
-     * @param stream the audio input stream containing audio data to be
-     * written to the file
-     * @param fileType file type to be written to the file
-     * @param out external file to which the file data should be written
+     *
+     * @param  stream the audio input stream containing audio data to be written
+     *         to the file
+     * @param  fileType file type to be written to the file
+     * @param  out external file to which the file data should be written
      * @return the number of bytes written to the file
      * @throws IOException if an I/O exception occurs
      * @throws IllegalArgumentException if the file format is not supported by
-     * the system
+     *         the system
      * @see #isFileTypeSupported
      * @see #getAudioFileTypes
      */
-    public abstract int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException;
-
-
+    public abstract int write(AudioInputStream stream, Type fileType, File out)
+            throws IOException;
 }
--- a/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/FormatConversionProvider.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,63 +25,62 @@
 
 package javax.sound.sampled.spi;
 
-import java.io.InputStream;
-
 import javax.sound.sampled.AudioFormat;
 import javax.sound.sampled.AudioInputStream;
 
+import static javax.sound.sampled.AudioFormat.Encoding;
+
 /**
- * A format conversion provider provides format conversion services
- * from one or more input formats to one or more output formats.
- * Converters include codecs, which encode and/or decode audio data,
- * as well as transcoders, etc.  Format converters provide methods for
- * determining what conversions are supported and for obtaining an audio
- * stream from which converted data can be read.
+ * A format conversion provider provides format conversion services from one or
+ * more input formats to one or more output formats. Converters include codecs,
+ * which encode and/or decode audio data, as well as transcoders, etc. Format
+ * converters provide methods for determining what conversions are supported and
+ * for obtaining an audio stream from which converted data can be read.
  * <p>
- * The source format represents the format of the incoming
- * audio data, which will be converted.
+ * The source format represents the format of the incoming audio data, which
+ * will be converted.
  * <p>
- * The target format represents the format of the processed, converted
- * audio data.  This is the format of the data that can be read from
- * the stream returned by one of the <code>getAudioInputStream</code> methods.
+ * The target format represents the format of the processed, converted audio
+ * data. This is the format of the data that can be read from the stream
+ * returned by one of the {@code getAudioInputStream} methods.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public abstract class FormatConversionProvider {
 
-
-    // NEW METHODS
+    /**
+     * Obtains the set of source format encodings from which format conversion
+     * services are provided by this provider.
+     *
+     * @return array of source format encodings. If for some reason provider
+     *         does not provide any conversion services, an array of length 0 is
+     *         returned.
+     */
+    public abstract Encoding[] getSourceEncodings();
 
     /**
-     * Obtains the set of source format encodings from which format
-     * conversion services are provided by this provider.
-     * @return array of source format encodings. If for some reason provider
-     * does not provide any conversion services, an array of length 0 is
-     * returned.
+     * Obtains the set of target format encodings to which format conversion
+     * services are provided by this provider.
+     *
+     * @return array of target format encodings. If for some reason provider
+     *         does not provide any conversion services, an array of length 0 is
+     *         returned.
      */
-    public abstract AudioFormat.Encoding[] getSourceEncodings();
-
-
-    /**
-     * Obtains the set of target format encodings to which format
-     * conversion services are provided by this provider.
-     * @return array of target format encodings. If for some reason provider
-     * does not provide any conversion services, an array of length 0 is
-     * returned.
-     */
-    public abstract AudioFormat.Encoding[] getTargetEncodings();
-
+    public abstract Encoding[] getTargetEncodings();
 
     /**
      * Indicates whether the format converter supports conversion from the
      * specified source format encoding.
-     * @param sourceEncoding the source format encoding for which support is queried
-     * @return <code>true</code> if the encoding is supported, otherwise <code>false</code>
+     *
+     * @param  sourceEncoding the source format encoding for which support is
+     *         queried
+     * @return {@code true} if the encoding is supported, otherwise
+     *         {@code false}
      */
-    public boolean isSourceEncodingSupported(AudioFormat.Encoding sourceEncoding){
+    public boolean isSourceEncodingSupported(Encoding sourceEncoding) {
 
-        AudioFormat.Encoding sourceEncodings[] = getSourceEncodings();
+        Encoding sourceEncodings[] = getSourceEncodings();
 
         for(int i=0; i<sourceEncodings.length; i++) {
             if( sourceEncoding.equals( sourceEncodings[i]) ) {
@@ -91,16 +90,18 @@
         return false;
     }
 
-
     /**
      * Indicates whether the format converter supports conversion to the
      * specified target format encoding.
-     * @param targetEncoding the target format encoding for which support is queried
-     * @return <code>true</code> if the encoding is supported, otherwise <code>false</code>
+     *
+     * @param  targetEncoding the target format encoding for which support is
+     *         queried
+     * @return {@code true} if the encoding is supported, otherwise
+     *         {@code false}
      */
-    public boolean isTargetEncodingSupported(AudioFormat.Encoding targetEncoding){
+    public boolean isTargetEncodingSupported(Encoding targetEncoding) {
 
-        AudioFormat.Encoding targetEncodings[] = getTargetEncodings();
+        Encoding targetEncodings[] = getTargetEncodings();
 
         for(int i=0; i<targetEncodings.length; i++) {
             if( targetEncoding.equals( targetEncodings[i]) ) {
@@ -110,28 +111,29 @@
         return false;
     }
 
-
     /**
-     * Obtains the set of target format encodings supported by the format converter
-     * given a particular source format.
-     * If no target format encodings are supported for this source format,
-     * an array of length 0 is returned.
-     * @param sourceFormat format of the incoming data
+     * Obtains the set of target format encodings supported by the format
+     * converter given a particular source format. If no target format encodings
+     * are supported for this source format, an array of length 0 is returned.
+     *
+     * @param  sourceFormat format of the incoming data
      * @return array of supported target format encodings.
      */
-    public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat sourceFormat);
-
+    public abstract Encoding[] getTargetEncodings(AudioFormat sourceFormat);
 
     /**
-     * Indicates whether the format converter supports conversion to a particular encoding
-     * from a particular format.
-     * @param targetEncoding desired encoding of the outgoing data
-     * @param sourceFormat format of the incoming data
-     * @return <code>true</code> if the conversion is supported, otherwise <code>false</code>
+     * Indicates whether the format converter supports conversion to a
+     * particular encoding from a particular format.
+     *
+     * @param  targetEncoding desired encoding of the outgoing data
+     * @param  sourceFormat format of the incoming data
+     * @return {@code true} if the conversion is supported, otherwise
+     *         {@code false}
      */
-    public boolean isConversionSupported(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat){
+    public boolean isConversionSupported(Encoding targetEncoding,
+                                         AudioFormat sourceFormat) {
 
-        AudioFormat.Encoding targetEncodings[] = getTargetEncodings(sourceFormat);
+        Encoding targetEncodings[] = getTargetEncodings(sourceFormat);
 
         for(int i=0; i<targetEncodings.length; i++) {
             if( targetEncoding.equals( targetEncodings[i]) ) {
@@ -141,27 +143,29 @@
         return false;
     }
 
-
     /**
-     * Obtains the set of target formats with the encoding specified
-     * supported by the format converter
-     * If no target formats with the specified encoding are supported
-     * for this source format, an array of length 0 is returned.
-     * @param targetEncoding desired encoding of the stream after processing
-     * @param sourceFormat format of the incoming data
+     * Obtains the set of target formats with the encoding specified supported
+     * by the format converter If no target formats with the specified encoding
+     * are supported for this source format, an array of length 0 is returned.
+     *
+     * @param  targetEncoding desired encoding of the stream after processing
+     * @param  sourceFormat format of the incoming data
      * @return array of supported target formats.
      */
-    public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targetEncoding, AudioFormat sourceFormat);
-
+    public abstract AudioFormat[] getTargetFormats(Encoding targetEncoding,
+                                                   AudioFormat sourceFormat);
 
     /**
      * Indicates whether the format converter supports conversion to one
      * particular format from another.
-     * @param targetFormat desired format of outgoing data
-     * @param sourceFormat format of the incoming data
-     * @return <code>true</code> if the conversion is supported, otherwise <code>false</code>
+     *
+     * @param  targetFormat desired format of outgoing data
+     * @param  sourceFormat format of the incoming data
+     * @return {@code true} if the conversion is supported, otherwise
+     *         {@code false}
      */
-    public boolean isConversionSupported(AudioFormat targetFormat, AudioFormat sourceFormat){
+    public boolean isConversionSupported(AudioFormat targetFormat,
+                                         AudioFormat sourceFormat) {
 
         AudioFormat targetFormats[] = getTargetFormats( targetFormat.getEncoding(), sourceFormat );
 
@@ -173,28 +177,33 @@
         return false;
     }
 
+    /**
+     * Obtains an audio input stream with the specified encoding from the given
+     * audio input stream.
+     *
+     * @param  targetEncoding desired encoding of the stream after processing
+     * @param  sourceStream stream from which data to be processed should be
+     *         read
+     * @return stream from which processed data with the specified target
+     *         encoding may be read
+     * @throws IllegalArgumentException if the format combination supplied is
+     *         not supported.
+     */
+    public abstract AudioInputStream getAudioInputStream(
+            Encoding targetEncoding, AudioInputStream sourceStream);
 
     /**
-     * Obtains an audio input stream with the specified encoding from the given audio
-     * input stream.
-     * @param targetEncoding desired encoding of the stream after processing
-     * @param sourceStream stream from which data to be processed should be read
-     * @return stream from which processed data with the specified target encoding may be read
+     * Obtains an audio input stream with the specified format from the given
+     * audio input stream.
+     *
+     * @param  targetFormat desired data format of the stream after processing
+     * @param  sourceStream stream from which data to be processed should be
+     *         read
+     * @return stream from which processed data with the specified format may be
+     *         read
      * @throws IllegalArgumentException if the format combination supplied is
-     * not supported.
+     *         not supported.
      */
-    public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding targetEncoding, AudioInputStream sourceStream);
-
-
-    /**
-     * Obtains an audio input stream with the specified format from the given audio
-     * input stream.
-     * @param targetFormat desired data format of the stream after processing
-     * @param sourceStream stream from which data to be processed should be read
-     * @return stream from which processed data with the specified format may be read
-     * @throws IllegalArgumentException if the format combination supplied is
-     * not supported.
-     */
-    public abstract AudioInputStream getAudioInputStream(AudioFormat targetFormat, AudioInputStream sourceStream);
-
+    public abstract AudioInputStream getAudioInputStream(
+            AudioFormat targetFormat, AudioInputStream sourceStream);
 }
--- a/jdk/src/share/classes/javax/sound/sampled/spi/MixerProvider.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/sound/sampled/spi/MixerProvider.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,28 +28,27 @@
 import javax.sound.sampled.Mixer;
 
 /**
- * A provider or factory for a particular mixer type.
- * This mechanism allows the implementation to determine
- * how resources are managed in creation / management of
- * a mixer.
+ * A provider or factory for a particular mixer type. This mechanism allows the
+ * implementation to determine how resources are managed in creation /
+ * management of a mixer.
  *
  * @author Kara Kytle
  * @since 1.3
  */
 public abstract class MixerProvider {
 
-
     /**
      * Indicates whether the mixer provider supports the mixer represented by
      * the specified mixer info object.
      * <p>
-     * The full set of mixer info objects that represent the mixers supported
-     * by this {@code MixerProvider} may be obtained
-     * through the {@code getMixerInfo} method.
+     * The full set of mixer info objects that represent the mixers supported by
+     * this {@code MixerProvider} may be obtained through the
+     * {@code getMixerInfo} method.
      *
-     * @param info an info object that describes the mixer for which support is queried
-     * @return {@code true} if the specified mixer is supported,
-     *     otherwise {@code false}
+     * @param  info an info object that describes the mixer for which support is
+     *         queried
+     * @return {@code true} if the specified mixer is supported, otherwise
+     *         {@code false}
      * @see #getMixerInfo()
      */
     public boolean isMixerSupported(Mixer.Info info) {
@@ -64,38 +63,34 @@
         return false;
     }
 
-
     /**
-     * Obtains the set of info objects representing the mixer
-     * or mixers provided by this MixerProvider.
+     * Obtains the set of info objects representing the mixer or mixers provided
+     * by this MixerProvider.
      * <p>
-     * The {@code isMixerSupported} method returns {@code true}
-     * for all the info objects returned by this method.
-     * The corresponding mixer instances for the info objects
-     * are returned by the {@code getMixer} method.
+     * The {@code isMixerSupported} method returns {@code true} for all the info
+     * objects returned by this method. The corresponding mixer instances for
+     * the info objects are returned by the {@code getMixer} method.
      *
      * @return a set of mixer info objects
-     * @see #getMixer(javax.sound.sampled.Mixer.Info) getMixer(Mixer.Info)
-     * @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)
+     * @see #getMixer(Mixer.Info)
+     * @see #isMixerSupported(Mixer.Info)
      */
     public abstract Mixer.Info[] getMixerInfo();
 
-
     /**
      * Obtains an instance of the mixer represented by the info object.
      * <p>
      * The full set of the mixer info objects that represent the mixers
-     * supported by this {@code MixerProvider} may be obtained
-     * through the {@code getMixerInfo} method.
-     * Use the {@code isMixerSupported} method to test whether
-     * this {@code MixerProvider} supports a particular mixer.
+     * supported by this {@code MixerProvider} may be obtained through the
+     * {@code getMixerInfo} method. Use the {@code isMixerSupported} method to
+     * test whether this {@code MixerProvider} supports a particular mixer.
      *
-     * @param info an info object that describes the desired mixer
+     * @param  info an info object that describes the desired mixer
      * @return mixer instance
      * @throws IllegalArgumentException if the info object specified does not
-     *     match the info object for a mixer supported by this MixerProvider.
+     *         match the info object for a mixer supported by this MixerProvider
      * @see #getMixerInfo()
-     * @see #isMixerSupported(javax.sound.sampled.Mixer.Info) isMixerSupported(Mixer.Info)
+     * @see #isMixerSupported(Mixer.Info)
      */
     public abstract Mixer getMixer(Mixer.Info info);
 }
--- a/jdk/src/share/classes/javax/swing/JComponent.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/JComponent.java	Wed Jul 05 19:42:29 2017 +0200
@@ -3986,7 +3986,18 @@
          * @see AccessibleKeyBinding
          * @since 1.4
          */
-        public AccessibleKeyBinding getAccessibleKeyBinding() {
+        public AccessibleKeyBinding getAccessibleKeyBinding(){
+            // Try to get the linked label's mnemonic if it exists
+            Object o = getClientProperty(JLabel.LABELED_BY_PROPERTY);
+            if (o instanceof Accessible){
+                AccessibleContext ac = ((Accessible) o).getAccessibleContext();
+                if (ac != null){
+                    AccessibleComponent comp = ac.getAccessibleComponent();
+                    if (! (comp instanceof AccessibleExtendedComponent))
+                        return null;
+                    return ((AccessibleExtendedComponent)comp).getAccessibleKeyBinding();
+                }
+            }
             return null;
         }
     } // inner class AccessibleJComponent
--- a/jdk/src/share/classes/javax/swing/border/BevelBorder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/border/BevelBorder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -134,7 +134,9 @@
      * when rendered on the specified component.  If no highlight
      * color was specified at instantiation, the highlight color
      * is derived from the specified component's background color.
+     *
      * @param c the component for which the highlight may be derived
+     * @return the outer highlight {@code Color}
      * @since 1.3
      */
     public Color getHighlightOuterColor(Component c)   {
@@ -148,7 +150,9 @@
      * when rendered on the specified component.  If no highlight
      * color was specified at instantiation, the highlight color
      * is derived from the specified component's background color.
+     *
      * @param c the component for which the highlight may be derived
+     * @return the inner highlight {@code Color}
      * @since 1.3
      */
     public Color getHighlightInnerColor(Component c)   {
@@ -162,7 +166,9 @@
      * when rendered on the specified component.  If no shadow
      * color was specified at instantiation, the shadow color
      * is derived from the specified component's background color.
+     *
      * @param c the component for which the shadow may be derived
+     * @return the inner shadow {@code Color}
      * @since 1.3
      */
     public Color getShadowInnerColor(Component c)      {
@@ -176,7 +182,9 @@
      * when rendered on the specified component.  If no shadow
      * color was specified at instantiation, the shadow color
      * is derived from the specified component's background color.
+     *
      * @param c the component for which the shadow may be derived
+     * @return the outer shadow {@code Color}
      * @since 1.3
      */
     public Color getShadowOuterColor(Component c)      {
@@ -189,6 +197,9 @@
      * Returns the outer highlight color of the bevel border.
      * Will return null if no highlight color was specified
      * at instantiation.
+     *
+     * @return the outer highlight {@code Color} or {@code null} if no highlight
+     *         color was specified
      * @since 1.3
      */
     public Color getHighlightOuterColor()   {
@@ -199,6 +210,9 @@
      * Returns the inner highlight color of the bevel border.
      * Will return null if no highlight color was specified
      * at instantiation.
+     *
+     * @return the inner highlight {@code Color} or {@code null} if no highlight
+     *         color was specified
      * @since 1.3
      */
     public Color getHighlightInnerColor()   {
@@ -209,6 +223,9 @@
      * Returns the inner shadow color of the bevel border.
      * Will return null if no shadow color was specified
      * at instantiation.
+     *
+     * @return the inner shadow {@code Color} or {@code null} if no shadow color
+     *         was specified
      * @since 1.3
      */
     public Color getShadowInnerColor()      {
@@ -219,6 +236,9 @@
      * Returns the outer shadow color of the bevel border.
      * Will return null if no shadow color was specified
      * at instantiation.
+     *
+     * @return the outer shadow {@code Color} or {@code null} if no shadow color
+     *         was specified
      * @since 1.3
      */
     public Color getShadowOuterColor()      {
@@ -227,13 +247,18 @@
 
     /**
      * Returns the type of the bevel border.
+     *
+     * @return the bevel border type, either {@code RAISED} or {@code LOWERED}
      */
     public int getBevelType()       {
         return bevelType;
     }
 
     /**
-     * Returns whether or not the border is opaque.
+     * Returns whether or not the border is opaque. This implementation
+     * returns {@code true}.
+     *
+     * @return true
      */
     public boolean isBorderOpaque() { return true; }
 
--- a/jdk/src/share/classes/javax/swing/border/Border.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/border/Border.java	Wed Jul 05 19:42:29 2017 +0200
@@ -66,6 +66,7 @@
     /**
      * Paints the border for the specified component with the specified
      * position and size.
+     *
      * @param c the component for which this border is being painted
      * @param g the paint graphics
      * @param x the x position of the painted border
@@ -77,7 +78,10 @@
 
     /**
      * Returns the insets of the border.
+     *
      * @param c the component for which this border insets value applies
+     * @return an {@code Insets} object containing the insets from top, left,
+     *         bottom and right of this {@code Border}
      */
     Insets getBorderInsets(Component c);
 
@@ -85,6 +89,8 @@
      * Returns whether or not the border is opaque.  If the border
      * is opaque, it is responsible for filling in it's own
      * background when painting.
+     *
+     * @return true if this {@code Border} is opaque
      */
     boolean isBorderOpaque();
 }
--- a/jdk/src/share/classes/javax/swing/border/CompoundBorder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/border/CompoundBorder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -155,6 +155,8 @@
 
     /**
      * Returns the outside border object.
+     *
+     * @return the outside {@code Border} object
      */
     public Border getOutsideBorder() {
         return outsideBorder;
@@ -162,6 +164,8 @@
 
     /**
      * Returns the inside border object.
+     *
+     * @return the inside {@code Border} object
      */
     public Border getInsideBorder() {
         return insideBorder;
--- a/jdk/src/share/classes/javax/swing/border/EmptyBorder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/border/EmptyBorder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -98,6 +98,9 @@
 
     /**
      * Returns the insets of the border.
+     *
+     * @return an {@code Insets} object containing the insets from top, left,
+     *         bottom and right
      * @since 1.3
      */
     public Insets getBorderInsets() {
--- a/jdk/src/share/classes/javax/swing/border/EtchedBorder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/border/EtchedBorder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -77,6 +77,7 @@
      * whose colors will be derived
      * from the background color of the component passed into
      * the paintBorder method.
+     *
      * @param etchType the type of etch to be drawn by the border
      */
     public EtchedBorder(int etchType)    {
@@ -86,6 +87,7 @@
     /**
      * Creates a lowered etched border with the specified highlight and
      * shadow colors.
+     *
      * @param highlight the color to use for the etched highlight
      * @param shadow the color to use for the etched shadow
      */
@@ -96,6 +98,7 @@
     /**
      * Creates an etched border with the specified etch-type,
      * highlight and shadow colors.
+     *
      * @param etchType the type of etch to be drawn by the border
      * @param highlight the color to use for the etched highlight
      * @param shadow the color to use for the etched shadow
@@ -110,6 +113,7 @@
     /**
      * Paints the border for the specified component with the
      * specified position and size.
+     *
      * @param c the component for which this border is being painted
      * @param g the paint graphics
      * @param x the x position of the painted border
@@ -138,6 +142,7 @@
 
     /**
      * Reinitialize the insets parameter with this Border's current Insets.
+     *
      * @param c the component for which this border insets value applies
      * @param insets the object to be reinitialized
      */
@@ -148,11 +153,16 @@
 
     /**
      * Returns whether or not the border is opaque.
+     * This implementation returns true.
+     *
+     * @return true
      */
     public boolean isBorderOpaque() { return true; }
 
     /**
      * Returns which etch-type is set on the etched border.
+     *
+     * @return the etched border type, either {@code RAISED} or {@code LOWERED}
      */
     public int getEtchType() {
         return etchType;
@@ -163,7 +173,9 @@
      * when rendered on the specified component.  If no highlight
      * color was specified at instantiation, the highlight color
      * is derived from the specified component's background color.
+     *
      * @param c the component for which the highlight may be derived
+     * @return the highlight {@code Color} of this {@code EtchedBorder}
      * @since 1.3
      */
     public Color getHighlightColor(Component c)   {
@@ -175,6 +187,9 @@
      * Returns the highlight color of the etched border.
      * Will return null if no highlight color was specified
      * at instantiation.
+     *
+     * @return the highlight {@code Color} of this {@code EtchedBorder} or null
+     *         if none was specified
      * @since 1.3
      */
     public Color getHighlightColor()   {
@@ -186,7 +201,9 @@
      * when rendered on the specified component.  If no shadow
      * color was specified at instantiation, the shadow color
      * is derived from the specified component's background color.
+     *
      * @param c the component for which the shadow may be derived
+     * @return the shadow {@code Color} of this {@code EtchedBorder}
      * @since 1.3
      */
     public Color getShadowColor(Component c)   {
@@ -197,6 +214,9 @@
      * Returns the shadow color of the etched border.
      * Will return null if no shadow color was specified
      * at instantiation.
+     *
+     * @return the shadow {@code Color} of this {@code EtchedBorder} or null
+     *         if none was specified
      * @since 1.3
      */
     public Color getShadowColor()   {
--- a/jdk/src/share/classes/javax/swing/border/LineBorder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/border/LineBorder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -60,8 +60,11 @@
     protected Color lineColor;
     protected boolean roundedCorners;
 
-    /** Convenience method for getting the Color.black LineBorder of thickness 1.
-      */
+    /**
+     * Convenience method for getting the Color.black LineBorder of thickness 1.
+     *
+     * @return a {@code LineBorder} with {@code Color.black} and thickness of 1
+     */
     public static Border createBlackLineBorder() {
         if (blackLine == null) {
             blackLine = new LineBorder(Color.black, 1);
@@ -69,8 +72,11 @@
         return blackLine;
     }
 
-    /** Convenience method for getting the Color.gray LineBorder of thickness 1.
-      */
+    /**
+     * Convenience method for getting the Color.gray LineBorder of thickness 1.
+     *
+     * @return a {@code LineBorder} with {@code Color.gray} and thickness of 1
+     */
     public static Border createGrayLineBorder() {
         if (grayLine == null) {
             grayLine = new LineBorder(Color.gray, 1);
@@ -81,6 +87,7 @@
     /**
      * Creates a line border with the specified color and a
      * thickness = 1.
+     *
      * @param color the color for the border
      */
     public LineBorder(Color color) {
@@ -89,6 +96,7 @@
 
     /**
      * Creates a line border with the specified color and thickness.
+     *
      * @param color the color of the border
      * @param thickness the thickness of the border
      */
@@ -99,6 +107,7 @@
     /**
      * Creates a line border with the specified color, thickness,
      * and corner shape.
+     *
      * @param color the color of the border
      * @param thickness the thickness of the border
      * @param roundedCorners whether or not border corners should be round
@@ -114,6 +123,7 @@
     /**
      * Paints the border for the specified component with the
      * specified position and size.
+     *
      * @param c the component for which this border is being painted
      * @param g the paint graphics
      * @param x the x position of the painted border
@@ -134,8 +144,8 @@
             int offs = this.thickness;
             int size = offs + offs;
             if (this.roundedCorners) {
-                int arc = offs + size;
-                outer = new RoundRectangle2D.Float(x, y, width, height, arc, arc);
+                float arc = .2f * offs;
+                outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
                 inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
             }
             else {
@@ -152,6 +162,7 @@
 
     /**
      * Reinitialize the insets parameter with this Border's current Insets.
+     *
      * @param c the component for which this border insets value applies
      * @param insets the object to be reinitialized
      */
@@ -162,6 +173,8 @@
 
     /**
      * Returns the color of the border.
+     *
+     * @return a {@code Color} object representing the color of this object
      */
     public Color getLineColor()     {
         return lineColor;
@@ -169,6 +182,8 @@
 
     /**
      * Returns the thickness of the border.
+     *
+     * @return the thickness of this border
      */
     public int getThickness()       {
         return thickness;
@@ -176,6 +191,8 @@
 
     /**
      * Returns whether this border will be drawn with rounded corners.
+     *
+     * @return {@code true} if this border should have rounded corners
      * @since 1.3
      */
     public boolean getRoundedCorners() {
@@ -184,6 +201,8 @@
 
     /**
      * Returns whether or not the border is opaque.
+     *
+     * @return {@code true} if the border is opaque, {@code false} otherwise
      */
     public boolean isBorderOpaque() {
         return !roundedCorners;
--- a/jdk/src/share/classes/javax/swing/border/MatteBorder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/border/MatteBorder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -196,6 +196,9 @@
     /**
      * Returns the color used for tiling the border or null
      * if a tile icon is being used.
+     *
+     * @return the {@code Color} object used to render the border or {@code null}
+     *         if a tile icon is used
      * @since 1.3
      */
     public Color getMatteColor() {
@@ -205,6 +208,9 @@
    /**
      * Returns the icon used for tiling the border or null
      * if a solid color is being used.
+     *
+     * @return the {@code Icon} used to tile the border or {@code null} if a
+     *         solid color is used to fill the border
      * @since 1.3
      */
     public Icon getTileIcon() {
@@ -213,6 +219,8 @@
 
     /**
      * Returns whether or not the border is opaque.
+     *
+     * @return {@code true} if the border is opaque, {@code false} otherwise
      */
     public boolean isBorderOpaque() {
         // If a tileIcon is set, then it may contain transparent bits
--- a/jdk/src/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -145,7 +145,8 @@
     /**
      * Invoked when the panel is added to the chooser.
      * If you override this, be sure to call <code>super</code>.
-     * @param enclosingChooser  the panel to be added
+     *
+     * @param enclosingChooser the chooser to which the panel is to be added
      * @exception RuntimeException  if the chooser panel has already been
      *                          installed
      */
@@ -163,6 +164,8 @@
     /**
      * Invoked when the panel is removed from the chooser.
      * If override this, be sure to call <code>super</code>.
+     *
+     * @param enclosingChooser the chooser from which the panel is to be removed
      */
   public void uninstallChooserPanel(JColorChooser enclosingChooser) {
         chooser.removePropertyChangeListener("enabled", enabledListener);
--- a/jdk/src/share/classes/javax/swing/filechooser/FileFilter.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileFilter.java	Wed Jul 05 19:42:29 2017 +0200
@@ -51,11 +51,16 @@
 public abstract class FileFilter {
     /**
      * Whether the given file is accepted by this filter.
+     *
+     * @param f the File to test
+     * @return true if the file is to be accepted
      */
     public abstract boolean accept(File f);
 
     /**
      * The description of this filter. For example: "JPG and GIF Images"
+     *
+     * @return the description of this filter
      * @see FileView#getName
      */
     public abstract String getDescription();
--- a/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileSystemView.java	Wed Jul 05 19:42:29 2017 +0200
@@ -324,11 +324,18 @@
 
     /**
      * Creates a new folder with a default folder name.
+     *
+     * @param containingDir a {@code File} object denoting directory to contain the new folder
+     * @return a {@code File} object denoting the newly created folder
+     * @throws IOException if new folder could not be created
      */
     public abstract File createNewFolder(File containingDir) throws IOException;
 
     /**
      * Returns whether a file is hidden or not.
+     *
+     * @param f a {@code File} object
+     * @return true if the given {@code File} denotes a hidden file
      */
     public boolean isHiddenFile(File f) {
         return f.isHidden();
@@ -395,6 +402,9 @@
      * Returns all root partitions on this system. For example, on
      * Windows, this would be the "Desktop" folder, while on DOS this
      * would be the A: through Z: drives.
+     *
+     * @return an array of {@code File} objects representing all root partitions
+     *         on this system
      */
     public File[] getRoots() {
         // Don't cache this array, because filesystem might change
@@ -435,6 +445,10 @@
 
     /**
      * Returns a File object constructed in dir from the given filename.
+     *
+     * @param dir an abstract pathname denoting a directory
+     * @param filename a {@code String} representation of a pathname
+     * @return a {@code File} object created from {@code dir} and {@code filename}
      */
     public File createFileObject(File dir, String filename) {
         if(dir == null) {
@@ -446,6 +460,9 @@
 
     /**
      * Returns a File object constructed from the given path string.
+     *
+     * @param path {@code String} representation of path
+     * @return a {@code File} object created from the given {@code path}
      */
     public File createFileObject(String path) {
         File f = new File(path);
@@ -458,6 +475,12 @@
 
     /**
      * Gets the list of shown (i.e. not hidden) files.
+     *
+     * @param dir the root directory of files to be returned
+     * @param useFileHiding determine if hidden files are returned
+     * @return an array of {@code File} objects representing files and
+     *         directories in the given {@code dir}. It includes hidden
+     *         files if {@code useFileHiding} is false.
      */
     public File[] getFiles(File dir, boolean useFileHiding) {
         List<File> files = new ArrayList<File>();
--- a/jdk/src/share/classes/javax/swing/filechooser/FileView.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/filechooser/FileView.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,9 @@
     /**
      * The name of the file. Normally this would be simply
      * <code>f.getName()</code>.
+     *
+     * @param f a {@code File} object
+     * @return a {@code String} representing the name of the file
      */
     public String getName(File f) {
         return null;
@@ -78,6 +81,11 @@
      * A human readable description of the file. For example,
      * a file named <i>jag.jpg</i> might have a description that read:
      * "A JPEG image file of James Gosling's face".
+     *
+     * @param f a {@code File} object
+     * @return a {@code String} containing a description of the file or
+     *         {@code null} if it is not available.
+     *
      */
     public String getDescription(File f) {
         return null;
@@ -87,6 +95,10 @@
      * A human readable description of the type of the file. For
      * example, a <code>jpg</code> file might have a type description of:
      * "A JPEG Compressed Image File"
+     *
+     * @param f a {@code File} object
+     * @return a {@code String} containing a description of the type of the file
+     *         or {@code null} if it is not available   .
      */
     public String getTypeDescription(File f) {
         return null;
@@ -94,6 +106,10 @@
 
     /**
      * The icon that represents this file in the <code>JFileChooser</code>.
+     *
+     * @param f a {@code File} object
+     * @return an {@code Icon} which represents the specified {@code File} or
+     *         {@code null} if it is not available.
      */
     public Icon getIcon(File f) {
         return null;
@@ -103,6 +119,12 @@
      * Whether the directory is traversable or not. This might be
      * useful, for example, if you want a directory to represent
      * a compound document and don't want the user to descend into it.
+     *
+     * @param f a {@code File} object representing a directory
+     * @return {@code true} if the directory is traversable,
+     *         {@code false} if it is not, and {@code null} if the
+     *         file system should be checked.
+     * @see FileSystemView#isTraversable
      */
     public Boolean isTraversable(File f) {
         return null;
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -2271,6 +2271,7 @@
 
     // From the JLF Design Guidelines:
     // http://www.oracle.com/technetwork/java/jlf-135985.html
+    @SuppressWarnings("fallthrough")
     private static class MetalLayoutStyle extends DefaultLayoutStyle {
         private static MetalLayoutStyle INSTANCE = new MetalLayoutStyle();
 
@@ -2407,4 +2408,4 @@
             return 0;
         }
     }
-}
\ No newline at end of file
+}
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/skin.laf	Wed Jul 05 19:42:29 2017 +0200
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
- Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -13424,10 +13424,10 @@
             <state stateKeys="Selected">
                 <style>
                    <textForeground>
-                      <matte red="255" green="255" blue="255" alpha="255" uiDefaultParentName="nimbusLightBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                      <matte red="255" green="255" blue="255" alpha="255" uiDefaultParentName="nimbusLightBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textForeground>
                    <textBackground>
-                      <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                      <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textBackground>
                    <background/>
                    <inherit-textForeground>false</inherit-textForeground>
@@ -13453,7 +13453,7 @@
                 <style>
                    <textForeground/>
                    <textBackground>
-                       <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                       <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textBackground>
                    <background/>
                    <inherit-textBackground>false</inherit-textBackground>
@@ -13477,7 +13477,7 @@
             <state stateKeys="Disabled">
                 <style>
                    <textForeground>
-                      <matte red="142" green="143" blue="145" alpha="255" uiDefaultParentName="nimbusDisabledText" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                      <matte red="142" green="143" blue="145" alpha="255" uiDefaultParentName="nimbusDisabledText" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                    </textForeground>
                    <textBackground/>
                    <background/>
@@ -13520,7 +13520,7 @@
                         </textForeground>
                         <textBackground/>
                         <background>
-                           <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0" uiResource="false"/>
+                           <matte red="57" green="105" blue="138" alpha="255" uiDefaultParentName="nimbusSelectionBackground" hueOffset="0.0" saturationOffset="0.0" brightnessOffset="0.0" alphaOffset="0"/>
                         </background>
                         <inherit-textForeground>false</inherit-textForeground>
                         <inherit-background>false</inherit-background>
--- a/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/JTextComponent.java	Wed Jul 05 19:42:29 2017 +0200
@@ -4473,6 +4473,7 @@
     // composed(uncommitted) text is done here after all input
     // method listeners get called for stealing the events.
     //
+    @SuppressWarnings("fallthrough")
     protected void processInputMethodEvent(InputMethodEvent e) {
         // let listeners handle the events
         super.processInputMethodEvent(e);
--- a/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/html/StyleSheet.java	Wed Jul 05 19:42:29 2017 +0200
@@ -2324,6 +2324,7 @@
          * @param itemNum number to format
          * @param type    type of ordered list
          */
+        @SuppressWarnings("fallthrough")
         String formatItemNum(int itemNum, char type) {
             String numStyle = "1";
 
--- a/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/AttributeList.java	Wed Jul 05 19:42:29 2017 +0200
@@ -59,6 +59,8 @@
 
     /**
      * Create an attribute list element.
+     *
+     * @param name  the attribute name
      */
     public AttributeList(String name) {
         this.name = name;
@@ -66,6 +68,13 @@
 
     /**
      * Create an attribute list element.
+     *
+     * @param name      the attribute name
+     * @param type      the attribute type
+     * @param modifier  the attribute modifier
+     * @param value     the default attribute value
+     * @param values    the possible attribute values
+     * @param next      the next attribute in the list
      */
     public AttributeList(String name, int type, int modifier, String value, Vector<?> values, AttributeList next) {
         this.name = name;
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -62,6 +62,8 @@
 
     /**
      * Create a content model for an element.
+     *
+     * @param content  the element
      */
     public ContentModel(Element content) {
         this(0, content, null);
@@ -69,6 +71,9 @@
 
     /**
      * Create a content model of a particular type.
+     *
+     * @param type     the type
+     * @param content  the content
      */
     public ContentModel(int type, ContentModel content) {
         this(type, content, null);
@@ -76,6 +81,10 @@
 
     /**
      * Create a content model of a particular type.
+     *
+     * @param type     the type
+     * @param content  the content
+     * @param next     the next content model
      */
     public ContentModel(int type, Object content, ContentModel next) {
         this.type = type;
@@ -86,6 +95,9 @@
     /**
      * Return true if the content model could
      * match an empty input stream.
+     *
+     * @return {@code true} if the content model could
+     *         match an empty input stream
      */
     public boolean empty() {
         switch (type) {
@@ -119,6 +131,8 @@
     /**
      * Update elemVec with the list of elements that are
      * part of the this contentModel.
+     *
+     * @param elemVec  the list of elements
      */
      public void getElements(Vector<Element> elemVec) {
          switch (type) {
@@ -148,6 +162,11 @@
     /**
      * Return true if the token could potentially be the
      * first token in the input stream.
+     *
+     * @param token  the token
+     *
+     * @return {@code true} if the token could potentially be the first token
+     *         in the input stream
      */
     public boolean first(Object token) {
         switch (type) {
@@ -206,6 +225,8 @@
 
     /**
      * Return the element that must be next.
+     *
+     * @return the element that must be next
      */
     public Element first() {
         switch (type) {
@@ -226,6 +247,8 @@
 
     /**
      * Convert to a string.
+     *
+     * @return the string representation of this {@code ContentModel}
      */
     public String toString() {
         switch (type) {
--- a/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/ContentModelState.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,12 +92,14 @@
      * tokens required in the input stream.
      * @return true if the model can terminate without further input
      */
+    @SuppressWarnings("fallthrough")
     public boolean terminate() {
         switch (model.type) {
           case '+':
             if ((value == 0) && !(model).empty()) {
                 return false;
             }
+            // Fall through
           case '*':
           case '?':
             return (next == null) || next.terminate();
--- a/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/DTD.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,6 +102,7 @@
 
     /**
      * Gets an entity by name.
+     * @param name  the entity name
      * @return the <code>Entity</code> corresponding to the
      *   <code>name</code> <code>String</code>
      */
@@ -111,6 +112,7 @@
 
     /**
      * Gets a character entity.
+     * @param ch  the character
      * @return the <code>Entity</code> corresponding to the
      *    <code>ch</code> character
      */
@@ -193,13 +195,15 @@
      * specified parameters.  If one doesn't exist, a new
      * one is created and returned.
      *
-     * @param name the name of the <code>Element</code>
-     * @param type the type of the <code>Element</code>
-     * @param omitStart <code>true</code> if start should be omitted
-     * @param omitEnd  <code>true</code> if end should be omitted
-     * @param content  the <code>ContentModel</code>
-     * @param atts the <code>AttributeList</code> specifying the
-     *    <code>Element</code>
+     * @param name        the name of the <code>Element</code>
+     * @param type        the type of the <code>Element</code>
+     * @param omitStart   <code>true</code> if start should be omitted
+     * @param omitEnd     <code>true</code> if end should be omitted
+     * @param content     the <code>ContentModel</code>
+     * @param exclusions  the set of elements that must not occur inside the element
+     * @param inclusions  the set of elements that can occur inside the element
+     * @param atts        the <code>AttributeList</code> specifying the
+     *                    <code>Element</code>
      * @return the <code>Element</code> specified
      */
     public Element defineElement(String name, int type,
@@ -231,6 +235,8 @@
     /**
      * Creates and returns a character <code>Entity</code>.
      * @param name the entity's name
+     * @param type the entity's type
+     * @param ch   the entity's value (character)
      * @return the new character <code>Entity</code>
      */
     public Entity defEntity(String name, int type, int ch) {
@@ -241,6 +247,8 @@
     /**
      * Creates and returns an <code>Entity</code>.
      * @param name the entity's name
+     * @param type the entity's type
+     * @param str  the entity's data section
      * @return the new <code>Entity</code>
      */
     protected Entity defEntity(String name, int type, String str) {
@@ -252,7 +260,14 @@
 
     /**
      * Creates and returns an <code>Element</code>.
-     * @param name the element's name
+     * @param name        the element's name
+     * @param type        the element's type
+     * @param omitStart   {@code true} if the element needs no starting tag
+     * @param omitEnd     {@code true} if the element needs no closing tag
+     * @param content     the element's content
+     * @param exclusions  the elements that must be excluded from the content of the element
+     * @param inclusions  the elements that can be included as the content of the element
+     * @param atts        the attributes of the element
      * @return the new <code>Element</code>
      */
     protected Element defElement(String name, int type,
@@ -280,11 +295,18 @@
     }
 
     /**
-     * Creates and returns an <code>AttributeList</code>.
-     * @param name the attribute list's name
+     * Creates and returns an <code>AttributeList</code> responding to a new attribute.
+     * @param name      the attribute's name
+     * @param type      the attribute's type
+     * @param modifier  the attribute's modifier
+     * @param value     the default value of the attribute
+     * @param values    the allowed values for the attribute (multiple values could be separated by '|')
+     * @param atts      the previous attribute of the element; to be placed to {@code AttributeList.next},
+     *                  creating a linked list
      * @return the new <code>AttributeList</code>
      */
-    protected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts) {
+    protected AttributeList defAttributeList(String name, int type, int modifier,
+                                             String value, String values, AttributeList atts) {
         Vector<String> vals = null;
         if (values != null) {
             vals = new Vector<String>();
@@ -301,6 +323,8 @@
     /**
      * Creates and returns a new content model.
      * @param type the type of the new content model
+     * @param obj  the content of the content model
+     * @param next pointer to the next content model
      * @return the new <code>ContentModel</code>
      */
     protected ContentModel defContentModel(int type, Object obj, ContentModel next) {
@@ -332,6 +356,7 @@
      *
      * @param name the name of the DTD
      * @return the DTD which corresponds to <code>name</code>
+     * @throws IOException if an I/O error occurs
      */
     public static DTD getDTD(String name) throws IOException {
         name = name.toLowerCase();
@@ -359,6 +384,7 @@
     /**
      * Recreates a DTD from an archived format.
      * @param in  the <code>DataInputStream</code> to read from
+     * @throws IOException if an I/O error occurs
      */
     public void read(DataInputStream in) throws IOException {
         if (in.readInt() != FILE_VERSION) {
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Element.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Element.java	Wed Jul 05 19:42:29 2017 +0200
@@ -64,6 +64,9 @@
 
     /**
      * Create a new element.
+     *
+     * @param name   the name of the element
+     * @param index  the index
      */
     Element(String name, int index) {
         this.name = name;
@@ -84,6 +87,8 @@
 
     /**
      * Get the name of the element.
+     *
+     * @return  the name of the element
      */
     public String getName() {
         return name;
@@ -91,6 +96,8 @@
 
     /**
      * Return true if the start tag can be omitted.
+     *
+     * @return  {@code true} if the start tag can be omitted
      */
     public boolean omitStart() {
         return oStart;
@@ -98,6 +105,8 @@
 
     /**
      * Return true if the end tag can be omitted.
+     *
+     * @return  {@code true} if the end tag can be omitted
      */
     public boolean omitEnd() {
         return oEnd;
@@ -105,6 +114,8 @@
 
     /**
      * Get type.
+     *
+     * @return  the type of the element
      */
     public int getType() {
         return type;
@@ -112,6 +123,8 @@
 
     /**
      * Get content model
+     *
+     * @return  the content model
      */
     public ContentModel getContent() {
         return content;
@@ -119,6 +132,8 @@
 
     /**
      * Get the attributes.
+     *
+     * @return  the {@code AttributeList} specifying the element
      */
     public AttributeList getAttributes() {
         return atts;
@@ -126,6 +141,8 @@
 
     /**
      * Get index.
+     *
+     * @return the element index
      */
     public int getIndex() {
         return index;
@@ -133,6 +150,8 @@
 
     /**
      * Check if empty
+     *
+     * @return  true if the current element is empty
      */
     public boolean isEmpty() {
         return type == EMPTY;
@@ -140,6 +159,8 @@
 
     /**
      * Convert to a string.
+     *
+     * @return  a string representation for the given {@code Element} instance
      */
     public String toString() {
         return name;
@@ -147,6 +168,10 @@
 
     /**
      * Get an attribute by name.
+     *
+     * @param name  the attribute name
+     *
+     * @return the {@code AttributeList} for the given {@code name}
      */
     public AttributeList getAttribute(String name) {
         for (AttributeList a = atts ; a != null ; a = a.next) {
@@ -159,10 +184,14 @@
 
     /**
      * Get an attribute by value.
+     *
+     * @param value  the string representation of value
+     *
+     * @return  the {@code AttributeList} for the given {@code value}
      */
-    public AttributeList getAttributeByValue(String name) {
+    public AttributeList getAttributeByValue(String value) {
         for (AttributeList a = atts ; a != null ; a = a.next) {
-            if ((a.values != null) && a.values.contains(name)) {
+            if ((a.values != null) && a.values.contains(value)) {
                 return a;
             }
         }
--- a/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/html/parser/Parser.java	Wed Jul 05 19:42:29 2017 +0200
@@ -216,6 +216,8 @@
      * the current comment tag, text, block.... This is provided for
      * subclassers that wish to know the start of the current block when
      * called with one of the handleXXX methods.
+     *
+     * @return the start position of the current block
      */
     int getBlockStartPosition() {
         return Math.max(0, lastBlockStartPos - 1);
@@ -223,31 +225,55 @@
 
     /**
      * Makes a TagElement.
+     *
+     * @param elem       the element storing the tag definition
+     * @param fictional  the value of the flag "{@code fictional}" to be set for the tag
+     *
+     * @return the created {@code TagElement}
      */
     protected TagElement makeTag(Element elem, boolean fictional) {
         return new TagElement(elem, fictional);
     }
 
+    /**
+     * Makes a TagElement.
+     *
+     * @param elem  the element storing the tag definition
+     *
+     * @return the created {@code TagElement}
+     */
     protected TagElement makeTag(Element elem) {
         return makeTag(elem, false);
     }
 
+    /**
+     * Returns attributes for the current tag.
+     *
+     * @return {@code SimpleAttributeSet} containing the attributes
+     */
     protected SimpleAttributeSet getAttributes() {
         return attributes;
     }
 
+    /**
+     * Removes the current attributes.
+     */
     protected void flushAttributes() {
         attributes.removeAttributes(attributes);
     }
 
     /**
      * Called when PCDATA is encountered.
+     *
+     * @param text  the section text
      */
     protected void handleText(char text[]) {
     }
 
     /**
      * Called when an HTML title tag is encountered.
+     *
+     * @param text  the title text
      */
     protected void handleTitle(char text[]) {
         // default behavior is to call handleText. Subclasses
@@ -257,10 +283,15 @@
 
     /**
      * Called when an HTML comment is encountered.
+     *
+     * @param text  the comment being handled
      */
     protected void handleComment(char text[]) {
     }
 
+    /**
+     * Called when the content terminates without closing the HTML comment.
+     */
     protected void handleEOFInComment() {
         // We've reached EOF.  Our recovery strategy is to
         // see if we have more than one line in the comment;
@@ -288,24 +319,34 @@
 
     /**
      * Called when an empty tag is encountered.
+     *
+     * @param tag  the tag being handled
+     * @throws ChangedCharSetException if the document charset was changed
      */
     protected void handleEmptyTag(TagElement tag) throws ChangedCharSetException {
     }
 
     /**
      * Called when a start tag is encountered.
+     *
+     * @param tag  the tag being handled
      */
     protected void handleStartTag(TagElement tag) {
     }
 
     /**
      * Called when an end tag is encountered.
+     *
+     * @param tag  the tag being handled
      */
     protected void handleEndTag(TagElement tag) {
     }
 
     /**
      * An error has occurred.
+     *
+     * @param ln   the number of line containing the error
+     * @param msg  the error message
      */
     protected void handleError(int ln, String msg) {
         /*
@@ -368,7 +409,12 @@
     }
 
     /**
-     * Invoke the error handler.
+     * Invokes the error handler.
+     *
+     * @param err   the error type
+     * @param arg1  the 1st error message argument
+     * @param arg2  the 2nd error message argument
+     * @param arg3  the 3rd error message argument
      */
     protected void error(String err, String arg1, String arg2,
         String arg3) {
@@ -390,6 +436,9 @@
      * Handle a start tag. The new tag is pushed
      * onto the tag stack. The attribute list is
      * checked for required attributes.
+     *
+     * @param tag  the tag
+     * @throws ChangedCharSetException if the document charset was changed
      */
     protected void startTag(TagElement tag) throws ChangedCharSetException {
         Element elem = tag.getElement();
@@ -441,6 +490,9 @@
     /**
      * Handle an end tag. The end tag is popped
      * from the tag stack.
+     *
+     * @param omitted  {@code true} if the tag is no actually present in the
+     *                 document, but is supposed by the parser
      */
     protected void endTag(boolean omitted) {
         handleText(stack.tag);
@@ -498,6 +550,8 @@
 
     /**
      * Marks the first time a tag has been seen in a document
+     *
+     * @param elem  the element represented by the tag
      */
 
     protected void markFirstTime(Element elem) {
@@ -852,6 +906,7 @@
             if (lower) {
                 ch = 'a' + (ch - 'A');
             }
+            break;
 
           case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
           case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -876,6 +931,7 @@
                 if (lower) {
                     ch = 'a' + (ch - 'A');
                 }
+                break;
 
               case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
               case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
@@ -1214,6 +1270,7 @@
     /**
      * Parse attribute value. [33] 331:1
      */
+    @SuppressWarnings("fallthrough")
     String parseAttributeValue(boolean lower) throws IOException {
         int delim = -1;
 
@@ -1258,6 +1315,7 @@
               case '\t':
                   if (delim < 0)
                       c = ' ';
+                  // Fall through
               case ' ':
                 ch = readCh();
                 if (delim < 0) {
@@ -1478,8 +1536,11 @@
     }
 
     /**
-     * Parses th Document Declaration Type markup declaration.
+     * Parses the Document Type Declaration markup declaration.
      * Currently ignores it.
+     *
+     * @return the string representation of the markup declaration
+     * @throws IOException if an I/O error occurs
      */
     public String parseDTDMarkup() throws IOException {
 
@@ -1523,6 +1584,11 @@
      * Parse markup declarations.
      * Currently only handles the Document Type Declaration markup.
      * Returns true if it is a markup declaration false otherwise.
+     *
+     * @param strBuff  the markup declaration
+     * @return {@code true} if this is a valid markup declaration;
+     *         otherwise {@code false}
+     * @throws IOException if an I/O error occurs
      */
     protected boolean parseMarkupDeclarations(StringBuffer strBuff) throws IOException {
 
@@ -1559,6 +1625,7 @@
     /**
      * Parse a start or end tag.
      */
+    @SuppressWarnings("fallthrough")
     void parseTag() throws IOException {
         Element elem;
         boolean net = false;
@@ -1602,6 +1669,7 @@
                         continue;
                       case '>':
                         ch = readCh();
+                        return;
                       case -1:
                         return;
                       default:
@@ -1626,6 +1694,7 @@
                     switch(ch) {
                       case '>':
                         ch = readCh();
+                        // Fall through
                       case -1:
                         error("invalid.markup");
                         return;
@@ -1657,6 +1726,7 @@
             switch (ch = readCh()) {
               case '>':
                 ch = readCh();
+                // Fall through
               case '<':
                 // empty end tag. either </> or </<
                 if (recent == null) {
@@ -1675,6 +1745,7 @@
                 switch (ch) {
                   case '>':
                     ch = readCh();
+                    break;
                   case '<':
                     break;
 
@@ -1875,6 +1946,7 @@
         switch (ch) {
           case '/':
             net = true;
+            // Fall through
           case '>':
             ch = readCh();
             if (ch == '>' && net) {
@@ -2236,6 +2308,9 @@
 
     /**
      * Parse an HTML stream, given a DTD.
+     *
+     * @param in  the reader to read the source from
+     * @throws IOException if an I/O error occurs
      */
     public synchronized void parse(Reader in) throws IOException {
         this.in = in;
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFGenerator.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -868,6 +868,7 @@
     afterKeyword = false;
 }
 
+@SuppressWarnings("fallthrough")
 public void writeCharacter(char ch)
     throws IOException
 {
--- a/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/text/rtf/RTFParser.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,6 +148,7 @@
       handleText(s);
   }
 
+  @SuppressWarnings("fallthrough")
   public void write(char ch)
     throws IOException
   {
--- a/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/AbstractLayoutCache.java	Wed Jul 05 19:42:29 2017 +0200
@@ -149,6 +149,8 @@
      * Returns the height of each row.  If the returned value is less than
      * or equal to 0 the height for each row is determined by the
      * renderer.
+     *
+     * @return the height of each row
      */
     public int getRowHeight() {
         return rowHeight;
@@ -263,6 +265,9 @@
 
     /**
       * Returns true if the value identified by row is currently expanded.
+      *
+      * @param path TreePath to check
+      * @return whether TreePath is expanded
       */
     public abstract boolean isExpanded(TreePath path);
 
@@ -496,6 +501,8 @@
 
     /**
       * Returns true if the height of each row is a fixed size.
+      *
+      * @return whether the height of each row is a fixed size
       */
     protected boolean isFixedRowHeight() {
         return (rowHeight > 0);
--- a/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultMutableTreeNode.java	Wed Jul 05 19:42:29 2017 +0200
@@ -534,6 +534,7 @@
      * Returns true if and only if <code>aNode</code> is in the same tree
      * as this node.  Returns false if <code>aNode</code> is null.
      *
+     * @param   aNode node to find common ancestor with
      * @see     #getSharedAncestor
      * @see     #getRoot
      * @return  true if <code>aNode</code> is in the same tree as this node;
@@ -638,6 +639,8 @@
       * Returns the user object path, from the root, to get to this node.
       * If some of the TreeNodes in the path have null user objects, the
       * returned path will contain nulls.
+      *
+      * @return the user object path, from the root, to get to this node
       */
     public Object[] getUserObjectPath() {
         TreeNode[]          realPath = getPath();
@@ -828,6 +831,7 @@
      * Modifying the tree by inserting, removing, or moving a node invalidates
      * any enumerations created before the modification.
      *
+     * @param           ancestor the node to start enumeration from
      * @see             #isNodeAncestor
      * @see             #isNodeDescendant
      * @exception       IllegalArgumentException if <code>ancestor</code> is
@@ -848,6 +852,7 @@
      * Returns true if <code>aNode</code> is a child of this node.  If
      * <code>aNode</code> is null, this method returns false.
      *
+     * @param   aNode the node to determinate whether it is a child
      * @return  true if <code>aNode</code> is a child of this node; false if
      *                  <code>aNode</code> is null
      */
@@ -906,6 +911,7 @@
      * <code>aChild</code> and is O(n) where n is the number of children; to
      * traverse the entire array of children, use an enumeration instead.
      *
+     * @param           aChild the child node to look for next child after it
      * @see             #children
      * @exception       IllegalArgumentException if <code>aChild</code> is
      *                                  null or is not a child of this node
@@ -938,6 +944,7 @@
      * performs a linear search of this node's children for <code>aChild</code>
      * and is O(n) where n is the number of children.
      *
+     * @param           aChild the child node to look for previous child before it
      * @exception       IllegalArgumentException if <code>aChild</code> is null
      *                                          or is not a child of this node
      * @return  the child of this node that immediately precedes
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellEditor.java	Wed Jul 05 19:42:29 2017 +0200
@@ -405,7 +405,9 @@
     /**
      * Returns true if <code>event</code> is a <code>MouseEvent</code>
      * and the click count is 1.
-     * @param event  the event being studied
+     *
+     * @param event the event being studied
+     * @return whether {@code event} should starts the editing timer
      */
     protected boolean shouldStartEditingTimer(EventObject event) {
         if((event instanceof MouseEvent) &&
@@ -433,7 +435,9 @@
      * Returns true if <code>event</code> is <code>null</code>,
      * or it is a <code>MouseEvent</code> with a click count &gt; 2
      * and <code>inHitRegion</code> returns true.
+     *
      * @param event the event being studied
+     * @return whether editing can be started for the given {@code event}
      */
     protected boolean canEditImmediately(EventObject event) {
         if((event instanceof MouseEvent) &&
@@ -513,6 +517,8 @@
     /**
      * Creates the container to manage placement of
      * <code>editingComponent</code>.
+     *
+     * @return new Container object
      */
     protected Container createContainer() {
         return new EditorContainer();
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -234,6 +234,9 @@
     /**
       * Returns the default icon, for the current laf, that is used to
       * represent non-leaf nodes that are expanded.
+      *
+      * @return the default icon, for the current laf, that is used to
+      *         represent non-leaf nodes that are expanded.
       */
     public Icon getDefaultOpenIcon() {
         return DefaultLookup.getIcon(this, ui, "Tree.openIcon");
@@ -242,6 +245,9 @@
     /**
       * Returns the default icon, for the current laf, that is used to
       * represent non-leaf nodes that are not expanded.
+      *
+      * @return the default icon, for the current laf, that is used to
+      *         represent non-leaf nodes that are not expanded.
       */
     public Icon getDefaultClosedIcon() {
         return DefaultLookup.getIcon(this, ui, "Tree.closedIcon");
@@ -250,6 +256,9 @@
     /**
       * Returns the default icon, for the current laf, that is used to
       * represent leaf nodes.
+      *
+      * @return the default icon, for the current laf, that is used to
+      *         represent leaf nodes.
       */
     public Icon getDefaultLeafIcon() {
         return DefaultLookup.getIcon(this, ui, "Tree.leafIcon");
@@ -257,6 +266,8 @@
 
     /**
       * Sets the icon used to represent non-leaf nodes that are expanded.
+      *
+      * @param newIcon the icon to be used for expanded non-leaf nodes
       */
     public void setOpenIcon(Icon newIcon) {
         openIcon = newIcon;
@@ -264,6 +275,8 @@
 
     /**
       * Returns the icon used to represent non-leaf nodes that are expanded.
+      *
+      * @return the icon used to represent non-leaf nodes that are expanded
       */
     public Icon getOpenIcon() {
         return openIcon;
@@ -271,6 +284,8 @@
 
     /**
       * Sets the icon used to represent non-leaf nodes that are not expanded.
+      *
+      * @param newIcon the icon to be used for not expanded non-leaf nodes
       */
     public void setClosedIcon(Icon newIcon) {
         closedIcon = newIcon;
@@ -279,6 +294,9 @@
     /**
       * Returns the icon used to represent non-leaf nodes that are not
       * expanded.
+      *
+      * @return the icon used to represent non-leaf nodes that are not
+      *         expanded
       */
     public Icon getClosedIcon() {
         return closedIcon;
@@ -286,6 +304,8 @@
 
     /**
       * Sets the icon used to represent leaf nodes.
+      *
+      * @param newIcon icon to be used for leaf nodes
       */
     public void setLeafIcon(Icon newIcon) {
         leafIcon = newIcon;
@@ -293,6 +313,8 @@
 
     /**
       * Returns the icon used to represent leaf nodes.
+      *
+      * @return the icon used to represent leaf nodes
       */
     public Icon getLeafIcon() {
         return leafIcon;
@@ -300,6 +322,8 @@
 
     /**
       * Sets the color the text is drawn with when the node is selected.
+      *
+      * @param newColor color to be used for text when the node is selected
       */
     public void setTextSelectionColor(Color newColor) {
         textSelectionColor = newColor;
@@ -307,6 +331,8 @@
 
     /**
       * Returns the color the text is drawn with when the node is selected.
+      *
+      * @return the color the text is drawn with when the node is selected
       */
     public Color getTextSelectionColor() {
         return textSelectionColor;
@@ -314,6 +340,8 @@
 
     /**
       * Sets the color the text is drawn with when the node isn't selected.
+      *
+      * @param newColor color to be used for text when the node isn't selected
       */
     public void setTextNonSelectionColor(Color newColor) {
         textNonSelectionColor = newColor;
@@ -321,6 +349,8 @@
 
     /**
       * Returns the color the text is drawn with when the node isn't selected.
+      *
+      * @return the color the text is drawn with when the node isn't selected.
       */
     public Color getTextNonSelectionColor() {
         return textNonSelectionColor;
@@ -328,6 +358,8 @@
 
     /**
       * Sets the color to use for the background if node is selected.
+      *
+      * @param newColor to be used for the background if the node is selected
       */
     public void setBackgroundSelectionColor(Color newColor) {
         backgroundSelectionColor = newColor;
@@ -336,6 +368,8 @@
 
     /**
       * Returns the color to use for the background if node is selected.
+      *
+      * @return the color to use for the background if node is selected
       */
     public Color getBackgroundSelectionColor() {
         return backgroundSelectionColor;
@@ -343,6 +377,8 @@
 
     /**
       * Sets the background color to be used for non selected nodes.
+      *
+      * @param newColor color to be used for the background for non selected nodes
       */
     public void setBackgroundNonSelectionColor(Color newColor) {
         backgroundNonSelectionColor = newColor;
@@ -350,6 +386,8 @@
 
     /**
       * Returns the background color to be used for non selected nodes.
+      *
+      * @return the background color to be used for non selected nodes.
       */
     public Color getBackgroundNonSelectionColor() {
         return backgroundNonSelectionColor;
@@ -357,6 +395,8 @@
 
     /**
       * Sets the color to use for the border.
+      *
+      * @param newColor color to be used for the border
       */
     public void setBorderSelectionColor(Color newColor) {
         borderSelectionColor = newColor;
@@ -364,6 +404,8 @@
 
     /**
       * Returns the color the border is drawn.
+      *
+      * @return the color the border is drawn
       */
     public Color getBorderSelectionColor() {
         return borderSelectionColor;
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeModel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -105,6 +105,9 @@
       * Sets whether or not to test leafness by asking getAllowsChildren()
       * or isLeaf() to the TreeNodes.  If newvalue is true, getAllowsChildren()
       * is messaged, otherwise isLeaf() is messaged.
+      *
+      * @param newValue if true, getAllowsChildren() is messaged, otherwise
+      *                 isLeaf() is messaged
       */
     public void setAsksAllowsChildren(boolean newValue) {
         asksAllowsChildren = newValue;
@@ -125,6 +128,8 @@
     /**
      * Sets the root to <code>root</code>. A null <code>root</code> implies
      * the tree is to display nothing, and is legal.
+     *
+     * @param root new value of tree root
      */
     public void setRoot(TreeNode root) {
         Object oldRoot = this.root;
@@ -231,6 +236,10 @@
      * This will then message nodesWereInserted to create the appropriate
      * event. This is the preferred way to add children as it will create
      * the appropriate event.
+     *
+     * @param newChild  child node to be inserted
+     * @param parent    node to which children new node will be added
+     * @param index     index of parent's children
      */
     public void insertNodeInto(MutableTreeNode newChild,
                                MutableTreeNode parent, int index){
@@ -247,6 +256,8 @@
      * nodesWereRemoved to create the appropriate event. This is the
      * preferred way to remove a node as it handles the event creation
      * for you.
+     *
+     * @param node the node to be removed from it's parrent
      */
     public void removeNodeFromParent(MutableTreeNode node) {
         MutableTreeNode         parent = (MutableTreeNode)node.getParent();
@@ -266,6 +277,8 @@
     /**
       * Invoke this method after you've changed how node is to be
       * represented in the tree.
+      *
+      * @param node the changed node
       */
     public void nodeChanged(TreeNode node) {
         if(listenerList != null && node != null) {
@@ -303,6 +316,9 @@
       * Invoke this method after you've inserted some TreeNodes into
       * node.  childIndices should be the index of the new elements and
       * must be sorted in ascending order.
+      *
+      * @param node         parent node which children count been incremented
+      * @param childIndices indexes of inserted children
       */
     public void nodesWereInserted(TreeNode node, int[] childIndices) {
         if(listenerList != null && node != null && childIndices != null
@@ -322,6 +338,10 @@
       * node.  childIndices should be the index of the removed elements and
       * must be sorted in ascending order. And removedChildren should be
       * the array of the children objects that were removed.
+      *
+      * @param node             parent node which childred were removed
+      * @param childIndices     indexes of removed childs
+      * @param removedChildren  array of the children objects that were removed
       */
     public void nodesWereRemoved(TreeNode node, int[] childIndices,
                                  Object[] removedChildren) {
@@ -334,6 +354,9 @@
     /**
       * Invoke this method after you've changed how the children identified by
       * childIndicies are to be represented in the tree.
+      *
+      * @param node         changed node
+      * @param childIndices indexes of changed children
       */
     public void nodesChanged(TreeNode node, int[] childIndices) {
         if(node != null) {
@@ -360,6 +383,8 @@
       * Invoke this method if you've totally changed the children of
       * node and its children's children...  This will post a
       * treeStructureChanged event.
+      *
+      * @param node changed node
       */
     public void nodeStructureChanged(TreeNode node) {
         if(node != null) {
@@ -374,6 +399,7 @@
      * tree.
      *
      * @param aNode the TreeNode to get the path for
+     * @return an array of TreeNodes giving the path from the root
      */
     public TreeNode[] getPathToRoot(TreeNode aNode) {
         return getPathToRoot(aNode, 0);
--- a/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -618,6 +618,9 @@
     /**
      * Notifies all listeners that are registered for
      * tree selection events on this object.
+     *
+     * @param e the event that characterizes the change
+     *
      * @see #addTreeSelectionListener
      * @see EventListenerList
      */
@@ -920,6 +923,9 @@
     /**
      * Returns true if the paths are contiguous,
      * or this object has no RowMapper.
+     *
+     * @param paths array of paths to check
+     * @return      whether the paths are contiguous, or this object has no RowMapper
      */
     protected boolean arePathsContiguous(TreePath[] paths) {
         if(rowMapper == null || paths.length < 2)
@@ -968,6 +974,9 @@
      * or the selection mode is <code>DISCONTIGUOUS_TREE_SELECTION</code>, or
      * adding the paths to the current selection still results in a
      * contiguous set of <code>TreePath</code>s.
+     *
+     * @param paths array of {@code TreePaths} to check
+     * @return      whether the particular set of {@code TreePaths} can be added
      */
     protected boolean canPathsBeAdded(TreePath[] paths) {
         if(paths == null || paths.length == 0 || rowMapper == null ||
@@ -1019,6 +1028,10 @@
      * Returns true if the paths can be removed without breaking the
      * continuity of the model.
      * This is rather expensive.
+     *
+     * @param paths array of {@code TreePath} to check
+     * @return      whether the paths can be removed without breaking the
+     *              continuity of the model
      */
     protected boolean canPathsBeRemoved(TreePath[] paths) {
         if(rowMapper == null || selection == null ||
@@ -1072,6 +1085,9 @@
      * instances of PathPlaceHolder.
      *
      * @deprecated As of JDK version 1.7
+     *
+     * @param changedPaths      the vector of the changed paths
+     * @param oldLeadSelection  the old selection path
      */
     @Deprecated
     protected void notifyPathChange(Vector<?> changedPaths,
--- a/jdk/src/share/classes/javax/swing/tree/MutableTreeNode.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/MutableTreeNode.java	Wed Jul 05 19:42:29 2017 +0200
@@ -42,22 +42,31 @@
     /**
      * Adds <code>child</code> to the receiver at <code>index</code>.
      * <code>child</code> will be messaged with <code>setParent</code>.
+     *
+     * @param child node to be added
+     * @param index index of the receiver
      */
     void insert(MutableTreeNode child, int index);
 
     /**
      * Removes the child at <code>index</code> from the receiver.
+     *
+     * @param index index of child to be removed
      */
     void remove(int index);
 
     /**
      * Removes <code>node</code> from the receiver. <code>setParent</code>
      * will be messaged on <code>node</code>.
+     *
+     * @param node node to be removed from the receiver
      */
     void remove(MutableTreeNode node);
 
     /**
      * Resets the user object of the receiver to <code>object</code>.
+     *
+     * @param object object to be set as a receiver
      */
     void setUserObject(Object object);
 
@@ -68,6 +77,8 @@
 
     /**
      * Sets the parent of the receiver to <code>newParent</code>.
+     *
+     * @param newParent node to be set as parent of the receiver
      */
     void setParent(MutableTreeNode newParent);
 }
--- a/jdk/src/share/classes/javax/swing/tree/RowMapper.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/RowMapper.java	Wed Jul 05 19:42:29 2017 +0200
@@ -41,6 +41,10 @@
      * the same length as that passed in, and if one of the TreePaths
      * in <code>path</code> is not valid its entry in the array should
      * be set to -1.
+     *
+     * @param path  array of TreePath to parse
+     * @return      the rows that the TreePath instances in {@code path} are
+     *              being displayed at
      */
     int[] getRowsForPaths(TreePath[] path);
 }
--- a/jdk/src/share/classes/javax/swing/tree/TreeCellRenderer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/TreeCellRenderer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -67,7 +67,14 @@
      *     }
      * </pre>
      *
-     * @return  the <code>Component</code> that the renderer uses to draw the value
+     * @param tree      the receiver is being configured for
+     * @param value     the value to render
+     * @param selected  whether node is selected
+     * @param expanded  whether node is expanded
+     * @param leaf      whether node is a lead node
+     * @param row       row index
+     * @param hasFocus  whether node has focus
+     * @return          the {@code Component} that the renderer uses to draw the value
      */
     Component getTreeCellRendererComponent(JTree tree, Object value,
                                    boolean selected, boolean expanded,
--- a/jdk/src/share/classes/javax/swing/tree/TreeModel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/TreeModel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -79,8 +79,9 @@
      * is a valid index for <code>parent</code> (that is <code>index &gt;= 0 &amp;&amp;
      * index &lt; getChildCount(parent</code>)).
      *
-     * @param   parent  a node in the tree, obtained from this data source
-     * @return  the child of <code>parent</code> at index <code>index</code>
+     * @param parent    a node in the tree, obtained from this data source
+     * @param index     index of child to be returned
+     * @return          the child of {@code parent} at index {@code index}
      */
     public Object getChild(Object parent, int index);
 
--- a/jdk/src/share/classes/javax/swing/tree/TreeNode.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/TreeNode.java	Wed Jul 05 19:42:29 2017 +0200
@@ -49,17 +49,24 @@
     /**
      * Returns the child <code>TreeNode</code> at index
      * <code>childIndex</code>.
+     *
+     * @param   childIndex  index of child
+     * @return              the child node at given index
      */
     TreeNode getChildAt(int childIndex);
 
     /**
      * Returns the number of children <code>TreeNode</code>s the receiver
      * contains.
+     *
+     * @return              the number of children the receiver contains
      */
     int getChildCount();
 
     /**
      * Returns the parent <code>TreeNode</code> of the receiver.
+     *
+     * @return              the parent of the receiver
      */
     TreeNode getParent();
 
@@ -67,21 +74,30 @@
      * Returns the index of <code>node</code> in the receivers children.
      * If the receiver does not contain <code>node</code>, -1 will be
      * returned.
+     *
+     * @param   node        node to be loked for
+     * @return              index of specified node
      */
     int getIndex(TreeNode node);
 
     /**
      * Returns true if the receiver allows children.
+     *
+     * @return              whether the receiver allows children
      */
     boolean getAllowsChildren();
 
     /**
      * Returns true if the receiver is a leaf.
+     *
+     * @return              whether the receiver is a leaf
      */
     boolean isLeaf();
 
     /**
      * Returns the children of the receiver as an <code>Enumeration</code>.
+     *
+     * @return              the children of the receiver as an {@code Enumeration}
      */
     Enumeration children();
 }
--- a/jdk/src/share/classes/javax/swing/tree/TreePath.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/TreePath.java	Wed Jul 05 19:42:29 2017 +0200
@@ -320,8 +320,10 @@
      * plus <code>child</code>. <code>child</code> is the last element
      * of the newly created {@code TreePath}.
      *
-     * @param child the path element to add
-     * @throws NullPointerException if {@code child} is {@code null}
+     * @param   child   the path element to add
+     * @throws          NullPointerException if {@code child} is {@code null}
+     * @return          a new path containing all the elements of this path
+     *                  plus {@code child}
      */
     public TreePath pathByAddingChild(Object child) {
         if(child == null)
--- a/jdk/src/share/classes/javax/swing/tree/TreeSelectionModel.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/tree/TreeSelectionModel.java	Wed Jul 05 19:42:29 2017 +0200
@@ -109,6 +109,8 @@
      * selected when the mode is changed to <code>SINGLE_TREE_SELECTION</code>,
      * only one TreePath will remain selected. It is up to the particular
      * implementation to decide what TreePath remains selected.
+     *
+     * @param   mode    selection mode to be set
      */
     void setSelectionMode(int mode);
 
@@ -117,6 +119,8 @@
      * <code>SINGLE_TREE_SELECTION</code>,
      * <code>CONTIGUOUS_TREE_SELECTION</code> or
      * <code>DISCONTIGUOUS_TREE_SELECTION</code>.
+     *
+     * @return          the current selection mode
      */
     int getSelectionMode();
 
@@ -125,7 +129,7 @@
       * the TreeSelectionListeners are notified. If <code>path</code> is
       * null, this has the same effect as invoking <code>clearSelection</code>.
       *
-      * @param path new path to select
+      * @param  path    new path to select
       */
     void setSelectionPath(TreePath path);
 
@@ -134,7 +138,7 @@
       * the TreeSelectionListeners are notified. If <code>paths</code> is
       * null, this has the same effect as invoking <code>clearSelection</code>.
       *
-      * @param paths new selection
+      * @param  paths   new selection
       */
     void setSelectionPaths(TreePath[] paths);
 
@@ -143,7 +147,7 @@
       * in the selection the TreeSelectionListeners are notified. This has
       * no effect if <code>path</code> is null.
       *
-      * @param path the new path to add to the current selection
+      * @param  path    the new path to add to the current selection
       */
     void addSelectionPath(TreePath path);
 
@@ -153,7 +157,7 @@
       * are notified. This has
       * no effect if <code>paths</code> is null.
       *
-      * @param paths the new paths to add to the current selection
+      * @param  paths   the new paths to add to the current selection
       */
     void addSelectionPaths(TreePath[] paths);
 
@@ -162,7 +166,7 @@
       * The TreeSelectionListeners are notified. This has no effect if
       * <code>path</code> is null.
       *
-      * @param path the path to remove from the selection
+      * @param  path    the path to remove from the selection
       */
     void removeSelectionPath(TreePath path);
 
@@ -172,7 +176,7 @@
       * are in the selection, the TreeSelectionListeners are notified.
       * This method has no effect if <code>paths</code> is null.
       *
-      * @param paths the path to remove from the selection
+      * @param  paths   the path to remove from the selection
       */
     void removeSelectionPaths(TreePath[] paths);
 
@@ -181,28 +185,39 @@
       * up to implementors, and may not necessarily be the TreePath with
       * the smallest integer value as determined from the
       * <code>RowMapper</code>.
+      *
+      * @return         the first path in the selection
       */
     TreePath getSelectionPath();
 
     /**
       * Returns the paths in the selection. This will return null (or an
       * empty array) if nothing is currently selected.
+      *
+      * @return         the paths in the selection
       */
     TreePath[] getSelectionPaths();
 
     /**
      * Returns the number of paths that are selected.
+     *
+     * @return          the number of paths that are selected
      */
     int getSelectionCount();
 
     /**
       * Returns true if the path, <code>path</code>, is in the current
       * selection.
+      *
+      * @param  path    the path to be loked for
+      * @return         whether the {@code path} is in the current selection
       */
     boolean isPathSelected(TreePath path);
 
     /**
       * Returns true if the selection is currently empty.
+      *
+      * @return         whether the selection is currently empty
       */
     boolean isSelectionEmpty();
 
@@ -215,12 +230,17 @@
     /**
      * Sets the RowMapper instance. This instance is used to determine
      * the row for a particular TreePath.
+     *
+     * @param   newMapper   RowMapper to be set
      */
     void setRowMapper(RowMapper newMapper);
 
     /**
      * Returns the RowMapper instance that is able to map a TreePath to a
      * row.
+     *
+     * @return          the RowMapper instance that is able to map a TreePath
+     *                  to a row
      */
     RowMapper getRowMapper();
 
@@ -228,6 +248,8 @@
       * Returns all of the currently selected rows. This will return
       * null (or an empty array) if there are no selected TreePaths or
       * a RowMapper has not been set.
+      *
+      * @return         all of the currently selected rows
       */
     int[] getSelectionRows();
 
@@ -235,6 +257,9 @@
      * Returns the smallest value obtained from the RowMapper for the
      * current set of selected TreePaths. If nothing is selected,
      * or there is no RowMapper, this will return -1.
+     *
+     * @return          the smallest value obtained from the RowMapper
+     *                  for the current set of selected TreePaths
       */
     int getMinSelectionRow();
 
@@ -242,11 +267,17 @@
      * Returns the largest value obtained from the RowMapper for the
      * current set of selected TreePaths. If nothing is selected,
      * or there is no RowMapper, this will return -1.
+     *
+     * @return          the largest value obtained from the RowMapper
+     *                  for the current set of selected TreePaths
       */
     int getMaxSelectionRow();
 
     /**
       * Returns true if the row identified by <code>row</code> is selected.
+      *
+      * @param  row     row to check
+      * @return         whether the row is selected
       */
     boolean isRowSelected(int row);
 
@@ -264,12 +295,16 @@
     /**
      * Returns the lead selection index. That is the last index that was
      * added.
+     *
+     * @return          the lead selection index
      */
     int getLeadSelectionRow();
 
     /**
      * Returns the last path that was added. This may differ from the
      * leadSelectionPath property maintained by the JTree.
+     *
+     * @return          the last path that was added
      */
     TreePath getLeadSelectionPath();
 
@@ -280,7 +315,7 @@
      * A PropertyChangeEvent will get fired when the selection mode
      * changes.
      *
-     * @param listener  the PropertyChangeListener to be added
+     * @param   listener    the PropertyChangeListener to be added
      */
     void addPropertyChangeListener(PropertyChangeListener listener);
 
@@ -289,7 +324,7 @@
      * This removes a PropertyChangeListener that was registered
      * for all properties.
      *
-     * @param listener  the PropertyChangeListener to be removed
+     * @param   listener    the PropertyChangeListener to be removed
      */
     void removePropertyChangeListener(PropertyChangeListener listener);
 
@@ -297,7 +332,7 @@
       * Adds x to the list of listeners that are notified each time the
       * set of selected TreePaths changes.
       *
-      * @param x the new listener to be added
+      * @param  x       the new listener to be added
       */
     void addTreeSelectionListener(TreeSelectionListener x);
 
@@ -305,7 +340,7 @@
       * Removes x from the list of listeners that are notified each time
       * the set of selected TreePaths changes.
       *
-      * @param x the listener to remove
+      * @param  x       the listener to remove
       */
     void removeTreeSelectionListener(TreeSelectionListener x);
 }
--- a/jdk/src/share/classes/javax/swing/undo/CompoundEdit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/undo/CompoundEdit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -82,6 +82,9 @@
      * Returns the last <code>UndoableEdit</code> in
      * <code>edits</code>, or <code>null</code>
      * if <code>edits</code> is empty.
+     *
+     * @return the last {@code UndoableEdit} in {@code edits},
+     *         or {@code null} if {@code edits} is empty.
      */
     protected UndoableEdit lastEdit() {
         int count = edits.size();
@@ -182,6 +185,7 @@
      * received end. This generally means that edits are still being
      * added to it.
      *
+     * @return  whether this edit is in progress
      * @see     #end
      */
     public boolean isInProgress() {
--- a/jdk/src/share/classes/javax/swing/undo/StateEditable.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/undo/StateEditable.java	Wed Jul 05 19:42:29 2017 +0200
@@ -43,12 +43,16 @@
     /**
      * Upon receiving this message the receiver should place any relevant
      * state into <EM>state</EM>.
+     *
+     * @param state Hashtable object to store the state
      */
     public void storeState(Hashtable<Object,Object> state);
 
     /**
      * Upon receiving this message the receiver should extract any relevant
      * state out of <EM>state</EM>.
+     *
+     * @param state Hashtable object to restore the state from it
      */
     public void restoreState(Hashtable<?,?> state);
 } // End of interface StateEditable
--- a/jdk/src/share/classes/javax/swing/undo/UndoManager.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/undo/UndoManager.java	Wed Jul 05 19:42:29 2017 +0200
@@ -326,6 +326,7 @@
      * Undoes all changes from the index of the next edit to
      * <code>edit</code>, updating the index of the next edit appropriately.
      *
+     * @param edit the edit to be undo to
      * @throws CannotUndoException if one of the edits throws
      *         <code>CannotUndoException</code>
      */
@@ -342,6 +343,7 @@
      * Redoes all changes from the index of the next edit to
      * <code>edit</code>, updating the index of the next edit appropriately.
      *
+     * @param edit the edit to be redo to
      * @throws CannotRedoException if one of the edits throws
      *         <code>CannotRedoException</code>
      */
--- a/jdk/src/share/classes/javax/swing/undo/UndoableEditSupport.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/javax/swing/undo/UndoableEditSupport.java	Wed Jul 05 19:42:29 2017 +0200
@@ -96,6 +96,8 @@
      * Called only from <code>postEdit</code> and <code>endUpdate</code>. Calls
      * <code>undoableEditHappened</code> in all listeners. No synchronization
      * is performed here, since the two calling methods are synchronized.
+     *
+     * @param e edit to be verified
      */
     protected void _postEdit(UndoableEdit e) {
         UndoableEditEvent ev = new UndoableEditEvent(realSource, e);
@@ -110,6 +112,8 @@
      * DEADLOCK WARNING: Calling this method may call
      * <code>undoableEditHappened</code> in all listeners.
      * It is unwise to call this method from one of its listeners.
+     *
+     * @param e edit to be posted
      */
     public synchronized void postEdit(UndoableEdit e) {
         if (updateLevel == 0) {
@@ -142,6 +146,8 @@
     /**
      * Called only from <code>beginUpdate</code>.
      * Exposed here for subclasses' use.
+     *
+     * @return new created {@code CompoundEdit} object
      */
     protected CompoundEdit createCompoundEdit() {
         return new CompoundEdit();
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java	Wed Jul 05 19:42:29 2017 +0200
@@ -27,6 +27,7 @@
 
 import sun.misc.Unsafe;
 
+import javax.accessibility.AccessibleContext;
 import java.awt.*;
 import java.awt.KeyboardFocusManager;
 import java.awt.DefaultKeyboardFocusManager;
@@ -620,7 +621,7 @@
         /**
          * Returns menus
          */
-        Vector getMenus(MenuBar menuBar);
+        Vector<Menu> getMenus(MenuBar menuBar);
     }
 
     /**
@@ -662,7 +663,7 @@
         /**
          * Returns vector of the items that are part of the Menu
          */
-        Vector getItems(Menu menu);
+        Vector<MenuItem> getItems(Menu menu);
     }
 
     /**
@@ -762,6 +763,14 @@
     }
 
     /*
+     * An accessor object for the AccessibleContext class
+     */
+    public interface AccessibleContextAccessor {
+        void setAppContext(AccessibleContext accessibleContext, AppContext appContext);
+        AppContext getAppContext(AccessibleContext accessibleContext);
+    }
+
+    /*
      * Accessor instances are initialized in the static initializers of
      * corresponding AWT classes by using setters defined below.
      */
@@ -791,6 +800,7 @@
     private static ToolkitAccessor toolkitAccessor;
     private static InvocationEventAccessor invocationEventAccessor;
     private static SystemColorAccessor systemColorAccessor;
+    private static AccessibleContextAccessor accessibleContextAccessor;
 
     /*
      * Set an accessor object for the java.awt.Component class.
@@ -1234,4 +1244,21 @@
      public static void setSystemColorAccessor(SystemColorAccessor systemColorAccessor) {
          AWTAccessor.systemColorAccessor = systemColorAccessor;
      }
+
+    /*
+     * Get the accessor object for the javax.accessibility.AccessibleContext class.
+     */
+    public static AccessibleContextAccessor getAccessibleContextAccessor() {
+        if (accessibleContextAccessor == null) {
+            unsafe.ensureClassInitialized(AccessibleContext.class);
+        }
+        return accessibleContextAccessor;
+    }
+
+   /*
+    * Set the accessor object for the javax.accessibility.AccessibleContext class.
+    */
+    public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) {
+        AWTAccessor.accessibleContextAccessor = accessor;
+    }
 }
--- a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java	Wed Jul 05 19:42:29 2017 +0200
@@ -35,7 +35,7 @@
 import java.util.Set;
 
 import sun.util.logging.PlatformLogger;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 /**
  * This class is to let AWT shutdown automatically when a user is done
--- a/jdk/src/share/classes/sun/awt/AppContext.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/AppContext.java	Wed Jul 05 19:42:29 2017 +0200
@@ -890,6 +890,7 @@
             Supplier<T> supplier) {
 
         final AppContext appContext = AppContext.getAppContext();
+        @SuppressWarnings("unchecked")
         SoftReference<T> ref = (SoftReference<T>) appContext.get(key);
         if (ref != null) {
             final T object = ref.get();
--- a/jdk/src/share/classes/sun/awt/FontConfiguration.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/FontConfiguration.java	Wed Jul 05 19:42:29 2017 +0200
@@ -64,7 +64,7 @@
     protected static String osName;
     protected static String encoding; // canonical name of default nio charset
     protected static Locale startupLocale = null;
-    protected static Hashtable localeMap = null;
+    protected static Hashtable<String, String> localeMap = null;
     private static FontConfiguration fontConfig;
     private static PlatformLogger logger;
     protected static boolean isProperties = true;
@@ -159,15 +159,15 @@
         short fontNameID = compFontNameIDs[0][0][0];
         short fileNameID = getComponentFileID(fontNameID);
         final String fileName = mapFileName(getComponentFileName(fileNameID));
-        Boolean exists = (Boolean)java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
-                 public Object run() {
+        Boolean exists = java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Boolean>() {
+                 public Boolean run() {
                      try {
                          File f = new File(fileName);
                          return Boolean.valueOf(f.exists());
                      }
                      catch (Exception e) {
-                         return false;
+                         return Boolean.FALSE;
                      }
                  }
                 });
@@ -534,11 +534,11 @@
    private short remapLocaleMap(int fontIndex, int styleIndex, short scriptID, short fontID) {
         String scriptName = getString(table_scriptIDs[scriptID]);
 
-        String value = (String)localeMap.get(scriptName);
+        String value = localeMap.get(scriptName);
         if (value == null) {
             String fontName = fontNames[fontIndex];
             String styleName = styleNames[styleIndex];
-            value = (String)localeMap.get(fontName + "." + styleName + "." + scriptName);
+            value = localeMap.get(fontName + "." + styleName + "." + scriptName);
         }
         if (value == null) {
             return fontID;
@@ -746,7 +746,7 @@
     /* Mappings from file encoding to font config name for font supporting
      * the corresponding language. This is filled in by initReorderMap()
      */
-    protected HashMap reorderMap = null;
+    protected HashMap<String, Object> reorderMap = null;
 
     /* Platform-specific mappings */
     protected abstract void initReorderMap();
@@ -777,7 +777,7 @@
         if (fontConfig.reorderMap == null) {
              fontConfig.initReorderMap();
         }
-        HashMap reorderMap = fontConfig.reorderMap;
+        HashMap<String, Object> reorderMap = fontConfig.reorderMap;
 
         /* Find the most specific mapping */
         String language = startupLocale.getLanguage();
@@ -817,9 +817,9 @@
         }
     }
 
-    private static Vector splitSequence(String sequence) {
+    private static Vector<String> splitSequence(String sequence) {
         //String.split would be more convenient, but incurs big performance penalty
-        Vector parts = new Vector();
+        Vector<String> parts = new Vector<>();
         int start = 0;
         int end;
         while ((end = sequence.indexOf(',', start)) >= 0) {
@@ -833,14 +833,14 @@
     }
 
     protected String[] split(String sequence) {
-        Vector v = splitSequence(sequence);
-        return (String[])v.toArray(new String[0]);
+        Vector<String> v = splitSequence(sequence);
+        return v.toArray(new String[0]);
     }
 
     ////////////////////////////////////////////////////////////////////////
     // Methods for extracting information from the fontconfig data for AWT//
     ////////////////////////////////////////////////////////////////////////
-    private Hashtable charsetRegistry = new Hashtable(5);
+    private Hashtable<String, Charset> charsetRegistry = new Hashtable<>(5);
 
     /**
      * Returns FontDescriptors describing the physical fonts used for the
@@ -932,9 +932,9 @@
 
         Charset fc = null;
         if (charsetName.equals("default")) {
-            fc = (Charset) charsetRegistry.get(fontName);
+            fc = charsetRegistry.get(fontName);
         } else {
-            fc = (Charset) charsetRegistry.get(charsetName);
+            fc = charsetRegistry.get(charsetName);
         }
         if (fc != null) {
             return fc.newEncoder();
@@ -943,8 +943,8 @@
         if (!charsetName.startsWith("sun.awt.") && !charsetName.equals("default")) {
             fc = Charset.forName(charsetName);
         } else {
-            Class fcc = (Class) AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+            Class<?> fcc = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
+                    public Class<?> run() {
                         try {
                             return Class.forName(charsetName, true,
                                                  ClassLoader.getSystemClassLoader());
@@ -1377,9 +1377,9 @@
 
         //This method will only be called during build time, do we
         //need do PrivilegedAction?
-        String osName = (String)java.security.AccessController.doPrivileged(
-                            new java.security.PrivilegedAction() {
-            public Object run() {
+        String osName = java.security.AccessController.doPrivileged(
+                            new java.security.PrivilegedAction<String>() {
+            public String run() {
                 return System.getProperty("os.name");
             }
         });
@@ -2139,7 +2139,7 @@
                 boolean has1252 = false;
 
                 //get the scriptID list
-                String[] ss = (String[])splitSequence(value).toArray(EMPTY_STRING_ARRAY);
+                String[] ss = splitSequence(value).toArray(EMPTY_STRING_ARRAY);
                 short [] sa = new short[ss.length];
                 for (int i = 0; i < ss.length; i++) {
                     if ("alphabetic/default".equals(ss[i])) {
--- a/jdk/src/share/classes/sun/awt/HToolkit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/HToolkit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -214,7 +214,8 @@
         throw new HeadlessException();
     }
 
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+    public Map<java.awt.font.TextAttribute, ?> mapInputMethodHighlight(
+            InputMethodHighlight highlight)
         throws HeadlessException {
         throw new HeadlessException();
     }
--- a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -29,6 +29,7 @@
 import java.awt.dnd.*;
 import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.event.*;
+import java.awt.font.TextAttribute;
 import java.awt.im.InputMethodHighlight;
 import java.awt.image.*;
 import java.awt.datatransfer.Clipboard;
@@ -224,7 +225,7 @@
         throw new HeadlessException();
     }
 
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight)
+    public Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight)
         throws HeadlessException {
         throw new HeadlessException();
     }
--- a/jdk/src/share/classes/sun/awt/PlatformFont.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/PlatformFont.java	Wed Jul 05 19:42:29 2017 +0200
@@ -143,7 +143,7 @@
         if (len < 1) {
             return new CharsetString[0];
         }
-        Vector mcs = null;
+        Vector<CharsetString> mcs = null;
         char[] tmpStr = new char[len];
         char tmpChar = defaultChar;
         boolean encoded = false;
@@ -198,7 +198,7 @@
             }
             if (currentFont != fd){
                 if (mcs == null) {
-                    mcs = new Vector(3);
+                    mcs = new Vector<>(3);
                 }
                 mcs.addElement(new CharsetString(tmpStr, lastIndex,
                                                  i-lastIndex, currentFont));
@@ -209,16 +209,13 @@
         }
         CharsetString[] result;
         CharsetString cs = new CharsetString(tmpStr, lastIndex,
-                                            len-lastIndex, currentFont);
+                                             len-lastIndex, currentFont);
         if (mcs == null) {
             result = new CharsetString[1];
             result[0] = cs;
         } else {
             mcs.addElement(cs);
-            result = new CharsetString[mcs.size()];
-            for (int i = 0; i < mcs.size(); i++){
-                result[i] = (CharsetString)mcs.elementAt(i);
-            }
+            result = mcs.toArray(new CharsetString[mcs.size()]);
         }
         return result;
     }
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1915,6 +1915,7 @@
 
     public synchronized void setWindowDeactivationTime(Window w, long time) {
         AppContext ctx = getAppContext(w);
+        @SuppressWarnings("unchecked")
         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
         if (map == null) {
             map = new WeakHashMap<Window, Long>();
@@ -1925,6 +1926,7 @@
 
     public synchronized long getWindowDeactivationTime(Window w) {
         AppContext ctx = getAppContext(w);
+        @SuppressWarnings("unchecked")
         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
         if (map == null) {
             return -1;
--- a/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/datatransfer/DataTransferer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -57,6 +57,7 @@
 import java.nio.charset.Charset;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.StandardCharsets;
 import java.nio.charset.UnsupportedCharsetException;
 
 import java.lang.reflect.Constructor;
@@ -70,22 +71,7 @@
 import java.security.PrivilegedExceptionAction;
 import java.security.ProtectionDomain;
 
-import java.util.AbstractMap;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.Set;
-import java.util.Stack;
-import java.util.TreeMap;
-import java.util.TreeSet;
+import java.util.*;
 
 import sun.util.logging.PlatformLogger;
 
@@ -164,7 +150,7 @@
             tempSet.add("UTF-16BE");
             tempSet.add("UTF-16LE");
             tempSet.add("UTF-16");
-            tempSet.add(getDefaultTextCharset());
+            tempSet.add(Charset.defaultCharset().name());
             return Collections.unmodifiableSortedSet(tempSet);
         }
     }
@@ -178,12 +164,6 @@
     private static final Map<String, Boolean> textMIMESubtypeCharsetSupport;
 
     /**
-     * Cache of the platform default encoding as specified in the
-     * "file.encoding" system property.
-     */
-    private static String defaultEncoding;
-
-    /**
      * A collection of all natives listed in flavormap.properties with
      * a primary MIME type of "text".
      */
@@ -281,17 +261,7 @@
 
         String encoding = flavor.getParameter("charset");
 
-        return (encoding != null) ? encoding : getDefaultTextCharset();
-    }
-
-    /**
-     * Returns the platform's default character encoding.
-     */
-    public static String getDefaultTextCharset() {
-        if (defaultEncoding != null) {
-            return defaultEncoding;
-        }
-        return defaultEncoding = Charset.defaultCharset().name();
+        return (encoding != null) ? encoding : Charset.defaultCharset().name();
     }
 
     /**
@@ -354,7 +324,7 @@
             return false;
         }
 
-        Class rep_class = flavor.getRepresentationClass();
+        Class<?> rep_class = flavor.getRepresentationClass();
 
         if (flavor.isRepresentationClassReader() ||
             String.class.equals(rep_class) ||
@@ -485,7 +455,7 @@
 
         textNatives.add(format);
         nativeCharsets.put(format, (charset != null && charset.length() != 0)
-                ? charset : getDefaultTextCharset());
+                ? charset : Charset.defaultCharset().name());
         if (eoln != null && eoln.length() != 0 && !eoln.equals("\n")) {
             nativeEOLNs.put(format, eoln);
         }
@@ -726,7 +696,7 @@
      *            DataFlavors and data formats
      * @throws NullPointerException if formats or map is <code>null</code>
      */
-    public Set getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
+    public Set<DataFlavor> getFlavorsForFormatsAsSet(long[] formats, FlavorTable map) {
         Set<DataFlavor> flavorSet = new HashSet<>(formats.length);
 
         for (long format : formats) {
@@ -786,19 +756,17 @@
      * clipboard string encoding/decoding, basing on clipboard
      * format and localeTransferable(on decoding, if available)
      */
-    private String getBestCharsetForTextFormat(Long lFormat,
+    protected String getBestCharsetForTextFormat(Long lFormat,
         Transferable localeTransferable) throws IOException
     {
         String charset = null;
         if (localeTransferable != null &&
             isLocaleDependentTextFormat(lFormat) &&
-            localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor))
-        {
+            localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
             try {
-                charset = new String(
-                    (byte[])localeTransferable.getTransferData(javaTextEncodingFlavor),
-                    "UTF-8"
-                );
+                byte[] charsetNameBytes = (byte[])localeTransferable
+                        .getTransferData(javaTextEncodingFlavor);
+                charset = new String(charsetNameBytes, StandardCharsets.UTF_8);
             } catch (UnsupportedFlavorException cannotHappen) {
             }
         } else {
@@ -806,7 +774,7 @@
         }
         if (charset == null) {
             // Only happens when we have a custom text type.
-            charset = getDefaultTextCharset();
+            charset = Charset.defaultCharset().name();
         }
         return charset;
     }
@@ -1117,7 +1085,7 @@
                 throw new IOException("data translation failed");
             }
 
-            final List list = (List)obj;
+            final List<?> list = (List<?>)obj;
 
             final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
 
@@ -1145,7 +1113,7 @@
             if (targetCharset == null) {
                 targetCharset = "UTF-8";
             }
-            final List list = (List)obj;
+            final List<?> list = (List<?>)obj;
             final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);
             final ArrayList<String> fileList = castToFiles(list, userProtectionDomain);
             final ArrayList<String> uriList = new ArrayList<>(fileList.size());
@@ -1290,7 +1258,7 @@
         return true;
     }
 
-    private ArrayList<String> castToFiles(final List files,
+    private ArrayList<String> castToFiles(final List<?> files,
                                           final ProtectionDomain userProtectionDomain) throws IOException {
         try {
             return AccessController.doPrivileged((PrivilegedExceptionAction<ArrayList<String>>) () -> {
@@ -1668,7 +1636,7 @@
      * instance of the Class as its sole parameter.
      */
     private Object constructFlavoredObject(Object arg, DataFlavor flavor,
-                                           Class clazz)
+                                           Class<?> clazz)
         throws IOException
     {
         final Class<?> dfrc = flavor.getRepresentationClass();
@@ -1676,19 +1644,19 @@
         if (clazz.equals(dfrc)) {
             return arg; // simple case
         } else {
-            Constructor[] constructors;
+            Constructor<?>[] constructors;
 
             try {
                 constructors = AccessController.doPrivileged(
-                        (PrivilegedAction<Constructor[]>) dfrc::getConstructors);
+                        (PrivilegedAction<Constructor<?>[]>) dfrc::getConstructors);
             } catch (SecurityException se) {
                 throw new IOException(se.getMessage());
             }
 
-            Constructor constructor = Stream.of(constructors)
+            Constructor<?> constructor = Stream.of(constructors)
                     .filter(c -> Modifier.isPublic(c.getModifiers()))
                     .filter(c -> {
-                        Class[] ptypes = c.getParameterTypes();
+                        Class<?>[] ptypes = c.getParameterTypes();
                         return ptypes != null
                                 && ptypes.length == 1
                                 && clazz.equals(ptypes[0]);
@@ -1731,28 +1699,8 @@
         {
             Long lFormat = format;
 
-            String sourceEncoding = null;
-            if (isLocaleDependentTextFormat(format) &&
-                localeTransferable != null &&
-                localeTransferable.
-                    isDataFlavorSupported(javaTextEncodingFlavor))
-            {
-                try {
-                    sourceEncoding = new String((byte[])localeTransferable.
-                                       getTransferData(javaTextEncodingFlavor),
-                                       "UTF-8");
-                } catch (UnsupportedFlavorException cannotHappen) {
-                }
-            } else {
-                sourceEncoding = getCharsetForTextFormat(lFormat);
-            }
-
-            if (sourceEncoding == null) {
-                // Only happens when we have a custom text type.
-                sourceEncoding = getDefaultTextCharset();
-            }
-            wrapped = new BufferedReader
-                (new InputStreamReader(bytestream, sourceEncoding));
+            String sourceEncoding = getBestCharsetForTextFormat(format, localeTransferable);
+            wrapped = new BufferedReader(new InputStreamReader(bytestream, sourceEncoding));
 
             if (targetEncoding == null) {
                 // Throw NullPointerException for compatibility with the former
@@ -1917,7 +1865,8 @@
         byte[] bytes, String mimeType) throws IOException
     {
 
-        Iterator readerIterator = ImageIO.getImageReadersByMIMEType(mimeType);
+        Iterator<ImageReader> readerIterator =
+            ImageIO.getImageReadersByMIMEType(mimeType);
 
         if (!readerIterator.hasNext()) {
             throw new IOException("No registered service provider can decode " +
@@ -1927,7 +1876,7 @@
         IOException ioe = null;
 
         while (readerIterator.hasNext()) {
-            ImageReader imageReader = (ImageReader)readerIterator.next();
+            ImageReader imageReader = readerIterator.next();
             try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes)) {
                 try (ImageInputStream imageInputStream = ImageIO.createImageInputStream(bais)) {
                     ImageReadParam param = imageReader.getDefaultReadParam();
@@ -1970,7 +1919,8 @@
       throws IOException {
         IOException originalIOE = null;
 
-        Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType);
+        Iterator<ImageWriter> writerIterator =
+            ImageIO.getImageWritersByMIMEType(mimeType);
 
         if (!writerIterator.hasNext()) {
             throw new IOException("No registered service provider can encode " +
@@ -2029,7 +1979,8 @@
                                               String mimeType)
         throws IOException {
 
-        Iterator writerIterator = ImageIO.getImageWritersByMIMEType(mimeType);
+        Iterator<ImageWriter> writerIterator =
+            ImageIO.getImageWritersByMIMEType(mimeType);
 
         ImageTypeSpecifier typeSpecifier =
             new ImageTypeSpecifier(renderedImage);
@@ -2038,7 +1989,7 @@
         IOException ioe = null;
 
         while (writerIterator.hasNext()) {
-            ImageWriter imageWriter = (ImageWriter)writerIterator.next();
+            ImageWriter imageWriter = writerIterator.next();
             ImageWriterSpi writerSpi = imageWriter.getOriginatingProvider();
 
             if (!writerSpi.canEncodeImage(typeSpecifier)) {
@@ -2122,7 +2073,7 @@
     public byte[] convertData(final Object source,
                               final Transferable contents,
                               final long format,
-                              final Map formatMap,
+                              final Map<Long, DataFlavor> formatMap,
                               final boolean isToolkitThread)
         throws IOException
     {
@@ -2145,7 +2096,7 @@
                     }
                     byte[] data = null;
                     try {
-                        DataFlavor flavor = (DataFlavor)formatMap.get(format);
+                        DataFlavor flavor = formatMap.get(format);
                         if (flavor != null) {
                             data = translateTransferable(contents, flavor, format);
                         }
@@ -2186,7 +2137,7 @@
         } finally {
             getToolkitThreadBlockedHandler().unlock();
         } else {
-            DataFlavor flavor = (DataFlavor)formatMap.get(format);
+            DataFlavor flavor = formatMap.get(format);
             if (flavor != null) {
                 ret = translateTransferable(contents, flavor, format);
             }
@@ -2235,7 +2186,7 @@
      * Helper function to convert a Set of DataFlavors to a sorted array.
      * The array will be sorted according to <code>DataFlavorComparator</code>.
      */
-    public static DataFlavor[] setToSortedDataFlavorArray(Set flavorsSet) {
+    public static DataFlavor[] setToSortedDataFlavorArray(Set<DataFlavor> flavorsSet) {
         DataFlavor[] flavors = new DataFlavor[flavorsSet.size()];
         flavorsSet.toArray(flavors);
         final Comparator<DataFlavor> comparator =
@@ -2267,8 +2218,8 @@
      * If there are no platform-specific mappings for this native, the method
      * returns an empty <code>List</code>.
      */
-    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
-        return new ArrayList<>();
+    public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat) {
+        return new LinkedHashSet<>();
     }
 
     /**
@@ -2276,8 +2227,8 @@
      * If there are no platform-specific mappings for this flavor, the method
      * returns an empty <code>List</code>.
      */
-    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
-        return new ArrayList<>();
+    public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        return new LinkedHashSet<>();
     }
 
     /**
@@ -2333,7 +2284,6 @@
      */
     public static class CharsetComparator extends IndexedComparator<String> {
         private static final Map<String, Integer> charsets;
-        private static final String defaultEncoding;
 
         private static final Integer DEFAULT_CHARSET_INDEX = 2;
         private static final Integer OTHER_CHARSET_INDEX = 1;
@@ -2354,8 +2304,7 @@
             // US-ASCII is the worst charset supported
             charsetsMap.put(canonicalName("US-ASCII"), WORST_CHARSET_INDEX);
 
-            defaultEncoding = DataTransferer.canonicalName(DataTransferer.getDefaultTextCharset());
-            charsetsMap.putIfAbsent(defaultEncoding, DEFAULT_CHARSET_INDEX);
+            charsetsMap.putIfAbsent(Charset.defaultCharset().name(), DEFAULT_CHARSET_INDEX);
 
             charsetsMap.put(UNSUPPORTED_CHARSET, UNSUPPORTED_CHARSET_INDEX);
 
@@ -2598,12 +2547,12 @@
             String primaryType1 = flavor1.getPrimaryType();
             String subType1 = flavor1.getSubType();
             String mimeType1 = primaryType1 + "/" + subType1;
-            Class class1 = flavor1.getRepresentationClass();
+            Class<?> class1 = flavor1.getRepresentationClass();
 
             String primaryType2 = flavor2.getPrimaryType();
             String subType2 = flavor2.getSubType();
             String mimeType2 = primaryType2 + "/" + subType2;
-            Class class2 = flavor2.getRepresentationClass();
+            Class<?> class2 = flavor2.getRepresentationClass();
 
             if (flavor1.isFlavorTextType() && flavor2.isFlavorTextType()) {
                 // First, compare MIME types
--- a/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/datatransfer/SunClipboard.java	Wed Jul 05 19:42:29 2017 +0200
@@ -78,7 +78,7 @@
      * this clipboard. It is used for tracking changes
      * of <code>DataFlavor</code>s available on this clipboard.
      */
-    private volatile Set currentDataFlavors;
+    private volatile Set<DataFlavor> currentDataFlavors;
 
 
     public SunClipboard(String name) {
@@ -338,7 +338,7 @@
     protected abstract byte[] getClipboardData(long format) throws IOException;
 
 
-    private static Set formatArrayAsDataFlavorSet(long[] formats) {
+    private static Set<DataFlavor> formatArrayAsDataFlavorSet(long[] formats) {
         return (formats == null) ? null :
                 DataTransferer.getInstance().
                 getFlavorsForFormatsAsSet(formats, getDefaultFlavorTable());
@@ -417,7 +417,7 @@
      *        this clipboard
      */
     public void checkChange(long[] formats) {
-        Set prevDataFlavors = currentDataFlavors;
+        Set<DataFlavor> prevDataFlavors = currentDataFlavors;
         currentDataFlavors = formatArrayAsDataFlavorSet(formats);
 
         if (Objects.equals(prevDataFlavors, currentDataFlavors)) {
--- a/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/datatransfer/TransferableProxy.java	Wed Jul 05 19:42:29 2017 +0200
@@ -111,9 +111,9 @@
     }
 
     protected void annotateClass(final Class<?> cl) throws IOException {
-        ClassLoader classLoader =
-            (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+        ClassLoader classLoader = AccessController.doPrivileged(
+            new PrivilegedAction<ClassLoader>() {
+                public ClassLoader run() {
                     return cl.getClassLoader();
                 }
             });
@@ -124,14 +124,14 @@
         map.put(s, classLoader);
     }
     protected void annotateProxyClass(final Class<?> cl) throws IOException {
-        ClassLoader classLoader =
-            (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
-                public Object run() {
+        ClassLoader classLoader = AccessController.doPrivileged(
+            new PrivilegedAction<ClassLoader>() {
+                public ClassLoader run() {
                     return cl.getClassLoader();
                 }
             });
 
-        Class[] interfaces = cl.getInterfaces();
+        Class<?>[] interfaces = cl.getInterfaces();
         Set<String> s = new HashSet<String>(interfaces.length);
         for (int i = 0; i < interfaces.length; i++) {
             s.add(interfaces[i].getName());
@@ -141,7 +141,7 @@
     }
 
     Map<Set<String>, ClassLoader> getClassLoaderMap() {
-        return new HashMap(map);
+        return new HashMap<>(map);
     }
 }
 
@@ -191,9 +191,9 @@
         boolean hasNonPublicInterface = false;
 
         // define proxy in class loader of non-public interface(s), if any
-        Class[] classObjs = new Class[interfaces.length];
+        Class<?>[] classObjs = new Class<?>[interfaces.length];
         for (int i = 0; i < interfaces.length; i++) {
-            Class cl = Class.forName(interfaces[i], false, classLoader);
+            Class<?> cl = Class.forName(interfaces[i], false, classLoader);
             if ((cl.getModifiers() & Modifier.PUBLIC) == 0) {
                 if (hasNonPublicInterface) {
                     if (nonPublicLoader != cl.getClassLoader()) {
--- a/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDragSourceContextPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -146,7 +146,7 @@
     }
 
     protected abstract void startDrag(Transferable trans,
-                                      long[] formats, Map formatMap);
+                                      long[] formats, Map<Long, DataFlavor> formatMap);
 
     /**
      * set cursor
--- a/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -239,17 +239,24 @@
 
         if (localTransferable != null) {
             return localTransferable.getTransferData(df);
+        } else if (df.isMimeTypeEqual(DataFlavor.javaJVMLocalObjectMimeType)) {
+            // Workaround to JDK-8024061: Exception thrown when drag and drop
+            //      between two components is executed quickly.
+            // It is expected localTransferable is not null if javaJVMLocalObjectMimeType
+            // is used. Executing further results in ClassCastException, so null is
+            // returned here as no transfer data is available in this case.
+            return null;
         }
 
         if (dropStatus != STATUS_ACCEPT || dropComplete) {
             throw new InvalidDnDOperationException("No drop current");
         }
 
-        Map flavorMap = DataTransferer.getInstance().getFlavorsForFormats
-            (currentT, DataTransferer.adaptFlavorMap
+        Map<DataFlavor, Long> flavorMap = DataTransferer.getInstance()
+            .getFlavorsForFormats(currentT, DataTransferer.adaptFlavorMap
                 (currentDT.getFlavorMap()));
 
-        lFormat = (Long)flavorMap.get(df);
+        lFormat = flavorMap.get(df);
         if (lFormat == null) {
             throw new UnsupportedFlavorException(df);
         }
@@ -738,7 +745,7 @@
         // dispatcher state fields
         private int returnValue = 0;
         // set of events to be dispatched by this dispatcher
-        private final HashSet eventSet = new HashSet(3);
+        private final HashSet<SunDropTargetEvent> eventSet = new HashSet<>(3);
 
         static final ToolkitThreadBlockedHandler handler =
             DataTransferer.getInstance().getToolkitThreadBlockedHandler();
--- a/jdk/src/share/classes/sun/awt/geom/AreaOp.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/geom/AreaOp.java	Wed Jul 05 19:42:29 2017 +0200
@@ -152,36 +152,36 @@
 
     public abstract int getState();
 
-    public Vector calculate(Vector left, Vector right) {
-        Vector edges = new Vector();
+    public Vector<Curve> calculate(Vector<Curve> left, Vector<Curve> right) {
+        Vector<Edge> edges = new Vector<>();
         addEdges(edges, left, AreaOp.CTAG_LEFT);
         addEdges(edges, right, AreaOp.CTAG_RIGHT);
-        edges = pruneEdges(edges);
+        Vector<Curve> curves = pruneEdges(edges);
         if (false) {
             System.out.println("result: ");
-            int numcurves = edges.size();
-            Curve[] curvelist = (Curve[]) edges.toArray(new Curve[numcurves]);
+            int numcurves = curves.size();
+            Curve[] curvelist = curves.toArray(new Curve[numcurves]);
             for (int i = 0; i < numcurves; i++) {
                 System.out.println("curvelist["+i+"] = "+curvelist[i]);
             }
         }
-        return edges;
+        return curves;
     }
 
-    private static void addEdges(Vector edges, Vector curves, int curvetag) {
-        Enumeration enum_ = curves.elements();
+    private static void addEdges(Vector<Edge> edges, Vector<Curve> curves, int curvetag) {
+        Enumeration<Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.getOrder() > 0) {
                 edges.add(new Edge(c, curvetag));
             }
         }
     }
 
-    private static Comparator YXTopComparator = new Comparator() {
-        public int compare(Object o1, Object o2) {
-            Curve c1 = ((Edge) o1).getCurve();
-            Curve c2 = ((Edge) o2).getCurve();
+    private static Comparator<Edge> YXTopComparator = new Comparator<Edge>() {
+        public int compare(Edge o1, Edge o2) {
+            Curve c1 = o1.getCurve();
+            Curve c2 = o2.getCurve();
             double v1, v2;
             if ((v1 = c1.getYTop()) == (v2 = c2.getYTop())) {
                 if ((v1 = c1.getXTop()) == (v2 = c2.getXTop())) {
@@ -195,12 +195,13 @@
         }
     };
 
-    private Vector pruneEdges(Vector edges) {
+    private Vector<Curve> pruneEdges(Vector<Edge> edges) {
         int numedges = edges.size();
         if (numedges < 2) {
-            return edges;
+            // empty vector is expected with less than 2 edges
+            return new Vector<>();
         }
-        Edge[] edgelist = (Edge[]) edges.toArray(new Edge[numedges]);
+        Edge[] edgelist = edges.toArray(new Edge[numedges]);
         Arrays.sort(edgelist, YXTopComparator);
         if (false) {
             System.out.println("pruning: ");
@@ -214,9 +215,9 @@
         int cur = 0;
         int next = 0;
         double yrange[] = new double[2];
-        Vector subcurves = new Vector();
-        Vector chains = new Vector();
-        Vector links = new Vector();
+        Vector<CurveLink> subcurves = new Vector<>();
+        Vector<ChainEnd> chains = new Vector<>();
+        Vector<CurveLink> links = new Vector<>();
         // Active edges are between left (inclusive) and right (exclusive)
         while (left < numedges) {
             double y = yrange[0];
@@ -385,7 +386,7 @@
             if (false) {
                 System.out.println("new links:");
                 for (int i = 0; i < links.size(); i++) {
-                    CurveLink link = (CurveLink) links.elementAt(i);
+                    CurveLink link = links.elementAt(i);
                     System.out.println("  "+link.getSubCurve());
                 }
             }
@@ -396,10 +397,10 @@
             yrange[0] = yend;
         }
         finalizeSubCurves(subcurves, chains);
-        Vector ret = new Vector();
-        Enumeration enum_ = subcurves.elements();
+        Vector<Curve> ret = new Vector<>();
+        Enumeration<CurveLink> enum_ = subcurves.elements();
         while (enum_.hasMoreElements()) {
-            CurveLink link = (CurveLink) enum_.nextElement();
+            CurveLink link = enum_.nextElement();
             ret.add(link.getMoveto());
             CurveLink nextlink = link;
             while ((nextlink = nextlink.getNext()) != null) {
@@ -413,7 +414,8 @@
         return ret;
     }
 
-    public static void finalizeSubCurves(Vector subcurves, Vector chains) {
+    public static void finalizeSubCurves(Vector<CurveLink> subcurves,
+                                         Vector<ChainEnd> chains) {
         int numchains = chains.size();
         if (numchains == 0) {
             return;
@@ -437,9 +439,9 @@
     private static CurveLink[] EmptyLinkList = new CurveLink[2];
     private static ChainEnd[] EmptyChainList = new ChainEnd[2];
 
-    public static void resolveLinks(Vector subcurves,
-                                    Vector chains,
-                                    Vector links)
+    public static void resolveLinks(Vector<CurveLink> subcurves,
+                                    Vector<ChainEnd> chains,
+                                    Vector<CurveLink> links)
     {
         int numlinks = links.size();
         CurveLink[] linklist;
--- a/jdk/src/share/classes/sun/awt/geom/Crossings.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/geom/Crossings.java	Wed Jul 05 19:42:29 2017 +0200
@@ -77,14 +77,14 @@
 
     public abstract boolean covers(double ystart, double yend);
 
-    public static Crossings findCrossings(Vector curves,
+    public static Crossings findCrossings(Vector<? extends Curve> curves,
                                           double xlo, double ylo,
                                           double xhi, double yhi)
     {
         Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi);
-        Enumeration enum_ = curves.elements();
+        Enumeration<? extends Curve> enum_ = curves.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(cross)) {
                 return null;
             }
@@ -237,7 +237,7 @@
         return false;
     }
 
-    private Vector tmp = new Vector();
+    private Vector<Curve> tmp = new Vector<>();
 
     public boolean accumulateQuad(double x0, double y0, double coords[]) {
         if (y0 < ylo && coords[1] < ylo && coords[3] < ylo) {
@@ -258,9 +258,9 @@
             return false;
         }
         Curve.insertQuad(tmp, x0, y0, coords);
-        Enumeration enum_ = tmp.elements();
+        Enumeration<Curve> enum_ = tmp.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(this)) {
                 return true;
             }
@@ -296,9 +296,9 @@
             return false;
         }
         Curve.insertCubic(tmp, x0, y0, coords);
-        Enumeration enum_ = tmp.elements();
+        Enumeration<Curve> enum_ = tmp.elements();
         while (enum_.hasMoreElements()) {
-            Curve c = (Curve) enum_.nextElement();
+            Curve c = enum_.nextElement();
             if (c.accumulateCrossings(this)) {
                 return true;
             }
--- a/jdk/src/share/classes/sun/awt/geom/Curve.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/geom/Curve.java	Wed Jul 05 19:42:29 2017 +0200
@@ -38,11 +38,11 @@
 
     protected int direction;
 
-    public static void insertMove(Vector curves, double x, double y) {
+    public static void insertMove(Vector<Curve> curves, double x, double y) {
         curves.add(new Order0(x, y));
     }
 
-    public static void insertLine(Vector curves,
+    public static void insertLine(Vector<Curve> curves,
                                   double x0, double y0,
                                   double x1, double y1)
     {
@@ -59,7 +59,7 @@
         }
     }
 
-    public static void insertQuad(Vector curves,
+    public static void insertQuad(Vector<Curve> curves,
                                   double x0, double y0,
                                   double coords[])
     {
@@ -82,7 +82,7 @@
         }
     }
 
-    public static void insertCubic(Vector curves,
+    public static void insertCubic(Vector<Curve> curves,
                                    double x0, double y0,
                                    double coords[])
     {
--- a/jdk/src/share/classes/sun/awt/geom/Order2.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/geom/Order2.java	Wed Jul 05 19:42:29 2017 +0200
@@ -47,7 +47,7 @@
     private double ycoeff1;
     private double ycoeff2;
 
-    public static void insert(Vector curves, double tmp[],
+    public static void insert(Vector<Curve> curves, double tmp[],
                               double x0, double y0,
                               double cx0, double cy0,
                               double x1, double y1,
@@ -74,7 +74,7 @@
                     tmp[i1 + 4], tmp[i1 + 5], direction);
     }
 
-    public static void addInstance(Vector curves,
+    public static void addInstance(Vector<Curve> curves,
                                    double x0, double y0,
                                    double cx0, double cy0,
                                    double x1, double y1,
--- a/jdk/src/share/classes/sun/awt/geom/Order3.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/geom/Order3.java	Wed Jul 05 19:42:29 2017 +0200
@@ -53,7 +53,7 @@
     private double ycoeff2;
     private double ycoeff3;
 
-    public static void insert(Vector curves, double tmp[],
+    public static void insert(Vector<Curve> curves, double tmp[],
                               double x0, double y0,
                               double cx0, double cy0,
                               double cx1, double cy1,
@@ -105,7 +105,7 @@
         }
     }
 
-    public static void addInstance(Vector curves,
+    public static void addInstance(Vector<Curve> curves,
                                    double x0, double y0,
                                    double cx0, double cy0,
                                    double cx1, double cy1,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/image/AbstractMultiResolutionImage.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.awt.image;
+
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.image.*;
+
+/**
+ * This class provides default implementations for the
+ * <code>MultiResolutionImage</code> interface. The developer needs only
+ * to subclass this abstract class and define the <code>getResolutionVariant</code>,
+ * <code>getResolutionVariants</code>, and <code>getBaseImage</code> methods.
+ *
+ *
+ * For example,
+ * {@code
+ * public class CustomMultiResolutionImage extends AbstractMultiResolutionImage {
+ *
+ *     int baseImageIndex;
+ *     Image[] resolutionVariants;
+ *
+ *     public CustomMultiResolutionImage(int baseImageIndex,
+ *             Image... resolutionVariants) {
+ *          this.baseImageIndex = baseImageIndex;
+ *          this.resolutionVariants = resolutionVariants;
+ *     }
+ *
+ *     @Override
+ *     public Image getResolutionVariant(float logicalDPIX, float logicalDPIY,
+ *             float baseImageWidth, float baseImageHeight,
+ *             float destImageWidth, float destImageHeight) {
+ *         // return a resolution variant based on the given logical DPI,
+ *         // base image size, or destination image size
+ *     }
+ *
+ *     @Override
+ *     public List<Image> getResolutionVariants() {
+ *         return Arrays.asList(resolutionVariants);
+ *     }
+ *
+ *     protected Image getBaseImage() {
+ *         return resolutionVariants[baseImageIndex];
+ *     }
+ * }
+ * }
+ *
+ * @see java.awt.Image
+ * @see java.awt.image.MultiResolutionImage
+ *
+ * @since 1.9
+ */
+public abstract class AbstractMultiResolutionImage extends java.awt.Image
+        implements MultiResolutionImage {
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public int getWidth(ImageObserver observer) {
+        return getBaseImage().getWidth(null);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public int getHeight(ImageObserver observer) {
+        return getBaseImage().getHeight(null);
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public ImageProducer getSource() {
+        return getBaseImage().getSource();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public Graphics getGraphics() {
+        return getBaseImage().getGraphics();
+
+    }
+
+    /**
+     * @inheritDoc
+     */
+    @Override
+    public Object getProperty(String name, ImageObserver observer) {
+        return getBaseImage().getProperty(name, observer);
+    }
+
+    /**
+     * @return base image
+     */
+    protected abstract Image getBaseImage();
+}
--- a/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/BufImgSurfaceData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -51,7 +51,7 @@
     private BufferedImageGraphicsConfig graphicsConfig;
     RenderLoops solidloops;
 
-    private static native void initIDs(Class ICM, Class ICMColorData);
+    private static native void initIDs(Class<?> ICM, Class<?> ICMColorData);
 
     private static final int DCM_RGBX_RED_MASK   = 0xff000000;
     private static final int DCM_RGBX_GREEN_MASK = 0x00ff0000;
--- a/jdk/src/share/classes/sun/awt/image/GifImageDecoder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/GifImageDecoder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -61,7 +61,7 @@
     int trans_pixel = -1;
     IndexColorModel global_model;
 
-    Hashtable props = new Hashtable();
+    Hashtable<String, Object> props = new Hashtable<>();
 
     byte[] saved_image;
     IndexColorModel saved_model;
--- a/jdk/src/share/classes/sun/awt/image/ImageDecoder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/ImageDecoder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -83,7 +83,7 @@
         return count;
     }
 
-    protected int setProperties(Hashtable props) {
+    protected int setProperties(Hashtable<?,?> props) {
         ImageConsumerQueue cq = null;
         int count = 0;
         while ((cq = nextConsumer(cq)) != null) {
@@ -164,7 +164,7 @@
         source.doneDecoding(this);
         close();
         java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
+            new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 feeder.interrupt();
                 return null;
--- a/jdk/src/share/classes/sun/awt/image/ImageFetcher.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/ImageFetcher.java	Wed Jul 05 19:42:29 2017 +0200
@@ -152,7 +152,7 @@
                         info.numWaiting--;
                     }
                 }
-                src = (ImageFetchable) info.waitList.elementAt(0);
+                src = info.waitList.elementAt(0);
                 info.waitList.removeElement(src);
             }
             return src;
@@ -303,26 +303,25 @@
        final ThreadGroup fetcherGroup = fetcherThreadGroup;
 
        java.security.AccessController.doPrivileged(
-         new java.security.PrivilegedAction() {
-         public Object run() {
-             for (int i = 0; i < info.fetchers.length; i++) {
-               if (info.fetchers[i] == null) {
-                   ImageFetcher f = new ImageFetcher(
-                           fetcherGroup, i);
-                   try {
-                       f.start();
-                       info.fetchers[i] = f;
-                       info.numFetchers++;
-                       break;
-                   } catch (Error e) {
+           new java.security.PrivilegedAction<Object>() {
+               public Object run() {
+                   for (int i = 0; i < info.fetchers.length; i++) {
+                       if (info.fetchers[i] == null) {
+                           ImageFetcher f = new ImageFetcher(fetcherGroup, i);
+                       try {
+                           f.start();
+                           info.fetchers[i] = f;
+                           info.numFetchers++;
+                           break;
+                       } catch (Error e) {
+                       }
                    }
+                 }
+                 return null;
                }
-             }
-          return null;
-        }
-       });
-      return;
-    }
+           });
+       return;
+   }
 
 }
 
@@ -337,13 +336,13 @@
     Thread[] fetchers;
     int numFetchers;
     int numWaiting;
-    Vector waitList;
+    Vector<ImageFetchable> waitList;
 
     private FetcherInfo() {
         fetchers = new Thread[MAX_NUM_FETCHERS_PER_APPCONTEXT];
         numFetchers = 0;
         numWaiting = 0;
-        waitList = new Vector();
+        waitList = new Vector<>();
     }
 
     /* The key to put()/get() the FetcherInfo into/from the AppContext. */
--- a/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/ImageRepresentation.java	Wed Jul 05 19:42:29 2017 +0200
@@ -185,7 +185,7 @@
     protected BufferedImage createImage(ColorModel cm,
                                         WritableRaster raster,
                                         boolean isRasterPremultiplied,
-                                        Hashtable properties)
+                                        Hashtable<?,?> properties)
     {
         BufferedImage bi =
             new BufferedImage(cm, raster, isRasterPremultiplied, null);
--- a/jdk/src/share/classes/sun/awt/image/ImagingLib.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/ImagingLib.java	Wed Jul 05 19:42:29 2017 +0200
@@ -61,7 +61,7 @@
     private static final int AFFINE_OP   = 1;
     private static final int CONVOLVE_OP = 2;
 
-    private static Class[] nativeOpClass = new Class[NUM_NATIVE_OPS];
+    private static Class<?>[] nativeOpClass = new Class<?>[NUM_NATIVE_OPS];
 
     /**
      * Returned value indicates whether the library initailization was
@@ -134,7 +134,7 @@
 
     }
 
-    private static int getNativeOpIndex(Class opClass) {
+    private static int getNativeOpIndex(Class<?> opClass) {
         //
         // Search for this class in cached list of
         // classes supplying native acceleration
--- a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -47,8 +47,8 @@
     private static ColorModel ARGBcolormodel;
     private static ColorModel Graycolormodel;
 
-    private static final Class InputStreamClass = InputStream.class;
-    private static native void initIDs(Class InputStreamClass);
+    private static final Class<?> InputStreamClass = InputStream.class;
+    private static native void initIDs(Class<?> InputStreamClass);
 
     private ColorModel colormodel;
 
@@ -73,7 +73,7 @@
     private native void readImage(InputStream is, byte buf[])
         throws ImageFormatException, IOException;
 
-    Hashtable props = new Hashtable();
+    Hashtable<String, Object> props = new Hashtable<>();
 
     public JPEGImageDecoder(InputStreamImageSource src, InputStream is) {
         super(src, is);
--- a/jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package sun.awt.image;
-
-import java.awt.Dimension;
-import java.awt.Image;
-import java.awt.Graphics;
-import java.awt.geom.Dimension2D;
-import java.awt.image.BufferedImage;
-import java.awt.image.ImageObserver;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Function;
-import java.util.function.BiFunction;
-import java.util.stream.Collectors;
-
-public class MultiResolutionBufferedImage extends BufferedImage
-        implements MultiResolutionImage {
-
-    private final BiFunction<Integer, Integer, Image> mapper;
-    private final Dimension2D[] sizes;
-    private int availableInfo;
-
-    public MultiResolutionBufferedImage(Image baseImage,
-            BiFunction<Integer, Integer, Image> mapper) {
-        this(baseImage, new Dimension[]{new Dimension(
-            baseImage.getWidth(null), baseImage.getHeight(null))
-        }, mapper);
-    }
-
-    public MultiResolutionBufferedImage(Image baseImage,
-            Dimension2D[] sizes, BiFunction<Integer, Integer, Image> mapper) {
-        super(baseImage.getWidth(null), baseImage.getHeight(null),
-                BufferedImage.TYPE_INT_ARGB_PRE);
-        this.sizes = sizes;
-        this.mapper = mapper;
-        this.availableInfo = getInfo(baseImage);
-        Graphics g = getGraphics();
-        g.drawImage(baseImage, 0, 0, null);
-        g.dispose();
-    }
-
-    @Override
-    public Image getResolutionVariant(int width, int height) {
-        int baseWidth = getWidth();
-        int baseHeight = getHeight();
-
-        if (baseWidth == width && baseHeight == height) {
-            return this;
-        }
-
-        ImageCache cache = ImageCache.getInstance();
-        ImageCacheKey key = new ImageCacheKey(this, width, height);
-        Image resolutionVariant = cache.getImage(key);
-        if (resolutionVariant == null) {
-            resolutionVariant = mapper.apply(width, height);
-            cache.setImage(key, resolutionVariant);
-            preload(resolutionVariant, availableInfo);
-        }
-
-        return resolutionVariant;
-    }
-
-    @Override
-    public List<Image> getResolutionVariants() {
-        return Arrays.stream(sizes).map((Function<Dimension2D, Image>) size
-                -> getResolutionVariant((int) size.getWidth(),
-                        (int) size.getHeight())).collect(Collectors.toList());
-    }
-
-    public MultiResolutionBufferedImage map(Function<Image, Image> mapper) {
-        return new MultiResolutionBufferedImage(mapper.apply(this), sizes,
-                (width, height) ->
-                        mapper.apply(getResolutionVariant(width, height)));
-    }
-
-    @Override
-    public int getWidth(ImageObserver observer) {
-        availableInfo |= ImageObserver.WIDTH;
-        return super.getWidth(observer);
-    }
-
-    @Override
-    public int getHeight(ImageObserver observer) {
-        availableInfo |= ImageObserver.HEIGHT;
-        return super.getHeight(observer);
-    }
-
-    @Override
-    public Object getProperty(String name, ImageObserver observer) {
-        availableInfo |= ImageObserver.PROPERTIES;
-        return super.getProperty(name, observer);
-    }
-
-    private static int getInfo(Image image) {
-        if (image instanceof ToolkitImage) {
-            return ((ToolkitImage) image).getImageRep().check(
-                    (img, infoflags, x, y, w, h) -> false);
-        }
-        return 0;
-    }
-
-    private static void preload(Image image, int availableInfo) {
-        if (availableInfo != 0 && image instanceof ToolkitImage) {
-            ((ToolkitImage) image).preload(new ImageObserver() {
-                int flags = availableInfo;
-
-                @Override
-                public boolean imageUpdate(Image img, int infoflags,
-                        int x, int y, int width, int height) {
-                    flags &= ~infoflags;
-                    return (flags != 0) && ((infoflags
-                            & (ImageObserver.ERROR | ImageObserver.ABORT)) == 0);
-                }
-            });
-        }
-    }
-
-    private static class ImageCacheKey implements ImageCache.PixelsKey {
-
-        private final int pixelCount;
-        private final int hash;
-
-        private final int w;
-        private final int h;
-        private final Image baseImage;
-
-        ImageCacheKey(final Image baseImage,
-                final int w, final int h) {
-            this.baseImage = baseImage;
-            this.w = w;
-            this.h = h;
-            this.pixelCount = w * h;
-            hash = hash();
-        }
-
-        @Override
-        public int getPixelCount() {
-            return pixelCount;
-        }
-
-        private int hash() {
-            int hash = baseImage.hashCode();
-            hash = 31 * hash + w;
-            hash = 31 * hash + h;
-            return hash;
-        }
-
-        @Override
-        public int hashCode() {
-            return hash;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj instanceof ImageCacheKey) {
-                ImageCacheKey key = (ImageCacheKey) obj;
-                return baseImage == key.baseImage && w == key.w && h == key.h;
-            }
-            return false;
-        }
-    }
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/image/MultiResolutionCachedImage.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.awt.image;
+
+import java.awt.Dimension;
+import java.awt.Image;
+import java.awt.geom.Dimension2D;
+import java.awt.image.ImageObserver;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.BiFunction;
+import java.util.stream.Collectors;
+
+public class MultiResolutionCachedImage extends AbstractMultiResolutionImage {
+
+    private final int baseImageWidth;
+    private final int baseImageHeight;
+    private final Dimension2D[] sizes;
+    private final BiFunction<Integer, Integer, Image> mapper;
+    private int availableInfo;
+
+    public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight,
+            BiFunction<Integer, Integer, Image> mapper) {
+        this(baseImageWidth, baseImageHeight, new Dimension[]{new Dimension(
+            baseImageWidth, baseImageHeight)
+        }, mapper);
+    }
+
+    public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight,
+            Dimension2D[] sizes, BiFunction<Integer, Integer, Image> mapper) {
+        this.baseImageWidth = baseImageWidth;
+        this.baseImageHeight = baseImageHeight;
+        this.sizes = sizes;
+        this.mapper = mapper;
+    }
+
+    @Override
+    public Image getResolutionVariant(int width, int height) {
+        ImageCache cache = ImageCache.getInstance();
+        ImageCacheKey key = new ImageCacheKey(this, width, height);
+        Image resolutionVariant = cache.getImage(key);
+        if (resolutionVariant == null) {
+            resolutionVariant = mapper.apply(width, height);
+            cache.setImage(key, resolutionVariant);
+        }
+        preload(resolutionVariant, availableInfo);
+        return resolutionVariant;
+    }
+
+    @Override
+    public List<Image> getResolutionVariants() {
+        return Arrays.stream(sizes).map((Function<Dimension2D, Image>) size
+                -> getResolutionVariant((int) size.getWidth(),
+                        (int) size.getHeight())).collect(Collectors.toList());
+    }
+
+    public MultiResolutionCachedImage map(Function<Image, Image> mapper) {
+        return new MultiResolutionCachedImage(baseImageWidth, baseImageHeight,
+                sizes, (width, height) ->
+                        mapper.apply(getResolutionVariant(width, height)));
+    }
+
+    @Override
+    public int getWidth(ImageObserver observer) {
+        updateInfo(observer, ImageObserver.WIDTH);
+        return super.getWidth(observer);
+    }
+
+    @Override
+    public int getHeight(ImageObserver observer) {
+        updateInfo(observer, ImageObserver.HEIGHT);
+        return super.getHeight(observer);
+    }
+
+    @Override
+    public Object getProperty(String name, ImageObserver observer) {
+        updateInfo(observer, ImageObserver.PROPERTIES);
+        return super.getProperty(name, observer);
+    }
+
+    @Override
+    protected Image getBaseImage() {
+        return getResolutionVariant(baseImageWidth, baseImageHeight);
+    }
+
+    private void updateInfo(ImageObserver observer, int info) {
+        availableInfo |= (observer == null) ? ImageObserver.ALLBITS : info;
+    }
+
+    private static int getInfo(Image image) {
+        if (image instanceof ToolkitImage) {
+            return ((ToolkitImage) image).getImageRep().check(
+                    (img, infoflags, x, y, w, h) -> false);
+        }
+        return 0;
+    }
+
+    private static void preload(Image image, int availableInfo) {
+        if (availableInfo != 0 && image instanceof ToolkitImage) {
+            ((ToolkitImage) image).preload(new ImageObserver() {
+                int flags = availableInfo;
+
+                @Override
+                public boolean imageUpdate(Image img, int infoflags,
+                        int x, int y, int width, int height) {
+                    flags &= ~infoflags;
+                    return (flags != 0) && ((infoflags
+                            & (ImageObserver.ERROR | ImageObserver.ABORT)) == 0);
+                }
+            });
+        }
+    }
+
+    private static class ImageCacheKey implements ImageCache.PixelsKey {
+
+        private final int pixelCount;
+        private final int hash;
+
+        private final int w;
+        private final int h;
+        private final Image baseImage;
+
+        ImageCacheKey(final Image baseImage,
+                final int w, final int h) {
+            this.baseImage = baseImage;
+            this.w = w;
+            this.h = h;
+            this.pixelCount = w * h;
+            hash = hash();
+        }
+
+        @Override
+        public int getPixelCount() {
+            return pixelCount;
+        }
+
+        private int hash() {
+            int hash = baseImage.hashCode();
+            hash = 31 * hash + w;
+            hash = 31 * hash + h;
+            return hash;
+        }
+
+        @Override
+        public int hashCode() {
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj instanceof ImageCacheKey) {
+                ImageCacheKey key = (ImageCacheKey) obj;
+                return baseImage == key.baseImage && w == key.w && h == key.h;
+            }
+            return false;
+        }
+    }
+}
\ No newline at end of file
--- a/jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/OffScreenImageSource.java	Wed Jul 05 19:42:29 2017 +0200
@@ -40,15 +40,15 @@
     BufferedImage image;
     int width;
     int height;
-    Hashtable properties;
+    Hashtable<?, ?> properties;
 
     public OffScreenImageSource(BufferedImage image,
-                                Hashtable properties) {
+                                Hashtable<?, ?> properties) {
         this.image = image;
         if (properties != null) {
             this.properties = properties;
         } else {
-            this.properties = new Hashtable();
+            this.properties = new Hashtable<String, Object>();
         }
         width  = image.getWidth();
         height = image.getHeight();
--- a/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/PNGImageDecoder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -68,7 +68,7 @@
     private int filterMethod;
     private int interlaceMethod;
     private int gamma = 100000;
-    private java.util.Hashtable properties;
+    private java.util.Hashtable<String, Object> properties;
   /* this is not needed
     ImageConsumer target;
     */
@@ -83,7 +83,7 @@
 
     private void property(String key,Object value) {
         if(value==null) return;
-        if(properties==null) properties=new java.util.Hashtable();
+        if(properties==null) properties=new java.util.Hashtable<>();
         properties.put(key,value);
     }
     private void property(String key,float value) {
--- a/jdk/src/share/classes/sun/awt/image/ToolkitImage.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/image/ToolkitImage.java	Wed Jul 05 19:42:29 2017 +0200
@@ -79,7 +79,7 @@
 
     private int width = -1;
     private int height = -1;
-    private Hashtable properties;
+    private Hashtable<?, ?> properties;
 
     private int availinfo;
 
@@ -254,9 +254,9 @@
         addInfo(ImageObserver.WIDTH | ImageObserver.HEIGHT);
     }
 
-    void setProperties(Hashtable props) {
+    void setProperties(Hashtable<?, ?> props) {
         if (props == null) {
-            props = new Hashtable();
+            props = new Hashtable<String, Object>();
         }
         properties = props;
         addInfo(ImageObserver.PROPERTIES);
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java	Wed Jul 05 19:42:29 2017 +0200
@@ -127,14 +127,14 @@
         File[] files = super.listFiles();
 
         if (!includeHiddenFiles) {
-            Vector v = new Vector();
+            Vector<File> v = new Vector<>();
             int nameCount = (files == null) ? 0 : files.length;
             for (int i = 0; i < nameCount; i++) {
                 if (!files[i].isHidden()) {
                     v.addElement(files[i]);
                 }
             }
-            files = (File[])v.toArray(new File[v.size()]);
+            files = v.toArray(new File[v.size()]);
         }
 
         return files;
@@ -208,7 +208,7 @@
     static {
         String managerClassName = (String)Toolkit.getDefaultToolkit().
                                       getDesktopProperty("Shell.shellFolderManager");
-        Class managerClass = null;
+        Class<?> managerClass = null;
         try {
             managerClass = ReflectUtil.forName(managerClassName);
         // swallow the exceptions below and use default shell folder
@@ -554,7 +554,7 @@
     /**
      * Provides a default comparator for the default column set
      */
-    private static final Comparator DEFAULT_COMPARATOR = new Comparator() {
+    private static final Comparator<Object> DEFAULT_COMPARATOR = new Comparator<Object>() {
         public int compare(Object o1, Object o2) {
             int gt;
 
@@ -565,7 +565,9 @@
             } else if (o1 == null && o2 != null) {
                 gt = -1;
             } else if (o1 instanceof Comparable) {
-                gt = ((Comparable) o1).compareTo(o2);
+                @SuppressWarnings("unchecked")
+                Comparable<Object> o = (Comparable<Object>) o1;
+                gt = o.compareTo(o2);
             } else {
                 gt = 0;
             }
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolderColumnInfo.java	Wed Jul 05 19:42:29 2017 +0200
@@ -38,7 +38,7 @@
      */
     private Integer alignment;
     private SortOrder sortOrder;
-    private Comparator comparator;
+    private Comparator<?> comparator;
     /**
      * <code>false</code> (default) if the {@link comparator} expects folders as arguments,
      * and <code>true</code> if folder's column values. The first option is used default for comparison
@@ -49,7 +49,7 @@
 
     public ShellFolderColumnInfo(String title, Integer width,
                                  Integer alignment, boolean visible,
-                                 SortOrder sortOrder, Comparator comparator,
+                                 SortOrder sortOrder, Comparator<?> comparator,
                                  boolean compareByColumn) {
         this.title = title;
         this.width = width;
@@ -62,7 +62,7 @@
 
     public ShellFolderColumnInfo(String title, Integer width,
                                  Integer alignment, boolean visible,
-                                 SortOrder sortOrder, Comparator comparator) {
+                                 SortOrder sortOrder, Comparator<?> comparator) {
         this(title, width, alignment, visible, sortOrder, comparator, false);
     }
 
@@ -115,11 +115,11 @@
         this.sortOrder = sortOrder;
     }
 
-    public Comparator getComparator() {
+    public Comparator<?> getComparator() {
         return comparator;
     }
 
-    public void setComparator(Comparator comparator) {
+    public void setComparator(Comparator<?> comparator) {
         this.comparator = comparator;
     }
 
--- a/jdk/src/share/classes/sun/awt/util/IdentityArrayList.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/util/IdentityArrayList.java	Wed Jul 05 19:42:29 2017 +0200
@@ -285,6 +285,7 @@
      *         this list
      * @throws NullPointerException if the specified array is null
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
         if (a.length < size)
             // Make a new array of a's runtime type, but my contents:
@@ -307,7 +308,9 @@
     public E get(int index) {
         rangeCheck(index);
 
-        return (E) elementData[index];
+        @SuppressWarnings("unchecked")
+        E rv = (E) elementData[index];
+        return rv;
     }
 
     /**
@@ -322,6 +325,7 @@
     public E set(int index, E element) {
         rangeCheck(index);
 
+        @SuppressWarnings("unchecked")
         E oldValue = (E) elementData[index];
         elementData[index] = element;
         return oldValue;
@@ -371,6 +375,7 @@
         rangeCheck(index);
 
         modCount++;
+        @SuppressWarnings("unchecked")
         E oldValue = (E) elementData[index];
 
         int numMoved = size - index - 1;
--- a/jdk/src/share/classes/sun/awt/util/IdentityLinkedList.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/awt/util/IdentityLinkedList.java	Wed Jul 05 19:42:29 2017 +0200
@@ -280,7 +280,9 @@
         Entry<E> successor = (index==size ? header : entry(index));
         Entry<E> predecessor = successor.previous;
         for (int i=0; i<numNew; i++) {
-            Entry<E> e = new Entry<E>((E)a[i], successor, predecessor);
+            @SuppressWarnings("unchecked")
+            E tmp = (E) a[i];
+            Entry<E> e = new Entry<E>(tmp, successor, predecessor);
             predecessor.next = e;
             predecessor = e;
         }
@@ -396,7 +398,7 @@
      */
     public int indexOf(Object o) {
         int index = 0;
-        for (Entry e = header.next; e != header; e = e.next) {
+        for (Entry<E> e = header.next; e != header; e = e.next) {
             if (o == e.element) {
                 return index;
             }
@@ -418,7 +420,7 @@
      */
     public int lastIndexOf(Object o) {
         int index = size;
-        for (Entry e = header.previous; e != header; e = e.previous) {
+        for (Entry<E> e = header.previous; e != header; e = e.previous) {
             index--;
             if (o == e.element) {
                 return index;
@@ -787,7 +789,7 @@
     }
 
     /** Adapter to provide descending iterators via ListItr.previous */
-    private class DescendingIterator implements Iterator {
+    private class DescendingIterator implements Iterator<E> {
         final ListItr itr = new ListItr(size());
         public boolean hasNext() {
             return itr.hasPrevious();
@@ -860,6 +862,7 @@
      *         this list
      * @throws NullPointerException if the specified array is null
      */
+    @SuppressWarnings("unchecked")
     public <T> T[] toArray(T[] a) {
         if (a.length < size)
             a = (T[])java.lang.reflect.Array.newInstance(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/util/ThreadGroupUtils.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.awt.util;
+
+/**
+ * A utility class needed to access the root {@code ThreadGroup}
+ *
+ * The class should not depend on any others, because it' called from JNI_OnLoad of the AWT
+ * native library. Triggering class loading could lead to a deadlock.
+ */
+public final class ThreadGroupUtils {
+
+    private ThreadGroupUtils() {
+        // Avoid instantiation
+    }
+
+    /**
+     * Returns a root thread group.
+     * Should be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION}
+     *
+     * @return a root {@code ThreadGroup}
+     */
+    public static ThreadGroup getRootThreadGroup() {
+        ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
+        ThreadGroup parentTG = currentTG.getParent();
+        while (parentTG != null) {
+            currentTG = parentTG;
+            parentTG = currentTG.getParent();
+        }
+        return currentTG;
+    }
+}
--- a/jdk/src/share/classes/sun/dc/META-INF/services/sun.java2d.pipe.RenderingEngine	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#  Ductus Rendering Engine module
-sun.dc.DuctusRenderingEngine
--- a/jdk/src/share/classes/sun/font/CreatedFontTracker.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/font/CreatedFontTracker.java	Wed Jul 05 19:42:29 2017 +0200
@@ -35,7 +35,7 @@
 import java.util.concurrent.TimeUnit;
 
 import sun.awt.AppContext;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 public class CreatedFontTracker {
 
--- a/jdk/src/share/classes/sun/font/SunFontManager.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/font/SunFontManager.java	Wed Jul 05 19:42:29 2017 +0200
@@ -52,7 +52,7 @@
 import sun.awt.AppContext;
 import sun.awt.FontConfiguration;
 import sun.awt.SunToolkit;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.FontSupport;
 import sun.util.logging.PlatformLogger;
 
@@ -1161,6 +1161,7 @@
             case FONTFORMAT_NATIVE:
                 NativeFont nf = new NativeFont(fileName, false);
                 physicalFont = addToFontList(nf, fontRank);
+                break;
             default:
 
             }
--- a/jdk/src/share/classes/sun/font/TrueTypeGlyphMapper.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/font/TrueTypeGlyphMapper.java	Wed Jul 05 19:42:29 2017 +0200
@@ -109,6 +109,7 @@
         cmap = CMap.theNullCmap;
     }
 
+    @SuppressWarnings("fallthrough")
     private final char remapJAChar(char unicode) {
         switch (unicode) {
         case REVERSE_SOLIDUS:
@@ -123,6 +124,7 @@
         default: return unicode;
         }
     }
+    @SuppressWarnings("fallthrough")
     private final int remapJAIntChar(int unicode) {
         switch (unicode) {
         case REVERSE_SOLIDUS:
--- a/jdk/src/share/classes/sun/java2d/Disposer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/Disposer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
 
 package sun.java2d;
 
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 import java.lang.ref.Reference;
 import java.lang.ref.ReferenceQueue;
--- a/jdk/src/share/classes/sun/java2d/Spans.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/Spans.java	Wed Jul 05 19:42:29 2017 +0200
@@ -49,7 +49,7 @@
      * Holds a list of individual
      * Span instances.
      */
-    private List mSpans = new Vector(kMaxAddsSinceSort);
+    private List<Span> mSpans = new Vector<>(kMaxAddsSinceSort);
 
     /**
      * The number of <code>Span</code>
@@ -144,7 +144,7 @@
         Collections.sort(mSpans);
         mAddsSinceSort = 0;
 
-        Iterator iter = mSpans.iterator();
+        Iterator<Span> iter = mSpans.iterator();
 
         /* Have 'span' start at the first span in
          * the collection. The collection may be empty
@@ -152,7 +152,7 @@
          */
         Span span = null;
         if (iter.hasNext()) {
-            span = (Span) iter.next();
+            span = iter.next();
         }
 
         /* Loop over the spans collapsing those that intersect
@@ -160,7 +160,7 @@
          */
         while (iter.hasNext()) {
 
-            Span nextSpan = (Span) iter.next();
+            Span nextSpan = iter.next();
 
             /* The spans are in ascending start position
              * order and so the next span's starting point
@@ -202,9 +202,9 @@
     private void printSpans() {
         System.out.println("----------");
         if (mSpans != null) {
-            Iterator iter = mSpans.iterator();
+            Iterator<Span> iter = mSpans.iterator();
             while (iter.hasNext()) {
-                Span span = (Span) iter.next();
+                Span span = iter.next();
                 System.out.println(span);
             }
         }
@@ -216,7 +216,7 @@
     /**
      * Holds a single half-open interval.
      */
-    static class Span implements Comparable {
+    static class Span implements Comparable<Span> {
 
         /**
          * The span includes the starting point.
@@ -315,8 +315,7 @@
          * position. The end position is ignored
          * in this ranking.
          */
-        public int compareTo(Object o) {
-            Span otherSpan = (Span) o;
+        public int compareTo(Span otherSpan) {
             float otherStart = otherSpan.getStart();
             int result;
 
@@ -345,7 +344,7 @@
      * <code>SpanIntersection.instance</code> to
      * get the single instance of this class.
      */
-    static class SpanIntersection implements Comparator {
+    static class SpanIntersection implements Comparator<Span> {
 
         /**
          * This class is a Singleton and the following
@@ -361,10 +360,8 @@
 
         }
 
-        public int compare(Object o1, Object o2) {
+        public int compare(Span span1, Span span2) {
             int result;
-            Span span1 = (Span) o1;
-            Span span2 = (Span) o2;
 
             /* Span 1 is entirely to the left of span2.
              * span1:   <-----<
--- a/jdk/src/share/classes/sun/java2d/SunGraphics2D.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/SunGraphics2D.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1430,8 +1430,11 @@
         }
     }
 
-    RenderingHints makeHints(Map hints) {
-        RenderingHints model = new RenderingHints(hints);
+    RenderingHints makeHints(Map<?,?> hints) {
+        RenderingHints model = new RenderingHints(null);
+        if (hints != null) {
+            model.putAll(hints);
+        }
         model.put(SunHints.KEY_RENDERING,
                   SunHints.Value.get(SunHints.INTKEY_RENDERING,
                                      renderHint));
--- a/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/SunGraphicsEnvironment.java	Wed Jul 05 19:42:29 2017 +0200
@@ -82,7 +82,7 @@
 
     public SunGraphicsEnvironment() {
         java.security.AccessController.doPrivileged(
-                                    new java.security.PrivilegedAction() {
+                                    new java.security.PrivilegedAction<Object>() {
             public Object run() {
                     String version = System.getProperty("os.version", "0.0");
                     try {
--- a/jdk/src/share/classes/sun/java2d/cmm/CMSManager.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/cmm/CMSManager.java	Wed Jul 05 19:42:29 2017 +0200
@@ -34,7 +34,6 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import sun.security.action.GetPropertyAction;
-import java.util.ServiceLoader;
 
 public class CMSManager {
     public static ColorSpace GRAYspace;       // These two fields allow access
@@ -52,35 +51,28 @@
             return cmmImpl;
         }
 
-        CMMServiceProvider spi = AccessController.doPrivileged(
-                new PrivilegedAction<CMMServiceProvider>() {
-                    public CMMServiceProvider run() {
-                        String cmmClass = System.getProperty(
-                            "sun.java2d.cmm", "sun.java2d.cmm.lcms.LcmsServiceProvider");
-
-                    ServiceLoader<CMMServiceProvider> cmmLoader
-                    = ServiceLoader.loadInstalled(CMMServiceProvider.class);
-
-                CMMServiceProvider spi = null;
+        GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm");
+        String cmmProviderClass = AccessController.doPrivileged(gpa);
+        CMMServiceProvider provider = null;
+        if (cmmProviderClass != null) {
+            try {
+                Class<?> cls = Class.forName(cmmProviderClass);
+                provider = (CMMServiceProvider)cls.newInstance();
+            } catch (ReflectiveOperationException e) {
+            }
+        }
+        if (provider == null) {
+            provider = new sun.java2d.cmm.lcms.LcmsServiceProvider();
+        }
 
-                for (CMMServiceProvider cmm : cmmLoader) {
-                    spi = cmm;
-                    if (cmm.getClass().getName().equals(cmmClass)) {
-                        break;
-                    }
-                }
-                return spi;
-            }
-        });
-
-        cmmImpl = spi.getColorManagementModule();
+        cmmImpl = provider.getColorManagementModule();
 
         if (cmmImpl == null) {
             throw new CMMException("Cannot initialize Color Management System."+
                                    "No CM module found");
         }
 
-        GetPropertyAction gpa = new GetPropertyAction("sun.java2d.cmm.trace");
+        gpa = new GetPropertyAction("sun.java2d.cmm.trace");
         String cmmTrace = AccessController.doPrivileged(gpa);
         if (cmmTrace != null) {
             cmmImpl = new CMMTracer(cmmImpl);
--- a/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/cmm/lcms/LCMS.java	Wed Jul 05 19:42:29 2017 +0200
@@ -189,7 +189,7 @@
                                            LCMSImageLayout dest);
     public static native void freeTransform(long ID);
 
-    public static native void initLCMS(Class Trans, Class IL, Class Pf);
+    public static native void initLCMS(Class<?> Trans, Class<?> IL, Class<?> Pf);
 
     private LCMS() {};
 
@@ -201,7 +201,7 @@
         }
 
         java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedAction() {
+                new java.security.PrivilegedAction<Object>() {
                     public Object run() {
                         /* We need to load awt here because of usage trace and
                          * disposer frameworks
--- a/jdk/src/share/classes/sun/java2d/cmm/lcms/META-INF/services/sun.java2d.cmm.CMMServiceProvider	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#  Little CMS color management module
-sun.java2d.cmm.lcms.LcmsServiceProvider
--- a/jdk/src/share/classes/sun/java2d/loops/Blit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/loops/Blit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -217,8 +217,8 @@
         Blit performop;
         Blit convertresult;
 
-        WeakReference srcTmp;
-        WeakReference dstTmp;
+        WeakReference<SurfaceData> srcTmp;
+        WeakReference<SurfaceData> dstTmp;
 
         public GeneralXorBlit(SurfaceType srctype,
                               CompositeType comptype,
@@ -257,14 +257,14 @@
             } else {
                 SurfaceData cachedSrc = null;
                 if (srcTmp != null) {
-                    cachedSrc = (SurfaceData) srcTmp.get();
+                    cachedSrc = srcTmp.get();
                 }
                 src = convertFrom(convertsrc, srcData, srcx, srcy,
                                   width, height, cachedSrc);
                 sx = 0;
                 sy = 0;
                 if (src != cachedSrc) {
-                    srcTmp = new WeakReference(src);
+                    srcTmp = new WeakReference<>(src);
                 }
             }
 
@@ -277,7 +277,7 @@
                 // assert: convertresult != null
                 SurfaceData cachedDst = null;
                 if (dstTmp != null) {
-                    cachedDst = (SurfaceData) dstTmp.get();
+                    cachedDst = dstTmp.get();
                 }
                 dst = convertFrom(convertdst, dstData, dstx, dsty,
                                   width, height, cachedDst);
@@ -285,7 +285,7 @@
                 dy = 0;
                 opclip = null;
                 if (dst != cachedDst) {
-                    dstTmp = new WeakReference(dst);
+                    dstTmp = new WeakReference<>(dst);
                 }
             }
 
--- a/jdk/src/share/classes/sun/java2d/loops/CustomComponent.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/loops/CustomComponent.java	Wed Jul 05 19:42:29 2017 +0200
@@ -50,7 +50,7 @@
     public static void register() {
         // REMIND: This does not work for all destinations yet since
         // the screen SurfaceData objects do not implement getRaster
-        Class owner = CustomComponent.class;
+        Class<?> owner = CustomComponent.class;
         GraphicsPrimitive[] primitives = {
             new GraphicsPrimitiveProxy(owner, "OpaqueCopyAnyToArgb",
                                        Blit.methodSignature,
--- a/jdk/src/share/classes/sun/java2d/loops/GeneralRenderer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/loops/GeneralRenderer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -50,7 +50,7 @@
 
 public final class GeneralRenderer {
     public static void register() {
-        Class owner = GeneralRenderer.class;
+        Class<?> owner = GeneralRenderer.class;
         GraphicsPrimitive[] primitives = {
             new  GraphicsPrimitiveProxy(owner, "SetFillRectANY",
                                         FillRect.methodSignature,
--- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitive.java	Wed Jul 05 19:42:29 2017 +0200
@@ -316,7 +316,7 @@
 
     public abstract GraphicsPrimitive traceWrap();
 
-    static HashMap traceMap;
+    static HashMap<Object, int[]> traceMap;
 
     public static int traceflags;
     public static String tracefile;
@@ -427,13 +427,14 @@
 
         public void run() {
             PrintStream ps = getTraceOutputFile();
-            Iterator iterator = traceMap.entrySet().iterator();
+            Iterator<Map.Entry<Object, int[]>> iterator =
+                traceMap.entrySet().iterator();
             long total = 0;
             int numprims = 0;
             while (iterator.hasNext()) {
-                Map.Entry me = (Map.Entry) iterator.next();
+                Map.Entry<Object, int[]> me = iterator.next();
                 Object prim = me.getKey();
-                int[] count = (int[]) me.getValue();
+                int[] count = me.getValue();
                 if (count[0] == 1) {
                     ps.print("1 call to ");
                 } else {
@@ -455,15 +456,15 @@
     public synchronized static void tracePrimitive(Object prim) {
         if ((traceflags & TRACECOUNTS) != 0) {
             if (traceMap == null) {
-                traceMap = new HashMap();
+                traceMap = new HashMap<>();
                 TraceReporter.setShutdownHook();
             }
-            Object o = traceMap.get(prim);
+            int[] o = traceMap.get(prim);
             if (o == null) {
                 o = new int[1];
                 traceMap.put(prim, o);
             }
-            ((int[]) o)[0]++;
+            o[0]++;
         }
         if ((traceflags & TRACELOG) != 0) {
             PrintStream ps = getTraceOutputFile();
--- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveMgr.java	Wed Jul 05 19:42:29 2017 +0200
@@ -45,11 +45,11 @@
     private static GraphicsPrimitive generalPrimitives[];
     private static boolean needssort = true;
 
-    private static native void initIDs(Class GP, Class ST, Class CT,
-                                       Class SG2D, Class Color, Class AT,
-                                       Class XORComp, Class AlphaComp,
-                                       Class Path2D, Class Path2DFloat,
-                                       Class SHints);
+    private static native void initIDs(Class<?> GP, Class<?> ST, Class<?> CT,
+                                       Class<?> SG2D, Class<?> Color, Class<?> AT,
+                                       Class<?> XORComp, Class<?> AlphaComp,
+                                       Class<?> Path2D, Class<?> Path2DFloat,
+                                       Class<?> SHints);
     private static native void registerNativeLoops();
 
     static {
@@ -73,16 +73,17 @@
         public int uniqueID;
     }
 
-    private static Comparator primSorter = new Comparator() {
-        public int compare(Object o1, Object o2) {
-            int id1 = ((GraphicsPrimitive) o1).getUniqueID();
-            int id2 = ((GraphicsPrimitive) o2).getUniqueID();
+    private static Comparator<GraphicsPrimitive> primSorter =
+            new Comparator<GraphicsPrimitive>() {
+        public int compare(GraphicsPrimitive o1, GraphicsPrimitive o2) {
+            int id1 = o1.getUniqueID();
+            int id2 = o2.getUniqueID();
 
             return (id1 == id2 ? 0 : (id1 < id2 ? -1 : 1));
         }
     };
 
-    private static Comparator primFinder = new Comparator() {
+    private static Comparator<Object> primFinder = new Comparator<Object>() {
         public int compare(Object o1, Object o2) {
             int id1 = ((GraphicsPrimitive) o1).getUniqueID();
             int id2 = ((PrimitiveSpec) o2).uniqueID;
--- a/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/loops/GraphicsPrimitiveProxy.java	Wed Jul 05 19:42:29 2017 +0200
@@ -41,7 +41,7 @@
  */
 public class GraphicsPrimitiveProxy extends GraphicsPrimitive {
 
-    private Class owner;
+    private Class<?> owner;
     private String relativeClassName;
 
     /**
@@ -53,7 +53,7 @@
      * @param relativeClassName  The name of the class this is a proxy for.
      *          This should not include the package.
      */
-    public GraphicsPrimitiveProxy(Class owner, String relativeClassName,
+    public GraphicsPrimitiveProxy(Class<?> owner, String relativeClassName,
                                   String methodSignature,
                                   int primID,
                                   SurfaceType srctype,
@@ -80,7 +80,7 @@
         String name = getPackageName(owner.getName()) + "."
                         + relativeClassName;
         try {
-            Class clazz = Class.forName(name);
+            Class<?> clazz = Class.forName(name);
             GraphicsPrimitive p = (GraphicsPrimitive) clazz.newInstance();
             if (!satisfiesSameAs(p)) {
                 throw new RuntimeException("Primitive " + p
--- a/jdk/src/share/classes/sun/java2d/loops/MaskBlit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/loops/MaskBlit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -143,8 +143,8 @@
         MaskBlit performop;
         Blit convertresult;
 
-        WeakReference srcTmp;
-        WeakReference dstTmp;
+        WeakReference<SurfaceData> srcTmp;
+        WeakReference<SurfaceData> dstTmp;
 
         public General(SurfaceType srctype,
                        CompositeType comptype,
@@ -184,14 +184,14 @@
             } else {
                 SurfaceData cachedSrc = null;
                 if (srcTmp != null) {
-                    cachedSrc = (SurfaceData) srcTmp.get();
+                    cachedSrc = srcTmp.get();
                 }
                 src = convertFrom(convertsrc, srcData, srcx, srcy,
                                   width, height, cachedSrc);
                 sx = 0;
                 sy = 0;
                 if (src != cachedSrc) {
-                    srcTmp = new WeakReference(src);
+                    srcTmp = new WeakReference<>(src);
                 }
             }
 
@@ -204,7 +204,7 @@
                 // assert: convertresult != null
                 SurfaceData cachedDst = null;
                 if (dstTmp != null) {
-                    cachedDst = (SurfaceData) dstTmp.get();
+                    cachedDst = dstTmp.get();
                 }
                 dst = convertFrom(convertdst, dstData, dstx, dsty,
                                   width, height, cachedDst);
@@ -212,7 +212,7 @@
                 dy = 0;
                 opclip = null;
                 if (dst != cachedDst) {
-                    dstTmp = new WeakReference(dst);
+                    dstTmp = new WeakReference<>(dst);
                 }
             }
 
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLBlitLoops.java	Wed Jul 05 19:42:29 2017 +0200
@@ -728,7 +728,7 @@
 class OGLGeneralBlit extends Blit {
 
     private Blit performop;
-    private WeakReference srcTmp;
+    private WeakReference<SurfaceData> srcTmp;
 
     OGLGeneralBlit(SurfaceType dstType,
                    CompositeType compType,
@@ -750,7 +750,7 @@
         SurfaceData cachedSrc = null;
         if (srcTmp != null) {
             // use cached intermediate surface, if available
-            cachedSrc = (SurfaceData)srcTmp.get();
+            cachedSrc = srcTmp.get();
         }
 
         // convert source to IntArgbPre
@@ -763,7 +763,7 @@
 
         if (src != cachedSrc) {
             // cache the intermediate surface
-            srcTmp = new WeakReference(src);
+            srcTmp = new WeakReference<>(src);
         }
     }
 }
@@ -802,7 +802,7 @@
 
         if (dstBuffer != cachedDst) {
             // cache the intermediate surface
-            dstTmp = new WeakReference(dstBuffer);
+            dstTmp = new WeakReference<>(dstBuffer);
         }
 
         // now blit the buffer back to the destination
--- a/jdk/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/opengl/OGLRenderQueue.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
 
 package sun.java2d.opengl;
 
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.pipe.RenderBuffer;
 import sun.java2d.pipe.RenderQueue;
 import static sun.java2d.pipe.BufferedOpCodes.*;
--- a/jdk/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/pipe/AlphaPaintPipe.java	Wed Jul 05 19:42:29 2017 +0200
@@ -48,16 +48,16 @@
  * SunGraphics2D.
  */
 public class AlphaPaintPipe implements CompositePipe {
-    static WeakReference cachedLastRaster;
-    static WeakReference cachedLastColorModel;
-    static WeakReference cachedLastData;
+    static WeakReference<Raster> cachedLastRaster;
+    static WeakReference<ColorModel> cachedLastColorModel;
+    static WeakReference<SurfaceData> cachedLastData;
 
     static class TileContext {
         SunGraphics2D sunG2D;
         PaintContext paintCtxt;
         ColorModel paintModel;
-        WeakReference lastRaster;
-        WeakReference lastData;
+        WeakReference<Raster> lastRaster;
+        WeakReference<SurfaceData> lastData;
         MaskBlit lastMask;
         Blit     lastBlit;
         SurfaceData dstData;
@@ -105,8 +105,8 @@
         SurfaceData srcData = null;
         Raster lastRas = null;
         if (context.lastData != null && context.lastRaster != null) {
-            srcData = (SurfaceData) context.lastData.get();
-            lastRas = (Raster) context.lastRaster.get();
+            srcData = context.lastData.get();
+            lastRas = context.lastRaster.get();
             if (srcData == null || lastRas == null) {
                 srcData = null;
                 lastRas = null;
@@ -127,7 +127,7 @@
                 }
                 if (lastRas != srcRaster) {
                     lastRas = srcRaster;
-                    context.lastRaster = new WeakReference(lastRas);
+                    context.lastRaster = new WeakReference<>(lastRas);
                     // REMIND: This will fail for a non-Writable raster!
                     BufferedImage bImg =
                         new BufferedImage(paintModel,
@@ -135,7 +135,7 @@
                                           paintModel.isAlphaPremultiplied(),
                                           null);
                     srcData = BufImgSurfaceData.createData(bImg);
-                    context.lastData = new WeakReference(srcData);
+                    context.lastData = new WeakReference<>(srcData);
                     context.lastMask = null;
                     context.lastBlit = null;
                 }
@@ -197,7 +197,7 @@
                 {
                     // Avoid creating new WeakReference if possible
                     cachedLastColorModel =
-                        new WeakReference(context.paintModel);
+                        new WeakReference<>(context.paintModel);
                 }
                 cachedLastData = context.lastData;
             }
--- a/jdk/src/share/classes/sun/java2d/pipe/RenderQueue.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/pipe/RenderQueue.java	Wed Jul 05 19:42:29 2017 +0200
@@ -81,10 +81,10 @@
      * A Set containing hard references to Objects that must stay alive until
      * the queue has been completely flushed.
      */
-    protected Set refSet;
+    protected Set<Object> refSet;
 
     protected RenderQueue() {
-        refSet = new HashSet();
+        refSet = new HashSet<>();
         buf = RenderBuffer.allocate(BUFFER_SIZE);
     }
 
--- a/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/pipe/RenderingEngine.java	Wed Jul 05 19:42:29 2017 +0200
@@ -32,7 +32,6 @@
 
 import java.security.PrivilegedAction;
 import java.security.AccessController;
-import java.util.ServiceLoader;
 import sun.security.action.GetPropertyAction;
 
 import sun.awt.geom.PathConsumer2D;
@@ -97,12 +96,9 @@
      * </pre>
      *
      * If no specific {@code RenderingEngine} is specified on the command
-     * or Ductus renderer is specified, it will attempt loading the
-     * sun.dc.DuctusRenderingEngine class using Class.forName as a fastpath;
-     * if not found, use the ServiceLoader.
-     * If no specific {@code RenderingEngine} is specified on the command
-     * line then the last one returned by enumerating all subclasses of
-     * {@code RenderingEngine} known to the ServiceLoader is used.
+     * or Ductus renderer is specified, it will first attempt loading the
+     * sun.dc.DuctusRenderingEngine class using Class.forName, if that
+     * is not found, then it will look for Pisces.
      * <p>
      * Runtime tracing of the actions of the {@code RenderingEngine}
      * can be enabled by specifying the runtime flag:
@@ -117,42 +113,30 @@
             return reImpl;
         }
 
-        reImpl =
-            AccessController.doPrivileged(new PrivilegedAction<RenderingEngine>() {
-                public RenderingEngine run() {
-                    final String ductusREClass = "sun.dc.DuctusRenderingEngine";
-                    String reClass =
-                        System.getProperty("sun.java2d.renderer", ductusREClass);
-                    if (reClass.equals(ductusREClass)) {
-                        try {
-                            Class<?> cls = Class.forName(ductusREClass);
-                            return (RenderingEngine) cls.newInstance();
-                        } catch (ReflectiveOperationException ignored) {
-                            // not found
-                        }
-                    }
-
-                    ServiceLoader<RenderingEngine> reLoader =
-                        ServiceLoader.loadInstalled(RenderingEngine.class);
-
-                    RenderingEngine service = null;
-
-                    for (RenderingEngine re : reLoader) {
-                        service = re;
-                        if (re.getClass().getName().equals(reClass)) {
-                            break;
-                        }
-                    }
-                    return service;
-                }
-            });
+        /* Look first for ductus or an app-override renderer,
+         * if not specified or present, then look for pisces.
+         */
+        final String ductusREClass = "sun.dc.DuctusRenderingEngine";
+        final String piscesREClass = "sun.java2d.pisces.PiscesRenderingEngine";
+        GetPropertyAction gpa =
+            new GetPropertyAction("sun.java2d.renderer", ductusREClass);
+        String reClass = AccessController.doPrivileged(gpa);
+        try {
+            Class<?> cls = Class.forName(reClass);
+            reImpl = (RenderingEngine) cls.newInstance();
+        } catch (ReflectiveOperationException ignored0) {
+            try {
+                Class<?> cls = Class.forName(piscesREClass);
+                reImpl = (RenderingEngine) cls.newInstance();
+            } catch (ReflectiveOperationException ignored1) {
+            }
+        }
 
         if (reImpl == null) {
             throw new InternalError("No RenderingEngine module found");
         }
 
-        GetPropertyAction gpa =
-            new GetPropertyAction("sun.java2d.renderer.trace");
+        gpa = new GetPropertyAction("sun.java2d.renderer.trace");
         String reTrace = AccessController.doPrivileged(gpa);
         if (reTrace != null) {
             reImpl = new Tracer(reImpl);
--- a/jdk/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/java2d/pipe/SpanClipRenderer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -39,14 +39,14 @@
 {
     CompositePipe outpipe;
 
-    static Class RegionClass = Region.class;
-    static Class RegionIteratorClass = RegionIterator.class;
+    static Class<?> RegionClass = Region.class;
+    static Class<?> RegionIteratorClass = RegionIterator.class;
 
     static {
         initIDs(RegionClass, RegionIteratorClass);
     }
 
-    static native void initIDs(Class rc, Class ric);
+    static native void initIDs(Class<?> rc, Class<?> ric);
 
     public SpanClipRenderer(CompositePipe pipe) {
         outpipe = pipe;
--- a/jdk/src/share/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-#  Pisces Rendering Engine module
-sun.java2d.pisces.PiscesRenderingEngine
--- a/jdk/src/share/classes/sun/misc/ThreadGroupUtils.java	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-/**
- * A utility class needed to access the root {@code ThreadGroup}
- *
- * The class should not depend on any others, because it' called from JNI_OnLoad of the AWT
- * native library. Triggering class loading could could lead to a deadlock.
- */
-public final class ThreadGroupUtils {
-
-    private ThreadGroupUtils() {
-        // Avoid instantiation
-    }
-
-    /**
-     * Returns a root thread group.
-     * Should be called with {@link sun.security.util.SecurityConstants#MODIFY_THREADGROUP_PERMISSION}
-     *
-     * @return a root {@code ThreadGroup}
-     */
-    public static ThreadGroup getRootThreadGroup() {
-        ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
-        ThreadGroup parentTG = currentTG.getParent();
-        while (parentTG != null) {
-            currentTG = parentTG;
-            parentTG = currentTG.getParent();
-        }
-        return currentTG;
-    }
-}
--- a/jdk/src/share/classes/sun/misc/VM.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/misc/VM.java	Wed Jul 05 19:42:29 2017 +0200
@@ -370,7 +370,37 @@
     /**
      * Returns {@code true} if we are in a set UID program.
      */
-    public static native boolean isSetUID();
+    public static boolean isSetUID() {
+        long uid = getuid();
+        long euid = geteuid();
+        long gid = getgid();
+        long egid = getegid();
+        return uid != euid  || gid != egid;
+    }
+
+    /**
+     * Returns the real user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getuid();
+
+    /**
+     * Returns the effective user ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long geteuid();
+
+    /**
+     * Returns the real group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getgid();
+
+    /**
+     * Returns the effective group ID of the calling process,
+     * or -1 if the value is not available.
+     */
+    public static native long getegid();
 
     static {
         initialize();
--- a/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/reflect/annotation/TypeAnnotationParser.java	Wed Jul 05 19:42:29 2017 +0200
@@ -75,7 +75,7 @@
             if (ti.getTarget() == filter)
                 l.add(t);
         }
-        TypeAnnotation[] typeAnnotations = l.toArray(new TypeAnnotation[0]);
+        TypeAnnotation[] typeAnnotations = l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY);
         return AnnotatedTypeFactory.buildAnnotatedType(type,
                                                        LocationInfo.BASE_LOCATION,
                                                        typeAnnotations,
@@ -245,7 +245,6 @@
         if (bounds != null) {
             int startIndex = 0;
             AnnotatedType[] res = new AnnotatedType[bounds.length];
-            Arrays.fill(res, AnnotatedTypeFactory.EMPTY_ANNOTATED_TYPE);
 
             // Adjust bounds index
             //
@@ -276,12 +275,12 @@
                             tInfo.getCount() == typeVarIndex) {
                         l.add(t);
                     }
-                    res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
-                                                                     loc,
-                                                                     l.toArray(new TypeAnnotation[0]),
-                                                                     candidates.toArray(new TypeAnnotation[0]),
-                                                                     (AnnotatedElement)decl);
                 }
+                res[i] = AnnotatedTypeFactory.buildAnnotatedType(bounds[i],
+                        loc,
+                        l.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
+                        candidates.toArray(EMPTY_TYPE_ANNOTATION_ARRAY),
+                        (AnnotatedElement)decl);
             }
             return res;
         }
--- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Wed Jul 05 19:42:29 2017 +0200
@@ -39,7 +39,6 @@
 import java.security.AccessController;
 import java.util.*;
 
-import com.sun.security.auth.module.UnixSystem;
 import sun.security.action.GetPropertyAction;
 import sun.security.krb5.internal.KerberosTime;
 import sun.security.krb5.internal.Krb5;
@@ -61,8 +60,7 @@
  *
  *    service_euid
  *
- * Java does not have a method to get euid, so uid is used instead. This
- * should normally to be since a Java program is seldom used as a setuid app.
+ * in which euid is available as sun.misc.VM.geteuid().
  *
  * The file has a header:
  *
@@ -108,14 +106,8 @@
 
     private static long uid;
     static {
-        try {
-            // Available on Solaris, Linux and Mac. Otherwise, no _euid suffix
-            UnixSystem us = new com.sun.security.auth.module.UnixSystem();
-            uid = us.getUid();
-        } catch (Throwable e) {
-            // Cannot be only Exception, might be UnsatisfiedLinkError
-            uid = -1;
-        }
+        // Available on Solaris, Linux and Mac. Otherwise, -1 and no _euid suffix
+        uid = sun.misc.VM.geteuid();
     }
 
     public DflCache (String source) {
--- a/jdk/src/share/classes/sun/security/pkcs11/P11Util.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/security/pkcs11/P11Util.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -166,7 +166,7 @@
         if (b == null) {
             return "(null)";
         }
-        StringBuffer sb = new StringBuffer(b.length * 3);
+        StringBuilder sb = new StringBuilder(b.length * 3);
         for (int i = 0; i < b.length; i++) {
             int k = b[i] & 0xff;
             if (i != 0) {
--- a/jdk/src/share/classes/sun/security/provider/DigestBase.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/security/provider/DigestBase.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,10 +122,10 @@
             }
         }
         // compress complete blocks
-        while (len >= blockSize) {
-            implCompress(b, ofs);
-            len -= blockSize;
-            ofs += blockSize;
+        if (len >= blockSize) {
+            int limit = ofs + len;
+            ofs = implCompressMultiBlock(b, ofs, limit - blockSize);
+            len = limit - ofs;
         }
         // copy remainder to buffer
         if (len > 0) {
@@ -134,6 +134,14 @@
         }
     }
 
+    // compress complete blocks
+    private int implCompressMultiBlock(byte[] b, int ofs, int limit) {
+        for (; ofs <= limit; ofs += blockSize) {
+            implCompress(b, ofs);
+        }
+        return ofs;
+    }
+
     // reset this object. See JCA doc.
     protected final void engineReset() {
         if (bytesProcessed == 0) {
--- a/jdk/src/share/classes/sun/text/resources/es/FormatData_es_DO.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/text/resources/es/FormatData_es_DO.java	Wed Jul 05 19:42:29 2017 +0200
@@ -75,8 +75,8 @@
                 new String[] {
                     "EEEE d' de 'MMMM' de 'yyyy", // full date pattern
                     "d' de 'MMMM' de 'yyyy", // long date pattern
-                    "MM/dd/yyyy", // medium date pattern
-                    "MM/dd/yy", // short date pattern
+                    "dd/MM/yyyy", // medium date pattern
+                    "dd/MM/yy", // short date pattern
                 }
             },
             { "DateTimePatterns",
--- a/jdk/src/share/classes/sun/tools/jinfo/JInfo.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/tools/jinfo/JInfo.java	Wed Jul 05 19:42:29 2017 +0200
@@ -158,6 +158,8 @@
                         sysprops(pid);
                         System.out.println();
                         flags(pid);
+                        System.out.println();
+                        commandLine(pid);
                     } else {
                         usage(1);
                     }
@@ -248,6 +250,12 @@
         drain(vm, in);
     }
 
+    private static void commandLine(String pid) throws IOException {
+        HotSpotVirtualMachine vm = (HotSpotVirtualMachine) attach(pid);
+        InputStream in = vm.executeJCmd("VM.command_line");
+        drain(vm, in);
+    }
+
     private static void sysprops(String pid) throws IOException {
         HotSpotVirtualMachine vm = (HotSpotVirtualMachine) attach(pid);
         InputStream in = vm.executeJCmd("VM.system_properties");
--- a/jdk/src/share/classes/sun/tools/serialver/SerialVer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/tools/serialver/SerialVer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,6 @@
 package sun.tools.serialver;
 
 import java.io.*;
-import java.awt.*;
-import java.applet.*;
 import java.io.ObjectStreamClass;
 import java.util.Properties;
 import java.text.MessageFormat;
@@ -39,106 +37,7 @@
 import java.util.StringTokenizer;
 import sun.net.www.ParseUtil;
 
-public class SerialVer extends Applet {
-    GridBagLayout gb;
-    TextField classname_t;
-    Button show_b;
-    TextField serialversion_t;
-    Label footer_l;
-
-    private static final long serialVersionUID = 7666909783837760853L;
-
-    public synchronized void init() {
-        gb = new GridBagLayout();
-        setLayout(gb);
-
-        GridBagConstraints c = new GridBagConstraints();
-        c.fill = GridBagConstraints.BOTH;
-
-        Label l1 = new Label(Res.getText("FullClassName"));
-        l1.setAlignment(Label.RIGHT);
-        gb.setConstraints(l1, c);
-        add(l1);
-
-        classname_t = new TextField(20);
-        c.gridwidth = GridBagConstraints.RELATIVE;
-        c.weightx = 1.0;
-        gb.setConstraints(classname_t, c);
-        add(classname_t);
-
-        show_b = new Button(Res.getText("Show"));
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        c.weightx = 0.0;        /* Don't grow the button */
-        gb.setConstraints(show_b, c);
-        add(show_b);
-
-        Label l2 = new Label(Res.getText("SerialVersion"));
-        l2.setAlignment(Label.RIGHT);
-        c.gridwidth = 1;
-        gb.setConstraints(l2, c);
-        add(l2);
-
-        serialversion_t = new TextField(50);
-        serialversion_t.setEditable(false);
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        gb.setConstraints(serialversion_t, c);
-        add(serialversion_t);
-
-        footer_l = new Label();
-        c.gridwidth = GridBagConstraints.REMAINDER;
-        gb.setConstraints(footer_l, c);
-        add(footer_l);
-
-        /* Give the focus to the type-in area */
-        classname_t.requestFocus();
-    }
-
-    public void start() {
-        /* Give the focus to the type-in area */
-        classname_t.requestFocus();
-    }
-
-    @SuppressWarnings("deprecation")
-    public boolean action(Event ev, Object obj) {
-        if (ev.target == classname_t) {
-            show((String)ev.arg);
-            return true;
-        } else if (ev.target == show_b) {
-            show(classname_t.getText());
-            return true;
-        }
-        return false;
-    }
-
-
-    @SuppressWarnings("deprecation")
-    public boolean handleEvent(Event ev) {
-        boolean rc = super.handleEvent(ev);
-        return rc;
-    }
-
-    /**
-     * Lookup the specified classname and display it.
-     */
-    void show(String classname) {
-        try {
-            footer_l.setText(""); // Clear the message
-            serialversion_t.setText(""); // clear the last value
-
-            if (classname.equals("")) {
-                return;
-            }
-
-            String s = serialSyntax(classname);
-            if (s != null) {
-                serialversion_t.setText(s);
-            } else {
-                footer_l.setText(Res.getText("NotSerializable", classname));
-            }
-        } catch (ClassNotFoundException cnf) {
-            footer_l.setText(Res.getText("ClassNotFound", classname));
-        }
-    }
+public class SerialVer {
 
     /*
      * A class loader that will load from the CLASSPATH environment
@@ -218,13 +117,7 @@
         }
     }
 
-    @SuppressWarnings("deprecation")
-    private static void showWindow(Window w) {
-        w.show();
-    }
-
     public static void main(String[] args) {
-        boolean show = false;
         String envcp = null;
         int i = 0;
 
@@ -234,9 +127,7 @@
         }
 
         for (i = 0; i < args.length; i++) {
-            if (args[i].equals("-show")) {
-                show = true;
-            } else if (args[i].equals("-classpath")) {
+            if (args[i].equals("-classpath")) {
                 if ((i+1 == args.length) || args[i+1].startsWith("-")) {
                     System.err.println(Res.getText("error.missing.classpath"));
                     usage();
@@ -278,51 +169,35 @@
             System.exit(3);
         }
 
-        if (!show) {
-            /*
-             * Check if there are any class names specified, if it is not a
-             * invocation with the -show option.
-             */
-            if (i == args.length) {
-                usage();
-                System.exit(1);
-            }
+        /*
+         * Check if there are any class names specified
+         */
+        if (i == args.length) {
+            usage();
+            System.exit(1);
+        }
 
-            /*
-             * The rest of the parameters are classnames.
-             */
-            boolean exitFlag = false;
-            for (i = i; i < args.length; i++ ) {
-                try {
-                    String syntax = serialSyntax(args[i]);
-                    if (syntax != null)
-                        System.out.println(args[i] + ":" + syntax);
-                    else {
-                        System.err.println(Res.getText("NotSerializable",
-                            args[i]));
-                        exitFlag = true;
-                    }
-                } catch (ClassNotFoundException cnf) {
-                    System.err.println(Res.getText("ClassNotFound", args[i]));
+        /*
+         * The rest of the parameters are classnames.
+         */
+        boolean exitFlag = false;
+        for (i = i; i < args.length; i++ ) {
+            try {
+                String syntax = serialSyntax(args[i]);
+                if (syntax != null)
+                    System.out.println(args[i] + ":" + syntax);
+                else {
+                    System.err.println(Res.getText("NotSerializable",
+                        args[i]));
                     exitFlag = true;
                 }
-            }
-            if (exitFlag) {
-                System.exit(1);
-            }
-        } else {
-            if (i < args.length) {
-                System.err.println(Res.getText("ignoring.classes"));
-                System.exit(1);
+            } catch (ClassNotFoundException cnf) {
+                System.err.println(Res.getText("ClassNotFound", args[i]));
+                exitFlag = true;
             }
-            Frame f =  new SerialVerFrame();
-            //  f.setLayout(new FlowLayout());
-            SerialVer sv = new SerialVer();
-            sv.init();
-
-            f.add("Center", sv);
-            f.pack();
-            showWindow(f);
+        }
+        if (exitFlag) {
+            System.exit(1);
         }
     }
 
@@ -337,65 +212,6 @@
 }
 
 /**
- * Top level frame so serialVer can be run as an main program
- * and have an exit menu item.
- */
-class SerialVerFrame extends Frame {
-    MenuBar menu_mb;
-    Menu file_m;
-    MenuItem exit_i;
-
-    private static final long serialVersionUID = -7248105987187532533L;
-
-    /*
-     * Construct a new Frame with title and menu.
-     */
-    SerialVerFrame() {
-        super(Res.getText("SerialVersionInspector"));
-
-        /* Create the file menu */
-        file_m = new Menu(Res.getText("File"));
-        file_m.add(exit_i = new MenuItem(Res.getText("Exit")));
-
-        /* Now add the file menu to the menu bar  */
-        menu_mb = new MenuBar();
-        menu_mb.add(file_m);
-
-        /* Add the menubar to the frame */
-        // Bug in JDK1.1        setMenuBar(menu_mb);
-    }
-
-    /*
-     * Handle a window destroy event by exiting.
-     */
-    @SuppressWarnings("deprecation")
-    public boolean handleEvent(Event e) {
-        if (e.id == Event.WINDOW_DESTROY) {
-            exit(0);
-        }
-        return super.handleEvent(e);
-    }
-    /*
-     * Handle an Exit event by exiting.
-     */
-    @SuppressWarnings("deprecation")
-    public boolean action(Event ev, Object obj) {
-        if (ev.target == exit_i) {
-            exit(0);
-        }
-        return false;
-    }
-
-    /*
-     * Cleanup and exit.
-     */
-    void exit(int ret) {
-        System.exit(ret);
-    }
-
-}
-
-/**
  * Utility for integrating with serialver and for localization.
  * Handle Resources. Access to error and warning counts.
  * Message formatting.
--- a/jdk/src/share/classes/sun/tools/serialver/resources/serialver.properties	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/classes/sun/tools/serialver/resources/serialver.properties	Wed Jul 05 19:42:29 2017 +0200
@@ -1,9 +1,3 @@
-SerialVersionInspector=Serial Version Inspector
-File=File
-Exit=Exit
-Show=Show
-FullClassName=Full Class Name:
-SerialVersion=Serial Version:
 NotSerializable=\
 	Class {0} is not Serializable.
 ClassNotFound=\
@@ -14,7 +8,5 @@
 	Missing argument for -classpath option
 invalid.flag=\
 	Invalid flag {0}.
-ignoring.classes=\
-	Cannot specify class arguments with the -show option
 usage=\
-	use: serialver [-classpath classpath] [-show] [classname...]
+	use: serialver [-classpath classpath] [classname...]
--- a/jdk/src/share/lib/security/sunpkcs11-solaris.cfg	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/lib/security/sunpkcs11-solaris.cfg	Wed Jul 05 19:42:29 2017 +0200
@@ -18,16 +18,6 @@
 
 disabledMechanisms = {
   CKM_DSA_KEY_PAIR_GEN
-# the following mechanisms are disabled due to CKR_SAVED_STATE_INVALID bug
-# (Solaris bug 7058108)
-  CKM_MD2
-  CKM_MD5
-  CKM_SHA_1
-# the following mechanisms are disabled due to no cloning support
-# (Solaris bug 7050617)
-  CKM_SHA256
-  CKM_SHA384
-  CKM_SHA512
 # the following mechanisms are disabled due to performance issues
 # (Solaris bug 6337157)
   CKM_DSA_SHA1
--- a/jdk/src/share/native/java/util/TimeZone.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/native/java/util/TimeZone.c	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,42 +38,28 @@
  */
 JNIEXPORT jstring JNICALL
 Java_java_util_TimeZone_getSystemTimeZoneID(JNIEnv *env, jclass ign,
-                                            jstring java_home, jstring country)
+                                            jstring java_home)
 {
-    const char *cname;
     const char *java_home_dir;
     char *javaTZ;
+    jstring jstrJavaTZ = NULL;
 
-    if (java_home == NULL)
-        return NULL;
+    CHECK_NULL_RETURN(java_home, NULL);
 
     java_home_dir = JNU_GetStringPlatformChars(env, java_home, 0);
-    if (java_home_dir == NULL)
-        return NULL;
-
-    if (country != NULL) {
-        cname = JNU_GetStringPlatformChars(env, country, 0);
-        /* ignore error cases for cname */
-    } else {
-        cname = NULL;
-    }
+    CHECK_NULL_RETURN(java_home_dir, NULL);
 
     /*
      * Invoke platform dependent mapping function
      */
-    javaTZ = findJavaTZ_md(java_home_dir, cname);
-
-    free((void *)java_home_dir);
-    if (cname != NULL) {
-        free((void *)cname);
+    javaTZ = findJavaTZ_md(java_home_dir);
+    if (javaTZ != NULL) {
+        jstrJavaTZ = JNU_NewStringPlatform(env, javaTZ);
+        free((void *)javaTZ);
     }
 
-    if (javaTZ != NULL) {
-        jstring jstrJavaTZ = JNU_NewStringPlatform(env, javaTZ);
-        free((void *)javaTZ);
-        return jstrJavaTZ;
-    }
-    return NULL;
+    JNU_ReleaseStringPlatformChars(env, java_home, java_home_dir);
+    return jstrJavaTZ;
 }
 
 /*
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,6 @@
 
 #include "splashscreen_impl.h"
 
-#include "jinclude.h"
 #include "jpeglib.h"
 #include "jerror.h"
 
@@ -107,11 +106,11 @@
     if (cinfo->src == NULL) {   /* first time for this JPEG object? */
         cinfo->src = (struct jpeg_source_mgr *)
             (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
-            JPOOL_PERMANENT, SIZEOF(stream_source_mgr));
+            JPOOL_PERMANENT, sizeof(stream_source_mgr));
         src = (stream_src_ptr) cinfo->src;
         src->buffer = (JOCTET *)
             (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo,
-            JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET));
+            JPOOL_PERMANENT, INPUT_BUF_SIZE * sizeof(JOCTET));
     }
 
     src = (stream_src_ptr) cinfo->src;
--- a/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/native/sun/java2d/cmm/lcms/LCMS.c	Wed Jul 05 19:42:29 2017 +0200
@@ -30,7 +30,7 @@
 #include "jni_util.h"
 #include "Trace.h"
 #include "Disposer.h"
-#include "lcms2.h"
+#include <lcms2.h>
 #include "jlong.h"
 
 
--- a/jdk/src/share/native/sun/java2d/loops/ProcessPath.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/native/sun/java2d/loops/ProcessPath.c	Wed Jul 05 19:42:29 2017 +0200
@@ -189,34 +189,34 @@
 
 #define PROCESS_POINT(hnd, fX, fY, checkBounds, pixelInfo)                  \
     do {                                                                    \
-        jint _X = (fX)>> MDP_PREC;                                          \
-        jint _Y = (fY)>> MDP_PREC;                                          \
+        jint X_ = (fX)>> MDP_PREC;                                          \
+        jint Y_ = (fY)>> MDP_PREC;                                          \
         if (checkBounds &&                                                  \
-            (hnd->dhnd->yMin > _Y  ||                                       \
-             hnd->dhnd->yMax <= _Y ||                                       \
-             hnd->dhnd->xMin > _X  ||                                       \
-             hnd->dhnd->xMax <= _X)) break;                                 \
+            (hnd->dhnd->yMin > Y_  ||                                       \
+             hnd->dhnd->yMax <= Y_ ||                                       \
+             hnd->dhnd->xMin > X_  ||                                       \
+             hnd->dhnd->xMax <= X_)) break;                                 \
 /*                                                                          \
- *       (_X,_Y) should be inside boundaries                                \
+ *       (X_,Y_) should be inside boundaries                                \
  *                                                                          \
- *       assert(hnd->dhnd->yMin <= _Y &&                                    \
- *              hnd->dhnd->yMax >  _Y &&                                    \
- *              hnd->dhnd->xMin <= _X &&                                    \
- *              hnd->dhnd->xMax >  _X);                                     \
+ *       assert(hnd->dhnd->yMin <= Y_ &&                                    \
+ *              hnd->dhnd->yMax >  Y_ &&                                    \
+ *              hnd->dhnd->xMin <= X_ &&                                    \
+ *              hnd->dhnd->xMax >  X_);                                     \
  *                                                                          \
  */                                                                         \
         if (pixelInfo[0] == 0) {                                            \
             pixelInfo[0] = 1;                                               \
-            pixelInfo[1] = _X;                                              \
-            pixelInfo[2] = _Y;                                              \
-            pixelInfo[3] = _X;                                              \
-            pixelInfo[4] = _Y;                                              \
-            hnd->dhnd->pDrawPixel(hnd->dhnd, _X, _Y);                       \
-        } else if ((_X != pixelInfo[3] || _Y != pixelInfo[4]) &&            \
-                   (_X != pixelInfo[1] || _Y != pixelInfo[2])) {            \
-            hnd->dhnd->pDrawPixel(hnd->dhnd, _X, _Y);                       \
-            pixelInfo[3] = _X;                                              \
-            pixelInfo[4] = _Y;                                              \
+            pixelInfo[1] = X_;                                              \
+            pixelInfo[2] = Y_;                                              \
+            pixelInfo[3] = X_;                                              \
+            pixelInfo[4] = Y_;                                              \
+            hnd->dhnd->pDrawPixel(hnd->dhnd, X_, Y_);                       \
+        } else if ((X_ != pixelInfo[3] || Y_ != pixelInfo[4]) &&            \
+                   (X_ != pixelInfo[1] || Y_ != pixelInfo[2])) {            \
+            hnd->dhnd->pDrawPixel(hnd->dhnd, X_, Y_);                       \
+            pixelInfo[3] = X_;                                              \
+            pixelInfo[4] = Y_;                                              \
         }                                                                   \
     } while(0)
 
--- a/jdk/src/share/native/sun/security/smartcardio/pcsc.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/native/sun/security/smartcardio/pcsc.c	Wed Jul 05 19:42:29 2017 +0200
@@ -108,7 +108,7 @@
 JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext
     (JNIEnv *env, jclass thisClass, jint dwScope)
 {
-    SCARDCONTEXT context;
+    SCARDCONTEXT context = 0;
     LONG rv;
     dprintf("-establishContext\n");
     rv = CALL_SCardEstablishContext(dwScope, NULL, NULL, &context);
@@ -180,7 +180,7 @@
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
     LPTSTR mszReaders;
-    DWORD size;
+    DWORD size = 0;
     jobjectArray result;
 
     dprintf1("-context: %x\n", context);
@@ -215,8 +215,8 @@
     SCARDCONTEXT context = (SCARDCONTEXT)jContext;
     LONG rv;
     LPCTSTR readerName;
-    SCARDHANDLE card;
-    DWORD proto;
+    SCARDHANDLE card = 0;
+    DWORD proto = 0;
 
     readerName = (*env)->GetStringUTFChars(env, jReaderName, NULL);
     if (readerName == NULL) {
@@ -280,8 +280,8 @@
     DWORD readerLen = READERNAME_BUFFER_SIZE;
     unsigned char atr[ATR_BUFFER_SIZE];
     DWORD atrLen = ATR_BUFFER_SIZE;
-    DWORD state;
-    DWORD protocol;
+    DWORD state = 0;
+    DWORD protocol = 0;
     jbyteArray jArray;
     jbyte status[2];
 
--- a/jdk/src/share/transport/socket/socketTransport.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/share/transport/socket/socketTransport.c	Wed Jul 05 19:42:29 2017 +0200
@@ -31,6 +31,11 @@
 #include "jdwpTransport.h"
 #include "sysSocket.h"
 
+#ifdef _WIN32
+ #include <winsock2.h>
+ #include <ws2tcpip.h>
+#endif
+
 /*
  * The Socket Transport Library.
  *
@@ -189,23 +194,83 @@
     return JDWPTRANSPORT_ERROR_NONE;
 }
 
+static uint32_t
+getLocalHostAddress() {
+    // Simple routine to guess localhost address.
+    // it looks up "localhost" and returns 127.0.0.1 if lookup
+    // fails.
+    struct addrinfo hints, *res = NULL;
+    int err;
+
+    // Use portable way to initialize the structure
+    memset((void *)&hints, 0, sizeof(hints));
+    hints.ai_family = AF_INET;
+
+    err = getaddrinfo("localhost", NULL, &hints, &res);
+    if (err < 0 || res == NULL) {
+        return dbgsysHostToNetworkLong(INADDR_LOOPBACK);
+    }
+
+    // getaddrinfo might return more than one address
+    // but we are using first one only
+    return ((struct sockaddr_in *)(res->ai_addr))->sin_addr.s_addr;
+}
+
+static int
+getPortNumber(const char *s_port) {
+    u_long n;
+    char *eptr;
+
+    if (*s_port == 0) {
+        // bad address - colon with no port number in parameters
+        return -1;
+    }
+
+    n = strtoul(s_port, &eptr, 10);
+    if (eptr != s_port + strlen(s_port)) {
+        // incomplete conversion - port number contains non-digit
+        return -1;
+    }
+
+    if (n > (u_short) -1) {
+        // check that value supplied by user is less than
+        // maximum possible u_short value (65535) and
+        // will not be truncated later.
+        return -1;
+    }
+
+    return n;
+}
+
 static jdwpTransportError
-parseAddress(const char *address, struct sockaddr_in *sa, uint32_t defaultHost) {
+parseAddress(const char *address, struct sockaddr_in *sa) {
     char *colon;
+    int port;
 
     memset((void *)sa,0,sizeof(struct sockaddr_in));
     sa->sin_family = AF_INET;
 
     /* check for host:port or port */
     colon = strchr(address, ':');
+    port = getPortNumber((colon == NULL) ? address : colon +1);
+    if (port < 0) {
+        RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT, "invalid port number specified");
+    }
+    sa->sin_port = dbgsysHostToNetworkShort((u_short)port);
+
     if (colon == NULL) {
-        u_short port = (u_short)atoi(address);
-        sa->sin_port = dbgsysHostToNetworkShort(port);
-        sa->sin_addr.s_addr = dbgsysHostToNetworkLong(defaultHost);
-    } else {
+        // bind to localhost only if no address specified
+        sa->sin_addr.s_addr = getLocalHostAddress();
+    } else if (strncmp(address,"localhost:",10) == 0) {
+        // optimize for common case
+        sa->sin_addr.s_addr = getLocalHostAddress();
+    } else if (*address == '*' && *(address+1) == ':') {
+        // we are explicitly asked to bind server to all available IP addresses
+        // has no meaning for client.
+        sa->sin_addr.s_addr = dbgsysHostToNetworkLong(INADDR_ANY);
+     } else {
         char *buf;
         char *hostname;
-        u_short port;
         uint32_t addr;
 
         buf = (*callback->alloc)((int)strlen(address)+1);
@@ -215,8 +280,6 @@
         strcpy(buf, address);
         buf[colon - address] = '\0';
         hostname = buf;
-        port = atoi(colon + 1);
-        sa->sin_port = dbgsysHostToNetworkShort(port);
 
         /*
          * First see if the host is a literal IP address.
@@ -277,7 +340,7 @@
         address = "0";
     }
 
-    err = parseAddress(address, &sa, INADDR_ANY);
+    err = parseAddress(address, &sa);
     if (err != JDWPTRANSPORT_ERROR_NONE) {
         return err;
     }
@@ -437,7 +500,7 @@
         RETURN_ERROR(JDWPTRANSPORT_ERROR_ILLEGAL_ARGUMENT, "address is missing");
     }
 
-    err = parseAddress(addressString, &sa, 0x7f000001);
+    err = parseAddress(addressString, &sa);
     if (err != JDWPTRANSPORT_ERROR_NONE) {
         return err;
     }
--- a/jdk/src/solaris/classes/java/lang/UNIXProcess.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/java/lang/UNIXProcess.java	Wed Jul 05 19:42:29 2017 +0200
@@ -483,6 +483,11 @@
     }
 
     @Override
+    public long getPid() {
+        return pid;
+    }
+
+    @Override
     public synchronized boolean isAlive() {
         return !hasExited;
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/InfoWindow.java	Wed Jul 05 19:42:29 2017 +0200
@@ -207,8 +207,9 @@
                             textLabel.setText(tooltipString);
                         }
 
-                        Point pointer = (Point)AccessController.doPrivileged(new PrivilegedAction() {
-                                public Object run() {
+                        Point pointer = AccessController.doPrivileged(
+                            new PrivilegedAction<Point>() {
+                                public Point run() {
                                     if (!isPointerOverTrayIcon(liveArguments.getBounds())) {
                                         return null;
                                     }
--- a/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/ListHelper.java	Wed Jul 05 19:42:29 2017 +0200
@@ -55,10 +55,10 @@
 
     private final int SCROLLBAR_WIDTH;  // Width of a scrollbar
 
-    private java.util.List items;        // List of items
+    private java.util.List<String> items;        // List of items
 
     // TODO: maybe this would be better as a simple int[]
-    private java.util.List selected;     // List of selected items
+    private java.util.List<Integer> selected;     // List of selected items
     private boolean multiSelect;         // Can multiple items be selected
                                          // at once?
     private int focusedIndex;
@@ -100,8 +100,8 @@
         this.peer = peer;
         this.colors = colors;
         this.multiSelect = multiSelect;
-        items = new ArrayList(initialSize);
-        selected = new ArrayList(1);
+        items = new ArrayList<>(initialSize);
+        selected = new ArrayList<>(1);
         selected.add(Integer.valueOf(-1));
 
         this.maxVisItems = maxVisItems;
@@ -190,7 +190,7 @@
     /* if called for multiselect, return -1 */
     public int getSelectedIndex() {
         if (!multiSelect) {
-            Integer val = (Integer)selected.get(0);
+            Integer val = selected.get(0);
             return val.intValue();
         }
         return -1;
@@ -217,7 +217,7 @@
     }
 
     public String getItem(int index) {
-        return (String) items.get(index);
+        return items.get(index);
     }
 
     /**********************************************************************/
@@ -576,9 +576,9 @@
     }
 
     boolean isItemSelected(int index) {
-        Iterator itr = selected.iterator();
+        Iterator<Integer> itr = selected.iterator();
         while (itr.hasNext()) {
-            Integer val = (Integer)itr.next();
+            Integer val = itr.next();
             if (val.intValue() == index) {
                 return true;
             }
--- a/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/MotifDnDDragSourceProtocol.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
 
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.InvalidDnDOperationException;
@@ -65,7 +66,7 @@
     }
 
     protected void initializeDragImpl(int actions, Transferable contents,
-                                      Map formatMap, long[] formats)
+                                      Map<Long, DataFlavor> formatMap, long[] formats)
       throws InvalidDnDOperationException,
         IllegalArgumentException, XException {
 
--- a/jdk/src/solaris/classes/sun/awt/X11/Native.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/Native.java	Wed Jul 05 19:42:29 2017 +0200
@@ -43,13 +43,12 @@
 
     static int dataModel;
     static {
-        String dataModelProp = (String)AccessController.
-            doPrivileged(
-                         new PrivilegedAction() {
-                                 public Object run() {
-                                     return System.getProperty("sun.arch.data.model");
-                                 }
-                             });
+        String dataModelProp = AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                public String run() {
+                    return System.getProperty("sun.arch.data.model");
+                }
+            });
         try {
             dataModel = Integer.parseInt(dataModelProp);
         } catch (Exception e) {
@@ -333,9 +332,9 @@
      * Stores Java Vector of Longs into memory. Memory location is treated as array
      * of native <code>long</code>s
      */
-    static void putLong(long ptr, Vector arr) {
+    static void putLong(long ptr, Vector<Long> arr) {
         for (int i = 0; i < arr.size(); i ++, ptr += getLongSize()) {
-            putLong(ptr, ((Long)arr.elementAt(i)).longValue());
+            putLong(ptr, arr.elementAt(i).longValue());
         }
     }
 
@@ -343,9 +342,9 @@
      * Stores Java Vector of Longs into memory. Memory location is treated as array
      * of native <code>long</code>s. Array is stored in reverse order
      */
-    static void putLongReverse(long ptr, Vector arr) {
+    static void putLongReverse(long ptr, Vector<Long> arr) {
         for (int i = arr.size()-1; i >= 0; i--, ptr += getLongSize()) {
-            putLong(ptr, ((Long)arr.elementAt(i)).longValue());
+            putLong(ptr, arr.elementAt(i).longValue());
         }
     }
     /**
--- a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java	Wed Jul 05 19:42:29 2017 +0200
@@ -98,7 +98,7 @@
          * should be "good enough" for most cases.
          */
 
-        Map updatedSettings = null;
+        Map<String, Object> updatedSettings = null;
         XToolkit.awtLock();
         try {
             long display = XToolkit.getDisplay();
@@ -112,7 +112,7 @@
     }
 
     private void updateXSettings(int screen, long owner) {
-        final Map updatedSettings = getUpdatedSettings(owner);
+        final Map<String, Object> updatedSettings = getUpdatedSettings(owner);
         // this method is called under awt lock and usually on toolkit thread
         // but parseXSettings() causes public code execution, so we need to transfer
         // this to EDT
@@ -123,7 +123,7 @@
         });
     }
 
-    private Map getUpdatedSettings(final long owner) {
+    private Map<String, Object> getUpdatedSettings(final long owner) {
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("owner =" + owner);
         }
@@ -131,7 +131,7 @@
             return null;
         }
 
-        Map settings = null;
+        Map<String, Object> settings = null;
         try {
             WindowPropertyGetter getter =
                 new WindowPropertyGetter(owner, xSettingsPropertyAtom, 0, MAX_LENGTH,
--- a/jdk/src/solaris/classes/sun/awt/X11/XAtomList.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAtomList.java	Wed Jul 05 19:42:29 2017 +0200
@@ -157,7 +157,7 @@
     public String toString() {
         StringBuffer buf = new StringBuffer();
         buf.append("[");
-        Iterator iter = atoms.iterator();
+        Iterator<XAtom> iter = atoms.iterator();
         while (iter.hasNext()) {
             buf.append(iter.next().toString());
             if (iter.hasNext()) {
--- a/jdk/src/solaris/classes/sun/awt/X11/XAwtState.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XAwtState.java	Wed Jul 05 19:42:29 2017 +0200
@@ -40,7 +40,7 @@
      * The mouse is over this component.
      * If the component is not disabled, it received MOUSE_ENTERED but no MOUSE_EXITED.
      */
-    private static WeakReference componentMouseEnteredRef = null;
+    private static WeakReference<Component> componentMouseEnteredRef = null;
 
     static void setComponentMouseEntered(Component component) {
         XToolkit.awtLock();
@@ -50,7 +50,7 @@
                 return;
             }
             if (component != getComponentMouseEntered()) {
-                componentMouseEnteredRef = new WeakReference(component);
+                componentMouseEnteredRef = new WeakReference<>(component);
             }
         } finally {
             XToolkit.awtUnlock();
@@ -63,7 +63,7 @@
             if (componentMouseEnteredRef == null) {
                 return null;
             }
-            return (Component)componentMouseEnteredRef.get();
+            return componentMouseEnteredRef.get();
         } finally {
             XToolkit.awtUnlock();
         }
@@ -83,7 +83,7 @@
         return inManualGrab;
     }
 
-    private static WeakReference grabWindowRef = null;
+    private static WeakReference<XBaseWindow> grabWindowRef = null;
 
     /**
      * The X Active Grab overrides any other active grab by the same
@@ -112,7 +112,7 @@
                 return;
             }
             if (grabWindow != getGrabWindow()) {
-                grabWindowRef = new WeakReference(grabWindow);
+                grabWindowRef = new WeakReference<>(grabWindow);
             }
         } finally {
             XToolkit.awtUnlock();
@@ -125,7 +125,7 @@
             if (grabWindowRef == null) {
                 return null;
             }
-            XBaseWindow xbw = (XBaseWindow)grabWindowRef.get();
+            XBaseWindow xbw = grabWindowRef.get();
             if( xbw != null && xbw.isDisposed() ) {
                 xbw = null;
                 grabWindowRef = null;
--- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Wed Jul 05 19:42:29 2017 +0200
@@ -231,7 +231,7 @@
      */
     void instantPreInit(XCreateWindowParams params) {
         super.instantPreInit(params);
-        items = new ArrayList();
+        items = new ArrayList<>();
     }
 
     /************************************************
@@ -367,10 +367,10 @@
      * Clears items vector and loads specified vector
      * @param items vector to be loaded
      */
-    public void reloadItems(Vector items) {
+    public void reloadItems(Vector<? extends MenuItem> items) {
         synchronized(getMenuTreeLock()) {
             this.items.clear();
-            MenuItem[] itemArray = (MenuItem[])items.toArray(new MenuItem[] {});
+            MenuItem[] itemArray = items.toArray(new MenuItem[] {});
             int itemCnt = itemArray.length;
             for(int i = 0; i < itemCnt; i++) {
                 addItem(itemArray[i]);
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -236,8 +236,8 @@
         return false;
     }
 
-    private static Class seClass;
-    private static Constructor seCtor;
+    private static Class<?> seClass;
+    private static Constructor<?> seCtor;
 
     final static AWTEvent wrapInSequenced(AWTEvent event) {
         try {
@@ -246,9 +246,11 @@
             }
 
             if (seCtor == null) {
-                seCtor = (Constructor) AccessController.doPrivileged(new PrivilegedExceptionAction() {
-                        public Object run() throws Exception {
-                            Constructor ctor = seClass.getConstructor(new Class[] { AWTEvent.class });
+                seCtor = AccessController.doPrivileged(new
+                    PrivilegedExceptionAction<Constructor<?>>() {
+                        public Constructor<?> run() throws Exception {
+                            Constructor<?> ctor = seClass.getConstructor(
+                                new Class<?>[] { AWTEvent.class });
                             ctor.setAccessible(true);
                             return ctor;
                         }
@@ -1322,7 +1324,7 @@
         }
     }
 
-    private void addTree(Collection order, Set set, Container cont) {
+    private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
         for (int i = 0; i < cont.getComponentCount(); i++) {
             Component comp = cont.getComponent(i);
             ComponentPeer peer = comp.getPeer();
--- a/jdk/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XCreateWindowParams.java	Wed Jul 05 19:42:29 2017 +0200
@@ -30,7 +30,7 @@
 import java.util.Map;
 
 @SuppressWarnings("serial") // JDK-implementation class
-public class XCreateWindowParams extends HashMap {
+public class XCreateWindowParams extends HashMap<Object, Object> {
     public XCreateWindowParams() {
     }
     public XCreateWindowParams(Object[] map) {
@@ -82,9 +82,9 @@
     }
     public String toString() {
         StringBuffer buf = new StringBuffer();
-        Iterator eIter = entrySet().iterator();
+        Iterator<Map.Entry<Object, Object>> eIter = entrySet().iterator();
         while (eIter.hasNext()) {
-            Map.Entry entry = (Map.Entry)eIter.next();
+            Map.Entry<Object, Object> entry = eIter.next();
             buf.append(entry.getKey() + ": " + entry.getValue() + "\n");
         }
         return buf.toString();
--- a/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDataTransferer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -45,9 +45,11 @@
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
 
 import javax.imageio.ImageIO;
+import javax.imageio.ImageReader;
 import javax.imageio.ImageTypeSpecifier;
 import javax.imageio.ImageWriter;
 import javax.imageio.spi.ImageWriterSpi;
@@ -258,28 +260,9 @@
                                   Transferable localeTransferable)
       throws IOException {
 
-        String charset = null;
-        if (localeTransferable != null &&
-            isLocaleDependentTextFormat(format) &&
-            localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor)) {
-            try {
-                charset = new String(
-                    (byte[])localeTransferable.getTransferData(javaTextEncodingFlavor),
-                    "UTF-8"
-                );
-            } catch (UnsupportedFlavorException cannotHappen) {
-            }
-        } else {
-            charset = getCharsetForTextFormat(format);
-        }
-        if (charset == null) {
-            // Only happens when we have a custom text type.
-            charset = getDefaultTextCharset();
-        }
-
-        BufferedReader reader = null;
-        try {
-            reader = new BufferedReader(new InputStreamReader(stream, charset));
+        String charset = getBestCharsetForTextFormat(format, localeTransferable);
+        try (InputStreamReader isr = new InputStreamReader(stream, charset);
+             BufferedReader reader = new BufferedReader(isr)) {
             String line;
             ArrayList<URI> uriList = new ArrayList<>();
             URI uri;
@@ -292,9 +275,6 @@
                 uriList.add(uri);
             }
             return uriList.toArray(new URI[uriList.size()]);
-        } finally {
-            if (reader != null)
-                reader.close();
         }
     }
 
@@ -330,8 +310,8 @@
      * type can be translated by the Data Transfer subsystem.
      */
     @Override
-    public List<DataFlavor> getPlatformMappingsForNative(String nat) {
-        List<DataFlavor> flavors = new ArrayList<>();
+    public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat) {
+        LinkedHashSet<DataFlavor> flavors = new LinkedHashSet<>();
 
         if (nat == null) {
             return flavors;
@@ -354,7 +334,7 @@
         // flavors to enable dynamic text native-to-flavor mapping generation.
         // See SystemFlavorMap.getFlavorsForNative() for details.
         if ("image".equals(primaryType)) {
-            Iterator readers = ImageIO.getImageReadersByMIMEType(baseType);
+            Iterator<ImageReader> readers = ImageIO.getImageReadersByMIMEType(baseType);
             if (readers.hasNext()) {
                 flavors.add(DataFlavor.imageFlavor);
             }
@@ -392,8 +372,8 @@
      * Transfer subsystem.
      */
     @Override
-    public List<String> getPlatformMappingsForFlavor(DataFlavor df) {
-        List<String> natives = new ArrayList<>(1);
+    public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df) {
+        LinkedHashSet<String> natives = new LinkedHashSet<>(1);
 
         if (df == null) {
             return natives;
--- a/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDnDDragSourceProtocol.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
 
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.InvalidDnDOperationException;
@@ -70,7 +71,7 @@
      * @returns true if the initialized successfully.
      */
     protected void initializeDragImpl(int actions, Transferable contents,
-                                         Map formatMap, long[] formats)
+                                      Map<Long, DataFlavor> formatMap, long[] formats)
       throws InvalidDnDOperationException,
         IllegalArgumentException, XException {
         assert XToolkit.isAWTLockHeldByCurrentThread();
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragAndDropProtocols.java	Wed Jul 05 19:42:29 2017 +0200
@@ -36,8 +36,8 @@
  * @since 1.5
  */
 final class XDragAndDropProtocols {
-    private final static List dragProtocols;
-    private final static List dropProtocols;
+    private final static List<XDragSourceProtocol> dragProtocols;
+    private final static List<XDropTargetProtocol> dropProtocols;
 
     public static final String XDnD = "XDnD";
     public static final String MotifDnD = "MotifDnD";
@@ -50,7 +50,7 @@
         XDropTargetProtocolListener dropTargetProtocolListener =
             XDropTargetContextPeer.getXDropTargetProtocolListener();
 
-        List tDragSourceProtocols = new ArrayList();
+        List<XDragSourceProtocol> tDragSourceProtocols = new ArrayList<>();
         XDragSourceProtocol xdndDragSourceProtocol =
             XDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
         tDragSourceProtocols.add(xdndDragSourceProtocol);
@@ -58,7 +58,7 @@
             MotifDnDDragSourceProtocol.createInstance(dragSourceProtocolListener);
         tDragSourceProtocols.add(motifdndDragSourceProtocol);
 
-        List tDropTargetProtocols = new ArrayList();
+        List<XDropTargetProtocol> tDropTargetProtocols = new ArrayList<>();
         XDropTargetProtocol xdndDropTargetProtocol =
             XDnDDropTargetProtocol.createInstance(dropTargetProtocolListener);
         tDropTargetProtocols.add(xdndDropTargetProtocol);
@@ -70,11 +70,11 @@
         dropProtocols = Collections.unmodifiableList(tDropTargetProtocols);
     }
 
-    static Iterator getDragSourceProtocols() {
+    static Iterator<XDragSourceProtocol> getDragSourceProtocols() {
         return dragProtocols.iterator();
     }
 
-    static Iterator getDropTargetProtocols() {
+    static Iterator<XDropTargetProtocol> getDropTargetProtocols() {
         return dropProtocols.iterator();
     }
 
@@ -88,10 +88,10 @@
             return null;
         }
 
-        Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+        Iterator<XDragSourceProtocol> dragProtocols =
+            XDragAndDropProtocols.getDragSourceProtocols();
         while (dragProtocols.hasNext()) {
-            XDragSourceProtocol dragProtocol =
-                (XDragSourceProtocol)dragProtocols.next();
+            XDragSourceProtocol dragProtocol = dragProtocols.next();
             if (dragProtocol.getProtocolName().equals(name)) {
                 return dragProtocol;
             }
@@ -110,10 +110,10 @@
             return null;
         }
 
-        Iterator dropProtocols = XDragAndDropProtocols.getDropTargetProtocols();
+        Iterator<XDropTargetProtocol> dropProtocols =
+            XDragAndDropProtocols.getDropTargetProtocols();
         while (dropProtocols.hasNext()) {
-            XDropTargetProtocol dropProtocol =
-                (XDropTargetProtocol)dropProtocols.next();
+            XDropTargetProtocol dropProtocol = dropProtocols.next();
             if (dropProtocol.getProtocolName().equals(name)) {
                 return dropProtocol;
             }
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceContextPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -29,6 +29,7 @@
 import java.awt.Cursor;
 import java.awt.Window;
 
+import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 
 import java.awt.dnd.DnDConstants;
@@ -110,7 +111,7 @@
     }
 
     protected void startDrag(Transferable transferable,
-                             long[] formats, Map formatMap) {
+                             long[] formats, Map<Long, DataFlavor> formatMap) {
         Component component = getTrigger().getComponent();
         Component c = null;
         XWindowPeer wpeer = null;
@@ -161,9 +162,10 @@
 
             int dropActions = getDragSourceContext().getSourceActions();
 
-            Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+            Iterator<XDragSourceProtocol> dragProtocols =
+                XDragAndDropProtocols.getDragSourceProtocols();
             while (dragProtocols.hasNext()) {
-                XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
+                XDragSourceProtocol dragProtocol = dragProtocols.next();
                 try {
                     dragProtocol.initializeDrag(dropActions, transferable,
                                                 formatMap, formats);
@@ -313,9 +315,10 @@
             dragDropFinished(false, DnDConstants.ACTION_NONE, xRoot, yRoot);
         }
 
-        Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+        Iterator<XDragSourceProtocol> dragProtocols =
+            XDragAndDropProtocols.getDragSourceProtocols();
         while (dragProtocols.hasNext()) {
-            XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
+            XDragSourceProtocol dragProtocol = dragProtocols.next();
             try {
                 dragProtocol.cleanup();
             } catch (XException xe) {
@@ -418,9 +421,10 @@
         }
 
         if (clientWindow != 0) {
-            Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+            Iterator<XDragSourceProtocol> dragProtocols =
+                XDragAndDropProtocols.getDragSourceProtocols();
             while (dragProtocols.hasNext()) {
-                XDragSourceProtocol dragProtocol = (XDragSourceProtocol)dragProtocols.next();
+                XDragSourceProtocol dragProtocol = dragProtocols.next();
                 if (dragProtocol.attachTargetWindow(clientWindow, time)) {
                     protocol = dragProtocol;
                     break;
@@ -550,10 +554,10 @@
 
         XClientMessageEvent xclient = ev.get_xclient();
 
-        Iterator dragProtocols = XDragAndDropProtocols.getDragSourceProtocols();
+        Iterator<XDragSourceProtocol> dragProtocols =
+            XDragAndDropProtocols.getDragSourceProtocols();
         while (dragProtocols.hasNext()) {
-            XDragSourceProtocol dragProtocol =
-                (XDragSourceProtocol)dragProtocols.next();
+            XDragSourceProtocol dragProtocol = dragProtocols.next();
             if (dragProtocol.processProxyModeEvent(xclient,
                                                    getProxyModeSourceWindow())) {
                 return true;
--- a/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDragSourceProtocol.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,6 +26,7 @@
 package sun.awt.X11;
 
 import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.DataFlavor;
 
 import java.awt.dnd.DnDConstants;
 import java.awt.dnd.InvalidDnDOperationException;
@@ -84,7 +85,7 @@
      * @throws XException if some X call failed.
      */
     public final void initializeDrag(int actions, Transferable contents,
-                                     Map formatMap, long[] formats)
+                                     Map<Long, DataFlavor> formatMap, long[] formats)
       throws InvalidDnDOperationException,
              IllegalArgumentException, XException {
         XToolkit.awtLock();
@@ -110,7 +111,8 @@
     /* The caller must hold AWT_LOCK. */
     protected abstract void initializeDragImpl(int actions,
                                                Transferable contents,
-                                               Map formatMap, long[] formats)
+                                               Map<Long, DataFlavor> formatMap,
+                                               long[] formats)
       throws InvalidDnDOperationException, IllegalArgumentException, XException;
 
     /**
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetContextPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -89,12 +89,12 @@
         /* If the event was not consumed, send a response to the source. */
         try {
             if (ctxt != 0 && !e.isConsumed()) {
-                Iterator dropTargetProtocols =
+                Iterator<XDropTargetProtocol> dropTargetProtocols =
                     XDragAndDropProtocols.getDropTargetProtocols();
 
                 while (dropTargetProtocols.hasNext()) {
                     XDropTargetProtocol dropTargetProtocol =
-                        (XDropTargetProtocol)dropTargetProtocols.next();
+                        dropTargetProtocols.next();
                     if (dropTargetProtocol.sendResponse(ctxt, e.getID(),
                                                         returnValue)) {
                         break;
@@ -116,12 +116,12 @@
 
         if (ctxt != 0) {
             try {
-                Iterator dropTargetProtocols =
+                Iterator<XDropTargetProtocol> dropTargetProtocols =
                     XDragAndDropProtocols.getDropTargetProtocols();
 
                 while (dropTargetProtocols.hasNext()) {
                     XDropTargetProtocol dropTargetProtocol =
-                        (XDropTargetProtocol)dropTargetProtocols.next();
+                        dropTargetProtocols.next();
                     if (dropTargetProtocol.sendDropDone(ctxt, success,
                                                         dropAction)) {
                         break;
@@ -140,12 +140,12 @@
         long ctxt = getNativeDragContext();
 
         if (ctxt != 0) {
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
                 XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                    dropTargetProtocols.next();
                 // getData throws IAE if ctxt is not for this protocol.
                 try {
                     return dropTargetProtocol.getData(ctxt, format);
@@ -221,12 +221,11 @@
 
     public void forwardEventToEmbedded(long embedded, long ctxt,
                                        int eventID) {
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             if (dropTargetProtocol.forwardEventToEmbedded(embedded, ctxt,
                                                           eventID)) {
                 break;
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetEventProcessor.java	Wed Jul 05 19:42:29 2017 +0200
@@ -79,12 +79,11 @@
         }
 
         if (protocol == null) {
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 // Don't try to process it again with the current protocol.
                 if (dropTargetProtocol == curProtocol) {
                     continue;
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetProtocol.java	Wed Jul 05 19:42:29 2017 +0200
@@ -295,7 +295,8 @@
     }
 
     /* Access to HashMap is synchronized on this XDropTargetProtocol instance. */
-    private final HashMap embedderRegistry = new HashMap();
+    private final HashMap<Long, EmbedderRegistryEntry> embedderRegistry =
+        new HashMap<>();
 
     protected final void putEmbedderRegistryEntry(long embedder,
                                                   boolean overriden,
@@ -310,8 +311,7 @@
 
     protected final EmbedderRegistryEntry getEmbedderRegistryEntry(long embedder) {
         synchronized (this) {
-            return
-                (EmbedderRegistryEntry)embedderRegistry.get(Long.valueOf(embedder));
+            return embedderRegistry.get(Long.valueOf(embedder));
         }
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XDropTargetRegistry.java	Wed Jul 05 19:42:29 2017 +0200
@@ -141,10 +141,10 @@
         }
         public long[] getSites() {
             long[] ret = new long[sites.size()];
-            Iterator iter = sites.iterator();
+            Iterator<Long> iter = sites.iterator();
             int index = 0;
             while (iter.hasNext()) {
-                Long l = (Long)iter.next();
+                Long l = iter.next();
                 ret[index++] = l.longValue();
             }
             return ret;
@@ -199,14 +199,13 @@
     private EmbeddedDropSiteEntry registerEmbedderDropSite(long embedder) {
         assert XToolkit.isAWTLockHeldByCurrentThread();
 
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
         // The list of protocols supported by the embedder.
-        List<XDropTargetProtocol> embedderProtocols = new ArrayList();
+        List<XDropTargetProtocol> embedderProtocols = new ArrayList<>();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             if (dropTargetProtocol.isProtocolSupported(embedder)) {
                 embedderProtocols.add(dropTargetProtocol);
             }
@@ -262,7 +261,7 @@
 
     private void registerProtocols(long embedder, boolean protocols,
                                    List<XDropTargetProtocol> supportedProtocols) {
-        Iterator dropTargetProtocols = null;
+        Iterator<XDropTargetProtocol> dropTargetProtocols = null;
 
         /*
          * By default, we register a drop site that supports all dnd
@@ -289,8 +288,7 @@
         XlibWrapper.XGrabServer(XToolkit.getDisplay());
         try {
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 if ((protocols == XEMBED_PROTOCOLS) ==
                     dropTargetProtocol.isXEmbedSupported()) {
                     dropTargetProtocol.registerEmbedderDropSite(embedder);
@@ -310,14 +308,13 @@
 
         assert XToolkit.isAWTLockHeldByCurrentThread();
 
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
         // The list of protocols supported by the embedder.
-        List<XDropTargetProtocol> embedderProtocols = new ArrayList();
+        List<XDropTargetProtocol> embedderProtocols = new ArrayList<>();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             if (dropTargetProtocol.isProtocolSupported(embedder)) {
                 embedderProtocols.add(dropTargetProtocol);
             }
@@ -361,8 +358,7 @@
         XlibWrapper.XGrabServer(XToolkit.getDisplay());
         try {
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 if (!isXEmbedServer || !dropTargetProtocol.isXEmbedSupported()) {
                     dropTargetProtocol.registerEmbedderDropSite(embedder);
                 }
@@ -376,7 +372,7 @@
                                             EmbeddedDropSiteEntry entry) {
         assert XToolkit.isAWTLockHeldByCurrentThread();
 
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
 
         /* Grab server, since we are working with the window that belongs to
@@ -384,8 +380,7 @@
         XlibWrapper.XGrabServer(XToolkit.getDisplay());
         try {
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 dropTargetProtocol.unregisterEmbedderDropSite(embedder);
             }
 
@@ -470,14 +465,14 @@
                     registerProtocols(toplevel, XEMBED_PROTOCOLS,
                                       entry.getSupportedProtocols());
                 } else {
-                    Iterator dropTargetProtocols =
+                    Iterator<XDropTargetProtocol> dropTargetProtocols =
                         XDragAndDropProtocols.getDropTargetProtocols();
 
                     // Register the embedded window as a plain drop site with
                     // all DnD protocols that are supported by XEmbed.
                     while (dropTargetProtocols.hasNext()) {
                         XDropTargetProtocol dropTargetProtocol =
-                            (XDropTargetProtocol)dropTargetProtocols.next();
+                            dropTargetProtocols.next();
                         if (dropTargetProtocol.isXEmbedSupported()) {
                             dropTargetProtocol.registerEmbedderDropSite(window);
                         }
@@ -558,12 +553,12 @@
         }
 
         if (toplevel == window) {
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
                 XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                    dropTargetProtocols.next();
                 dropTargetProtocol.registerDropTarget(toplevel);
             }
         } else {
@@ -584,13 +579,13 @@
         long toplevel = getToplevelWindow(window);
 
         if (toplevel == window) {
-            Iterator dropProtocols =
+            Iterator<XDropTargetProtocol> dropProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             removeDelayedRegistrationEntry(window);
 
             while (dropProtocols.hasNext()) {
-                XDropTargetProtocol dropProtocol = (XDropTargetProtocol)dropProtocols.next();
+                XDropTargetProtocol dropProtocol = dropProtocols.next();
                 dropProtocol.unregisterDropTarget(window);
             }
         } else {
@@ -615,12 +610,11 @@
             }
             registerEmbeddedDropSite(canvasWindow, clientWindow);
 
-            Iterator dropTargetProtocols =
+            Iterator<XDropTargetProtocol> dropTargetProtocols =
                 XDragAndDropProtocols.getDropTargetProtocols();
 
             while (dropTargetProtocols.hasNext()) {
-                XDropTargetProtocol dropTargetProtocol =
-                    (XDropTargetProtocol)dropTargetProtocols.next();
+                XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
                 dropTargetProtocol.registerEmbeddedDropSite(clientWindow);
             }
 
@@ -634,12 +628,11 @@
         if (logger.isLoggable(PlatformLogger.Level.FINE)) {
             logger.fine("        XEmbed drop site will be unregistered for " + Long.toHexString(clientWindow));
         }
-        Iterator dropTargetProtocols =
+        Iterator<XDropTargetProtocol> dropTargetProtocols =
             XDragAndDropProtocols.getDropTargetProtocols();
 
         while (dropTargetProtocols.hasNext()) {
-            XDropTargetProtocol dropTargetProtocol =
-                (XDropTargetProtocol)dropTargetProtocols.next();
+            XDropTargetProtocol dropTargetProtocol = dropTargetProtocols.next();
             dropTargetProtocol.unregisterEmbeddedDropSite(clientWindow);
         }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbeddingContainer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -32,7 +32,7 @@
 import sun.awt.AWTAccessor;
 
 public class XEmbeddingContainer extends XEmbedHelper implements XEventDispatcher {
-    HashMap children = new HashMap();
+    HashMap<Long, java.awt.peer.ComponentPeer> children = new HashMap<>();
 
     XEmbeddingContainer() {
     }
--- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -146,9 +146,9 @@
         savedDir = target.getDirectory();
         // Shouldn't save 'user.dir' to 'savedDir'
         // since getDirectory() will be incorrect after handleCancel
-        userDir = (String)AccessController.doPrivileged(
-            new PrivilegedAction() {
-                public Object run() {
+        userDir = AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                public String run() {
                     return System.getProperty("user.dir");
                 }
             });
--- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -70,7 +70,7 @@
     ListPainter painter;
 
     // TODO: ick - Vector?
-    Vector                      items;
+    Vector<String>              items;
     boolean                     multipleSelections;
     int                         active = NONE;
 
@@ -139,7 +139,7 @@
         super.preInit(params);
 
         // Stuff that must be initialized before layout() is called
-        items = new Vector();
+        items = new Vector<>();
         createVerScrollbar();
         createHorScrollbar();
 
@@ -281,7 +281,7 @@
         int m = 0;
         int end = items.size();
         for(int i = 0 ; i < end ; i++) {
-            int l = fm.stringWidth(((String)items.elementAt(i)));
+            int l = fm.stringWidth(items.elementAt(i));
             m = Math.max(m, l);
         }
         return m;
@@ -292,7 +292,7 @@
      */
     int getItemWidth(int i) {
         FontMetrics fm = getFontMetrics(getFont());
-        return fm.stringWidth((String)items.elementAt(i));
+        return fm.stringWidth(items.elementAt(i));
     }
 
     /**
@@ -659,7 +659,7 @@
                         ( clickCount % 2 == 0 ) ) {
                 postEvent(new ActionEvent(target,
                                           ActionEvent.ACTION_PERFORMED,
-                                          (String)items.elementAt(currentIndex),
+                                          items.elementAt(currentIndex),
                                           mouseEvent.getWhen(),
                                           mouseEvent.getModifiers()));  // No ext mods
             } else if (active == WINDOW) {
@@ -986,7 +986,7 @@
               if (selected.length > 0) {
                   postEvent(new ActionEvent((List)target,
                                             ActionEvent.ACTION_PERFORMED,
-                                            (String)items.elementAt(getFocusIndex()),
+                                            items.elementAt(getFocusIndex()),
                                             e.getWhen(),
                                             e.getModifiers()));  // ActionEvent doesn't have
                   // extended modifiers.
@@ -1343,7 +1343,7 @@
      */
     public void clear() {
         selected = new int[0];
-        items = new Vector();
+        items = new Vector<>();
         currentIndex = -1;
         // Fixed 6291736: ITEM_STATE_CHANGED triggered after List.removeAll(), XToolkit
         // We should update 'focusIndex' variable more carefully
@@ -1926,7 +1926,7 @@
                     } else {
                         g.setColor(getListForeground());
                     }
-                    String str = (String)items.elementAt(index);
+                    String str = items.elementAt(index);
                     g.drawString(str, x - hsb.getValue(), y + fontAscent);
                 } else {
                     // Clear the remaining area around the item - focus area and the rest of border
--- a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java	Wed Jul 05 19:42:29 2017 +0200
@@ -60,7 +60,7 @@
     String selectionName;
 
     /* list of listeners to be called for events */
-    Vector listeners;
+    Vector<XMSelectionListener> listeners;
 
     /* X atom array (one per screen) for this selection */
     XAtom atoms[];
@@ -75,7 +75,7 @@
 
     static XAtom XA_MANAGER;
 
-    static HashMap selectionMap;
+    static HashMap<Long, XMSelection> selectionMap;
 
     static {
         long display = XToolkit.getDisplay();
@@ -90,7 +90,7 @@
             initScreen(display,screen);
         }
 
-        selectionMap = new HashMap();
+        selectionMap = new HashMap<>();
     }
 
     static void initScreen(long display, final int screen) {
@@ -227,7 +227,7 @@
 
 
     static XMSelection getInstance(long selection) {
-        return (XMSelection) selectionMap.get(Long.valueOf(selection));
+        return selectionMap.get(Long.valueOf(selection));
     }
 
 
@@ -259,7 +259,7 @@
 
     public synchronized void addSelectionListener(XMSelectionListener listener) {
         if (listeners == null) {
-            listeners = new Vector();
+            listeners = new Vector<>();
         }
         listeners.add(listener);
     }
@@ -270,7 +270,7 @@
         }
     }
 
-    synchronized Collection getListeners() {
+    synchronized Collection<XMSelectionListener> getListeners() {
         return listeners;
     }
 
@@ -310,9 +310,9 @@
             log.fine("Selection Changed : Screen = " + screen + "Event =" + ev);
         }
         if (listeners != null) {
-            Iterator iter = listeners.iterator();
+            Iterator<XMSelectionListener> iter = listeners.iterator();
             while (iter.hasNext()) {
-                XMSelectionListener disp = (XMSelectionListener) iter.next();
+                XMSelectionListener disp = iter.next();
                 disp.selectionChanged(screen, this, ev.get_window(), ev);
             }
         }
@@ -323,9 +323,9 @@
             log.fine("Owner dead : Screen = " + screen + "Event =" + de);
         }
         if (listeners != null) {
-            Iterator iter = listeners.iterator();
+            Iterator<XMSelectionListener> iter = listeners.iterator();
             while (iter.hasNext()) {
-                XMSelectionListener disp = (XMSelectionListener) iter.next();
+                XMSelectionListener disp = iter.next();
                 disp.ownerDeath(screen, this, de.get_window());
 
             }
@@ -349,9 +349,9 @@
 
     synchronized void dispatchOwnerChangedEvent(XEvent ev, int screen, long owner, long data, long timestamp) {
         if (listeners != null) {
-            Iterator iter = listeners.iterator();
+            Iterator<XMSelectionListener> iter = listeners.iterator();
             while (iter.hasNext()) {
-                XMSelectionListener disp = (XMSelectionListener) iter.next();
+                XMSelectionListener disp = iter.next();
                 disp.ownerChanged(screen,this, owner, data, timestamp);
             }
         }
--- a/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -195,10 +195,10 @@
     void postInit(XCreateWindowParams params) {
         super.postInit(params);
         // Get menus from the target.
-        Vector targetMenuVector = AWTAccessor.getMenuBarAccessor()
-                                      .getMenus(menuBarTarget);
+        Vector<Menu> targetMenuVector = AWTAccessor.getMenuBarAccessor()
+                                                   .getMenus(menuBarTarget);
         Menu targetHelpMenu = AWTAccessor.getMenuBarAccessor()
-                                  .getHelpMenu(menuBarTarget);
+                                         .getHelpMenu(menuBarTarget);
         reloadItems(targetMenuVector);
         if (targetHelpMenu != null) {
             addHelpMenu(targetHelpMenu);
--- a/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -143,7 +143,7 @@
      * Access to target's fields
      *
      ************************************************/
-    Vector getTargetItems() {
+    Vector<MenuItem> getTargetItems() {
         return AWTAccessor.getMenuAccessor().getItems((Menu)getTarget());
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuWindow.java	Wed Jul 05 19:42:29 2017 +0200
@@ -164,7 +164,7 @@
             this.menuPeer = menuPeer;
             this.target = menuPeer.getContainer().target;
             // Get menus from the target.
-            Vector targetItemVector = null;
+            Vector<MenuItem> targetItemVector = null;
             targetItemVector = getMenuTargetItems();
             reloadItems(targetItemVector);
         }
@@ -356,7 +356,7 @@
      * Reads vector of items from target
      * This function is overriden in XPopupMenuPeer
      */
-    Vector getMenuTargetItems() {
+    Vector<MenuItem> getMenuTargetItems() {
         return menuPeer.getTargetItems();
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -134,7 +134,7 @@
     public void show(Event e) {
         target = (Component)e.target;
         // Get menus from the target.
-        Vector targetItemVector = getMenuTargetItems();
+        Vector<MenuItem> targetItemVector = getMenuTargetItems();
         if (targetItemVector != null) {
             reloadItems(targetItemVector);
             //Fix for 6287092: JCK15a: api/java_awt/interactive/event/EventTests.html#EventTest0015 fails, mustang
@@ -188,7 +188,7 @@
         return AWTAccessor.getMenuItemAccessor().isEnabled(popupMenuTarget);
     }
 
-    Vector getMenuTargetItems() {
+    Vector<MenuItem> getMenuTargetItems() {
         if (popupMenuTarget == null) {
             return null;
         }
--- a/jdk/src/solaris/classes/sun/awt/X11/XSelection.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XSelection.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,6 +25,7 @@
 
 package sun.awt.X11;
 
+import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 
 import java.io.ByteArrayOutputStream;
@@ -87,7 +88,7 @@
     /* The contents supplied by the current owner. */
     private Transferable contents = null;
     /* The format-to-flavor map for the current owner. */
-    private Map formatMap = null;
+    private Map<Long, DataFlavor> formatMap = null;
     /* The formats supported by the current owner was set. */
     private long[] formats = null;
     /* The AppContext in which the current owner was set. */
@@ -134,7 +135,8 @@
         return selectionAtom;
     }
 
-    public synchronized boolean setOwner(Transferable contents, Map formatMap,
+    public synchronized boolean setOwner(Transferable contents,
+                                         Map<Long, DataFlavor> formatMap,
                                          long[] formats, long time)
     {
         long owner = XWindow.getXAWTRootWindow().getWindow();
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -36,6 +36,7 @@
 import java.awt.dnd.MouseDragGestureRecognizer;
 import java.awt.dnd.InvalidDnDOperationException;
 import java.awt.dnd.peer.DragSourceContextPeer;
+import java.awt.font.TextAttribute;
 import java.awt.im.InputMethodHighlight;
 import java.awt.im.spi.InputMethodDescriptor;
 import java.awt.image.ColorModel;
@@ -51,7 +52,7 @@
 import sun.font.FontConfigManager;
 import sun.java2d.SunGraphicsEnvironment;
 import sun.misc.*;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.print.PrintJob2D;
 import sun.security.action.GetPropertyAction;
 import sun.security.action.GetBooleanAction;
@@ -99,9 +100,9 @@
     private FontConfigManager fcManager = new FontConfigManager();
 
     static int arrowCursor;
-    static TreeMap winMap = new TreeMap();
-    static HashMap specialPeerMap = new HashMap();
-    static HashMap winToDispatcher = new HashMap();
+    static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
+    static HashMap<Object, Object> specialPeerMap = new HashMap<>();
+    static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
     private static long _display;
     static UIDefaults uidefaults;
     static X11GraphicsEnvironment localEnv;
@@ -358,16 +359,16 @@
     }
     static XBaseWindow windowToXWindow(long window) {
         synchronized(winMap) {
-            return (XBaseWindow) winMap.get(Long.valueOf(window));
+            return winMap.get(Long.valueOf(window));
         }
     }
 
     static void addEventDispatcher(long window, XEventDispatcher dispatcher) {
         synchronized(winToDispatcher) {
             Long key = Long.valueOf(window);
-            Collection dispatchers = (Collection)winToDispatcher.get(key);
+            Collection<XEventDispatcher> dispatchers = winToDispatcher.get(key);
             if (dispatchers == null) {
-                dispatchers = new Vector();
+                dispatchers = new Vector<>();
                 winToDispatcher.put(key, dispatchers);
             }
             dispatchers.add(dispatcher);
@@ -376,7 +377,7 @@
     static void removeEventDispatcher(long window, XEventDispatcher dispatcher) {
         synchronized(winToDispatcher) {
             Long key = Long.valueOf(window);
-            Collection dispatchers = (Collection)winToDispatcher.get(key);
+            Collection<XEventDispatcher> dispatchers = winToDispatcher.get(key);
             if (dispatchers != null) {
                 dispatchers.remove(dispatcher);
             }
@@ -493,18 +494,18 @@
         }
         XBaseWindow.dispatchToWindow(ev);
 
-        Collection dispatchers = null;
+        Collection<XEventDispatcher> dispatchers = null;
         synchronized(winToDispatcher) {
             Long key = Long.valueOf(xany.get_window());
-            dispatchers = (Collection)winToDispatcher.get(key);
+            dispatchers = winToDispatcher.get(key);
             if (dispatchers != null) { // Clone it to avoid synchronization during dispatching
-                dispatchers = new Vector(dispatchers);
+                dispatchers = new Vector<>(dispatchers);
             }
         }
         if (dispatchers != null) {
-            Iterator iter = dispatchers.iterator();
+            Iterator<XEventDispatcher> iter = dispatchers.iterator();
             while (iter.hasNext()) {
-                XEventDispatcher disp = (XEventDispatcher)iter.next();
+                XEventDispatcher disp = iter.next();
                 disp.dispatchEvent(ev);
             }
         }
@@ -764,7 +765,7 @@
 
         Insets insets = new Insets(0, 0, 0, 0);
 
-        java.util.List search = new LinkedList();
+        java.util.List<Object> search = new LinkedList<>();
         search.add(root);
         search.add(0);
         while (!search.isEmpty())
@@ -929,6 +930,7 @@
         return XDragSourceContextPeer.createDragSourceContextPeer(dge);
     }
 
+    @SuppressWarnings("unchecked")
     public <T extends DragGestureRecognizer> T
     createDragGestureRecognizer(Class<T> recognizerClass,
                     DragSource ds,
@@ -1147,7 +1149,7 @@
         return 2;  // Black and white.
     }
 
-    public Map mapInputMethodHighlight(InputMethodHighlight highlight)     {
+    public Map<TextAttribute, ?> mapInputMethodHighlight( InputMethodHighlight highlight) {
         return XInputMethod.mapInputMethodHighlight(highlight);
     }
     @Override
@@ -1338,31 +1340,25 @@
     static void dumpPeers() {
         if (log.isLoggable(PlatformLogger.Level.FINE)) {
             log.fine("Mapped windows:");
-            Iterator iter = winMap.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                log.fine(entry.getKey() + "->" + entry.getValue());
-                if (entry.getValue() instanceof XComponentPeer) {
-                    Component target = (Component)((XComponentPeer)entry.getValue()).getTarget();
+            winMap.forEach((k, v) -> {
+                log.fine(k + "->" + v);
+                if (v instanceof XComponentPeer) {
+                    Component target = (Component)((XComponentPeer)v).getTarget();
                     log.fine("\ttarget: " + target);
                 }
-            }
+            });
 
             SunToolkit.dumpPeers(log);
 
             log.fine("Mapped special peers:");
-            iter = specialPeerMap.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                log.fine(entry.getKey() + "->" + entry.getValue());
-            }
+            specialPeerMap.forEach((k, v) -> {
+                log.fine(k + "->" + v);
+            });
 
             log.fine("Mapped dispatchers:");
-            iter = winToDispatcher.entrySet().iterator();
-            while (iter.hasNext()) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                log.fine(entry.getKey() + "->" + entry.getValue());
-            }
+            winToDispatcher.forEach((k, v) -> {
+                log.fine(k + "->" + v);
+            });
         }
     }
 
@@ -1586,16 +1582,16 @@
      * <code>loadXSettings</code>.  It is called from the System EDT
      * if triggered by an XSETTINGS change.
      */
-    void parseXSettings(int screen_XXX_ignored,Map updatedSettings) {
+    void parseXSettings(int screen_XXX_ignored,Map<String, Object> updatedSettings) {
 
         if (updatedSettings == null || updatedSettings.isEmpty()) {
             return;
         }
 
-        Iterator i = updatedSettings.entrySet().iterator();
+        Iterator<Map.Entry<String, Object>> i = updatedSettings.entrySet().iterator();
         while (i.hasNext()) {
-            Map.Entry e = (Map.Entry)i.next();
-            String name = (String)e.getKey();
+            Map.Entry<String, Object> e = i.next();
+            String name = e.getKey();
 
             name = "gnome." + name;
             setDesktopProperty(name, e.getValue());
@@ -1692,7 +1688,7 @@
             long window = 0;
             try{
                 // get any application window
-                window = ((Long)(winMap.firstKey())).longValue();
+                window = winMap.firstKey().longValue();
             }catch(NoSuchElementException nex) {
                 // get root window
                 window = getDefaultRootWindow();
@@ -1798,7 +1794,7 @@
     }
 
 
-    private static SortedMap timeoutTasks;
+    private static SortedMap<Long, java.util.List<Runnable>> timeoutTasks;
 
     /**
      * Removed the task from the list of waiting-to-be called tasks.
@@ -1819,10 +1815,10 @@
                 }
                 return;
             }
-            Collection values = timeoutTasks.values();
-            Iterator iter = values.iterator();
+            Collection<java.util.List<Runnable>> values = timeoutTasks.values();
+            Iterator<java.util.List<Runnable>> iter = values.iterator();
             while (iter.hasNext()) {
-                java.util.List list = (java.util.List)iter.next();
+                java.util.List<Runnable> list = iter.next();
                 boolean removed = false;
                 if (list.contains(task)) {
                     list.remove(task);
@@ -1869,13 +1865,13 @@
             }
 
             if (timeoutTasks == null) {
-                timeoutTasks = new TreeMap();
+                timeoutTasks = new TreeMap<>();
             }
 
             Long time = Long.valueOf(System.currentTimeMillis() + interval);
-            java.util.List tasks = (java.util.List)timeoutTasks.get(time);
+            java.util.List<Runnable> tasks = timeoutTasks.get(time);
             if (tasks == null) {
-                tasks = new ArrayList(1);
+                tasks = new ArrayList<>(1);
                 timeoutTasks.put(time, tasks);
             }
             tasks.add(task);
@@ -1897,7 +1893,7 @@
             if (timeoutTasks == null || timeoutTasks.isEmpty()) {
                 return -1L;
             }
-            return (Long)timeoutTasks.firstKey();
+            return timeoutTasks.firstKey();
         } finally {
             awtUnlock();
         }
@@ -1918,13 +1914,13 @@
         }
 
         Long currentTime = Long.valueOf(System.currentTimeMillis());
-        Long time = (Long)timeoutTasks.firstKey();
+        Long time = timeoutTasks.firstKey();
 
         while (time.compareTo(currentTime) <= 0) {
-            java.util.List tasks = (java.util.List)timeoutTasks.remove(time);
+            java.util.List<Runnable> tasks = timeoutTasks.remove(time);
 
-            for (Iterator iter = tasks.iterator(); iter.hasNext();) {
-                Runnable task = (Runnable)iter.next();
+            for (Iterator<Runnable> iter = tasks.iterator(); iter.hasNext();) {
+                Runnable task = iter.next();
 
                 if (timeoutTaskLog.isLoggable(PlatformLogger.Level.FINER)) {
                     timeoutTaskLog.finer("XToolkit.callTimeoutTasks(): current time={0}" +
@@ -1943,7 +1939,7 @@
             if (timeoutTasks.isEmpty()) {
                 break;
             }
-            time = (Long)timeoutTasks.firstKey();
+            time = timeoutTasks.firstKey();
         }
     }
 
--- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -85,7 +85,7 @@
         // Fix for 6317038: as EmbeddedFrame is instance of Frame, it is blocked
         // by modal dialogs, but in the case of TrayIcon it shouldn't. So we
         // set ModalExclusion property on it.
-        AccessController.doPrivileged(new PrivilegedAction() {
+        AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
                 eframe.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
                 return null;
--- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1072,6 +1072,7 @@
      * Returns all protocols supporting given protocol interface
      */
     <T> Collection<T> getProtocols(Class<T> protocolInterface) {
+        @SuppressWarnings("unchecked")
         Collection<T> res = (Collection<T>) protocolsMap.get(protocolInterface);
         if (res != null) {
             return res;
@@ -1322,9 +1323,9 @@
         }
     }
 
-    HashMap storedInsets = new HashMap();
+    HashMap<Class<?>, Insets> storedInsets = new HashMap<>();
     Insets guessInsets(XDecoratedPeer window) {
-        Insets res = (Insets)storedInsets.get(window.getClass());
+        Insets res = storedInsets.get(window.getClass());
         if (res == null) {
             switch (WMID) {
               case ENLIGHTEN_WM:
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java	Wed Jul 05 19:42:29 2017 +0200
@@ -59,7 +59,7 @@
     static int lastX = 0, lastY = 0;
     static long lastTime = 0;
     static long lastButton = 0;
-    static WeakReference lastWindowRef = null;
+    static WeakReference<XWindow> lastWindowRef = null;
     static int clickCount = 0;
 
     // used to check if we need to re-create surfaceData.
@@ -692,7 +692,7 @@
         if (type == XConstants.ButtonPress) {
             //Allow this mouse button to generate CLICK event on next ButtonRelease
             mouseButtonClickAllowed |= XlibUtil.getButtonMask(lbutton);
-            XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
+            XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
             /*
                multiclick checking
             */
@@ -705,7 +705,7 @@
                 clickCount++;
             } else {
                 clickCount = 1;
-                lastWindowRef = new WeakReference(this);
+                lastWindowRef = new WeakReference<>(this);
                 lastButton = lbutton;
                 lastX = x;
                 lastY = y;
@@ -820,7 +820,7 @@
         */
         int x = xme.get_x();
         int y = xme.get_y();
-        XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
+        XWindow lastWindow = (lastWindowRef != null) ? (lastWindowRef.get()):(null);
 
         if (!(lastWindow == this &&
               (xme.get_time() - lastTime) < XToolkit.getMultiClickTime()  &&
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -950,7 +950,7 @@
         // make new hash of toplevels of all windows from 'windows' hash.
         // FIXME: do not call them "toplevel" as it is misleading.
         //
-        HashSet toplevels = new HashSet();
+        HashSet<Long> toplevels = new HashSet<>();
         long topl = 0, mytopl = 0;
 
         for (XWindowPeer xp : windows) {
--- a/jdk/src/solaris/classes/sun/awt/X11CustomCursor.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11CustomCursor.java	Wed Jul 05 19:42:29 2017 +0200
@@ -47,7 +47,7 @@
     protected void createNativeCursor(Image im, int[] pixels, int width, int height,
                                       int xHotSpot, int yHotSpot) {
 
-        class CCount implements Comparable {
+        class CCount implements Comparable<CCount> {
             int color;
             int count;
 
@@ -56,8 +56,8 @@
                 count = ct;
             }
 
-            public int compareTo(Object cc) {
-                return ((CCount)cc).count - count;
+            public int compareTo(CCount cc) {
+                return cc.count - count;
             }
         }
 
--- a/jdk/src/solaris/classes/sun/awt/X11FontManager.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11FontManager.java	Wed Jul 05 19:42:29 2017 +0200
@@ -59,7 +59,7 @@
      * E.g., the -0-0-0-0-p-0- reported by X is -*-%d-*-*-p-*- in the font
      * configuration files. We need to remove that part for comparisons.
      */
-    private static Map fontNameMap = new HashMap();
+    private static Map<String, String> fontNameMap = new HashMap<>();
 
     /*
      * xlfdMap is a map from a platform path like
@@ -72,7 +72,7 @@
      * the full XLFD string like :-
      * "-ricoh-hg gothic b-medium-r-normal--0-0-0-0-m-0-jisx0201.1976-0"
      */
-    private static Map xlfdMap = new HashMap();
+    private static Map<String, Vector<String>> xlfdMap = new HashMap<>();
 
     /* xFontDirsMap is also a map from a font ID to a font filepath.
      * The difference from fontNameMap is just that it does not have
@@ -88,7 +88,7 @@
      * X11 font directory, then precautions must be taken to include both
      * directories.
      */
-     private static Map xFontDirsMap;
+     private static Map<String, String> xFontDirsMap;
 
      /*
       * This is the set of font directories needed to be on the X font path
@@ -121,7 +121,7 @@
      * of the singleton GE instance is already synchronised and that is
      * the only code path that accesses this map.
      */
-     private static HashMap registeredDirs = new HashMap();
+     private static HashMap<String, Object> registeredDirs = new HashMap<>();
 
      /* Array of directories to be added to the X11 font path.
       * Used by static method called from Toolkits which use X11 fonts.
@@ -183,7 +183,7 @@
                  * Add this XLFD (platform name) to the list of known
                  * ones for this file.
                  */
-                Vector xVal = (Vector) xlfdMap.get(fileName);
+                Vector<String> xVal = xlfdMap.get(fileName);
                 if (xVal == null) {
                     /* Try to be robust on Linux distros which move fonts
                      * around by verifying that the fileName represents a
@@ -194,7 +194,7 @@
                         fileName = null;
                     }
                     if (fileName != null) {
-                        xVal = new Vector();
+                        xVal = new Vector<>();
                         xVal.add(platName);
                         xlfdMap.put(fileName, xVal);
                     }
@@ -211,7 +211,7 @@
         }
 
         if (fontID != null) {
-            fileName = (String)fontNameMap.get(fontID);
+            fileName = fontNameMap.get(fontID);
             /* On Linux check for the Lucida Oblique fonts */
             if (fileName == null && FontUtilities.isLinux && !isOpenJDK()) {
                 if (oblmap == null) {
@@ -235,7 +235,7 @@
                     FontUtilities.getLogger()
                             .warning("** Finished registering all font paths");
                 }
-                fileName = (String)fontNameMap.get(fontID);
+                fileName = fontNameMap.get(fontID);
             }
             if (fileName == null && !isHeadless()) {
                 /* Query X11 directly to see if this font is available
@@ -245,7 +245,7 @@
             }
             if (fileName == null) {
                 fontID = switchFontIDForName(platName);
-                fileName = (String)fontNameMap.get(fontID);
+                fileName = fontNameMap.get(fontID);
             }
             if (fileName != null) {
                 fontNameMap.put(fontID, fileName);
@@ -257,8 +257,8 @@
     @Override
     protected String[] getNativeNames(String fontFileName,
             String platformName) {
-        Vector nativeNames;
-        if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) {
+        Vector<String> nativeNames;
+        if ((nativeNames=xlfdMap.get(fontFileName))==null) {
             if (platformName == null) {
                 return null;
             } else {
@@ -271,7 +271,7 @@
             }
         } else {
             int len = nativeNames.size();
-            return (String[])nativeNames.toArray(new String[len]);
+            return nativeNames.toArray(new String[len]);
         }
     }
 
@@ -366,7 +366,7 @@
                             }
                             String fontPart = st.sval.substring(breakPos+1);
                             String fontID = specificFontIDForName(fontPart);
-                            String sVal = (String) fontNameMap.get(fontID);
+                            String sVal = fontNameMap.get(fontID);
 
                             if (FontUtilities.debugFonts()) {
                                 PlatformLogger logger = FontUtilities.getLogger();
@@ -386,14 +386,14 @@
                                  * wants to use the native rasteriser.
                                  */
                                 if (xFontDirsMap == null) {
-                                    xFontDirsMap = new HashMap();
+                                    xFontDirsMap = new HashMap<>();
                                 }
                                 xFontDirsMap.put(fontID, path);
                                 fullPath = file.getCanonicalPath();
                             } catch (IOException e) {
                                 fullPath = path + File.separator + fileName;
                             }
-                            Vector xVal = (Vector) xlfdMap.get(fullPath);
+                            Vector<String> xVal = xlfdMap.get(fullPath);
                             if (FontUtilities.debugFonts()) {
                                 FontUtilities.getLogger()
                                       .info("fullPath=" + fullPath +
@@ -408,7 +408,7 @@
                                 }
                                 fontNameMap.put(fontID, fullPath);
                                 if (xVal == null) {
-                                    xVal = new Vector();
+                                    xVal = new Vector<>();
                                     xlfdMap.put (fullPath, xVal);
                                 }
                                 xVal.add(fontPart);
@@ -447,8 +447,8 @@
          * will typically not ever need to initialise it so it can be null.
          */
         xFontDirsMap = null;
-        xlfdMap = new HashMap(1);
-        fontNameMap = new HashMap(1);
+        xlfdMap = new HashMap<>(1);
+        fontNameMap = new HashMap<>(1);
     }
 
     private String getObliqueLucidaFontID(String fontID) {
@@ -579,10 +579,10 @@
         String fileName = null;
         String fontID = specificFontIDForName(name);
         if (fontID != null) {
-            fileName = (String)fontNameMap.get(fontID);
+            fileName = fontNameMap.get(fontID);
             if (fileName == null) {
                 fontID = switchFontIDForName(name);
-                fileName = (String)fontNameMap.get(fontID);
+                fileName = fontNameMap.get(fontID);
             }
             if (fileName == null) {
                 fileName = getDefaultFontFile();
@@ -685,7 +685,7 @@
         getPlatformFontPathFromFontConfig();
         if (xFontDirsMap != null) {
             String fontID = specificFontIDForName(platformName);
-            String dirName = (String)xFontDirsMap.get(fontID);
+            String dirName = xFontDirsMap.get(fontID);
             if (dirName != null) {
                 fontConfigDirs.add(dirName);
             }
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java	Wed Jul 05 19:42:29 2017 +0200
@@ -42,7 +42,7 @@
 import sun.java2d.xr.XRGraphicsConfig;
 import sun.java2d.loops.SurfaceType;
 
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 /**
  * This is an implementation of a GraphicsDevice object for a single
@@ -56,7 +56,7 @@
     implements DisplayChangedListener
 {
     int screen;
-    HashMap x11ProxyKeyMap = new HashMap();
+    HashMap<SurfaceType, Object> x11ProxyKeyMap = new HashMap<>();
 
     private static AWTPermission fullScreenExclusivePermission;
     private static Boolean xrandrExtSupported;
@@ -127,7 +127,7 @@
 
     GraphicsConfiguration[] configs;
     GraphicsConfiguration defaultConfig;
-    HashSet doubleBufferVisuals;
+    HashSet<Integer> doubleBufferVisuals;
 
     /**
      * Returns all of the graphics
@@ -159,7 +159,7 @@
 
             boolean dbeSupported = isDBESupported();
             if (dbeSupported && doubleBufferVisuals == null) {
-                doubleBufferVisuals = new HashSet();
+                doubleBufferVisuals = new HashSet<>();
                 getDoubleBufferVisuals(screen);
             }
             for ( ; i < num; i++) {
@@ -249,7 +249,7 @@
                 int depth = getConfigDepth(0, screen);
                 boolean doubleBuffer = false;
                 if (isDBESupported() && doubleBufferVisuals == null) {
-                    doubleBufferVisuals = new HashSet();
+                    doubleBufferVisuals = new HashSet<>();
                     getDoubleBufferVisuals(screen);
                     doubleBuffer =
                         doubleBufferVisuals.contains(Integer.valueOf(visNum));
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsEnvironment.java	Wed Jul 05 19:42:29 2017 +0200
@@ -72,7 +72,7 @@
 
     static {
         java.security.AccessController.doPrivileged(
-                          new java.security.PrivilegedAction() {
+                          new java.security.PrivilegedAction<Object>() {
             public Object run() {
                 System.loadLibrary("awt");
 
@@ -254,12 +254,12 @@
             return true;
         }
 
-        Boolean result = (Boolean)java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction() {
-            public Object run() {
+        Boolean result = java.security.AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Boolean>() {
+            public Boolean run() {
                 InetAddress remAddr[] = null;
-                Enumeration locals = null;
-                Enumeration interfaces = null;
+                Enumeration<InetAddress> locals = null;
+                Enumeration<NetworkInterface> interfaces = null;
                 try {
                     interfaces = NetworkInterface.getNetworkInterfaces();
                     remAddr = InetAddress.getAllByName(hostName);
@@ -275,10 +275,11 @@
                 }
 
                 for (; interfaces.hasMoreElements();) {
-                    locals = ((NetworkInterface)interfaces.nextElement()).getInetAddresses();
+                    locals = interfaces.nextElement().getInetAddresses();
                     for (; locals.hasMoreElements();) {
+                        final InetAddress localAddr = locals.nextElement();
                         for (int i = 0; i < remAddr.length; i++) {
-                            if (locals.nextElement().equals(remAddr[i])) {
+                            if (localAddr.equals(remAddr[i])) {
                                 return Boolean.TRUE;
                             }
                         }
--- a/jdk/src/solaris/classes/sun/awt/X11InputMethod.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/X11InputMethod.java	Wed Jul 05 19:42:29 2017 +0200
@@ -100,7 +100,7 @@
     private boolean   isLastTemporary = false;
     private boolean   isActive = false;
     private boolean   isActiveClient = false;
-    private static Map[] highlightStyles;
+    private static Map<TextAttribute, ?>[] highlightStyles;
     private boolean disposed = false;
 
     //reset the XIC if necessary
@@ -136,31 +136,29 @@
 
     // Initialize highlight mapping table
     static {
-        Map styles[] = new Map[4];
-        HashMap map;
+        @SuppressWarnings({"unchecked", "rawtypes"})
+        Map<TextAttribute, ?> styles[] = new Map[4];
+        HashMap<TextAttribute, Object> map;
 
         // UNSELECTED_RAW_TEXT_HIGHLIGHT
-        map = new HashMap(1);
-        map.put(TextAttribute.WEIGHT,
-                  TextAttribute.WEIGHT_BOLD);
+        map = new HashMap<>(1);
+        map.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
         styles[0] = Collections.unmodifiableMap(map);
 
         // SELECTED_RAW_TEXT_HIGHLIGHT
-        map = new HashMap(1);
-        map.put(TextAttribute.SWAP_COLORS,
-                  TextAttribute.SWAP_COLORS_ON);
+        map = new HashMap<>(1);
+        map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
         styles[1] = Collections.unmodifiableMap(map);
 
         // UNSELECTED_CONVERTED_TEXT_HIGHLIGHT
-        map = new HashMap(1);
+        map = new HashMap<>(1);
         map.put(TextAttribute.INPUT_METHOD_UNDERLINE,
-                  TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
+                TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
         styles[2] = Collections.unmodifiableMap(map);
 
         // SELECTED_CONVERTED_TEXT_HIGHLIGHT
-        map = new HashMap(1);
-        map.put(TextAttribute.SWAP_COLORS,
-                  TextAttribute.SWAP_COLORS_ON);
+        map = new HashMap<>(1);
+        map.put(TextAttribute.SWAP_COLORS, TextAttribute.SWAP_COLORS_ON);
         styles[3] = Collections.unmodifiableMap(map);
 
         highlightStyles = styles;
@@ -433,7 +431,7 @@
     /**
      * @see java.awt.Toolkit#mapInputMethodHighlight
      */
-    public static Map mapInputMethodHighlight(InputMethodHighlight highlight) {
+    public static Map<TextAttribute, ?> mapInputMethodHighlight(InputMethodHighlight highlight) {
         int index;
         int state = highlight.getState();
         if (state == InputMethodHighlight.RAW_TEXT) {
--- a/jdk/src/solaris/classes/sun/awt/XSettings.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/XSettings.java	Wed Jul 05 19:42:29 2017 +0200
@@ -52,7 +52,7 @@
      *     settings manager.
      * @return a <code>Map</code> of changed settings.
      */
-    public Map update(byte[] data) {
+    public Map<String, Object> update(byte[] data) {
         return (new Update(data)).update();
     }
 
@@ -79,7 +79,7 @@
         private int nsettings = 0;
         private boolean isValid;
 
-        private HashMap updatedSettings;
+        private HashMap<String, Object> updatedSettings;
 
 
         /**
@@ -113,7 +113,7 @@
             idx = 8;
             nsettings = getINT32();
 
-            updatedSettings = new HashMap();
+            updatedSettings = new HashMap<>();
 
             isValid = true;
         }
@@ -213,7 +213,7 @@
         /**
          * Update settings.
          */
-        public Map update() {
+        public Map<String, Object> update() {
             if (!isValid) {
                 return null;
             }
--- a/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/awt/motif/MFontConfiguration.java	Wed Jul 05 19:42:29 2017 +0200
@@ -67,7 +67,7 @@
      * the fontconfig files.
      */
     protected void initReorderMap() {
-        reorderMap = new HashMap();
+        reorderMap = new HashMap<>();
         if (osName == null) {  /* null means SunOS */
             initReorderMapForSolaris();
         } else {
@@ -240,7 +240,7 @@
                 return "sun.awt.Symbol";
             }
         }
-        String encoding = (String) encodingMap.get(xlfdEncoding);
+        String encoding = encodingMap.get(xlfdEncoding);
         if (encoding == null) {
             encoding = "default";
         }
@@ -288,7 +288,7 @@
 
     /* methods for table setup ***********************************************/
 
-    private static HashMap encodingMap = new HashMap();
+    private static HashMap<String, String> encodingMap = new HashMap<>();
 
     private void initTables() {
         // encodingMap maps XLFD encoding component to
--- a/jdk/src/solaris/classes/sun/java2d/pisces/META-INF/services/sun.java2d.pipe.RenderingEngine	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-# Jules Rendering Engine module
-sun.java2d.jules.JulesRenderingEngine
-
-#  Pisces Rendering Engine module
-sun.java2d.pisces.PiscesRenderingEngine
--- a/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/classes/sun/java2d/x11/X11SurfaceData.java	Wed Jul 05 19:42:29 2017 +0200
@@ -72,7 +72,7 @@
 
     protected int depth;
 
-    private static native void initIDs(Class xorComp, boolean tryDGA);
+    private static native void initIDs(Class<?> xorComp, boolean tryDGA);
     protected native void initSurface(int depth, int width, int height,
                                       long drawable);
 
@@ -515,6 +515,7 @@
         return getSurfaceType(gc, transparency, false);
     }
 
+    @SuppressWarnings("fallthrough")
     public static SurfaceType getSurfaceType(X11GraphicsConfig gc,
                                              int transparency,
                                              boolean pixmapSurface)
--- a/jdk/src/solaris/native/java/util/TimeZone_md.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/java/util/TimeZone_md.c	Wed Jul 05 19:42:29 2017 +0200
@@ -652,11 +652,11 @@
  * using <java_home>/lib/tzmappings. If the TZ value is not found, it
  * trys some libc implementation dependent mappings. If it still
  * can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
- * form. `country', which can be null, is not used for UNIX platforms.
+ * form.
  */
 /*ARGSUSED1*/
 char *
-findJavaTZ_md(const char *java_home_dir, const char *country)
+findJavaTZ_md(const char *java_home_dir)
 {
     char *tz;
     char *javatz = NULL;
--- a/jdk/src/solaris/native/java/util/TimeZone_md.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/java/util/TimeZone_md.h	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #ifndef _TIMEZONE_MD_H
 #define _TIMEZONE_MD_H
 
-char *findJavaTZ_md(const char *java_home_dir, const char *region);
+char *findJavaTZ_md(const char *java_home_dir);
 char *getGMTOffsetID();
 
 #endif
--- a/jdk/src/solaris/native/sun/awt/awt.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/awt/awt.h	Wed Jul 05 19:42:29 2017 +0200
@@ -34,9 +34,9 @@
 #include "jni_util.h"
 #include "debug_util.h"
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 #include <X11/Intrinsic.h>
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 
 /* The JVM instance: defined in awt_MToolkit.c */
@@ -110,9 +110,9 @@
 #define AWT_NOTIFY()         AWT_NOTIFY_IMPL()
 #define AWT_NOTIFY_ALL()     AWT_NOTIFY_ALL_IMPL()
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 extern Display         *awt_display; /* awt_GraphicsEnv.c */
 extern Boolean          awt_ModLockIsShiftLock; /* XToolkit.c */
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 #endif /* ! _AWT_ */
--- a/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	Wed Jul 05 19:42:29 2017 +0200
@@ -35,8 +35,6 @@
 #include <sys/param.h>
 #include <sys/utsname.h>
 
-#include "awt_Plugin.h"
-
 #ifdef AIX
 #include "porting_aix.h" /* For the 'dladdr' function. */
 #endif
@@ -236,55 +234,3 @@
 
     (*XsessionWMcommand)(env, jargv);
 }
-
-
-#define REFLECT_VOID_FUNCTION(name, arglist, paramlist)                 \
-typedef void name##_type arglist;                                       \
-void name arglist                                                       \
-{                                                                       \
-    static name##_type *name##_ptr = NULL;                              \
-    if (name##_ptr == NULL && awtHandle == NULL) {                      \
-        return;                                                         \
-    }                                                                   \
-    name##_ptr = (name##_type *)                                        \
-        dlsym(awtHandle, #name);                                        \
-    if (name##_ptr == NULL) {                                           \
-        return;                                                         \
-    }                                                                   \
-    (*name##_ptr)paramlist;                                             \
-}
-
-#define REFLECT_FUNCTION(return_type, name, arglist, paramlist)         \
-typedef return_type name##_type arglist;                                \
-return_type name arglist                                                \
-{                                                                       \
-    static name##_type *name##_ptr = NULL;                              \
-    if (name##_ptr == NULL && awtHandle == NULL) {                      \
-        return NULL;                                                    \
-    }                                                                   \
-    name##_ptr = (name##_type *)                                        \
-        dlsym(awtHandle, #name);                                        \
-    if (name##_ptr == NULL) {                                           \
-        return NULL;                                                    \
-    }                                                                   \
-    return (*name##_ptr)paramlist;                                      \
-}
-
-
-/*
- * These entry point must remain in libawt.so ***for Java Plugin ONLY***
- * Reflect this call over to the correct libawt_<toolkit>.so.
- */
-
-REFLECT_VOID_FUNCTION(getAwtLockFunctions,
-                      (void (**AwtLock)(JNIEnv *), void (**AwtUnlock)(JNIEnv *),
-                       void (**AwtNoFlushUnlock)(JNIEnv *), void *reserved),
-                      (AwtLock, AwtUnlock, AwtNoFlushUnlock, reserved))
-
-REFLECT_VOID_FUNCTION(getAwtData,
-                      (int32_t *awt_depth, Colormap *awt_cmap, Visual **awt_visual,
-                       int32_t *awt_num_colors, void *pReserved),
-                      (awt_depth, awt_cmap, awt_visual,
-                       awt_num_colors, pReserved))
-
-REFLECT_FUNCTION(Display *, getAwtDisplay, (void), ())
--- a/jdk/src/solaris/native/sun/awt/awt_Plugin.c	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifdef HEADLESS
-    #error This file should not be included in headless library
-#endif
-
-#include <jni.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <awt.h>
-#include <awt_p.h>
-
-/*
- * Fix 4221246: Provide utility function for Netscape to use to
- * get AWT display, depth, colormap, and number of colors.
- *
- */
-
-Display *getAwtDisplay(void)
-{
-  return awt_display;
-}
-
-void getExtAwtData(Display      *display,
-                   int32_t      screen,
-                   int32_t      *awt_depth,
-                   Colormap     *awt_cmap,
-                   Visual       **awt_visual,
-                   int32_t      *awt_num_colors,
-                   void         *pReserved)
-{
-  AwtGraphicsConfigDataPtr defaultConfig = NULL;
-
-#ifdef DEBUG
-  if (pReserved != NULL) {
-    jio_fprintf(stderr,
-                "getExtAwtData: warning: reserved pointer is not null\n");
-  }
-#endif
-
-  if (screen >= 0) {
-    defaultConfig = getDefaultConfig(screen);
-  }
-
-  if (defaultConfig) {
-    if (awt_depth != NULL) {
-      *awt_depth = defaultConfig->awt_depth;
-    }
-
-    if (awt_cmap != NULL) {
-      *awt_cmap = defaultConfig->awt_cmap;
-    }
-
-    if (awt_visual != NULL) {
-      *awt_visual = defaultConfig->awt_visInfo.visual;
-    }
-
-    if (awt_num_colors != NULL) {
-      *awt_num_colors = defaultConfig->awt_num_colors;
-    }
-  }
-}
-
-/*
- * getAwtData provided for compatibility with Solaris 1.2 Java Plug-in
- *
- */
-void getAwtData(int32_t          *awt_depth,
-                Colormap     *awt_cmap,
-                Visual       **awt_visual,
-                int32_t          *awt_num_colors,
-                void         *pReserved)
-{
-  Display *display = getAwtDisplay();
-
-  getExtAwtData(display,
-                DefaultScreen(display),
-                awt_depth,
-                awt_cmap,
-                awt_visual,
-                awt_num_colors,
-                pReserved);
-}
-
-/*
- * Fix 4221246: Provide utility funtion for Netscape to get
- * function pointers to AWT lock functions.
- *
- */
-
-static void awt_lock_wrapper(JNIEnv *env) {
-  AWT_LOCK();
-}
-
-static void awt_unlock_wrapper(JNIEnv *env) {
-  AWT_UNLOCK();
-}
-
-static void awt_noflush_unlock_wrapper(JNIEnv *env) {
-  AWT_NOFLUSH_UNLOCK();
-}
-
-void getAwtLockFunctions(void (**AwtLock)(JNIEnv *),
-                         void (**AwtUnlock)(JNIEnv *),
-                         void (**AwtNoFlushUnlock)(JNIEnv *),
-                         void *pReserved)
-{
-#ifdef DEBUG
-  if (pReserved != NULL) {
-    jio_fprintf(stderr,
-                "getAwtLockFunctions: warning: reserved pointer is not null\n");
-  }
-#endif
-
-  if (AwtLock != NULL) {
-    *AwtLock = awt_lock_wrapper;
-  }
-
-  if (AwtUnlock != NULL) {
-    *AwtUnlock = awt_unlock_wrapper;
-  }
-
-  if (AwtNoFlushUnlock != NULL) {
-    *AwtNoFlushUnlock = awt_noflush_unlock_wrapper;
-  }
-}
--- a/jdk/src/solaris/native/sun/awt/awt_Plugin.h	Tue May 27 16:39:05 2014 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Fix 4221246: Export functions for Netscape to use to get AWT info
- */
-
-#ifndef _AWT_PLUGIN_H_
-#define _AWT_PLUGIN_H_
-
-#include <jni.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-void getAwtLockFunctions(void (**AwtLock)(JNIEnv *),
-                         void (**AwtUnlock)(JNIEnv *),
-                         void (**AwtNoFlushUnlock)(JNIEnv *),
-                         void *);
-
-void getExtAwtData(Display *,
-                   int32_t,
-                   int32_t *,      /* awt_depth */
-                   Colormap *,     /* awt_cmap  */
-                   Visual **,      /* awt_visInfo.visual */
-                   int32_t *,      /* awt_num_colors */
-                   void *);
-
-void getAwtData(int32_t *, Colormap *, Visual **, int32_t *, void *);
-
-Display *getAwtDisplay(void);
-
-#endif /* _AWT_PLUGIN_H_ */
--- a/jdk/src/solaris/native/sun/awt/color.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/awt/color.h	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,13 +28,13 @@
 #include "awt.h"
 #include "colordata.h"
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 typedef struct {
     unsigned int Depth;
     XPixmapFormatValues wsImageFormat;
     ImgColorData clrdata;
     ImgConvertFcn *convert[NUM_IMGCV];
 } awtImageData;
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 #endif           /* _COLOR_H_ */
--- a/jdk/src/solaris/native/sun/awt/img_util_md.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/awt/img_util_md.h	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 #include "color.h"
 
-#ifndef HEADLESS
+#if !defined(HEADLESS) && !defined(MACOSX)
 typedef struct {
     ImgConvertData cvdata;      /* The data needed by ImgConvertFcn's */
     struct Hsun_awt_image_ImageRepresentation *hJavaObject;     /* backptr */
@@ -68,7 +68,7 @@
 #define MaskScan(cvdata)                                        \
         ((((IRData *)cvdata)->maskim->bytes_per_line) >> 2)
 
-#endif /* !HEADLESS */
+#endif /* !HEADLESS && !MACOSX */
 
 #define MaskOffset(x)           ((x) >> 5)
 
--- a/jdk/src/solaris/native/sun/awt/utility/rect.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/awt/utility/rect.h	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,18 @@
 #ifndef _AWT_RECT_H
 #define _AWT_RECT_H
 
+#ifndef MACOSX
 #include <X11/Xlib.h>
 typedef XRectangle RECT_T;
+#else
+// OSX still needs this for BitmapToYXBandedRectangles
+typedef struct {
+    int x;
+    int y;
+    int width;
+    int height;
+} RECT_T;
+#endif /* !MACOSX */
 
 #define RECT_EQ_X(r1,r2)        ((r1).x==(r2).x && (r1).width==(r2).width)
 
--- a/jdk/src/solaris/native/sun/misc/VM_md.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/misc/VM_md.c	Wed Jul 05 19:42:29 2017 +0200
@@ -27,12 +27,26 @@
 #include "jni_util.h"
 
 
-JNIEXPORT jboolean JNICALL
-Java_sun_misc_VM_isSetUID(JNIEnv *env, jclass thisclass) {
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+
+    return getuid();
+}
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+
+    return geteuid();
+}
 
-    /* Return true if we are in a set UID or set GID process. */
-    if (getuid() != geteuid() || getgid() != getegid()) {
-        return JNI_TRUE;
-    }
-    return JNI_FALSE;
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+
+    return getgid();
 }
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+
+    return getegid();
+}
--- a/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c	Wed Jul 05 19:42:29 2017 +0200
@@ -39,6 +39,8 @@
 
 #if defined(__linux__) || defined(__solaris__)
 #include <sys/sendfile.h>
+#elif defined(_AIX)
+#include <sys/socket.h>
 #elif defined(_ALLBSD_SOURCE)
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -207,9 +209,7 @@
 
     numBytes = count;
 
-#ifdef __APPLE__
     result = sendfile(srcFD, dstFD, position, &numBytes, NULL, 0);
-#endif
 
     if (numBytes > 0)
         return numBytes;
@@ -228,7 +228,48 @@
     }
 
     return result;
+
+#elif defined(_AIX)
+    jlong max = (jlong)java_lang_Integer_MAX_VALUE;
+    struct sf_parms sf_iobuf;
+    jlong result;
+
+    if (position > max)
+        return IOS_UNSUPPORTED_CASE;
+
+    if (count > max)
+        count = max;
+
+    memset(&sf_iobuf, 0, sizeof(sf_iobuf));
+    sf_iobuf.file_descriptor = srcFD;
+    sf_iobuf.file_offset = (off_t)position;
+    sf_iobuf.file_bytes = count;
+
+    result = send_file(&dstFD, &sf_iobuf, SF_SYNC_CACHE);
+
+    /* AIX send_file() will return 0 when this operation complete successfully,
+     * return 1 when partial bytes transfered and return -1 when an error has
+     * Occured.
+     */
+    if (result == -1) {
+        if (errno == EWOULDBLOCK)
+            return IOS_UNAVAILABLE;
+        if ((errno == EINVAL) && ((ssize_t)count >= 0))
+            return IOS_UNSUPPORTED_CASE;
+        if (errno == EINTR)
+            return IOS_INTERRUPTED;
+        if (errno == ENOTSOCK)
+            return IOS_UNSUPPORTED;
+        JNU_ThrowIOExceptionWithLastError(env, "Transfer failed");
+        return IOS_THROWN;
+    }
+
+    if (sf_iobuf.bytes_sent > 0)
+        return (jlong)sf_iobuf.bytes_sent;
+
+    return IOS_UNSUPPORTED_CASE;
 #else
     return IOS_UNSUPPORTED_CASE;
 #endif
 }
+
--- a/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h	Wed Jul 05 19:42:29 2017 +0200
@@ -62,6 +62,8 @@
 
 #define MAX_ATR_SIZE                    33      /* Maximum ATR size */
 
+#ifndef __APPLE__
+
 typedef struct
 {
         const char *szReader;
@@ -73,6 +75,23 @@
 }
 SCARD_READERSTATE_A;
 
+#else // __APPLE__
+
+#pragma pack(1)
+typedef struct
+{
+        const char *szReader;
+        void *pvUserData;
+        uint32_t dwCurrentState;
+        uint32_t dwEventState;
+        uint32_t cbAtr;
+        unsigned char rgbAtr[MAX_ATR_SIZE];
+}
+SCARD_READERSTATE_A;
+#pragma pack()
+
+#endif // __APPLE__
+
 typedef SCARD_READERSTATE_A SCARD_READERSTATE, *PSCARD_READERSTATE_A,
         *LPSCARD_READERSTATE_A;
 
--- a/jdk/src/windows/classes/java/lang/ProcessImpl.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/classes/java/lang/ProcessImpl.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,15 +25,15 @@
 
 package java.lang;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileDescriptor;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
 import java.lang.ProcessBuilder.Redirect;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -483,6 +483,14 @@
     private static native void terminateProcess(long handle);
 
     @Override
+    public long getPid() {
+        int pid = getProcessId0(handle);
+        return pid;
+    }
+
+    private static native int getProcessId0(long handle);
+
+    @Override
     public boolean isAlive() {
         return isProcessAlive(handle);
     }
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java	Wed Jul 05 19:42:29 2017 +0200
@@ -39,7 +39,7 @@
 
 import static sun.awt.shell.Win32ShellFolder2.*;
 import sun.awt.OSInfo;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 
 // NOTE: This class supersedes Win32ShellFolderManager, which was removed
 //       from distribution after version 1.4.2.
--- a/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/classes/sun/awt/windows/WDataTransferer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -59,6 +59,7 @@
 
 import java.net.URL;
 
+import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -268,9 +269,9 @@
         if (format == CFSTR_INETURL &&
                 URL.class.equals(flavor.getRepresentationClass()))
         {
-            String charset = getDefaultTextCharset();
-            if (localeTransferable != null && localeTransferable.
-                                                                    isDataFlavorSupported(javaTextEncodingFlavor))
+            String charset = Charset.defaultCharset().name();
+            if (localeTransferable != null
+                    && localeTransferable.isDataFlavorSupported(javaTextEncodingFlavor))
             {
                 try {
                     charset = new String((byte[])localeTransferable.
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -40,7 +40,7 @@
 import sun.awt.AWTPermissions;
 import sun.awt.LightweightFrame;
 import sun.awt.SunToolkit;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.awt.Win32GraphicsDevice;
 import sun.awt.Win32GraphicsEnvironment;
 import sun.awt.datatransfer.DataTransferer;
--- a/jdk/src/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/classes/sun/java2d/d3d/D3DScreenUpdateManager.java	Wed Jul 05 19:42:29 2017 +0200
@@ -38,7 +38,7 @@
 import java.util.HashMap;
 
 import sun.awt.AWTAccessor;
-import sun.misc.ThreadGroupUtils;
+import sun.awt.util.ThreadGroupUtils;
 import sun.awt.Win32GraphicsConfig;
 import sun.awt.windows.WComponentPeer;
 import sun.java2d.InvalidPipeException;
--- a/jdk/src/windows/lib/tzmappings	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/lib/tzmappings	Wed Jul 05 19:42:29 2017 +0200
@@ -137,8 +137,8 @@
 Central Standard Time:36,37::America/Chicago:
 Eastern:38,39::America/New_York:
 Eastern Standard Time:38,39::America/New_York:
-E. Europe:4,5:BY:Europe/Minsk:
-E. Europe Standard Time:4,5:BY:Europe/Minsk:
+E. Europe:4,5::EET:
+E. Europe Standard Time:4,5::EET:
 Egypt:4,68::Africa/Cairo:
 Egypt Standard Time:4,68::Africa/Cairo:
 South Africa:4,69::Africa/Harare:
@@ -192,5 +192,6 @@
 Kaliningrad Standard Time:925,925:RU:Europe/Kaliningrad:
 Turkey Standard Time:926,926::Asia/Istanbul:
 Bahia Standard Time:927,927::America/Bahia:
-Western Brazilian Standard Time:928,928:BR:America/Rio_Branco:
-Armenian Standard Time:929,929:AM:Asia/Yerevan:
+Libya Standard Time:928,928:LY:Africa/Tripoli:
+Western Brazilian Standard Time:929,929:BR:America/Rio_Branco:
+Armenian Standard Time:930,930:AM:Asia/Yerevan:
--- a/jdk/src/windows/native/java/lang/ProcessImpl_md.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/native/java/lang/ProcessImpl_md.c	Wed Jul 05 19:42:29 2017 +0200
@@ -248,6 +248,17 @@
         }
 }
 
+/*
+ * Class:     java_lang_ProcessImpl
+ * Method:    getProcessId0
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_java_lang_ProcessImpl_getProcessId0
+  (JNIEnv *env, jclass clazz, jlong handle) {
+    DWORD pid = GetProcessId((HANDLE) jlong_to_ptr(handle));
+    return (jint)pid;
+}
+
 /* Please, read about the MS inheritance problem
    http://support.microsoft.com/kb/315939
    and critical section/synchronized block solution. */
--- a/jdk/src/windows/native/java/util/TimeZone_md.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/native/java/util/TimeZone_md.c	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -394,31 +394,34 @@
  *
  * value_type is one of the following values:
  *      VALUE_KEY for exact key matching
- *      VALUE_MAPID for MapID and country-based mapping (this is
+ *      VALUE_MAPID for MapID (this is
  *      required for the old Windows, such as NT 4.0 SP3).
  */
 static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName,
-                         char *mapID, const char *country)
+                         char *mapID)
 {
     int line;
     int IDmatched = 0;
     FILE *fp;
     char *javaTZName = NULL;
     char *items[TZ_NITEMS];
-    char mapFileName[_MAX_PATH + 1];
+    char *mapFileName;
     char lineBuffer[MAX_ZONE_CHAR * 4];
-    char bestMatch[MAX_ZONE_CHAR];
-    int noMapID = *mapID == '\0';       /* no mapID on Vista */
+    int noMapID = *mapID == '\0';       /* no mapID on Vista and later */
 
-    bestMatch[0] = '\0';
-
+    mapFileName = malloc(strlen(java_home_dir) + strlen(MAPPINGS_FILE) + 1);
+    if (mapFileName == NULL) {
+        return NULL;
+    }
     strcpy(mapFileName, java_home_dir);
     strcat(mapFileName, MAPPINGS_FILE);
 
     if ((fp = fopen(mapFileName, "r")) == NULL) {
         jio_fprintf(stderr, "can't open %s.\n", mapFileName);
+        free((void *) mapFileName);
         return NULL;
     }
+    free((void *) mapFileName);
 
     line = 0;
     while (fgets(lineBuffer, sizeof(lineBuffer), fp) != NULL) {
@@ -469,18 +472,6 @@
                 javaTZName = _strdup(items[TZ_JAVA_NAME]);
                 break;
             }
-            /*
-             * Try to find the most likely time zone.
-             */
-            if (*items[TZ_REGION] == '\0') {
-                strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
-            } else if (country != NULL && strcmp(items[TZ_REGION], country) == 0) {
-                if (value_type == VALUE_MAPID) {
-                    javaTZName = _strdup(items[TZ_JAVA_NAME]);
-                    break;
-                }
-                strncpy(bestMatch, items[TZ_JAVA_NAME], MAX_ZONE_CHAR);
-            }
         } else {
             if (IDmatched == 1) {
                 /*
@@ -492,9 +483,6 @@
     }
     fclose(fp);
 
-    if (javaTZName == NULL && bestMatch[0] != '\0') {
-        javaTZName = _strdup(bestMatch);
-    }
     return javaTZName;
 
  illegal_format:
@@ -506,7 +494,7 @@
 /*
  * Detects the platform time zone which maps to a Java time zone ID.
  */
-char *findJavaTZ_md(const char *java_home_dir, const char *country)
+char *findJavaTZ_md(const char *java_home_dir)
 {
     char winZoneName[MAX_ZONE_CHAR];
     char winMapID[MAX_MAPID_LENGTH];
@@ -521,7 +509,7 @@
             std_timezone = _strdup(winZoneName);
         } else {
             std_timezone = matchJavaTZ(java_home_dir, result,
-                                       winZoneName, winMapID, country);
+                                       winZoneName, winMapID);
         }
     }
 
--- a/jdk/src/windows/native/java/util/TimeZone_md.h	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/native/java/util/TimeZone_md.h	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #ifndef _TIMEZONE_MD_H
 #define _TIMEZONE_MD_H
 
-char *findJavaTZ_md(const char *java_home_dir, const char *region);
+char *findJavaTZ_md(const char *java_home_dir);
 char *getGMTOffsetID();
 
 #endif
--- a/jdk/src/windows/native/sun/misc/VM_md.c	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/src/windows/native/sun/misc/VM_md.c	Wed Jul 05 19:42:29 2017 +0200
@@ -26,9 +26,30 @@
 #include "jni_util.h"
 
 
-JNIEXPORT jboolean JNICALL
-Java_sun_misc_VM_isSetUID(JNIEnv *env, jclass thisclass) {
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getuid(JNIEnv *env, jclass thisclass) {
+
+    /* -1 means function not available. */
+    return -1;
+}
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_geteuid(JNIEnv *env, jclass thisclass) {
+
+    /* -1 means function not available. */
+    return -1;
+}
 
-    /* There is no set UID on Windows. */
-    return JNI_FALSE;
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getgid(JNIEnv *env, jclass thisclass) {
+
+    /* -1 means function not available. */
+    return -1;
 }
+
+JNIEXPORT jlong JNICALL
+Java_sun_misc_VM_getegid(JNIEnv *env, jclass thisclass) {
+
+    /* -1 means function not available. */
+    return -1;
+}
--- a/jdk/test/com/sun/jdi/BadHandshakeTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/com/sun/jdi/BadHandshakeTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,7 @@
  * @summary Check that a bad handshake doesn't cause a debuggee to abort
  * @library /lib/testlibrary
  *
- * @build VMConnection BadHandshakeTest Exit0
+ * @build jdk.testlibrary.* VMConnection BadHandshakeTest Exit0
  * @run main BadHandshakeTest
  *
  */
@@ -110,12 +110,12 @@
         }
 
         // Connect to the debuggee and handshake with garbage
-        Socket s = new Socket(InetAddress.getLocalHost(), port);
+        Socket s = new Socket("localhost", port);
         s.getOutputStream().write("Here's a poke in the eye".getBytes("UTF-8"));
         s.close();
 
         // Re-connect and to a partial handshake - don't disconnect
-        s = new Socket(InetAddress.getLocalHost(), port);
+        s = new Socket("localhost", port);
         s.getOutputStream().write("JDWP-".getBytes("UTF-8"));
 
 
--- a/jdk/test/com/sun/jdi/ExclusiveBind.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/com/sun/jdi/ExclusiveBind.java	Wed Jul 05 19:42:29 2017 +0200
@@ -27,8 +27,7 @@
  *          at the same time.
  * @library /lib/testlibrary
  *
- * @build jdk.testlibrary.ProcessTools jdk.testlibrary.JDKToolLauncher jdk.testlibrary.Utils
- * @build VMConnection ExclusiveBind HelloWorld
+ * @build jdk.testlibrary.* VMConnection ExclusiveBind HelloWorld
  * @run main ExclusiveBind
  */
 import java.net.ServerSocket;
--- a/jdk/test/com/sun/jdi/OptionTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/com/sun/jdi/OptionTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -157,6 +157,37 @@
                 throw new Exception("Test failed: jdwp doesn't like " + cmds[1]);
             }
         }
+
+        System.out.println("Testing invalid address string");
+
+        // Test invalid addresses
+        String badAddresses[] = {
+            ":",
+            "localhost:",
+            "localhost:abc",
+            "localhost:65536",
+            "localhost:65F"
+        };
+
+        for (String badAddress : badAddresses) {
+
+            String badOptions = "transport=dt_socket" +
+                              ",address=" + badAddress +
+                              ",server=y" +
+                              ",suspend=n";
+            String cmds[] = {javaExe, "-agentlib:jdwp=" + badOptions, targetClass};
+            OptionTest myTest = new OptionTest();
+            String results[] = myTest.run(VMConnection.insertDebuggeeVMOptions(cmds));
+
+            if (!results[RETSTAT].equals("0") && results[STDERR].startsWith("ERROR:")) {
+                // We got expected error, test passed
+            }
+            else {
+                throw new Exception("Test failed: jdwp accept invalid address '" + badAddress + "'");
+            }
+        }
+
         System.out.println("Test passed: status = 0");
     }
 }
+
--- a/jdk/test/com/sun/jdi/RunToExit.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/com/sun/jdi/RunToExit.java	Wed Jul 05 19:42:29 2017 +0200
@@ -161,6 +161,9 @@
         Connector.IntegerArgument port_arg =
             (Connector.IntegerArgument)conn_args.get("port");
         port_arg.setValue(port);
+
+        System.out.println("Connection arguments: " + conn_args);
+
         VirtualMachine vm = conn.attach(conn_args);
 
         // The first event is always a VMStartEvent, and it is always in
--- a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,11 +64,12 @@
         env.put(Context.SECURITY_PRINCIPAL, "user");
         env.put(Context.SECURITY_CREDENTIALS, "password");
 
-        env.put("com.sun.jndi.ldap.connect.timeout", "10");
-        env.put("com.sun.jndi.ldap.read.timeout", "3000");
-
         InitialContext ctx = null;
         try {
+            new LdapTimeoutTest().deadServerNoTimeout(env);
+
+            env.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env.put("com.sun.jndi.ldap.read.timeout", "3000");
             new LdapTimeoutTest().ldapReadTimeoutTest(env, false);
             new LdapTimeoutTest().ldapReadTimeoutTest(env, true);
             new LdapTimeoutTest().simpleAuthConnectTest(env);
@@ -84,7 +85,7 @@
     void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
         InitialContext ctx = null;
         if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
-        ScheduledFuture killer = killSwitch();
+        ScheduledFuture killer = killSwitch(5000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -112,7 +113,7 @@
 
     void simpleAuthConnectTest(Hashtable env) {
         InitialContext ctx = null;
-        ScheduledFuture killer = killSwitch();
+        ScheduledFuture killer = killSwitch(5000);
         long start = System.nanoTime();
         try {
             ctx = new InitialDirContext(env);
@@ -139,6 +140,32 @@
         }
     }
 
+    void deadServerNoTimeout(Hashtable env) {
+        InitialContext ctx = null;
+        ScheduledFuture killer = killSwitch(30000);
+        long start = System.nanoTime();
+        try {
+            ctx = new InitialDirContext(env);
+            SearchControls scl = new SearchControls();
+            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+            NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
+                .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
+            // shouldn't reach here
+            fail();
+        } catch (NamingException e) {
+            long end = System.nanoTime();
+            if (TimeUnit.NANOSECONDS.toMillis(end - start) < 14000) {
+                System.err.println("fail: timeout should be at least 15 seconds, actual time: "
+                                   + TimeUnit.NANOSECONDS.toMillis(end - start));
+                fail();
+            } else {
+                pass();
+            }
+        } finally {
+            if (!shutItDown(killer, ctx)) fail();
+        }
+    }
+
     boolean shutItDown(ScheduledFuture killer, InitialContext ctx) {
         killer.cancel(true);
         try {
@@ -149,15 +176,15 @@
         }
     }
 
-    ScheduledFuture killSwitch() {
+    ScheduledFuture killSwitch(int ms) {
         final Thread current = Thread.currentThread();
         return LdapTimeoutTest.pool.schedule(new Callable<Void>() {
             public Void call() throws Exception {
                 System.err.println("Fail: killSwitch()");
-                current.interrupt();
+                System.exit(0);
                 return null;
             }
-        }, 5000, TimeUnit.MILLISECONDS);
+        }, ms, TimeUnit.MILLISECONDS);
     }
 
     static class Server extends Thread {
--- a/jdk/test/com/sun/tools/attach/TempDirTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/com/sun/tools/attach/TempDirTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -38,8 +38,8 @@
  * @bug 8033104
  * @summary Test to make sure attach and jvmstat works correctly when java.io.tmpdir is set
  * @library /lib/testlibrary
- * @run build Application Shutdown RunnerUtil
- * @run main/timeout=10 TempDirTest
+ * @run build jdk.testlibrary.* Application Shutdown RunnerUtil
+ * @run main TempDirTest
  */
 
 public class TempDirTest {
--- a/jdk/test/demo/jvmti/mtrace/JFrameCreateTime.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/demo/jvmti/mtrace/JFrameCreateTime.java	Wed Jul 05 19:42:29 2017 +0200
@@ -32,24 +32,28 @@
  *   was very slow (VisualMust debugger people reported this).
  */
 
+import java.awt.GraphicsEnvironment;
 import javax.swing.*;
 
 public class JFrameCreateTime {
     public static void main(String[] args) {
         JFrame f;
         long start, end;
-
-        start = System.currentTimeMillis();
-        f = new JFrame("JFrame");
-        end = System.currentTimeMillis();
-
-        System.out.println("JFrame first creation took " + (end - start) + " ms");
+        if (GraphicsEnvironment.isHeadless()) {
+            System.out.println("JFrameCreateTime test was skipped due to headless mode");
+        } else {
+            start = System.currentTimeMillis();
+            f = new JFrame("JFrame");
+            end = System.currentTimeMillis();
 
-        start = System.currentTimeMillis();
-        f = new JFrame("JFrame");
-        end = System.currentTimeMillis();
+            System.out.println("JFrame first creation took " + (end - start) + " ms");
 
-        System.out.println("JFrame second creation took " + (end - start) + " ms");
-        System.exit(0);
+            start = System.currentTimeMillis();
+            f = new JFrame("JFrame");
+            end = System.currentTimeMillis();
+
+            System.out.println("JFrame second creation took " + (end - start) + " ms");
+            System.exit(0);
+        }
     }
 }
--- a/jdk/test/demo/jvmti/mtrace/TraceJFrame.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/demo/jvmti/mtrace/TraceJFrame.java	Wed Jul 05 19:42:29 2017 +0200
@@ -37,7 +37,7 @@
 public class TraceJFrame {
     public static void main(String args[]) throws Exception {
         if (GraphicsEnvironment.isHeadless()) {
-            System.out.println("JFrame test was skipped due to headless mode");
+            System.out.println("TraceJFrame test was skipped due to headless mode");
         } else {
             DemoRun demo;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Choice/RemoveAllShrinkTest/RemoveAllShrinkTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4851798 8041896
+  @summary Tests Choice List shrinks after removeAll
+  @run main RemoveAllShrinkTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+
+public class RemoveAllShrinkTest {
+
+    public static void main(String[] args) {
+        Frame f = new Frame();
+        Choice choice = new Choice();
+
+        for (int i = 0; i < 10; ++i) {
+            choice.addItem("Item " + i);
+        }
+
+        f.add(choice, BorderLayout.NORTH);
+        Panel panel = new Panel();
+        panel.setBackground(Color.RED);
+        f.add(panel);
+
+        f.setSize(200, 200);
+        f.setVisible(true);
+        f.toFront();
+
+        choice.removeAll();
+
+        try {
+            Robot robot = new Robot();
+            robot.setAutoWaitForIdle(true);
+            robot.setAutoDelay(50);
+
+            robot.waitForIdle();
+            Thread.sleep(200);
+
+            Point pt = choice.getLocationOnScreen();
+            robot.mouseMove(pt.x + choice.getWidth() - choice.getHeight() / 2,
+                    pt.y + choice.getHeight() / 2);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+            Thread.sleep(400);
+
+            Point pt1 = panel.getLocationOnScreen();
+
+            Color color = robot.getPixelColor(pt1.x + panel.getWidth() / 2,
+                    pt1.y + panel.getHeight() / 2);
+
+            if (!color.equals(Color.RED)) {
+                throw new RuntimeException("RemoveAllShrinkTest failed. " + color);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException("The test was not completed.\n\n" + e);
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/SetMaximizedBounds/SetMaximizedBounds.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+
+/*
+ * @test
+ * @summary When Frame.setExtendedState(Frame.MAXIMIZED_BOTH)
+ *          is called for a Frame after been called setMaximizedBounds() with
+ *          certain value, Frame bounds must equal to this value.
+ *
+ * @library ../../../../lib/testlibrary
+ * @build ExtendedRobot
+ * @run main SetMaximizedBounds
+ */
+
+public class SetMaximizedBounds {
+
+    Frame frame;
+    Rectangle bound;
+    boolean supported;
+    ExtendedRobot robot;
+    static Rectangle max = new Rectangle(100,100,400,400);
+
+    public void doTest() throws Exception {
+        robot = new ExtendedRobot();
+
+        EventQueue.invokeAndWait( () -> {
+            frame = new Frame( "TestFrame ");
+            frame.setLayout(new FlowLayout());
+
+            if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) {
+                supported = true;
+                frame.setMaximizedBounds(max);
+            } else {
+                supported = false;
+            }
+
+            frame.setSize(200, 200);
+            frame.setVisible(true);
+        });
+
+        robot.waitForIdle(2000);
+        if (supported) {
+            EventQueue.invokeAndWait( () -> {
+                frame.setExtendedState(Frame.MAXIMIZED_BOTH);
+            });
+            robot.waitForIdle(2000);
+            bound = frame.getBounds();
+            if(!bound.equals(max))
+                throw new RuntimeException("The bounds of the Frame do not equal to what"
+                    + " is specified when the frame is in Frame.MAXIMIZED_BOTH state");
+        } else {
+            System.out.println("Frame.MAXIMIZED_BOTH not supported");
+        }
+
+        frame.dispose();
+    }
+
+    public static void main(String[] args) throws Exception {
+        String os = System.getProperty("os.name").toLowerCase();
+        System.out.println(os);
+        if (os.contains("windows") || os.contains("os x"))
+            new SetMaximizedBounds().doTest();
+        else
+            System.out.println("Platform "+os+" is not supported. Supported platforms are Windows and OS X.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/FullScreen/DisplayChangeVITest/DisplayChangeVITest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 6366359
+ * @summary Test that we don't crash when changing from 8 to 16/32 bit modes
+ * @author Dmitri.Trembovetski@Sun.COM area=FullScreen
+ * @run main/othervm/timeout=200 DisplayChangeVITest
+ * @run main/othervm/timeout=200 -Dsun.java2d.d3d=false DisplayChangeVITest
+ * @run main/othervm/timeout=200 -Dsun.java2d.opengl=true DisplayChangeVITest
+ */
+
+import java.awt.Color;
+import java.awt.DisplayMode;
+import java.awt.Graphics;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.image.BufferedImage;
+import java.awt.image.VolatileImage;
+import java.lang.Exception;
+import java.lang.Thread;
+import java.util.ArrayList;
+import java.util.Random;
+import javax.swing.JFrame;
+
+/**
+ * The test enters fullscreen mode (if it's supported) and then tries
+ * to switch between display moes with different depths and dimensions
+ * while doing both rendering to the screen (via a VolatileImage)
+ * and Swing repainting just to make things more chaotic.
+ *
+ * The procedure is repeated TEST_REPS times (3 by default).
+ *
+ * Don't pay attention to what happens on the screen, it won't be pretty.
+ * If the test doesn't crash or throw exceptions, it passes, otherwise
+ * it fails.
+ */
+public class DisplayChangeVITest extends JFrame implements Runnable {
+
+    private final Random rnd = new Random();
+    private VolatileImage bb;
+    private BufferedImage sprite;
+    private VolatileImage volSprite;
+
+    private static boolean done = false;
+    private static final Object lock = new Object();
+    private static final int TEST_REPS = 3;
+
+    private ArrayList<DisplayMode> dms;
+
+    DisplayChangeVITest() {
+        selectDisplayModes();
+        addKeyListener(new KeyAdapter() {
+            public void keyPressed(KeyEvent e) {
+                if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
+                    synchronized (lock) {
+                        done = true;
+                    }
+                }
+            }
+        });
+        sprite = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
+        sprite.getRaster().getDataBuffer();
+        Graphics g = sprite.getGraphics();
+        g.setColor(Color.yellow);
+        g.fillRect(0, 0, sprite.getWidth(), sprite.getHeight());
+    }
+
+    void render(Graphics g) {
+        do {
+            // volatile images validated here
+            initBackbuffer();
+
+            g.setColor(Color.black);
+            g.fillRect(0, 0, getWidth(), getHeight());
+
+            Graphics gg = bb.getGraphics();
+            gg.setColor(new Color(rnd.nextInt(0x00ffffff)));
+            gg.fillRect(0, 0, bb.getWidth(), bb.getHeight());
+            for (int x = 0; x < 10; x++) {
+                gg.drawImage(sprite, x*200, 0, null);
+                gg.drawImage(volSprite, x*200, 500, null);
+            }
+
+            g.drawImage(bb, 0, 0, null);
+        } while (bb.contentsLost());
+    }
+
+    private static void sleep(long msec) {
+        try { Thread.sleep(msec); } catch (InterruptedException e) {}
+    }
+
+    private int reps = 0;
+    public void run() {
+        GraphicsDevice gd = getGraphicsConfiguration().getDevice();
+        if (gd.isDisplayChangeSupported() && dms.size() > 0) {
+            while (!done && reps++ < TEST_REPS) {
+                for (DisplayMode dm : dms) {
+                    System.err.printf("Entering DisplayMode[%dx%dx%d]\n",
+                        dm.getWidth(), dm.getHeight(), dm.getBitDepth());
+                    gd.setDisplayMode(dm);
+
+                    initBackbuffer();
+                    for (int i = 0; i < 10; i++) {
+                        // render to the screen
+                        render(getGraphics());
+                        // ask Swing to repaint
+                        repaint();
+                        sleep(100);
+                    }
+                    sleep(1500);
+                }
+            }
+        } else {
+            System.err.println("Display mode change " +
+                               "not supported. Test passed.");
+        }
+        dispose();
+        synchronized (lock) {
+            done = true;
+            lock.notify();
+        }
+    }
+
+    private void createBackbuffer() {
+        if (bb == null ||
+            bb.getWidth() != getWidth() || bb.getHeight() != getHeight())
+        {
+            bb = createVolatileImage(getWidth(), getHeight());
+        }
+    }
+
+    private void initBackbuffer() {
+        createBackbuffer();
+
+        int res = bb.validate(getGraphicsConfiguration());
+        if (res == VolatileImage.IMAGE_INCOMPATIBLE) {
+            bb = null;
+            createBackbuffer();
+            bb.validate(getGraphicsConfiguration());
+            res = VolatileImage.IMAGE_RESTORED;
+        }
+        if (res == VolatileImage.IMAGE_RESTORED) {
+            Graphics g = bb.getGraphics();
+            g.setColor(new Color(rnd.nextInt(0x00ffffff)));
+            g.fillRect(0, 0, bb.getWidth(), bb.getHeight());
+
+            volSprite = createVolatileImage(100, 100);
+        }
+        volSprite.validate(getGraphicsConfiguration());
+    }
+
+    private void selectDisplayModes() {
+        GraphicsDevice gd =
+            GraphicsEnvironment.getLocalGraphicsEnvironment().
+                getDefaultScreenDevice();
+        dms = new ArrayList<DisplayMode>();
+        DisplayMode dmArray[] = gd.getDisplayModes();
+        boolean found8 = false, found16 = false,
+                found24 = false, found32 = false;
+        for (DisplayMode dm : dmArray) {
+            if (!found8 &&
+                (dm.getBitDepth() == 8 ||
+                 dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI)  &&
+                (dm.getWidth() >= 800 && dm.getWidth() < 1024))
+            {
+                dms.add(dm);
+                found8 = true;
+                continue;
+            }
+            if (!found32 &&
+                (dm.getBitDepth() == 32 ||
+                 dm.getBitDepth() == DisplayMode.BIT_DEPTH_MULTI)  &&
+                dm.getWidth() >= 1280)
+            {
+                dms.add(dm);
+                found32 = true;
+                continue;
+            }
+            if (!found16 &&
+               dm.getBitDepth() == 16 &&
+                (dm.getWidth() >= 1024 && dm.getWidth() < 1280))
+            {
+                dms.add(dm);
+                found16 = true;
+                continue;
+            }
+            if (found8 && found16 && found32) {
+                break;
+            }
+        }
+        System.err.println("Found display modes:");
+        for (DisplayMode dm : dms) {
+            System.err.printf("DisplayMode[%dx%dx%d]\n",
+                dm.getWidth(), dm.getHeight(), dm.getBitDepth());
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        DisplayChangeVITest test = new DisplayChangeVITest();
+        GraphicsDevice gd =
+            GraphicsEnvironment.getLocalGraphicsEnvironment().
+                getDefaultScreenDevice();
+        if (gd.isFullScreenSupported()) {
+            gd.setFullScreenWindow(test);
+            Thread t = new Thread(test);
+            t.run();
+            synchronized (lock) {
+                while (!done) {
+                    try {
+                        lock.wait(50);
+                    } catch (InterruptedException ex) {
+                        ex.printStackTrace();
+                    }
+                }
+            }
+            System.err.println("Test Passed.");
+        } else {
+            System.err.println("Full screen not supported. Test passed.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+
+/*
+ * @test
+ * @summary Have different components having different preferred sizes
+ *          added to a grid layout. Change the rows and columns of the
+ *          grid layout and check the components are re-laid out.
+ *          The strategy followed is to calculate the component location
+ *          depending on the preferred sizes and gaps and click the cornors
+ *          of the components to check if events are triggered
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main ChangeGridSize
+ * @run main ChangeGridSize -hg 20 -vg 20
+ */
+
+public class ChangeGridSize {
+
+    private int width = 200;
+    private int height = 200;
+    private final int hGap, vGap;
+    private final int rows = 3;
+    private final int columns = 2;
+    private final int componentCount = 6;
+
+    private Button[] buttons;
+    private Frame frame;
+
+    private ExtendedRobot robot;
+    private GridLayout layout;
+
+    private volatile boolean actionPerformed = false;
+
+    public ChangeGridSize(int hGap, int vGap) throws Exception  {
+        this.hGap = hGap;
+        this.vGap = vGap;
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait( () -> {
+            frame = new Frame("Test frame");
+            frame.setSize(width, height);
+            layout = new GridLayout(rows + 3, columns - 1, hGap, vGap);
+            frame.setLayout(layout);
+
+            buttons = new Button[componentCount];
+            for (int i = 0; i < componentCount; i++) {
+                buttons[i] = new Button("Button" + i);
+                frame.add(buttons[i]);
+                buttons[i].addActionListener( (event) -> { actionPerformed = true; });
+            }
+            frame.setVisible(true);
+        });
+    }
+
+    public static void main(String[] args) throws Exception {
+        int hGap = 0;
+        int vGap = 0;
+        for (int i = 0; i < args.length; i++) {
+            switch (args[i]) {
+                case "-hg":
+                    hGap = Integer.parseInt(args[++i]);
+                    break;
+                case "-vg":
+                    vGap = Integer.parseInt(args[++i]);
+                    break;
+            }
+        }
+        new ChangeGridSize(hGap, vGap).doTest();
+    }
+
+    private void resizeFrame() throws Exception {
+        EventQueue.invokeAndWait(() -> {
+            Insets insets = frame.getInsets();
+            double dH = (height-insets.top-insets.bottom - vGap*(rows-1)) % rows;
+            double dW = (width-insets.left-insets.right - hGap*(columns-1)) % columns;
+            height -= dH;
+            width -= dW;
+            frame.setSize(width, height);
+            frame.revalidate();
+        });
+        robot.waitForIdle();
+    }
+
+    private void changeGridSize() throws Exception {
+        EventQueue.invokeAndWait(() -> {
+            layout.setRows(rows);
+            layout.setColumns(columns);
+
+            frame.revalidate();
+        });
+        robot.waitForIdle();
+    }
+
+    public void testBoundaries(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY) throws Exception {
+
+        actionPerformed = false;
+        robot.mouseMove(topLeftX, topLeftY);
+        robot.delay(500);
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.delay(500);
+        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        robot.waitForIdle(3000);
+
+        if(!actionPerformed)
+            throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+
+        actionPerformed = false;
+        robot.mouseMove(bottomRightX, bottomRightY);
+        robot.delay(500);
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.delay(500);
+        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        robot.waitForIdle(3000);
+
+        if(!actionPerformed)
+            throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+    }
+
+    private void doTest() throws Exception {
+        robot.waitForIdle();
+        changeGridSize();
+        resizeFrame();
+
+        int availableWidth = width - frame.getInsets().left -
+                frame.getInsets().right;
+        int componentWidth = (availableWidth + hGap) / columns - hGap;
+        int availableHeight = height - frame.getInsets().top -
+                frame.getInsets().bottom;
+        int componentHeight = (availableHeight + vGap) / rows - vGap;
+
+        for (int i = 0; i < buttons.length; i++) {
+            if (buttons[i].getSize().width != componentWidth ||
+                    buttons[i].getSize().height != componentHeight) {
+                throw new RuntimeException(
+                        "FAIL: Button " + i + " not of proper size" +
+                        "Expected: " + componentWidth + "*" + componentHeight +
+                        "Actual: " + buttons[i].getSize().width + "*" + buttons[i].getSize().height);
+            }
+        }
+
+        // Components are visible. They should trigger events.
+        // Now you can check for the actual size shown.
+        int currentRow = 1;
+        int currentColumn = 0;
+        for (int i = 0; i < buttons.length; i++) {
+            currentColumn++;
+            if (currentColumn > columns) {
+                currentColumn = 1;
+                currentRow++;
+            }
+
+            int topPosX = frame.getLocationOnScreen().x +
+                    frame.getInsets().left +
+                    (currentColumn - 1) * (componentWidth + hGap);
+            int topPosY = frame.getLocationOnScreen().y +
+                    frame.getInsets().top +
+                    (currentRow - 1) * (componentHeight + vGap);
+
+            int bottomPosX = topPosX + componentWidth - 1;
+            int bottomPosY = topPosY + componentHeight - 1;
+            testBoundaries(topPosX, topPosY, bottomPosX, bottomPosY);
+        }
+
+        frame.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+/*
+ * @test
+ * @summary Have different components having different preferred sizes
+ *          added to a grid layout having various values of row/columns.
+ *          Check if the compnents are correctly laid out.
+ *          The strategy followed is to calculate the component location
+ *          depending on the preferred sizes and gaps and click the cornors
+ *          of the components to check if events are triggered
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main ComponentPreferredSize
+ * @run main ComponentPreferredSize -hg 20 -vg 20
+ */
+
+public class ComponentPreferredSize {
+
+    private int width = 200;
+    private int height = 200;
+    private final int hGap, vGap;
+    private final int rows = 3;
+    private final int columns = 2;
+    private final int componentCount = 6;
+
+    private Button[] buttons;
+    private Frame frame;
+
+    private ExtendedRobot robot;
+    private GridLayout layout;
+
+    private volatile boolean actionPerformed = false;
+
+    public ComponentPreferredSize(int hGap, int vGap) throws Exception {
+        this.hGap = hGap;
+        this.vGap = vGap;
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait( () -> {
+            frame = new Frame("Test frame");
+            frame.setSize(width, height);
+            layout = new GridLayout(rows, columns, hGap, vGap);
+            frame.setLayout(layout);
+
+            buttons = new Button[componentCount];
+            for (int i = 0; i < componentCount; i++) {
+                buttons[i] = new Button("Button" + i);
+                buttons[i].setPreferredSize(new Dimension((int) Math.random() * 100,
+                        (int) Math.random() * 100));
+                frame.add(buttons[i]);
+                buttons[i].addActionListener((event) -> {actionPerformed = true;});
+            }
+
+            frame.setVisible(true);
+        });
+    }
+
+    public static void main(String[] args) throws Exception {
+        int hGap = 0;
+        int vGap = 0;
+        for (int i = 0; i < args.length; i++) {
+            switch (args[i]) {
+                case "-hg":
+                    hGap = Integer.parseInt(args[++i]);
+                    break;
+                case "-vg":
+                    vGap = Integer.parseInt(args[++i]);
+                    break;
+            }
+        }
+        new ComponentPreferredSize(hGap, vGap).doTest();
+    }
+
+    private void resizeFrame() throws Exception {
+        EventQueue.invokeAndWait(() -> {
+            Insets insets = frame.getInsets();
+            double dH = (height-insets.top-insets.bottom - vGap*(rows-1)) % rows;
+            double dW = (width-insets.left-insets.right - hGap*(columns-1)) % columns;
+            height -= dH;
+            width -= dW;
+            frame.setSize(width, height);
+            frame.revalidate();
+        });
+        robot.waitForIdle();
+    }
+
+    public void testBoundaries(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY) throws Exception {
+
+        actionPerformed = false;
+        robot.mouseMove(topLeftX, topLeftY);
+        robot.delay(500);
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.delay(500);
+        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        robot.waitForIdle(3000);
+
+        if(!actionPerformed)
+            throw new RuntimeException("Clicking on the left top of button did not trigger action event");
+
+        actionPerformed = false;
+        robot.mouseMove(bottomRightX, bottomRightY);
+        robot.delay(500);
+        robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
+        robot.delay(500);
+        robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
+        robot.waitForIdle(3000);
+
+        if(!actionPerformed)
+            throw new RuntimeException("Clicking on the bottom right of button did not trigger action event");
+    }
+
+    private void doTest() throws Exception {
+        robot.waitForIdle();
+        resizeFrame();
+
+        int availableWidth = width - frame.getInsets().left -
+                frame.getInsets().right;
+        int componentWidth = (availableWidth + hGap) / columns - hGap;
+        int availableHeight = height - frame.getInsets().top -
+                frame.getInsets().bottom;
+        int componentHeight = (availableHeight + vGap) / rows - vGap;
+
+        for (int i = 0; i < buttons.length; i++) {
+            if (buttons[i].getSize().width != componentWidth ||
+                    buttons[i].getSize().height != componentHeight) {
+                throw new RuntimeException(
+                        "FAIL: Button " + i + " not of proper size" +
+                        "Expected: " + componentWidth + "*" + componentHeight +
+                        "Actual: " + buttons[i].getSize().width + "*" + buttons[i].getSize().height);
+            }
+        }
+
+        // Components are visible. They should trigger events.
+        // Now you can check for the actual size shown.
+        int currentRow = 1;
+        int currentColumn = 0;
+        for (int i = 0; i < buttons.length; i++) {
+            currentColumn++;
+            if (currentColumn > columns) {
+                currentColumn = 1;
+                currentRow++;
+            }
+
+            int topPosX = frame.getLocationOnScreen().x +
+                    frame.getInsets().left +
+                    (currentColumn - 1) * (componentWidth + hGap);
+            int topPosY = frame.getLocationOnScreen().y +
+                    frame.getInsets().top +
+                    (currentRow - 1) * (componentHeight + vGap);
+
+            int bottomPosX = topPosX + componentWidth - 1;
+            int bottomPosY = topPosY + componentHeight - 1;
+            testBoundaries(topPosX, topPosY, bottomPosX, bottomPosY);
+        }
+
+        frame.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/FrameBorderCounter.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowAdapter;
+
+public class FrameBorderCounter {
+
+    private static Frame frame;
+    private static Frame background;
+    private static Dimension size;
+    private static Point location;
+    private static Point entered;
+
+    public static void main(String[] args) throws Exception {
+        final Robot robot = new Robot();
+        EventQueue.invokeAndWait(new Runnable() {
+            public void run() {
+                robot.mouseMove(0, 0);
+            }
+        });
+        EventQueue.invokeAndWait(new Runnable() {
+            public void run() {
+                background = new Frame();
+                background.setBounds(100, 100, 300, 300);
+                background.addMouseListener(new MouseAdapter() {
+                    @Override
+                    public void mouseEntered(MouseEvent e) {
+                        entered = e.getLocationOnScreen();
+                        System.err.println("[ENTERED] : " + entered);
+                    }
+                });
+                background.setVisible(true);
+            }
+        });
+        EventQueue.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new Frame("Frame");
+                frame.setBounds(200, 200, 100, 100);
+                frame.addWindowListener(new WindowAdapter() {
+                    public void windowClosing(WindowEvent e) {
+                        System.exit(0);
+                    }
+                });
+                frame.setVisible(true);
+            }
+        });
+        Thread.sleep(1000);
+        EventQueue.invokeAndWait(new Runnable() {
+            public void run() {
+                location = frame.getLocationOnScreen();
+                size = frame.getSize();
+            }
+        });
+        int out = 20;
+        for (int x = location.x + size.width - out; x <= location.x + size.width + out; ++x) {
+            robot.mouseMove(x, location.y + size.height / 2);
+            Thread.sleep(50);
+        }
+        System.err.println("[LOCATION] : " + location);
+        System.err.println("[SIZE] : " + size);
+        Thread.sleep(250);
+        int shift = entered.x - location.x - size.width - 1;
+        System.err.println("Done");
+        System.out.println(shift);
+        frame.dispose();
+        background.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.InputEvent;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.JFrame;
+import javax.swing.SpringLayout;
+import javax.swing.SwingUtilities;
+
+/**
+ * Base class for testing overlapping of Swing and AWT component put into GlassPane.
+ * Validates drawing and event delivery at the components intersection.
+ * <p> See {@link OverlappingTestBase} for usage
+ *
+ * @author Sergey Grinev
+ */
+public abstract class GlassPaneOverlappingTestBase extends SimpleOverlappingTestBase {
+
+    /**
+     * If true components is additionally tested to be correctly drawn after resize.
+     */
+    protected boolean testResize = true;
+    private JFrame f = null;
+    private volatile Point ancestorLoc;
+
+    /**
+     * Setups GlassPane with lightweight component returned by {@link SimpleOverlappingTestBase#getSwingComponent() }
+     * Called by base class.
+     */
+    @Override
+    protected void prepareControls() {
+        wasLWClicked = false;
+
+        if(f != null) {
+            f.setVisible(false);
+        }
+        f = new JFrame("Mixing : GlassPane Overlapping test");
+        f.setLayout(new SpringLayout());
+        f.setSize(200, 200);
+
+        propagateAWTControls(f);
+
+        f.getGlassPane().setVisible(true);
+        Container glassPane = (Container) f.getGlassPane();
+        glassPane.setLayout(null);
+
+        testedComponent = getSwingComponent();
+        if (useDefaultClickValidation) {
+            testedComponent.addMouseListener(new MouseAdapter() {
+
+                @Override
+                public void mouseClicked(MouseEvent e) {
+                    //System.err.println("lw mouse clicked");
+                    wasLWClicked = true;
+                }
+            });
+        }
+        testedComponent.setBounds(0, 0, testedComponent.getPreferredSize().width, testedComponent.getPreferredSize().height);
+        glassPane.add(testedComponent);
+
+        f.setVisible(true);
+    }
+
+    public GlassPaneOverlappingTestBase() {
+        super();
+    }
+
+    public GlassPaneOverlappingTestBase(boolean defaultClickValidation) {
+        super(defaultClickValidation);
+    }
+
+    /**
+     * Run test by {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) } validation for current lightweight component.
+     * <p>Also resize component and repeat validation in the resized area.
+     * <p>Called by base class.
+     * @return true if test passed
+     * @see GlassPaneOverlappingTestBase#testResize
+     */
+    @Override
+    protected boolean performTest() {
+        if (!super.performTest()) {
+            return false;
+        }
+        if (testResize) {
+            wasLWClicked = false;
+            try {
+                SwingUtilities.invokeAndWait(new Runnable() {
+
+                    public void run() {
+                        testedComponent.setBounds(0, 0, testedComponent.getPreferredSize().width, testedComponent.getPreferredSize().height + 20);
+                        ancestorLoc = f.getLocationOnScreen();
+                    }
+                });
+            } catch (InterruptedException ex) {
+                fail(ex.getMessage());
+            } catch (InvocationTargetException ex) {
+                fail(ex.getMessage());
+            }
+            Point lLoc = testedComponent.getLocationOnScreen();
+            lLoc.translate(1, testedComponent.getPreferredSize().height + 1);
+
+            /* this is a workaround for certain jtreg(?) focus issue:
+               tests fail starting after failing mixing tests but always pass alone.
+             */
+            Util.waitForIdle(robot);
+            ancestorLoc.translate(f.getWidth()/2-15, 2);
+            robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
+            Util.waitForIdle(robot);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(50);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            Util.waitForIdle(robot);
+
+            clickAndBlink(robot, lLoc);
+            return wasLWClicked;
+        } else {
+            return true;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,692 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.SwingUtilities;
+import java.io.*;
+
+/**
+ * AWT Mixing test for HierarchyBoundsListener ancestors.
+ * <p>See <a href="https://bugs.openjdk.java.net/browse/JDK-6768230">CR6768230</a> for details.
+ */
+/*
+@test
+@bug 6768230
+@summary Mixing test for HierarchyBoundsListener ancestors
+@build FrameBorderCounter
+@run main HierarchyBoundsListenerMixingTest
+ */
+public class HierarchyBoundsListenerMixingTest {
+
+    protected void prepareControls() {
+        dummy = new Frame();
+        dummy.setSize(100, 100);
+        dummy.setLocation(0, 350);
+        dummy.setVisible(true);
+
+        frame = new Frame("Test Frame");
+        frame.setLayout(new FlowLayout());
+
+        panel = new Panel();
+        button = new Button("Button");
+        label = new Label("Label");
+        list = new List();
+        list.add("One");
+        list.add("Two");
+        list.add("Three");
+        choice = new Choice();
+        choice.add("Red");
+        choice.add("Orange");
+        choice.add("Yellow");
+        checkbox = new Checkbox("Checkbox");
+        scrollbar = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
+        textfield = new TextField(15);
+        textarea = new TextArea(5, 15);
+
+        components = new Component[] {
+            panel, button, label, list, choice, checkbox, scrollbar, textfield, textarea
+        };
+        ancestorResized = new boolean[components.length];
+        ancestorMoved = new boolean[components.length];
+
+        frame.addWindowListener(new WindowAdapter() {
+            @Override
+            public void windowClosing(WindowEvent event) {
+                System.err.println("User closed the window");
+                System.exit(1);
+            }
+        });
+
+        HierarchyBoundsListener listener = new HierarchyBoundsListenerImpl();
+        for (int i = 0; i < components.length; i++) {
+            components[i].addHierarchyBoundsListener(listener);
+            frame.add(components[i]);
+        }
+        frame.setSize(300, 300);
+        frame.setVisible(true);
+    }
+
+    private int frameBorderCounter() {
+        String JAVA_HOME = System.getProperty("java.home");
+
+        try {
+            Process p = Runtime.getRuntime().exec(JAVA_HOME + "/bin/java FrameBorderCounter");
+            try {
+                p.waitFor();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                throw new RuntimeException(e);
+            }
+            if (p.exitValue() != 0) {
+                throw new RuntimeException("FrameBorderCounter exited with not null code!\n" + readInputStream(p.getErrorStream()));
+            }
+            return Integer.parseInt(readInputStream(p.getInputStream()).trim());
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+    private String readInputStream(InputStream is) throws IOException {
+        byte[] buffer = new byte[4096];
+        int len = 0;
+        StringBuilder sb = new StringBuilder();
+        try (InputStreamReader isr = new InputStreamReader(is)) {
+            while ((len = is.read(buffer)) > 0) {
+                sb.append(new String(buffer, 0, len));
+            }
+        }
+        return sb.toString();
+    }
+
+    protected boolean performTest() {
+        int BORDER_SHIFT = frameBorderCounter();
+        BORDER_SHIFT = Math.abs(BORDER_SHIFT) == 1 ? BORDER_SHIFT : BORDER_SHIFT / 2;
+        Robot robot = null;
+        try {
+            robot = new Robot();
+            Thread.sleep(delay * 10);
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+
+        robot.mouseMove((int) components[0].getLocationOnScreen().x + components[0].getSize().width / 2,
+                        (int) components[0].getLocationOnScreen().y + components[0].getSize().height / 2);
+        robot.delay(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(delay);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.delay(delay);
+
+        resetValues();
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    frame.setSize(new Dimension(frame.getSize().width + 10, frame.getSize().height + 10));
+                    frame.invalidate();
+                    frame.validate();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            passed = false;
+        }
+        if (! resizeTriggered) {
+            synchronized (resizeLock) {
+                try {
+                    resizeLock.wait(delay * 10);
+                } catch (Exception e) {
+                }
+            }
+        }
+        for (int i = 0; i < components.length; i++) {
+            if (! ancestorResized[i]) {
+                System.err.println("FAIL: Frame resized using API call. " +
+                                   "Ancestor resized event did not occur for " + components[i].getClass());
+                passed = false;
+            }
+        }
+        if (moveCount > 0) {
+            System.err.println("FAIL: Ancestor moved event occured when Frame resized using API");
+            passed = false;
+        }
+        robot.delay(delay * 5);
+
+        resetValues();
+        int x = (int) frame.getLocationOnScreen().x;
+        int y = (int) frame.getLocationOnScreen().y;
+        int w = frame.getSize().width;
+        int h = frame.getSize().height;
+
+        robot.mouseMove(x + w + BORDER_SHIFT, y + h / 2);
+        robot.delay(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(delay);
+        for (int i = 0; i < 20; i++) {
+            robot.mouseMove(x + w + i + BORDER_SHIFT, y + h / 2);
+            robot.delay(50);
+        }
+        robot.delay(delay);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        if (! resizeTriggered) {
+            synchronized (resizeLock) {
+                try {
+                    resizeLock.wait(delay * 10);
+                } catch (Exception e) {
+                }
+            }
+        }
+
+        for (int i = 0; i < components.length; i++) {
+            if (! ancestorResized[i]) {
+                System.err.println("FAIL: Frame resized using mouse action. " +
+                                   "Ancestor resized event did not occur for " +
+                                   components[i].getClass());
+                passed = false;
+            }
+        }
+        if (moveCount > 0) {
+            System.err.println("FAIL: Ancestor moved event occured when Frame resized using mouse");
+            passed = false;
+        }
+
+        resetValues();
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                public void run() {
+                    frame.setLocation(frame.getLocation().x + 20, frame.getLocation().y + 20);
+                    frame.invalidate();
+                    frame.validate();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            passed = false;
+        }
+        if (! moveTriggered) {
+            synchronized (moveLock) {
+                try {
+                    moveLock.wait(delay * 10);
+                } catch (Exception e) {
+                }
+            }
+        }
+        for (int i = 0; i < components.length; i++) {
+            if (! ancestorMoved[i]) {
+                System.err.println("FAIL: Frame moved using API call. " +
+                                   "Ancestor moved event did not occur for " + components[i].getClass());
+                passed = false;
+            }
+        }
+        if (resizeCount > 0) {
+            System.err.println("FAIL: Ancestor resized event occured when Frame moved using API");
+            passed = false;
+        }
+        robot.delay(delay * 10);
+
+        resetValues();
+        x = (int) frame.getLocationOnScreen().x;
+        y = (int) frame.getLocationOnScreen().y;
+        w = frame.getSize().width;
+        h = frame.getSize().height;
+
+        //Click on the dummy frame so that the test frame loses focus. This is to workaround
+        //a bug in Linux AS.
+        robot.mouseMove((int) dummy.getLocationOnScreen().x + dummy.getSize().width / 2,
+                        (int) dummy.getLocationOnScreen().y + dummy.getSize().height / 2);
+        robot.delay(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(delay);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        robot.delay(delay);
+
+        robot.mouseMove(x + w / 2, y + 10);
+        robot.delay(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(delay);
+        for (int i = 1; i <= 20; i++) {
+            robot.mouseMove(x + w / 2 + i, y + 10);
+            robot.delay(50);
+        }
+        robot.delay(delay);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        if (! moveTriggered) {
+            synchronized (moveLock) {
+                try {
+                    moveLock.wait(delay * 10);
+                } catch (Exception e) {
+                }
+            }
+        }
+
+        for (int i = 0; i < components.length; i++) {
+            if (! ancestorMoved[i]) {
+                System.err.println("FAIL: Frame moved using mouse action. " +
+                                   "Ancestor moved event did not occur for " + components[i].getClass());
+                passed = false;
+            }
+        }
+        if (resizeCount > 0) {
+            System.err.println("FAIL: Ancestor resized event occured when Frame moved using mouse");
+            passed = false;
+        }
+
+        return passed;
+    }
+
+    private void resetValues() {
+        moveTriggered = false;
+        resizeTriggered = false;
+        moveCount = 0;
+        resizeCount = 0;
+        for (int i = 0; i < ancestorResized.length; i++) {
+            ancestorResized[i] = false;
+            ancestorMoved[i] = false;
+        }
+    }
+
+    private void keyType(int key, Robot robot) throws Exception {
+        robot.keyPress(key);
+        robot.delay(keyDelay);
+        robot.keyRelease(key);
+        robot.delay(keyDelay);
+    }
+
+    class HierarchyBoundsListenerImpl implements HierarchyBoundsListener {
+        // checks for Ancestor_Moved events
+        public void ancestorMoved(HierarchyEvent ce) {
+            if (check) {
+                System.out.println("Moved " + ce.getComponent());
+            }
+            for (int i = 0; i < components.length; i++) {
+                if (components[i].equals(ce.getComponent())) {
+                    //setting this array for purpose of checking ancestor_moved.
+                    ancestorMoved[i] = true;
+                    moveCount++;
+                    if (moveCount == components.length) {
+                        moveTriggered = true;
+                        synchronized (moveLock) {
+                            try {
+                                moveLock.notifyAll();
+                            } catch (Exception e) {
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        // checks for Ancestor_Moved events
+        public void ancestorResized(HierarchyEvent ce) {
+            if (check) {
+                System.out.println("Resized " + ce.getComponent());
+            }
+            for (int i = 0; i < components.length; i++) {
+                if (components[i].equals(ce.getComponent())) {
+                    if (! frame.equals(ce.getChanged()) || ce.getChangedParent() != null) {
+                        System.err.println("FAIL: Invalid value of HierarchyEvent.getXXX");
+                        System.err.println("ce.getChanged() : " + ce.getChanged());
+                        System.err.println("ce.getChangedParent() : " + ce.getChangedParent());
+                        passed = false;
+                    }
+                    //setting this array for purpose of checking ancestor_resized
+                    ancestorResized[i] = true;
+                    resizeCount++;
+                    if (resizeCount == components.length) {
+                        resizeTriggered = true;
+                        synchronized (resizeLock) {
+                            try {
+                                resizeLock.notifyAll();
+                            } catch (Exception e) {
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    private Frame frame, dummy;
+    private Panel panel;
+    private Button button;
+    private Label label;
+    private List list;
+    private Choice choice;
+    private Checkbox checkbox;
+    private Scrollbar scrollbar;
+    private TextField textfield;
+    private TextArea textarea;
+    private Component[] components;
+    private boolean[] ancestorResized;
+    private boolean[] ancestorMoved;
+
+    private int delay = 500;
+    private int keyDelay = 50;
+    private int moveCount = 0;
+    private int resizeCount = 0;
+
+    private boolean passed = true;
+    private boolean moveTriggered = false;
+    private boolean resizeTriggered = false;
+    private final Object moveLock = new Object();
+    private final Object resizeLock = new Object();
+
+    private boolean check = false;
+
+    private void invoke() throws InterruptedException {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+
+                public void run() {
+                    prepareControls();
+                }
+            });
+            try {
+                Thread.sleep(1000); // wait for graphic effects on systems like Win7
+            } catch (InterruptedException ex) {
+            }
+            if (!performTest()) {
+                fail("Test failed");
+            }
+        } catch (InvocationTargetException ex) {
+            fail(ex.getMessage());
+        }
+    }
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static void init() throws InterruptedException {
+        //*** Create instructions for the user here ***
+        //System.setProperty("sun.awt.disableMixing", "true");
+
+        String[] instructions = {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog();
+        Sysout.printInstructions(instructions);
+
+        HierarchyBoundsListenerMixingTest instance = new HierarchyBoundsListenerMixingTest();
+
+        instance.invoke();
+
+        pass();
+    }//End  init()
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+    private static Thread mainThread = null;
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main(String args[]) throws InterruptedException {
+        mainThread = Thread.currentThread();
+        try {
+            init();
+        } catch (TestPassedException e) {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try {
+            Thread.sleep(sleepTime);
+            //Timed out, so fail the test
+            throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds");
+        } catch (InterruptedException e) {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if (!testGeneratedInterrupt) {
+                throw e;
+            }
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if (theTestPassed == false) {
+                throw new RuntimeException(failureMessage);
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo(int seconds) {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass() {
+        Sysout.println("The test passed.");
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //first check if this is executing in main thread
+        if (mainThread == Thread.currentThread()) {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail() {
+        //test writer didn't specify why test failed, so give generic
+        fail("it just plain failed! :-)");
+    }
+
+    public static synchronized void fail(String whyFailed) {
+        Sysout.println("The test failed: " + whyFailed);
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //check if this called from main thread
+        if (mainThread == Thread.currentThread()) {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException(whyFailed);
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+}// class LWComboBox
+class TestPassedException extends RuntimeException {
+}
+
+//*********** End Standard Test Machinery Section **********
+//************ Begin classes defined for the test ****************
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+{
+static int newVar = 0;
+
+public void eventDispatched(AWTEvent e)
+{
+//Counting events to see if we get enough
+eventCount++;
+
+if( eventCount == 20 )
+{
+//got enough events, so pass
+
+LWComboBox.pass();
+}
+else if( tries == 20 )
+{
+//tried too many times without getting enough events so fail
+
+LWComboBox.fail();
+}
+
+}// eventDispatched()
+
+}// NewClass class
+
+ */
+//************** End classes defined for the test *******************
+/****************************************************
+Standard Test Machinery
+DO NOT modify anything below -- it's a standard
+chunk of code whose purpose is to make user
+interaction uniform, and thereby make it simpler
+to read and understand someone else's test.
+ ****************************************************/
+/**
+This is part of the standard test machinery.
+It creates a dialog (with the instructions), and is the interface
+for sending text messages to the user.
+To print the instructions, send an array of strings to Sysout.createDialog
+WithInstructions method.  Put one line of instructions per array entry.
+To display a message for the tester to see, simply call Sysout.println
+with the string to be displayed.
+This mimics System.out.println but works within the test harness as well
+as standalone.
+ */
+class Sysout {
+
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+        System.out.println(messageIn);
+    }
+}// Sysout  class
+
+/**
+This is part of the standard test machinery.  It provides a place for the
+test instructions to be displayed, and a place for interactive messages
+to the user to be displayed.
+To have the test instructions displayed, see Sysout.
+To have a message to the user be displayed, see Sysout.
+Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) {
+                        posOfSpace = maxStringLength - 1;
+                    }
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                } //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+        System.out.println(messageIn);
+    }
+}// TestDialog  class
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JButton } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JButton
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JButtonInGlassPaneOverlapping
+ */
+public class JButtonInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JButton ch = new JButton();
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JButtonInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JButtonOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JButton } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JButton
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JButtonOverlapping
+ */
+public class JButtonOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JButton ch = new JButton();
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JButtonOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JColorChooserOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JColorChooser } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JColorChooser
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JColorChooserOverlapping
+ */
+public class JColorChooserOverlapping extends SimpleOverlappingTestBase {
+
+    public JColorChooserOverlapping() {
+        super(false);
+    }
+
+    @Override
+    protected JComponent getSwingComponent() {
+        wasLWClicked = true;
+        JColorChooser ch = new JColorChooser();
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JColorChooserOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JComboBoxOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import javax.swing.BoxLayout;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JCombobox } component.
+ * <p>This test creates combobox and test if heavyweight component is drawn correctly then dropdown is shown.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JComboBoxOverlapping
+ */
+public class JComboBoxOverlapping extends OverlappingTestBase {
+
+    private boolean lwClicked = false;
+    private Point loc;
+    private Point loc2;
+
+    {testEmbeddedFrame = true;}
+
+    protected void prepareControls() {
+        final JFrame frame = new JFrame("Mixing : Dropdown Overlapping test");
+        frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS));
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+
+        final JComboBox cb = new JComboBox(petStrings);
+        cb.setPreferredSize(new Dimension(frame.getContentPane().getWidth(), 20));
+        cb.addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent e) {
+                if (e.getSource() == cb) {
+                    lwClicked = true;
+                }
+            }
+        });
+
+        frame.add(cb);
+        propagateAWTControls(frame);
+        frame.setVisible(true);
+        loc = cb.getLocationOnScreen();
+        loc2 = frame.getContentPane().getLocationOnScreen();
+    }
+
+    @Override
+    protected boolean performTest() {
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        loc2.translate(75, 75);
+        pixelPreCheck(robot, loc2, currentAwtControl);
+
+        loc.translate(3, 3);
+        clickAndBlink(robot, loc, false);
+
+        clickAndBlink(robot, loc2, false);
+
+        return lwClicked;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JComboBoxOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Point;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JBEditorPane } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JEditorPaneInGlassPaneOverlapping
+ */
+public class JEditorPaneInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JEditorPane ch = new JEditorPane();
+        ch.setText("<b>Swing component</b>");
+        OverlappingTestBase.shift = new Point(12, 12);
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JEditorPaneInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JEditorPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JEditorPane } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JEditorPaneOverlapping
+ */
+public class JEditorPaneOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JEditorPane ch = new JEditorPane();
+        ch.setText("<b>Swing component</b>");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JEditorPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneInternalFrameOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test with JInternalFrame being put in GlassPane.
+ * See <a href="https://bugs.openjdk.java.net/browse/JDK-6637655">JDK-6637655</a> and
+ * <a href="https://bugs.openjdk.java.net/browse/JDK-6985776">JDK-6985776</a>.
+ * <p>See base class for details.
+ */
+/*
+@test
+@bug 6637655 6985776
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JGlassPaneInternalFrameOverlapping
+ */
+public class JGlassPaneInternalFrameOverlapping extends OverlappingTestBase {
+
+    private boolean lwClicked = true;
+    private Point lLoc;
+    private Point lLoc2;
+    private JInternalFrame internalFrame;
+
+    protected boolean performTest() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    lLoc = internalFrame.getContentPane().getLocationOnScreen();
+                    lLoc2 = lLoc.getLocation();
+                    lLoc2.translate(0, internalFrame.getContentPane().getHeight() + 10);
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        clickAndBlink(robot, lLoc);
+
+        Color c = robot.getPixelColor(lLoc2.x, lLoc2.y);
+        robot.mouseMove(lLoc2.x, lLoc2.y);
+        if (!c.equals(AWT_BACKGROUND_COLOR) &&
+            currentAwtControl.getClass() != java.awt.Scrollbar.class &&
+            currentAwtControl.getClass() != java.awt.Choice.class) {
+            fail("The HW component did not pass pixel color check and is not drawn correctly");
+        }
+
+        return lwClicked;
+    }
+
+   // {debugClassName = "Choice";}
+
+    @Override
+    protected void prepareControls() {
+        JFrame frame = new JFrame("Glass Pane children test");
+        frame.setLayout(null);
+
+        Container contentPane = frame.getContentPane();
+        contentPane.setLayout(new BorderLayout());
+        super.propagateAWTControls(contentPane);
+
+        Container glassPane = (Container) frame.getRootPane().getGlassPane();
+        glassPane.setVisible(true);
+        glassPane.setLayout(null);
+
+        internalFrame = new JInternalFrame("Internal Frame", true);
+        internalFrame.setBounds(50, 0, 200, 100);
+        internalFrame.setVisible(true);
+        glassPane.add(internalFrame);
+
+        internalFrame.addMouseListener(new MouseAdapter() {
+
+            @Override
+            public void mouseClicked(MouseEvent e) {
+                lwClicked = true;
+            }
+        });
+
+        frame.setSize(300, 180);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        if (System.getProperty("os.name").toLowerCase().contains("os x")) {
+            System.out.println("Aqua L&F ignores setting color to component. Test passes on Mac OS X.");
+            return;
+        }
+        instance = new JGlassPaneInternalFrameOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JGlassPaneMoveOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test with JInternalFrame being moved in GlassPane.
+ * See <a href="https://bugs.openjdk.java.net/browse/JDK-6637655">JDK-6637655</a> and
+ * <a href="https://bugs.openjdk.java.net/browse/JDK-6981919">JDK-6981919</a>.
+ * <p>See base class for details.
+ */
+/*
+@test
+@bug 6637655 6981919
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JGlassPaneMoveOverlapping
+ */
+public class JGlassPaneMoveOverlapping extends OverlappingTestBase {
+
+    private boolean lwClicked = true;
+    private volatile Point lLoc;
+    private volatile Point lLoc2;
+
+    private JInternalFrame internalFrame;
+    private JFrame frame = null;
+    private volatile Point frameLoc;
+
+    protected boolean performTest() {
+
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    lLoc = internalFrame.getContentPane().getLocationOnScreen();
+                    lLoc2 = lLoc.getLocation();
+                    lLoc2.translate(0, internalFrame.getHeight());
+                    frameLoc = frame.getLocationOnScreen();
+                    frameLoc.translate(frame.getWidth()/2, 3);
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        // force focus on JFrame (jtreg workaround)
+        robot.mouseMove(frameLoc.x, frameLoc.y);
+        Util.waitForIdle(robot);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(50);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        Util.waitForIdle(robot);
+
+
+        //slow move
+        robot.mouseMove(lLoc.x +  25, lLoc.y - 5);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(100);
+        robot.mouseMove(lLoc.x +  45, lLoc.y - 5);
+        robot.delay(100);
+        robot.mouseMove(lLoc.x +  internalWidth - 75, lLoc.y - 5);
+        robot.delay(100);
+        robot.mouseMove(lLoc.x +  internalWidth - 55, lLoc.y - 5);
+        robot.delay(100);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        Color c2 = robot.getPixelColor(lLoc.x +  internalWidth + 15, lLoc.y - 5);
+        if (c2.equals(AWT_BACKGROUND_COLOR)) {
+            error("Foreground frame is not drawn properly");
+        }
+        Color c = robot.getPixelColor(lLoc.x +  internalWidth - 95, lLoc.y + 5);
+        robot.mouseMove(lLoc.x +  internalWidth - 95, lLoc.y + 5);
+        System.out.println("color: " + c + " " + AWT_BACKGROUND_COLOR);
+        if (!c.equals(AWT_BACKGROUND_COLOR) && currentAwtControl.getClass() != java.awt.Scrollbar.class) {
+            error("Background AWT component is not drawn properly");
+        }
+
+        return true;
+    }
+
+    // {debugClassName = "Choice";}
+
+    private static void error(String st) {
+        //System.out.println(st);
+        fail(st);
+    }
+
+    private static final int internalWidth = 200;
+
+    @Override
+    protected void prepareControls() {
+        if(frame != null) {
+            frame.setVisible(false);
+        }
+        frame = new JFrame("Glass Pane children test");
+        frame.setLayout(null);
+
+        Container contentPane = frame.getContentPane();
+        contentPane.setLayout(new BorderLayout());
+        super.propagateAWTControls(contentPane);
+
+        Container glassPane = (Container) frame.getRootPane().getGlassPane();
+        glassPane.setVisible(true);
+        glassPane.setLayout(null);
+
+        internalFrame = new JInternalFrame("Internal Frame", true);
+        internalFrame.setBounds(50, 0, internalWidth, 100);
+        internalFrame.setVisible(true);
+        glassPane.add(internalFrame);
+
+        internalFrame.addMouseListener(new MouseAdapter() {
+
+            @Override
+            public void mouseClicked(MouseEvent e) {
+                lwClicked = true;
+            }
+        });
+
+        frame.setSize(400, 180);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        if (System.getProperty("os.name").toLowerCase().contains("os x")) {
+            System.out.println("Aqua L&F ignores setting color to component. Test passes on Mac OS X.");
+            return;
+        }
+        instance = new JGlassPaneMoveOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameMoveOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.JButton;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JInternalFrame } component during move.
+ * <p>See <a href="http://monaco.sfbay.sun.com/detail.jsf?cr=6985399">CR6768230</a> for details and base class for test info.
+ */
+/*
+@test
+@bug 6985399
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JInternalFrameMoveOverlapping
+ */
+public class JInternalFrameMoveOverlapping extends OverlappingTestBase {
+
+    private boolean lwClicked = true;
+    private Point locTopFrame;
+    private Point locTarget;
+
+    protected boolean performTest() {
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        robot.mouseMove(locTopFrame.x + 25, locTopFrame.y + 25);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException ex) {
+        }
+        robot.mouseMove(locTopFrame.x + (locTarget.x - locTopFrame.x)/2, locTopFrame.y + (locTarget.y - locTopFrame.y)/2);
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException ex) {
+        }
+        robot.mouseMove(locTarget.x, locTarget.y);
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException ex) {
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        clickAndBlink(robot, locTarget);
+
+        return lwClicked;
+    }
+
+    //static {debugClassName = "Choice";}
+
+    @Override
+    protected void prepareControls() {
+
+
+        JDesktopPane desktopPane = new JDesktopPane();
+
+        JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false);
+        bottomFrame.setSize(220, 220);
+        super.propagateAWTControls(bottomFrame);
+        desktopPane.add(bottomFrame);
+        bottomFrame.setVisible(true);
+
+        JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false);
+        topFrame.setSize(200, 200);
+        topFrame.add(new JButton("LW Button") {
+
+            {
+                addMouseListener(new MouseAdapter() {
+
+                    @Override
+                    public void mouseClicked(MouseEvent e) {
+                        lwClicked = true;
+                    }
+                });
+            }
+        });
+        desktopPane.add(topFrame);
+        topFrame.setVisible(true);
+
+        JFrame frame = new JFrame("Test Window");
+        frame.setSize(300, 300);
+        frame.setContentPane(desktopPane);
+        frame.setVisible(true);
+
+        locTopFrame = topFrame.getLocationOnScreen();
+        locTarget = new Point(locTopFrame.x + bottomFrame.getWidth() / 2, locTopFrame.y + bottomFrame.getHeight()/2);
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JInternalFrameMoveOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JInternalFrameOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.JButton;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JInternalFrame } component.
+ * <p>See base class for test info.
+ */
+/*
+@test
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JInternalFrameOverlapping
+ */
+public class JInternalFrameOverlapping extends OverlappingTestBase {
+
+    private boolean lwClicked = true;
+    private Point lLoc;
+
+    protected boolean performTest() {
+
+
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        clickAndBlink(robot, lLoc);
+
+        return lwClicked;
+    }
+
+    /**
+     * Creating two JInternalFrames in JDesktopPanes. Put lightweight component into one frame and heavyweight into another.
+     */
+    @Override
+    protected void prepareControls() {
+        JDesktopPane desktopPane = new JDesktopPane();
+
+        JFrame frame = new JFrame("Test Window");
+        frame.setSize(300, 300);
+        frame.setContentPane(desktopPane);
+        frame.setVisible(true);
+        JInternalFrame bottomFrame = new JInternalFrame("bottom frame", false, false, false, false);
+        bottomFrame.setSize(220, 220);
+        desktopPane.add(bottomFrame);
+        bottomFrame.setVisible(true);
+
+        super.propagateAWTControls(bottomFrame);
+        JInternalFrame topFrame = new JInternalFrame("top frame", false, false, false, false);
+        topFrame.setSize(200, 200);
+        JButton jbutton = new JButton("LW Button") {{
+                addMouseListener(new MouseAdapter() {
+
+                    @Override
+                    public void mouseClicked(MouseEvent e) {
+                        lwClicked = true;
+                    }
+                });
+            }};
+        topFrame.add(jbutton);
+        desktopPane.add(topFrame);
+        topFrame.setVisible(true);
+        lLoc = jbutton.getLocationOnScreen();
+        lLoc.translate(jbutton.getWidth()/2, jbutton.getWidth()/2); //click at middle of the button
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JInternalFrameOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JLabel } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JLabelInGlassPaneOverlapping
+ */
+public class JLabelInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JLabel ch = new JLabel();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JLabelInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JLabelOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JLabel } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JLabelOverlapping
+ */
+public class JLabelOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JLabel ch = new JLabel();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JLabelOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JListInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JList } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JList
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JListInGlassPaneOverlapping
+ */
+public class JListInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JList ch = new JList(new String[] {"one", "two", "three"});
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JListInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JListOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JList } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JList
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JListOverlapping
+ */
+public class JListOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JList ch = new JList(new String[] {"one", "two", "three", "four"});
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JListOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JMenuBarOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.JFrame;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JSeparator;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JMenuBar } and {@link javax.swing.JSeparator} components.
+ * <p>This test creates menu bar and test if heavyweight component is drawn correctly then menu dropdown is shown.
+ * <p>See base class for test info.
+ */
+/*
+@test
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JMenuBarOverlapping
+ */
+public class JMenuBarOverlapping extends OverlappingTestBase {
+
+    {testEmbeddedFrame = true;}
+
+    private boolean lwClicked = false;
+    private boolean spClicked = false;
+    private Point loc;
+    private Point loc2;
+    private Point sepLoc;
+    private JFrame frame;
+    private JMenuBar menuBar;
+    JSeparator separator;
+
+    protected void prepareControls() {
+        frame = new JFrame("Mixing : Dropdown Overlapping test");
+        frame.setLayout(new GridLayout(0,1));
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+
+        menuBar = new JMenuBar();
+        JMenu menu = new JMenu("Test Menu");
+        ActionListener menuListener = new ActionListener() {
+
+            public void actionPerformed(ActionEvent event) {
+                lwClicked = true;
+            }
+        };
+
+        JMenuItem item;
+        menu.add(item = new JMenuItem("first"));
+        item.addActionListener(menuListener);
+        separator = new JSeparator();
+        separator.addMouseListener(new MouseAdapter() {
+
+            @Override
+            public void mouseClicked(MouseEvent e) {
+                spClicked = true;
+            }
+        });
+        menu.add(separator);
+
+        for (int i = 0; i < petStrings.length; i++) {
+            menu.add(item = new JMenuItem(petStrings[i]));
+            item.addActionListener(menuListener);
+        }
+        menuBar.add(menu);
+        frame.setJMenuBar(menuBar);
+
+        propagateAWTControls(frame);
+        frame.setVisible(true);
+    }
+
+    @Override
+    protected boolean performTest() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    loc = menuBar.getLocationOnScreen();
+                    loc2 = frame.getContentPane().getLocationOnScreen();
+                }
+            });
+        } catch (Exception e) {
+        }
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        loc2.translate(75, 75);
+        pixelPreCheck(robot, loc2, currentAwtControl);
+
+        loc.translate(3, 3);
+        clickAndBlink(robot, loc, false);
+
+        clickAndBlink(robot, loc2, false);
+
+        clickAndBlink(robot, loc, false);
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    sepLoc = separator.getLocationOnScreen();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+        sepLoc.translate(20, 1);
+        clickAndBlink(robot, sepLoc, false);
+
+        clickAndBlink(robot, loc, false); // close menu before running next step
+        return lwClicked && spClicked;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JMenuBarOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JPanel } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JPanel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JPanelInGlassPaneOverlapping
+ */
+public class JPanelInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JPanel ch = new JPanel();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setBorder(BorderFactory.createTitledBorder("Swing Component"));
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JPanelInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPanelOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JPanel } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JPanel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JPanelOverlapping
+ */
+public class JPanelOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JPanel ch = new JPanel();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setBorder(BorderFactory.createTitledBorder("Swing Component"));
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JPanelOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JPopupMenuOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.lang.reflect.InvocationTargetException;
+import javax.swing.JFrame;
+import javax.swing.JMenuItem;
+import javax.swing.JPopupMenu;
+import javax.swing.SpringLayout;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JPopupMenu } component.
+ * <p>This test creates menu and test if heavyweight component is drawn correctly then menu dropdown is shown.
+ * <p>See base class for test info.
+ */
+/*
+@test
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JPopupMenuOverlapping
+ */
+public class JPopupMenuOverlapping extends OverlappingTestBase {
+
+    {testEmbeddedFrame = true;}
+
+    private boolean lwClicked = false;
+    private Point loc;
+    private JPopupMenu popup;
+    private JFrame frame=null;
+
+    protected void prepareControls() {
+        if(frame != null) {
+            frame.setVisible(false);
+        }
+        frame = new JFrame("Mixing : Dropdown Overlapping test");
+        frame.setLayout(new SpringLayout());
+        frame.setSize(200, 200);
+
+        popup = new JPopupMenu();
+        ActionListener menuListener = new ActionListener() {
+
+            public void actionPerformed(ActionEvent event) {
+                lwClicked = true;
+            }
+        };
+        JMenuItem item;
+        for (int i = 0; i < petStrings.length; i++) {
+            popup.add(item = new JMenuItem(petStrings[i]));
+            item.addActionListener(menuListener);
+        }
+        propagateAWTControls(frame);
+        frame.setVisible(true);
+        loc = frame.getContentPane().getLocationOnScreen();
+    }
+
+    @Override
+    protected boolean performTest() {
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        loc.translate(75, 75);
+
+        pixelPreCheck(robot, loc, currentAwtControl);
+
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+
+                public void run() {
+                    popup.show(frame.getContentPane(), 15, 15);
+                }
+            });
+
+            robot.waitForIdle();
+
+            clickAndBlink(robot, loc, false);
+
+            SwingUtilities.invokeAndWait(new Runnable() {
+
+                public void run() {
+                    popup.setVisible(false);
+                }
+            });
+        } catch (InterruptedException ex) {
+            fail(ex.getMessage());
+        } catch (InvocationTargetException ex) {
+            fail(ex.getMessage());
+        }
+
+        return lwClicked;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JPopupMenuOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JProgressBar } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JProgressBar
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JProgressBarInGlassPaneOverlapping
+ */
+public class JProgressBarInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JProgressBar ch = new JProgressBar();
+        ch.setValue(50);
+        ch.setPreferredSize(new Dimension(50, 50));
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JProgressBarInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JProgressBarOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JProgressBar } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JProgressBar
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JProgressBarOverlapping
+ */
+public class JProgressBarOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JProgressBar ch = new JProgressBar();
+        ch.setValue(50);
+        ch.setPreferredSize(new Dimension(50, 50));
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JProgressBarOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Point;
+import java.awt.Dimension;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JScrollBar } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JScrollBar
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JScrollBarInGlassPaneOverlapping
+ */
+public class JScrollBarInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    public JScrollBarInGlassPaneOverlapping() {
+        super(false);
+    }
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JScrollBar ch = new JScrollBar(JScrollBar.VERTICAL);
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setValue(50);
+        ch.addAdjustmentListener(new AdjustmentListener() {
+
+            public void adjustmentValueChanged(AdjustmentEvent e) {
+                wasLWClicked = true;
+            }
+        });
+        OverlappingTestBase.shift = new Point(20, 16);
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JScrollBarInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollBarOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Point;
+import java.awt.Dimension;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JScrollBar } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JScrollBar
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JScrollBarOverlapping
+ */
+public class JScrollBarOverlapping extends SimpleOverlappingTestBase {
+
+    public JScrollBarOverlapping() {
+        super(false);
+    }
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JScrollBar ch = new JScrollBar(JScrollBar.VERTICAL);
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setValue(50);
+        ch.addAdjustmentListener(new AdjustmentListener() {
+
+            public void adjustmentValueChanged(AdjustmentEvent e) {
+                wasLWClicked = true;
+            }
+        });
+        OverlappingTestBase.shift = new Point(20, 16);
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JScrollBarOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JScrollPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JScrollPane } component.
+ * <p>See base class for test info.
+ */
+/*
+@test
+@summary Overlapping test for javax.swing.JScrollPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JScrollPaneOverlapping
+ */
+public class JScrollPaneOverlapping extends OverlappingTestBase {
+
+//    {testEmbeddedFrame = true;}
+
+    private boolean horizontalClicked = false;
+    private boolean verticalClicked = false;
+    private Point hLoc;
+    private Point vLoc;
+
+    private JFrame f;
+    private JPanel p;
+    private JScrollPane scrollPane;
+
+    protected void prepareControls() {
+
+        f = new JFrame("JScrollPane");
+        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        f.setSize(120, 120);
+
+        p = new JPanel(new GridLayout(0, 1));
+
+        scrollPane = new JScrollPane(p);
+        scrollPane.setPreferredSize(new Dimension(300,300));
+        scrollPane.setHorizontalScrollBarPolicy(
+                JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+        scrollPane.setVerticalScrollBarPolicy(
+                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+
+        scrollPane.getHorizontalScrollBar().setValue(1);
+        scrollPane.getHorizontalScrollBar().addAdjustmentListener(new AdjustmentListener() {
+
+            public void adjustmentValueChanged(AdjustmentEvent e) {
+                horizontalClicked = true;
+            }
+        });
+
+        scrollPane.getVerticalScrollBar().setValue(1);
+        scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
+
+            public void adjustmentValueChanged(AdjustmentEvent e) {
+                verticalClicked = true;
+            }
+        });
+
+        f.getContentPane().add(scrollPane);
+        f.setVisible(true);
+        propagateAWTControls(p);
+//        JButton b = new JButton("Space extender");
+//        b.setPreferredSize(new Dimension(150,150));
+//        p.add( b );
+
+        //b.requestFocus(); // to change the look of AWT component, especially Choice
+    }
+
+    @Override
+    protected boolean performTest() {
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    hLoc = scrollPane.getHorizontalScrollBar().getLocationOnScreen();
+                    vLoc = scrollPane.getVerticalScrollBar().getLocationOnScreen();
+                }
+            });
+        } catch (Exception e) {
+        }
+        hLoc.translate(2, 2);
+        vLoc.translate(2, 2);
+
+        clickAndBlink(robot, hLoc, false);
+        clickAndBlink(robot, vLoc, false);
+
+        return horizontalClicked && verticalClicked;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JScrollPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JSlider } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JSlider
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JSliderInGlassPaneOverlapping
+ */
+public class JSliderInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JSlider ch = new JSlider();
+        ch.setPreferredSize(new Dimension(50, 50));
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JSliderInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSliderOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JSlider } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JSlider
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JSliderOverlapping
+ */
+public class JSliderOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JSlider ch = new JSlider();
+        ch.setPreferredSize(new Dimension(50, 50));
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JSliderOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import javax.swing.event.ChangeEvent;
+import javax.swing.*;
+import javax.swing.event.ChangeListener;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JSpinner } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JSpinner
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JSpinnerInGlassPaneOverlapping
+ */
+public class JSpinnerInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    {testResize = false;}
+
+    public JSpinnerInGlassPaneOverlapping() {
+        super(false);
+    }
+
+//    static {debugClassName = "Choice";}
+    @Override
+    protected JComponent getSwingComponent() {
+        JSpinner ch = new JSpinner();
+        ch.setPreferredSize(new Dimension(30, 50));
+        ch.addChangeListener(new ChangeListener() {
+
+            public void stateChanged(ChangeEvent e) {
+                wasLWClicked = true;
+            }
+        });
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JSpinnerInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSpinnerOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import javax.swing.event.ChangeEvent;
+import javax.swing.*;
+import javax.swing.event.ChangeListener;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JSpinner } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JSpinner
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JSpinnerOverlapping
+ */
+public class JSpinnerOverlapping extends SimpleOverlappingTestBase {
+
+    public JSpinnerOverlapping() {
+        super(false);
+    }
+
+//    static {debugClassName = "Choice";}
+    @Override
+    protected JComponent getSwingComponent() {
+        JSpinner ch = new JSpinner();
+        ch.setPreferredSize(new Dimension(30, 50));
+        ch.addChangeListener(new ChangeListener() {
+
+            public void stateChanged(ChangeEvent e) {
+                wasLWClicked = true;
+            }
+        });
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JSpinnerOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JSplitPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JSplitPane } component.
+ * <p>This test creates puts heavyweight and lightweight components into different panels and test if splitter image and components itself are drawn correctly.
+ * <p>See base class for test info.
+ */
+/*
+@test
+@bug 6986109
+@summary Overlapping test for javax.swing.JSplitPane
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JSplitPaneOverlapping
+ */
+public class JSplitPaneOverlapping extends OverlappingTestBase {
+
+    private boolean clicked = false;
+    private Point splitterLoc;
+    private JScrollPane sp1;
+    private JScrollPane sp2;
+
+    protected void prepareControls() {
+        JFrame frame = new JFrame("SplitPane Mixing");
+        JPanel p = new JPanel(new GridLayout());
+        p.setPreferredSize(new Dimension(500, 500));
+        propagateAWTControls(p);
+        sp1 = new JScrollPane(p);
+
+        JButton button = new JButton("JButton");
+        button.setBackground(Color.RED);
+        button.addActionListener(new ActionListener() {
+
+            public void actionPerformed(ActionEvent e) {
+                clicked = true;
+            }
+        });
+        sp2 = new JScrollPane(button);
+
+        JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp1, sp2);
+        splitPane.setOneTouchExpandable(false);
+        splitPane.setDividerLocation(150);
+
+        splitPane.setPreferredSize(new Dimension(400, 200));
+
+        frame.getContentPane().add(splitPane);
+        frame.pack();
+        frame.setVisible(true);
+    }
+
+    private static final boolean ignoreFail = false;
+
+    @Override
+    protected boolean performTest() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    splitterLoc = sp2.getLocationOnScreen();
+                    Point leftLoc = sp1.getLocationOnScreen();
+                    leftLoc.translate(sp1.getWidth(), 0);
+                    splitterLoc.translate(-(splitterLoc.x - leftLoc.x) / 2, 30);
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        robot.mouseMove(splitterLoc.x, splitterLoc.y);
+        Util.waitForIdle(robot);
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(splitterLoc.x - 50, splitterLoc.y);
+        Color c = robot.getPixelColor(splitterLoc.x - 50, splitterLoc.y);
+        System.out.println("Actual: "+c+", (not) expected: "+AWT_VERIFY_COLOR+" at "+(splitterLoc.x - 50)+", "+ splitterLoc.y);
+        if (!ignoreFail && c.equals(AWT_VERIFY_COLOR)) {
+            fail("The JSplitPane drag-n-drop image did not pass pixel color check and is overlapped");
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        clickAndBlink(robot, splitterLoc);
+
+        return clicked;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JSplitPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import javax.swing.JComponent;
+import javax.swing.JTable;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JTable } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for JTable
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JTableInGlassPaneOverlapping
+ */
+public class JTableInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    {
+        testResize = false;
+    }
+
+    @Override
+    protected JComponent getSwingComponent() {
+        // Create columns names
+        String columnNames[] = {"Column 1", "Column 2", "Column 3"};
+
+        // Create some data
+        String dataValues[][] = {
+            {"12", "234", "67"},
+            {"-123", "43", "853"},
+            {"93", "89.2", "109"},
+            {"279", "9033", "3092"},
+            {"12", "234", "67"},
+            {"-123", "43", "853"},
+            {"93", "89.2", "109"},
+            {"279", "9033", "3092"},
+            {"12", "234", "67"},
+            {"-123", "43", "853"},
+            {"93", "89.2", "109"},
+            {"279", "9033", "3092"},
+            {"12", "234", "67"},
+            {"-123", "43", "853"},
+            {"93", "89.2", "109"},
+            {"279", "9033", "3092"}
+        };
+
+        // Create a new table instance
+        JTable jt = new JTable(dataValues, columnNames);
+        jt.getModel().addTableModelListener(new TableModelListener() {
+
+            public void tableChanged(TableModelEvent e) {
+                System.err.println("table changed");
+            }
+        });
+        return jt;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JTableInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTableOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JTable } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for JTable
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JTableOverlapping
+ */
+public class JTableOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        // Create columns names
+        String columnNames[] = { "Column 1", "Column 2", "Column 3" };
+
+        // Create some data
+        String dataValues[][] =
+        {
+            { "12", "234", "67" },
+            { "-123", "43", "853" },
+            { "93", "89.2", "109" },
+            { "279", "9033", "3092" },
+            { "12", "234", "67" },
+            { "-123", "43", "853" },
+            { "93", "89.2", "109" },
+            { "279", "9033", "3092" },
+            { "12", "234", "67" },
+            { "-123", "43", "853" },
+            { "93", "89.2", "109" },
+            { "279", "9033", "3092" },
+            { "12", "234", "67" },
+            { "-123", "43", "853" },
+            { "93", "89.2", "109" },
+            { "279", "9033", "3092" }
+        };
+
+        // Create a new table instance
+        return new JTable( dataValues, columnNames );
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JTableOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JTextArea } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JTextAreaInGlassPaneOverlapping
+ */
+public class JTextAreaInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JTextArea ch = new JTextArea();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JTextAreaInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextAreaOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JTextArea } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JTextAreaOverlapping
+ */
+public class JTextAreaOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JTextArea ch = new JTextArea();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JTextAreaOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JTextField } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JTextFieldInGlassPaneOverlapping
+ */
+public class JTextFieldInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JTextField ch = new JTextField();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JTextFieldInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JTextFieldOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dimension;
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JTextField } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JLabel
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JTextFieldOverlapping
+ */
+public class JTextFieldOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JTextField ch = new JTextField();
+        ch.setPreferredSize(new Dimension(50, 50));
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JTextFieldOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonInGlassPaneOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JToggleButton } component in GlassPane.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JToggleButton
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JToggleButtonInGlassPaneOverlapping
+ */
+public class JToggleButtonInGlassPaneOverlapping extends GlassPaneOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JToggleButton ch = new JToggleButton();
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JToggleButtonInGlassPaneOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/JToggleButtonOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.*;
+
+/**
+ * AWT/Swing overlapping test for {@link javax.swing.JToggleButton } component.
+ * <p>See base class for details.
+ */
+/*
+@test
+@summary Simple Overlapping test for javax.swing.JToggleButton
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main JToggleButtonOverlapping
+ */
+public class JToggleButtonOverlapping extends SimpleOverlappingTestBase {
+
+    @Override
+    protected JComponent getSwingComponent() {
+        JToggleButton ch = new JToggleButton();
+        ch.setText("Swing component");
+        return ch;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new JToggleButtonOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingFrameResizing.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import javax.swing.JFrame;
+import javax.swing.SpringLayout;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test.
+ * <p>This test puts heavyweight component into JFrame and verifies that it's being drawn correctly after resizing the frame.
+ * <p>See base class for test info.
+ */
+/*
+@test
+@bug 6777370
+@summary Issues when resizing the JFrame with HW components
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main MixingFrameResizing
+ */
+public class MixingFrameResizing extends OverlappingTestBase {
+
+    {testEmbeddedFrame = true;}
+
+    private JFrame frame = null;
+    private Point lLoc;
+    private Point lLoc2;
+    private Dimension size;
+
+    protected void prepareControls() {
+        if(frame != null) {
+            frame.setVisible(false);
+        }
+        frame = new JFrame("Mixing : Frame Resizing test");
+        frame.setLayout(new SpringLayout());
+        frame.setSize(50, 50);
+        frame.setVisible(true);
+        propagateAWTControls(frame);
+        Util.waitTillShown(frame);
+    }
+
+    @Override
+    protected boolean performTest() {
+        int BORDER_SHIFT = frameBorderCounter();
+        BORDER_SHIFT = Math.abs(BORDER_SHIFT) == 1 ? BORDER_SHIFT : (BORDER_SHIFT / 2);
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    lLoc = frame.getLocationOnScreen();
+                    size = frame.getSize();
+                    lLoc2 = frame.getContentPane().getLocationOnScreen();
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY/2);
+
+        // resize window
+        robot.mouseMove(lLoc.x + size.width / 2 + BORDER_SHIFT, lLoc.y + size.height + BORDER_SHIFT);
+        Util.waitForIdle(robot);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        for (int i = 0; i < 10; i++) {
+            robot.mouseMove(lLoc.x + size.width / 2 + BORDER_SHIFT, lLoc.y + size.height + BORDER_SHIFT + 20 * i);
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        robot.mouseMove(lLoc.x + size.width + BORDER_SHIFT, lLoc.y + size.height + BORDER_SHIFT);
+        Util.waitForIdle(robot);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        for (int i = 0; i < 10; i++) {
+            robot.mouseMove(lLoc.x + size.width + BORDER_SHIFT + 20 * i, lLoc.y + size.height + BORDER_SHIFT);
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        Util.waitForIdle(robot);
+        // check if component is visible on the opened space
+        try {
+            Thread.sleep(300); //some more wait for Solaris (for some reason)
+        }catch(Exception ex) {}
+        lLoc2.translate(75, 75);
+        Color c = robot.getPixelColor(lLoc2.x, lLoc2.y);
+        System.out.println("Actual: "+c+", expected: "+AWT_VERIFY_COLOR);
+
+        if (!c.equals(AWT_VERIFY_COLOR)) {
+            fail("HW component is not visible after resizing");
+        }
+
+        return true;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        if (System.getProperty("os.name").toLowerCase().contains("os x")) {
+            System.out.println("Aqua L&F ignores setting color to component. Test passes on Mac OS X.");
+            return;
+        }
+        instance = new MixingFrameResizing();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/MixingPanelsResizing.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.event.InputEvent;
+import javax.swing.*;
+import java.io.*;
+
+/**
+ * AWT/Swing overlapping test for Panel and JPanel behavior during resizing.
+ * <p>See <a href="https://bugs.openjdk.java.net/browse/JDK-6786219">JDK-6786219</a> for details
+ */
+/*
+@test
+@bug 6786219
+@summary Issues when resizing the frame after mixing of heavy weight & light weight components
+@author sergey.grinev@oracle.com: area=awt.mixing
+@build FrameBorderCounter
+@run main MixingPanelsResizing
+ */
+public class MixingPanelsResizing {
+
+    static volatile boolean failed = false;
+
+    private static JFrame frame;
+    private static JButton jbutton;
+    private static Button awtButton;
+    private static JButton jbutton2;
+    private static Button awtButton2;
+    private static final Color jbColor = Color.RED;
+    private static final Color awtColor = Color.ORANGE;
+    private static final Color jb2Color = Color.BLUE;
+    private static final Color awt2Color = Color.CYAN;
+    private static final int ROBOT_DELAY = 500;
+
+    private static Point lLoc;
+    private static int borderShift;
+
+    private static int frameBorderCounter() {
+        String JAVA_HOME = System.getProperty("java.home");
+        try {
+            Process p = Runtime.getRuntime().exec(JAVA_HOME + "/bin/java FrameBorderCounter");
+            try {
+                p.waitFor();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                throw new RuntimeException(e);
+            }
+            if (p.exitValue() != 0) {
+                throw new RuntimeException("FrameBorderCounter exited with not null code!\n" + readInputStream(p.getErrorStream()));
+            }
+            return Integer.parseInt(readInputStream(p.getInputStream()).trim());
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static String readInputStream(InputStream is) throws IOException {
+        byte[] buffer = new byte[4096];
+        int len = 0;
+        StringBuilder sb = new StringBuilder();
+        try (InputStreamReader isr = new InputStreamReader(is)) {
+            while ((len = is.read(buffer)) > 0) {
+                sb.append(new String(buffer, 0, len));
+            }
+        }
+        return sb.toString();
+    }
+
+    private static void init() throws Exception {
+        //*** Create instructions for the user here ***
+
+        borderShift = frameBorderCounter();
+        borderShift = Math.abs(borderShift) == 1 ? borderShift : (borderShift / 2);
+        String[] instructions = {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                Sysout.createDialog();
+                Sysout.printInstructions(instructions);
+
+                // prepare controls
+
+                frame = new JFrame();
+
+                Panel awtPanel = new Panel();
+                awtPanel.setBackground(Color.GREEN);
+                awtButton = new Button("AWTButton");
+                awtPanel.add(awtButton);
+                awtButton.setForeground(awtColor);
+                awtButton.setBackground(awtColor);
+                jbutton = new JButton("SwingButton");
+                awtPanel.add(jbutton);
+                jbutton.setForeground(jbColor);
+                jbutton.setBackground(jbColor);
+
+                JPanel jPanel = new JPanel();
+                jbutton2 = new JButton("SwingButton2");
+                jPanel.add(jbutton2);
+                jbutton2.setForeground(jb2Color);
+                jbutton2.setBackground(jb2Color);
+                awtButton2 = new Button("AWT Button2");
+                jPanel.add(awtButton2);
+                awtButton2.setForeground(awt2Color);
+                awtButton2.setBackground(awt2Color);
+                jPanel.setBackground(Color.YELLOW);
+
+                frame.add(awtPanel, BorderLayout.SOUTH);
+                frame.add(jPanel, BorderLayout.NORTH);
+
+                frame.pack();
+                frame.setVisible(true);
+            }
+        });
+
+        /////////////////////////
+
+        final Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        Util.waitForIdle(robot);
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                lLoc = frame.getLocationOnScreen();
+                lLoc.translate(frame.getWidth() + borderShift, frame.getHeight() + borderShift);
+            }
+        });
+
+        //grow
+        robot.mouseMove(lLoc.x, lLoc.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+
+        Runnable test = new Runnable() {
+
+            public void run() {
+                Point btnLoc = jbutton.getLocationOnScreen();
+                Color c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5);
+                if (!c.equals(jbColor)) {
+                    fail("JButton was not redrawn properly on AWT Panel during move");
+                }
+
+                btnLoc = awtButton.getLocationOnScreen();
+                c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5);
+                if (!c.equals(awtColor)) {
+                    fail("AWT Button was not redrawn properly on AWT Panel during move");
+                }
+
+                btnLoc = jbutton2.getLocationOnScreen();
+                c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5);
+                if (!c.equals(jb2Color)) {
+                    fail("JButton was not redrawn properly on JPanel during move");
+                }
+
+                btnLoc = awtButton2.getLocationOnScreen();
+                c = robot.getPixelColor(btnLoc.x + 5, btnLoc.y + 5);
+                if (!c.equals(awt2Color)) {
+                    fail("ATW Button was not redrawn properly on JPanel during move");
+                }
+            }
+        };
+
+        for (int i = 0; i < 30; i++) {
+            test.run();
+            robot.mouseMove(lLoc.x + 20 * i, lLoc.y + 10 * i);
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        //back
+        System.out.println("fast back");
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        for (int i = 5; i >= 0; i--) {
+            test.run();
+            robot.mouseMove(lLoc.x + 120 * i, lLoc.y + 60 * i);
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        pass();
+    }//End  init()
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+    private static Thread mainThread = null;
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main(String args[]) throws Exception {
+        if (!Toolkit.getDefaultToolkit().isDynamicLayoutActive()) {
+            System.out.println("Dynamic layout is not active. Test passes.");
+            return;
+        }
+        mainThread = Thread.currentThread();
+        try {
+            init();
+        } catch (TestPassedException e) {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try {
+            Thread.sleep(sleepTime);
+            //Timed out, so fail the test
+            throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds");
+        } catch (InterruptedException e) {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if (!testGeneratedInterrupt) {
+                throw e;
+            }
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if (theTestPassed == false) {
+                throw new RuntimeException(failureMessage);
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo(int seconds) {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass() {
+        Sysout.println("The test passed.");
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //first check if this is executing in main thread
+        if (mainThread == Thread.currentThread()) {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail() {
+        //test writer didn't specify why test failed, so give generic
+        fail("it just plain failed! :-)");
+    }
+
+    public static synchronized void fail(String whyFailed) {
+        Sysout.println("The test failed: " + whyFailed);
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //check if this called from main thread
+        if (mainThread == Thread.currentThread()) {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException(whyFailed);
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+}// class JButtonInGlassPane
+class TestPassedException extends RuntimeException {
+}
+
+//*********** End Standard Test Machinery Section **********
+//************ Begin classes defined for the test ****************
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+{
+static int newVar = 0;
+
+public void eventDispatched(AWTEvent e)
+{
+//Counting events to see if we get enough
+eventCount++;
+
+if( eventCount == 20 )
+{
+//got enough events, so pass
+
+JButtonInGlassPane.pass();
+}
+else if( tries == 20 )
+{
+//tried too many times without getting enough events so fail
+
+JButtonInGlassPane.fail();
+}
+
+}// eventDispatched()
+
+}// NewClass class
+
+ */
+//************** End classes defined for the test *******************
+/****************************************************
+Standard Test Machinery
+DO NOT modify anything below -- it's a standard
+chunk of code whose purpose is to make user
+interaction uniform, and thereby make it simpler
+to read and understand someone else's test.
+ ****************************************************/
+/**
+This is part of the standard test machinery.
+It creates a dialog (with the instructions), and is the interface
+for sending text messages to the user.
+To print the instructions, send an array of strings to Sysout.createDialog
+WithInstructions method.  Put one line of instructions per array entry.
+To display a message for the tester to see, simply call Sysout.println
+with the string to be displayed.
+This mimics System.out.println but works within the test harness as well
+as standalone.
+ */
+class Sysout {
+
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+        System.out.println(messageIn);
+    }
+}// Sysout  class
+
+/**
+This is part of the standard test machinery.  It provides a place for the
+test instructions to be displayed, and a place for interactive messages
+to the user to be displayed.
+To have the test instructions displayed, see Sysout.
+To have a message to the user be displayed, see Sysout.
+Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog {
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) {
+                        posOfSpace = maxStringLength - 1;
+                    }
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                } //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+        System.out.println(messageIn);
+    }
+}// TestDialog  class
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import com.sun.awt.AWTUtilities;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.JButton;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test for opaque Swing components.
+ * <p>This test verify if AWT components are drawn correctly under opaque components.
+ * <p>See <a href="https://bugs.openjdk.java.net/browse/JDK-6776743">JDK-6776743</a> for details
+ * <p>See base class for test info.
+ */
+/*
+@test
+@bug 6776743
+@summary Opaque overlapping test for each AWT component
+@run main OpaqueOverlapping
+ */
+public class OpaqueOverlapping extends OverlappingTestBase {
+
+    {
+        useClickValidation = false;
+        failMessage = "Opacity test mismatchs";
+
+        // CR 6994264 (Choice autohides dropdown on Solaris 10)
+        skipClassNames = new String[] { "Choice" };
+    }
+    private String testSeq;
+    private final static String checkSeq = "010000101";
+    private Point heavyLoc;
+    private JButton light;
+    private Frame frame = null;
+
+    protected void prepareControls() {
+        testSeq = "";
+        // Create components
+        if(frame != null) {
+            frame.setVisible(false);
+        }
+        frame = new Frame("OpaqueOverlapping mixing test");
+        final Panel panel = new Panel();
+        panel.setLayout(null);
+
+        propagateAWTControls(panel);
+
+        // Overlap the buttons
+        currentAwtControl.setBounds(30, 30, 200, 200);
+
+        light = new JButton("  LW Button  ");
+        light.setBounds(10, 10, 50, 50);
+
+        // Put the components into the frame
+        panel.add(light);
+        frame.add(panel);
+        frame.setBounds(50, 50, 400, 400);
+        frame.setVisible(true);
+
+        currentAwtControl.addMouseListener(new MouseAdapter() {
+            @Override
+            public void mouseClicked(MouseEvent e) {
+                panel.setComponentZOrder(light, 0);
+                frame.validate();
+                testSeq = testSeq + "0";
+            }
+        });
+        light.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent e) {
+                panel.setComponentZOrder(currentAwtControl, 0);
+                frame.validate();
+                testSeq = testSeq + "1";
+            }
+        });
+    }
+
+    @Override
+    protected boolean performTest() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    heavyLoc = currentAwtControl.getLocationOnScreen();
+                }
+            });
+        } catch (Exception e) {
+        }
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        Util.waitForIdle(robot);
+
+        // Move the mouse pointer to the position where both
+        //    components overlap
+        robot.mouseMove(heavyLoc.x + 5, heavyLoc.y + 5);
+
+        // Now perform the click at this point for 9 times
+        // In the middle of the process toggle the opaque
+        // flag value.
+        for (int i = 0; i < 9; ++i) {
+            if (i == 3) {
+                AWTUtilities.setComponentMixingCutoutShape(light,
+                        new Rectangle());
+            }
+            if (i == 6) {
+                AWTUtilities.setComponentMixingCutoutShape(light,
+                        null);
+            }
+
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            Util.waitForIdle(robot);
+
+            if (currentAwtControl.getClass() == java.awt.Choice.class && i != 1 && i != 6 && i != 8) {
+                // due to the fact that Choice doesn't get mouseClicked event if its dropdown is shown
+                robot.mousePress(InputEvent.BUTTON1_MASK);
+                robot.mouseRelease(InputEvent.BUTTON1_MASK);
+                Util.waitForIdle(robot);
+            }
+        }
+
+        Util.waitForIdle(robot);
+
+        boolean result = testSeq.equals(checkSeq);
+        if (!result) {
+            System.err.println("Expected: " + checkSeq);
+            System.err.println("Observed: " + testSeq);
+        }
+        return result;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new OpaqueOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OpaqueOverlappingChoice.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/**
+ * AWT/Swing overlapping test for opaque Choice.
+ *
+ * This test case was separated from {@link OpaqueOverlapping} due to CR 6994264 (Choice autohides dropdown on Solaris 10)
+ */
+/*
+@test
+@bug 6994264
+@summary Opaque overlapping test for Choice AWT component
+@run main OpaqueOverlappingChoice
+ */
+public class OpaqueOverlappingChoice extends OpaqueOverlapping  {
+    {
+        onlyClassName = "Choice";
+        skipClassNames = null;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new OpaqueOverlappingChoice();
+        OverlappingTestBase.doMain(args);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/OverlappingTestBase.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,800 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.peer.ComponentPeer;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import javax.swing.*;
+import sun.awt.*;
+import java.io.*;
+
+/**
+ * <p>This class provides basis for AWT Mixing testing.
+ * <p>It provides all standard test machinery and should be used by
+ * extending and overriding next methods:
+ * <li> {@link OverlappingTestBase#prepareControls()} - setup UI components
+ * <li> {@link OverlappingTestBase#performTest()} -  run particular test
+ * Those methods would be run in the loop for each AWT component.
+ * <p>Current AWT component should be added to the tested UI by {@link OverlappingTestBase#propagateAWTControls(java.awt.Container) ()}.
+ * There AWT components are prepared to be tested as being overlayed by other (e.g. Swing) components - they are colored to
+ * {@link OverlappingTestBase#AWT_BACKGROUND_COLOR} and throws failure on catching mouse event.
+ * <p> Validation of component being overlayed should be tested by {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) }
+ * See each method javadoc for more details.
+ *
+ * <p>Due to test machinery limitations all test should be run from their own main() by calling next coe
+ * <code>
+ *     public static void main(String args[]) throws InterruptedException {
+ *        instance = new YourTestInstance();
+ *        OverlappingTestBase.doMain(args);
+ *     }
+ * </code>
+ *
+ * @author Sergey Grinev
+ */
+public abstract class OverlappingTestBase {
+    // working variables
+    private static volatile boolean wasHWClicked = false;
+    private static volatile boolean passed = true;
+    // constants
+    /**
+     * Default color for AWT component used for validate correct drawing of overlapping. <b>Never</b> use it for lightweight components.
+     */
+    protected static final Color AWT_BACKGROUND_COLOR = new Color(21, 244, 54);
+    protected static Color AWT_VERIFY_COLOR = AWT_BACKGROUND_COLOR;
+    protected static final int ROBOT_DELAY = 500;
+    private static final String[] simpleAwtControls = {"Button", "Checkbox", "Label", "TextArea"};
+    /**
+     * Generic strings array. To be used for population of List based controls.
+     */
+    protected static final String[] petStrings = {"Bird", "Cat", "Dog", "Rabbit", "Rhynocephalia Granda", "Bear", "Tiger", "Mustang"};
+    // "properties"
+    /**
+     * Tests customization. Set this variable to test only control from java.awt
+     * <p>Usage of this variable should be marked with CR being the reason.
+     * <p>Do not use this variable simultaneously with {@link OverlappingTestBase#skipClassNames}
+     */
+    protected String onlyClassName = null;
+    /**
+     * For customizing tests. List classes' simple names to skip them from testings.
+     * <p>Usage of this variable should be marked with CR being the reason.
+     */
+    protected String[] skipClassNames = null;
+    /**
+     * Set to false to avoid event delivery validation
+     * @see OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point, boolean)
+     */
+    protected boolean useClickValidation = true;
+    /**
+     * Set to false if test doesn't supposed to verify EmbeddedFrame
+     */
+    protected boolean testEmbeddedFrame = false;
+    /**
+     * Set this variable to true if testing embedded frame is impossible (on Mac, for instance, for now).
+     * The testEmbeddedFrame is explicitly set to true in dozen places.
+     */
+    protected boolean skipTestingEmbeddedFrame = false;
+
+    public static final boolean isMac = System.getProperty("os.name").toLowerCase().contains("os x");
+    private boolean isFrameBorderCalculated;
+    private int borderShift;
+
+    {    if (Toolkit.getDefaultToolkit().getClass().getName().matches(".*L.*Toolkit")) {
+             // No EmbeddedFrame in LWToolkit/LWCToolkit, yet
+             // And it should be programmed some other way, too, in any case
+             System.err.println("skipTestingEmbeddedFrame");
+             skipTestingEmbeddedFrame = true;
+         }else {
+             System.err.println("do not skipTestingEmbeddedFrame");
+         }
+    }
+
+    protected int frameBorderCounter() {
+        if (!isFrameBorderCalculated) {
+            try {
+                new FrameBorderCounter(); // force compilation by jtreg
+                String JAVA_HOME = System.getProperty("java.home");
+                Process p = Runtime.getRuntime().exec(JAVA_HOME + "/bin/java FrameBorderCounter");
+                try {
+                    p.waitFor();
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                    throw new RuntimeException(e);
+                }
+                if (p.exitValue() != 0) {
+                    throw new RuntimeException("FrameBorderCounter exited with not null code!\n" + readInputStream(p.getErrorStream()));
+                }
+                borderShift = Integer.parseInt(readInputStream(p.getInputStream()).trim());
+                isFrameBorderCalculated = true;
+            } catch (IOException e) {
+                e.printStackTrace();
+                System.exit(1);
+            }
+        }
+        return borderShift;
+    }
+
+    public void getVerifyColor() {
+        try {
+            final int size = 200;
+            final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+            final Point[] p = new Point[1];
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run(){
+                    JFrame frame = new JFrame("set back");
+                    frame.getContentPane().setBackground(AWT_BACKGROUND_COLOR);
+                    frame.setSize(size, size);
+                    frame.setUndecorated(true);
+                    frame.setVisible(true);
+                    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+                    p[0] = frame.getLocation();
+                }
+            });
+            Robot robot = new Robot();
+            toolkit.realSync();
+            Thread.sleep(ROBOT_DELAY);
+            AWT_VERIFY_COLOR = robot.getPixelColor(p[0].x+size/2, p[0].y+size/2);
+            System.out.println("Color will be compared with " + AWT_VERIFY_COLOR + " instead of " + AWT_BACKGROUND_COLOR);
+        } catch (Exception e) {
+            System.err.println("Cannot get verify color: "+e.getMessage());
+        }
+    }
+
+    private String readInputStream(InputStream is) throws IOException {
+        byte[] buffer = new byte[4096];
+        int len = 0;
+        StringBuilder sb = new StringBuilder();
+        try (InputStreamReader isr = new InputStreamReader(is)) {
+            while ((len = is.read(buffer)) > 0) {
+                sb.append(new String(buffer, 0, len));
+            }
+        }
+        return sb.toString();
+    }
+
+    private void setupControl(final Component control) {
+        if (useClickValidation) {
+            control.addMouseListener(new MouseAdapter() {
+                @Override
+                public void mouseClicked(MouseEvent e) {
+                    System.err.println("ERROR: " + control.getClass() + " received mouse click.");
+                    wasHWClicked = true;
+                }
+            });
+        }
+        control.setBackground(AWT_BACKGROUND_COLOR);
+        control.setForeground(AWT_BACKGROUND_COLOR);
+        control.setPreferredSize(new Dimension(150, 150));
+        control.setFocusable(false);
+    }
+
+    private void addAwtControl(java.util.List<Component> container, final Component control) {
+        String simpleName = control.getClass().getSimpleName();
+        if (onlyClassName != null && !simpleName.equals(onlyClassName)) {
+            return;
+        }
+        if (skipClassNames != null) {
+            for (String skipMe : skipClassNames) {
+                if (simpleName.equals(skipMe)) {
+                    return;
+                }
+            }
+        }
+        setupControl(control);
+        container.add(control);
+    }
+
+    private void addSimpleAwtControl(java.util.List<Component> container, String className) {
+        try {
+            Class definition = Class.forName("java.awt." + className);
+            Constructor constructor = definition.getConstructor(new Class[]{String.class});
+            java.awt.Component component = (java.awt.Component) constructor.newInstance(new Object[]{"AWT Component " + className});
+            addAwtControl(container, component);
+        } catch (Exception ex) {
+            System.err.println(ex.getMessage());
+            fail("Setup error, this jdk doesn't have awt conrol " + className);
+        }
+    }
+
+    /**
+     * Adds current AWT control to container
+     * <p>N.B.: if testEmbeddedFrame == true this method will also add EmbeddedFrame over Canvas
+     * and it should be called <b>after</b> Frame.setVisible(true) call
+     * @param container container to hold AWT component
+     */
+    protected final void propagateAWTControls(Container container) {
+        if (currentAwtControl != null) {
+            container.add(currentAwtControl);
+        } else { // embedded frame
+            try {
+
+                //create embedder
+                Canvas embedder = new Canvas();
+                embedder.setBackground(Color.RED);
+                embedder.setPreferredSize(new Dimension(150, 150));
+                container.add(embedder);
+                container.setVisible(true); // create peer
+
+                long frameWindow = 0;
+                String getWindowMethodName = "getHWnd";
+                if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) {
+                    getWindowMethodName = "getWindow";
+                }
+                ComponentPeer peer = embedder.getPeer();
+//                System.err.println("Peer: " + peer);
+                Method getWindowMethod = peer.getClass().getMethod(getWindowMethodName);
+                frameWindow = (Long) getWindowMethod.invoke(peer);
+//                System.err.println("frame peer ID: " + frameWindow);
+
+                String eframeClassName = "sun.awt.windows.WEmbeddedFrame";
+                if (Toolkit.getDefaultToolkit().getClass().getName().contains("XToolkit")) {
+                    eframeClassName = "sun.awt.X11.XEmbeddedFrame";
+                }
+                Class eframeClass = Class.forName(eframeClassName);
+                Constructor eframeCtor = eframeClass.getConstructor(long.class);
+                EmbeddedFrame eframe = (EmbeddedFrame) eframeCtor.newInstance(frameWindow);
+                setupControl(eframe);
+                eframe.setSize(new Dimension(150, 150));
+                eframe.setVisible(true);
+//                System.err.println(eframe.getSize());
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                fail("Failed to instantiate EmbeddedFrame: " + ex.getMessage());
+            }
+        }
+    }
+    private static final Font hugeFont = new Font("Arial", Font.BOLD, 70);
+
+    private java.util.List<Component> getAWTControls() {
+        java.util.List<Component> components = new ArrayList<Component>();
+
+        for (String clazz : simpleAwtControls) {
+            addSimpleAwtControl(components, clazz);
+        }
+
+        TextField tf = new TextField();
+        tf.setFont(hugeFont);
+        addAwtControl(components, tf);
+
+        // more complex controls
+        Choice c = new Choice();
+        for (int i = 0; i < petStrings.length; i++) {
+            c.add(petStrings[i]);
+        }
+        addAwtControl(components, c);
+        c.setPreferredSize(null);
+        c.setFont(hugeFont); // to make control bigger as setPrefferedSize don't do his job here
+
+        List l = new List(petStrings.length);
+        for (int i = 0; i < petStrings.length; i++) {
+            l.add(petStrings[i]);
+        }
+        addAwtControl(components, l);
+
+        Canvas canvas = new Canvas();
+        canvas.setSize(100, 200);
+        addAwtControl(components, canvas);
+
+        Scrollbar sb = new Scrollbar(Scrollbar.VERTICAL, 500, 1, 0, 500);
+        addAwtControl(components, sb);
+
+        Scrollbar sb2 = new Scrollbar(Scrollbar.HORIZONTAL, 500, 1, 0, 500);
+        addAwtControl(components, sb2);
+
+        return components;
+    }
+    /**
+     * Default shift for {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) }
+     */
+    protected static Point shift = new Point(16, 16);
+
+    /**
+     * Verifies point using specified AWT Robot. Supposes <code>defaultShift == true</code> for {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point, boolean) }.
+     * This method is used to verify controls by providing just their plain screen coordinates.
+     * @param robot AWT Robot. Usually created by {@link Util#createRobot() }
+     * @param lLoc point to verify
+     * @see OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point, boolean)
+     */
+    protected void clickAndBlink(Robot robot, Point lLoc) {
+        clickAndBlink(robot, lLoc, true);
+    }
+    /**
+     * Default failure message for color check
+     * @see OverlappingTestBase#performTest()
+     */
+    protected String failMessageColorCheck = "The LW component did not pass pixel color check and is overlapped";
+    /**
+     * Default failure message event check
+     * @see OverlappingTestBase#performTest()
+     */
+    protected String failMessage = "The LW component did not received the click.";
+
+    private static boolean isValidForPixelCheck(Component component) {
+        if ((component instanceof java.awt.Scrollbar) || isMac && (component instanceof java.awt.Button)) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Preliminary validation - should be run <b>before</b> overlapping happens to ensure test is correct.
+     * @param robot AWT Robot. Usually created by {@link Util#createRobot() }
+     * @param lLoc point to validate to be <b>of</b> {@link OverlappingTestBase#AWT_BACKGROUND_COLOR}
+     * @param component tested component, should be pointed out as not all components are valid for pixel check.
+     */
+    protected void pixelPreCheck(Robot robot, Point lLoc, Component component) {
+        if (isValidForPixelCheck(component)) {
+            int tries = 10;
+            Color c = null;
+            while (tries-- > 0) {
+                c = robot.getPixelColor(lLoc.x, lLoc.y);
+                System.out.println("Precheck. color: "+c+" compare with "+AWT_VERIFY_COLOR);
+                if (c.equals(AWT_VERIFY_COLOR)) {
+                    return;
+                }
+                try {
+                    Thread.sleep(100);
+                } catch (InterruptedException e) {
+                }
+            }
+            System.err.println(lLoc + ": " + c);
+            fail("Dropdown test setup failure, colored part of AWT component is not located at click area");
+        }
+    }
+
+    /**
+     * Verifies point using specified AWT Robot.
+     * <p>Firstly, verifies point by color pixel check
+     * <p>Secondly, verifies event delivery by mouse click
+     * @param robot AWT Robot. Usually created by {@link Util#createRobot() }
+     * @param lLoc point to verify
+     * @param defaultShift if true verified position will be shifted by {@link OverlappingTestBase#shift }.
+     */
+    protected void clickAndBlink(Robot robot, Point lLoc, boolean defaultShift) {
+        Point loc = lLoc.getLocation();
+        //check color
+        Util.waitForIdle(robot);
+        try{
+            Thread.sleep(500);
+        }catch(Exception exx){
+            exx.printStackTrace();
+        }
+
+        if (defaultShift) {
+            loc.translate(shift.x, shift.y);
+        }
+        if (!(System.getProperty("os.name").toLowerCase().contains("os x"))) {
+            Color c = robot.getPixelColor(loc.x, loc.y);
+            System.out.println("C&B. color: "+c+" compare with "+AWT_VERIFY_COLOR);
+            if (c.equals(AWT_VERIFY_COLOR)) {
+                fail(failMessageColorCheck);
+                passed = false;
+            }
+
+            // perform click
+            Util.waitForIdle(robot);
+        }
+
+        robot.mouseMove(loc.x, loc.y);
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        Util.waitForIdle(robot);
+    }
+
+    /**
+     * This method should be overriden with code which setups UI for testing.
+     * Code in this method <b>will</b> be called only from AWT thread so Swing operations can be called directly.
+     *
+     * @see {@link OverlappingTestBase#propagateAWTControls(java.awt.Container) } for instructions about adding tested AWT control to UI
+     */
+    protected abstract void prepareControls();
+
+    /**
+     * This method should be overriden with test execution. It will <b>not</b> be called from AWT thread so all Swing operations should be treated accordingly.
+     * @return true if test passed. Otherwise fail with default fail message.
+     * @see {@link OverlappingTestBase#failMessage} default fail message
+     */
+    protected abstract boolean performTest();
+    /**
+     * This method can be overriden with cleanup routines. It will be called from AWT thread so all Swing operations should be treated accordingly.
+     */
+    protected void cleanup() {
+        // intentionally do nothing
+    }
+    /**
+     * Currect tested AWT Control. Usually shouldn't be accessed directly.
+     *
+     * @see {@link OverlappingTestBase#propagateAWTControls(java.awt.Container) } for instructions about adding tested AWT control to UI
+     */
+    protected Component currentAwtControl;
+
+    private void testComponent(Component component) throws InterruptedException, InvocationTargetException {
+        currentAwtControl = component;
+        System.out.println("Testing " + currentAwtControl.getClass().getSimpleName());
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                prepareControls();
+            }
+        });
+        if (component != null) {
+            Util.waitTillShown(component);
+        }
+        Util.waitForIdle(null);
+        try {
+            Thread.sleep(500); // wait for graphic effects on systems like Win7
+        } catch (InterruptedException ex) {
+        }
+        if (!instance.performTest()) {
+            fail(failMessage);
+            passed = false;
+        }
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                cleanup();
+            }
+        });
+    }
+
+    private void testEmbeddedFrame() throws InvocationTargetException, InterruptedException {
+        System.out.println("Testing EmbeddedFrame");
+        currentAwtControl = null;
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                prepareControls();
+            }
+        });
+        Util.waitForIdle(null);
+        try {
+            Thread.sleep(500); // wait for graphic effects on systems like Win7
+        } catch (InterruptedException ex) {
+        }
+        if (!instance.performTest()) {
+            fail(failMessage);
+            passed = false;
+        }
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                cleanup();
+            }
+        });
+    }
+
+    private void testAwtControls() throws InterruptedException {
+        try {
+            for (Component component : getAWTControls()) {
+                testComponent(component);
+            }
+            if (testEmbeddedFrame && !skipTestingEmbeddedFrame) {
+                testEmbeddedFrame();
+            }
+        } catch (InvocationTargetException ex) {
+            ex.printStackTrace();
+            fail(ex.getMessage());
+        }
+    }
+    /**
+     * Used by standard test machinery. See usage at {@link OverlappingTestBase }
+     */
+    protected static OverlappingTestBase instance;
+
+    protected OverlappingTestBase() {
+        getVerifyColor();
+    }
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static void init() throws InterruptedException {
+        //*** Create instructions for the user here ***
+        //System.setProperty("sun.awt.disableMixing", "true");
+
+        String[] instructions = {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog();
+        Sysout.printInstructions(instructions);
+
+        instance.testAwtControls();
+
+        if (wasHWClicked) {
+            fail("HW component received the click.");
+            passed = false;
+        }
+        if (passed) {
+            pass();
+        }
+    }//End  init()
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+    private static Thread mainThread = null;
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    /**
+     * Starting point for test runs. See usage at {@link OverlappingTestBase }
+     * @param args regular main args, not used.
+     * @throws InterruptedException
+     */
+    public static void doMain(String args[]) throws InterruptedException {
+        mainThread = Thread.currentThread();
+        try {
+            init();
+        } catch (TestPassedException e) {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try {
+            Thread.sleep(sleepTime);
+            //Timed out, so fail the test
+            throw new RuntimeException("Timed out after " + sleepTime / 1000 + " seconds");
+        } catch (InterruptedException e) {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if (!testGeneratedInterrupt) {
+                throw e;
+            }
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if (theTestPassed == false) {
+                throw new RuntimeException(failureMessage);
+            }
+        }
+
+    }//main
+
+    /**
+     * Test will fail if not passed after this timeout. Default timeout is 300 seconds.
+     * @param seconds timeout in seconds
+     */
+    public static synchronized void setTimeoutTo(int seconds) {
+        sleepTime = seconds * 1000;
+    }
+
+    /**
+     * Set test as passed. Usually shoudn't be called directly.
+     */
+    public static synchronized void pass() {
+        Sysout.println("The test passed.");
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //first check if this is executing in main thread
+        if (mainThread == Thread.currentThread()) {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    /**
+     * Fail test generic message.
+     */
+    public static synchronized void fail() {
+        //test writer didn't specify why test failed, so give generic
+        fail("it just plain failed! :-)");
+    }
+
+    /**
+     * Fail test providing specific reason.
+     * @param whyFailed reason
+     */
+    public static synchronized void fail(String whyFailed) {
+        Sysout.println("The test failed: " + whyFailed);
+        Sysout.println("The test is over, hit  Ctl-C to stop Java VM");
+        //check if this called from main thread
+        if (mainThread == Thread.currentThread()) {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException(whyFailed);
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+}// class LWComboBox
+class TestPassedException extends RuntimeException {
+}
+
+//*********** End Standard Test Machinery Section **********
+//************ Begin classes defined for the test ****************
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+{
+static int newVar = 0;
+
+public void eventDispatched(AWTEvent e)
+{
+//Counting events to see if we get enough
+eventCount++;
+
+if( eventCount == 20 )
+{
+//got enough events, so pass
+
+LWComboBox.pass();
+}
+else if( tries == 20 )
+{
+//tried too many times without getting enough events so fail
+
+LWComboBox.fail();
+}
+
+}// eventDispatched()
+
+}// NewClass class
+
+ */
+//************** End classes defined for the test *******************
+/****************************************************
+Standard Test Machinery
+DO NOT modify anything below -- it's a standard
+chunk of code whose purpose is to make user
+interaction uniform, and thereby make it simpler
+to read and understand someone else's test.
+ ****************************************************/
+/**
+This is part of the standard test machinery.
+It creates a dialog (with the instructions), and is the interface
+for sending text messages to the user.
+To print the instructions, send an array of strings to Sysout.createDialog
+WithInstructions method.  Put one line of instructions per array entry.
+To display a message for the tester to see, simply call Sysout.println
+with the string to be displayed.
+This mimics System.out.println but works within the test harness as well
+as standalone.
+ */
+class Sysout {
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions(String[] instructions) {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        dialog.printInstructions(instructions);
+        //dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void createDialog() {
+        dialog = new TestDialog(new Frame(), "Instructions");
+        String[] defInstr = {"Instructions will appear here. ", ""};
+        dialog.printInstructions(defInstr);
+        //dialog.setVisible(true);
+        println("Any messages for the tester will display here.");
+    }
+
+    public static void printInstructions(String[] instructions) {
+        dialog.printInstructions(instructions);
+    }
+
+    public static void println(String messageIn) {
+        dialog.displayMessage(messageIn);
+        System.out.println(messageIn);
+    }
+}// Sysout  class
+
+/**
+This is part of the standard test machinery.  It provides a place for the
+test instructions to be displayed, and a place for interactive messages
+to the user to be displayed.
+To have the test instructions displayed, see Sysout.
+To have a message to the user be displayed, see Sysout.
+Do not call anything in this dialog directly.
+ */
+class TestDialog extends Dialog {
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog(Frame frame, String name) {
+        super(frame, name);
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
+        add("North", instructionsText);
+
+        messageText = new TextArea("", 5, maxStringLength, scrollBoth);
+        add("Center", messageText);
+
+        pack();
+
+       //setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions(String[] instructions) {
+        //Clear out any current instructions
+        instructionsText.setText("");
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for (int i = 0; i < instructions.length; i++) {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[i];
+            while (remainingStr.length() > 0) {
+                //if longer than max then chop off first max chars to print
+                if (remainingStr.length() >= maxStringLength) {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1);
+
+                    if (posOfSpace <= 0) {
+                        posOfSpace = maxStringLength - 1;
+                    }
+
+                    printStr = remainingStr.substring(0, posOfSpace + 1);
+                    remainingStr = remainingStr.substring(posOfSpace + 1);
+                } //else just print
+                else {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append(printStr + "\n");
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage(String messageIn) {
+        messageText.append(messageIn + "\n");
+        System.out.println(messageIn);
+    }
+}// TestDialog  class
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * Base class for testing overlapping of Swing and AWT component put into one frame.
+ * Validates drawing and event delivery at the components intersection.
+ * <p> See base class for usage
+ *
+ * @author Sergey Grinev
+*/
+public abstract class SimpleOverlappingTestBase extends OverlappingTestBase {
+
+    {
+        testEmbeddedFrame = true;
+    }
+
+    /**
+     * Event delivery validation. If set to true (default) tested lightweight component will be provided
+     * with mouse listener which should be called in order for test to pass.
+     */
+    protected final boolean useDefaultClickValidation;
+
+    /**
+     * Constructor which sets {@link SimpleOverlappingTestBase#useDefaultClickValidation }
+     * @param defaultClickValidation
+     */
+    protected SimpleOverlappingTestBase(boolean defaultClickValidation) {
+        super();
+        this.useDefaultClickValidation = defaultClickValidation;
+    }
+
+    public SimpleOverlappingTestBase() {
+        this(true);
+    }
+
+    //overridables
+    /**
+     * Successors override this method providing swing component for testing
+     * @return swing component to test
+     */
+    protected abstract JComponent getSwingComponent();
+
+    /**
+     * For tests debugging. Please, ignore.
+     */
+    protected static final boolean debug = false;
+
+    /**
+     * Should be set to true if test isn't using {@link SimpleOverlappingTestBase#useDefaultClickValidation }
+     */
+    protected volatile boolean wasLWClicked = false;
+
+    /**
+     * Current tested lightweight component
+     * @see SimpleOverlappingTestBase#getSwingComponent()
+     */
+    protected JComponent testedComponent;
+
+    /**
+     * Setups simple frame with lightweight component returned by {@link SimpleOverlappingTestBase#getSwingComponent() }
+     * Called by base class.
+     */
+    protected void prepareControls() {
+        wasLWClicked = false;
+
+        final JFrame f = new JFrame("Mixing : Simple Overlapping test");
+        f.setLayout(new SpringLayout());
+        f.setSize(200, 200);
+
+        testedComponent = getSwingComponent();
+
+        if (useDefaultClickValidation) {
+            testedComponent.addMouseListener(new MouseAdapter() {
+
+                @Override
+                public void mouseClicked(MouseEvent e) {
+                    wasLWClicked = true;
+                    f.setVisible(false);
+                }
+            });
+        }
+
+        if (!debug) {
+            f.add(testedComponent);
+        } else {
+            System.err.println("Warning: DEBUG MODE");
+        }
+
+        propagateAWTControls(f);
+
+        f.setVisible(true);
+    }
+
+    /**
+     * AWT Robot instance. Shouldn't be used in most cases.
+     */
+    protected Robot robot;
+
+    /**
+     * Run test by {@link OverlappingTestBase#clickAndBlink(java.awt.Robot, java.awt.Point) } validation for current lightweight component.
+     * <p>Called by base class.
+     * @return true if test passed
+     */
+    protected boolean performTest() {
+        testedComponent.requestFocus();
+
+        // run robot
+        robot = Util.createRobot();
+        robot.setAutoDelay(20);
+
+        // get coord
+        Point lLoc = !debug ? testedComponent.getLocationOnScreen() : new Point(70, 30);
+        Util.waitForIdle(null);
+        /* this is a workaround for certain jtreg(?) focus issue:
+           tests fail starting after failing mixing tests but always pass alone.
+         */
+        JFrame ancestor = (JFrame)(testedComponent.getTopLevelAncestor());
+        if( ancestor != null ) {
+            Point ancestorLoc = ancestor.getLocationOnScreen();
+            ancestorLoc.translate(ancestor.getWidth()/2-15, 2);
+            robot.mouseMove(ancestorLoc.x, ancestorLoc.y);
+            Util.waitForIdle(robot);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(50);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            Util.waitForIdle(robot);
+        }
+
+        clickAndBlink(robot, lLoc);
+        Util.waitForIdle(null);
+
+        return wasLWClicked;
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/Util.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,601 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Component;
+import java.awt.Frame;
+import java.awt.Dialog;
+import java.awt.Window;
+import java.awt.Button;
+import java.awt.Point;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.IllegalComponentStateException;
+import java.awt.AWTException;
+import java.awt.AWTEvent;
+
+import java.awt.event.InputEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.event.ActionEvent;
+import java.awt.event.FocusEvent;
+import java.awt.event.WindowListener;
+import java.awt.event.WindowFocusListener;
+import java.awt.event.FocusListener;
+import java.awt.event.ActionListener;
+
+import java.awt.peer.FramePeer;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * <p>This class contains utilities useful for regression testing.
+ * <p>When using jtreg you would include this class into the build
+ * list via something like:
+ * <pre>
+     &amp;library ../../../../share/lib/AWT_Mixing/src/regtesthelpers/
+     &amp;build Util
+     &amp;run main YourTest
+   </pre>
+ * Note that if you are about to create a test based on
+ * Applet-template, then put those lines into html-file, not in java-file.
+ * <p> And put an
+ * import regtesthelpers.Util;
+ * into the java source of test.
+*/
+public final class Util {
+    private Util() {} // this is a helper class with static methods :)
+
+    /*
+     * @throws RuntimeException when creation failed
+     */
+    public static Robot createRobot() {
+        try {
+            return new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+    }
+
+    public static Frame createEmbeddedFrame(final Frame embedder)
+        throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException,
+               InstantiationException, InvocationTargetException
+    {
+        Toolkit tk = Toolkit.getDefaultToolkit();
+        FramePeer frame_peer = (FramePeer) embedder.getPeer();
+        System.out.println("frame's peer = " + frame_peer);
+        if ("sun.awt.windows.WToolkit".equals(tk.getClass().getName())) {
+            Class comp_peer_class =
+                Class.forName("sun.awt.windows.WComponentPeer");
+            System.out.println("comp peer class = " + comp_peer_class);
+            Field hwnd_field = comp_peer_class.getDeclaredField("hwnd");
+            hwnd_field.setAccessible(true);
+            System.out.println("hwnd_field =" + hwnd_field);
+            long hwnd = hwnd_field.getLong(frame_peer);
+            System.out.println("hwnd = " + hwnd);
+
+            Class clazz = Class.forName("sun.awt.windows.WEmbeddedFrame");
+            Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE});
+            return (Frame) constructor.newInstance (new Object[] {hwnd});
+        } else if ("sun.awt.X11.XToolkit".equals(tk.getClass().getName())) {
+            Class x_base_window_class = Class.forName("sun.awt.X11.XBaseWindow");
+            System.out.println("x_base_window_class = " + x_base_window_class);
+            Method get_window = x_base_window_class.getMethod("getWindow", new Class[0]);
+            System.out.println("get_window = " + get_window);
+            long window = (Long) get_window.invoke(frame_peer, new Object[0]);
+            System.out.println("window = " + window);
+            Class clazz = Class.forName("sun.awt.X11.XEmbeddedFrame");
+            Constructor constructor = clazz.getConstructor (new Class [] {Long.TYPE, Boolean.TYPE});
+            return (Frame) constructor.newInstance (new Object[] {window, true});
+        }
+
+        throw new RuntimeException("Unexpected toolkit - " + tk);
+    }
+
+    /**
+     * Makes the window visible and waits until it's shown.
+     */
+    public static void showWindowWait(Window win) {
+        win.setVisible(true);
+        waitTillShown(win);
+    }
+
+    /**
+     * Moves mouse pointer in the center of given {@code comp} component
+     * using {@code robot} parameter.
+     */
+    public static void pointOnComp(final Component comp, final Robot robot) {
+        Rectangle bounds = new Rectangle(comp.getLocationOnScreen(), comp.getSize());
+        robot.mouseMove(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
+    }
+
+    /**
+     * Moves mouse pointer in the center of a given {@code comp} component
+     * and performs a left mouse button click using the {@code robot} parameter
+     * with the {@code delay} delay between press and release.
+     */
+    public static void clickOnComp(final Component comp, final Robot robot, int delay) {
+        pointOnComp(comp, robot);
+        robot.delay(delay);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.delay(delay);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+    }
+
+    /**
+     * Moves mouse pointer in the center of a given {@code comp} component
+     * and performs a left mouse button click using the {@code robot} parameter
+     * with the default delay between press and release.
+     */
+    public static void clickOnComp(final Component comp, final Robot robot) {
+        clickOnComp(comp, robot, 50);
+    }
+
+    /*
+     * Clicks on a title of Frame/Dialog.
+     * WARNING: it may fail on some platforms when the window is not wide enough.
+     */
+    public static void clickOnTitle(final Window decoratedWindow, final Robot robot) {
+        Point p = decoratedWindow.getLocationOnScreen();
+        Dimension d = decoratedWindow.getSize();
+
+        if (decoratedWindow instanceof Frame || decoratedWindow instanceof Dialog) {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)decoratedWindow.getInsets().top/2);
+            robot.delay(50);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.delay(50);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        }
+    }
+
+    public static void waitForIdle(final Robot robot) {
+        // we do not use robot for now, use SunToolkit.realSync() instead
+        ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+    }
+
+    public static Field getField(final Class klass, final String fieldName) {
+        return AccessController.doPrivileged(new PrivilegedAction<Field>() {
+            public Field run() {
+                try {
+                    Field field = klass.getDeclaredField(fieldName);
+                    assert (field != null);
+                    field.setAccessible(true);
+                    return field;
+                } catch (SecurityException se) {
+                    throw new RuntimeException("Error: unexpected exception caught!", se);
+                } catch (NoSuchFieldException nsfe) {
+                    throw new RuntimeException("Error: unexpected exception caught!", nsfe);
+                }
+            }
+        });
+    }
+
+    /*
+     * Waits for a notification and for a boolean condition to become true.
+     * The method returns when the above conditions are fullfilled or when the timeout
+     * occurs.
+     *
+     * @param condition the object to be notified and the booelan condition to wait for
+     * @param timeout the maximum time to wait in milliseconds
+     * @param catchExceptions if {@code true} the method catches InterruptedException
+     * @return the final boolean value of the {@code condition}
+     * @throws InterruptedException if the awaiting proccess has been interrupted
+     */
+    public static boolean waitForConditionEx(final AtomicBoolean condition, long timeout)
+      throws InterruptedException
+        {
+            synchronized (condition) {
+                long startTime = System.currentTimeMillis();
+                while (!condition.get()) {
+                    condition.wait(timeout);
+                    if (System.currentTimeMillis() - startTime >= timeout ) {
+                        break;
+                    }
+                }
+            }
+            return condition.get();
+        }
+
+    /*
+     * The same as {@code waitForConditionEx(AtomicBoolean, long)} except that it
+     * doesn't throw InterruptedException.
+     */
+    public static boolean waitForCondition(final AtomicBoolean condition, long timeout) {
+        try {
+            return waitForConditionEx(condition, timeout);
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Error: unexpected exception caught!", e);
+        }
+    }
+
+    /*
+     * The same as {@code waitForConditionEx(AtomicBoolean, long)} but without a timeout.
+     */
+    public static void waitForConditionEx(final AtomicBoolean condition)
+      throws InterruptedException
+        {
+            synchronized (condition) {
+                while (!condition.get()) {
+                    condition.wait();
+                }
+            }
+        }
+
+    /*
+     * The same as {@code waitForConditionEx(AtomicBoolean)} except that it
+     * doesn't throw InterruptedException.
+     */
+    public static void waitForCondition(final AtomicBoolean condition) {
+        try {
+            waitForConditionEx(condition);
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Error: unexpected exception caught!", e);
+        }
+    }
+
+    public static void waitTillShownEx(final Component comp) throws InterruptedException {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                comp.getLocationOnScreen();
+                break;
+            } catch (IllegalComponentStateException e) {}
+        }
+    }
+    public static void waitTillShown(final Component comp) {
+        try {
+            waitTillShownEx(comp);
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Error: unexpected exception caught!", e);
+        }
+    }
+
+    /**
+     * Drags from one point to another with the specified mouse button pressed.
+     *
+     * @param robot a robot to use for moving the mouse, etc.
+     * @param startPoint a start point of the drag
+     * @param endPoint an end point of the drag
+     * @param button one of {@code InputEvent.BUTTON1_MASK},
+     *     {@code InputEvent.BUTTON2_MASK}, {@code InputEvent.BUTTON3_MASK}
+     *
+     * @throws IllegalArgumentException if {@code button} is not one of
+     *     {@code InputEvent.BUTTON1_MASK}, {@code InputEvent.BUTTON2_MASK},
+     *     {@code InputEvent.BUTTON3_MASK}
+     */
+    public static void drag(Robot robot, Point startPoint, Point endPoint, int button) {
+        if (!(button == InputEvent.BUTTON1_MASK || button == InputEvent.BUTTON2_MASK
+                || button == InputEvent.BUTTON3_MASK))
+        {
+            throw new IllegalArgumentException("invalid mouse button");
+        }
+
+        robot.mouseMove(startPoint.x, startPoint.y);
+        robot.mousePress(button);
+        try {
+            mouseMove(robot, startPoint, endPoint);
+        } finally {
+            robot.mouseRelease(button);
+        }
+    }
+
+    /**
+     * Moves the mouse pointer from one point to another.
+     * Uses Bresenham's algorithm.
+     *
+     * @param robot a robot to use for moving the mouse
+     * @param startPoint a start point of the drag
+     * @param endPoint an end point of the drag
+     */
+    public static void mouseMove(Robot robot, Point startPoint, Point endPoint) {
+        int dx = endPoint.x - startPoint.x;
+        int dy = endPoint.y - startPoint.y;
+
+        int ax = Math.abs(dx) * 2;
+        int ay = Math.abs(dy) * 2;
+
+        int sx = signWOZero(dx);
+        int sy = signWOZero(dy);
+
+        int x = startPoint.x;
+        int y = startPoint.y;
+
+        int d = 0;
+
+        if (ax > ay) {
+            d = ay - ax/2;
+            while (true){
+                robot.mouseMove(x, y);
+                robot.delay(50);
+
+                if (x == endPoint.x){
+                    return;
+                }
+                if (d >= 0){
+                    y = y + sy;
+                    d = d - ax;
+                }
+                x = x + sx;
+                d = d + ay;
+            }
+        } else {
+            d = ax - ay/2;
+            while (true){
+                robot.mouseMove(x, y);
+                robot.delay(50);
+
+                if (y == endPoint.y){
+                    return;
+                }
+                if (d >= 0){
+                    x = x + sx;
+                    d = d - ay;
+                }
+                y = y + sy;
+                d = d + ax;
+            }
+        }
+    }
+
+    private static int signWOZero(int i){
+        return (i > 0)? 1: -1;
+    }
+
+    private static int sign(int n) {
+        return n < 0 ? -1 : n == 0 ? 0 : 1;
+    }
+
+    /** Returns {@code WindowListener} instance that diposes {@code Window} on
+     *  "window closing" event.
+     *
+     * @return    the {@code WindowListener} instance that could be set
+     *            on a {@code Window}. After that
+     *            the {@code Window} is disposed when "window closed"
+     *            event is sent to the {@code Window}
+     */
+    public static WindowListener getClosingWindowAdapter() {
+        return new WindowAdapter () {
+            public void windowClosing(WindowEvent e) {
+                e.getWindow().dispose();
+            }
+        };
+    }
+
+    /*
+     * The values directly map to the ones of
+     * sun.awt.X11.XWM & sun.awt.motif.MToolkit classes.
+     */
+    public final static int
+        UNDETERMINED_WM = 1,
+        NO_WM = 2,
+        OTHER_WM = 3,
+        OPENLOOK_WM = 4,
+        MOTIF_WM = 5,
+        CDE_WM = 6,
+        ENLIGHTEN_WM = 7,
+        KDE2_WM = 8,
+        SAWFISH_WM = 9,
+        ICE_WM = 10,
+        METACITY_WM = 11,
+        COMPIZ_WM = 12,
+        LG3D_WM = 13;
+
+    /*
+     * Returns -1 in case of not X Window or any problems.
+     */
+    public static int getWMID() {
+        Class clazz = null;
+        try {
+            if ("sun.awt.X11.XToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+                clazz = Class.forName("sun.awt.X11.XWM");
+            } else if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+                clazz = Class.forName("sun.awt.motif.MToolkit");
+            }
+        } catch (ClassNotFoundException cnfe) {
+            cnfe.printStackTrace();
+        }
+        if (clazz == null) {
+            return -1;
+        }
+
+        try {
+            final Class _clazz = clazz;
+            Method m_getWMID = (Method)AccessController.doPrivileged(new PrivilegedAction() {
+                    public Object run() {
+                        try {
+                            Method method = _clazz.getDeclaredMethod("getWMID", new Class[] {});
+                            if (method != null) {
+                                method.setAccessible(true);
+                            }
+                            return method;
+                        } catch (NoSuchMethodException e) {
+                            assert false;
+                        } catch (SecurityException e) {
+                            assert false;
+                        }
+                        return null;
+                    }
+                });
+            return ((Integer)m_getWMID.invoke(null, new Object[] {})).intValue();
+        } catch (IllegalAccessException iae) {
+            iae.printStackTrace();
+        } catch (InvocationTargetException ite) {
+            ite.printStackTrace();
+        }
+        return -1;
+    }
+
+
+    ////////////////////////////
+    // Some stuff to test focus.
+    ////////////////////////////
+
+    private static WindowGainedFocusListener wgfListener = new WindowGainedFocusListener();
+    private static FocusGainedListener fgListener = new FocusGainedListener();
+    private static ActionPerformedListener apListener = new ActionPerformedListener();
+
+    private abstract static class EventListener {
+        AtomicBoolean notifier = new AtomicBoolean(false);
+        Component comp;
+        boolean printEvent;
+
+        public void listen(Component comp, boolean printEvent) {
+            this.comp = comp;
+            this.printEvent = printEvent;
+            notifier.set(false);
+            setListener(comp);
+        }
+
+        public AtomicBoolean getNotifier() {
+            return notifier;
+        }
+
+        abstract void setListener(Component comp);
+
+        void printAndNotify(AWTEvent e) {
+            if (printEvent) {
+                System.err.println(e);
+            }
+            synchronized (notifier) {
+                notifier.set(true);
+                notifier.notifyAll();
+            }
+        }
+    }
+
+    private static class WindowGainedFocusListener extends EventListener implements WindowFocusListener {
+
+        void setListener(Component comp) {
+            ((Window)comp).addWindowFocusListener(this);
+        }
+
+        public void windowGainedFocus(WindowEvent e) {
+
+            ((Window)comp).removeWindowFocusListener(this);
+            printAndNotify(e);
+        }
+
+        public void windowLostFocus(WindowEvent e) {}
+    }
+
+    private static class FocusGainedListener extends EventListener implements FocusListener {
+
+        void setListener(Component comp) {
+            comp.addFocusListener(this);
+        }
+
+        public void focusGained(FocusEvent e) {
+            comp.removeFocusListener(this);
+            printAndNotify(e);
+        }
+
+        public void focusLost(FocusEvent e) {}
+    }
+
+    private static class ActionPerformedListener extends EventListener implements ActionListener {
+
+        void setListener(Component comp) {
+            ((Button)comp).addActionListener(this);
+        }
+
+        public void actionPerformed(ActionEvent e) {
+            ((Button)comp).removeActionListener(this);
+            printAndNotify(e);
+        }
+    }
+
+    private static boolean trackEvent(int eventID, Component comp, Runnable action, int time, boolean printEvent) {
+        EventListener listener = null;
+
+        switch (eventID) {
+        case WindowEvent.WINDOW_GAINED_FOCUS:
+            listener = wgfListener;
+            break;
+        case FocusEvent.FOCUS_GAINED:
+            listener = fgListener;
+            break;
+        case ActionEvent.ACTION_PERFORMED:
+            listener = apListener;
+            break;
+        }
+
+        listener.listen(comp, printEvent);
+        action.run();
+        return Util.waitForCondition(listener.getNotifier(), time);
+    }
+
+    /*
+     * Tracks WINDOW_GAINED_FOCUS event for a window caused by an action.
+     * @param window the window to track the event for
+     * @param action the action to perform
+     * @param time the max time to wait for the event
+     * @param printEvent should the event received be printed or doesn't
+     * @return true if the event has been received, otherwise false
+     */
+    public static boolean trackWindowGainedFocus(Window window, Runnable action, int time, boolean printEvent) {
+        return trackEvent(WindowEvent.WINDOW_GAINED_FOCUS, window, action, time, printEvent);
+    }
+
+    /*
+     * Tracks FOCUS_GAINED event for a component caused by an action.
+     * @see #trackWindowGainedFocus
+     */
+    public static boolean trackFocusGained(Component comp, Runnable action, int time, boolean printEvent) {
+        return trackEvent(FocusEvent.FOCUS_GAINED, comp, action, time, printEvent);
+    }
+
+    /*
+     * Tracks ACTION_PERFORMED event for a button caused by an action.
+     * @see #trackWindowGainedFocus
+     */
+    public static boolean trackActionPerformed(Button button, Runnable action, int time, boolean printEvent) {
+        return trackEvent(ActionEvent.ACTION_PERFORMED, button, action, time, printEvent);
+    }
+
+    /*
+     * Requests focus on the component provided and waits for the result.
+     * @return true if the component has been focused, false otherwise.
+     */
+    public static boolean focusComponent(Component comp, int time) {
+        return focusComponent(comp, time, false);
+    }
+    public static boolean focusComponent(final Component comp, int time, boolean printEvent) {
+        return trackFocusGained(comp,
+                                new Runnable() {
+                                    public void run() {
+                                        comp.requestFocus();
+                                    }
+                                },
+                                time, printEvent);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.SwingUtilities;
+
+/**
+ * AWT/Swing overlapping test for viewport
+ * <p>This test verify if AWT components are drawn correctly being partially shown through viewport
+ * <p>See <a href="http://monaco.sfbay.sun.com/detail.jsf?cr=6778882">CR6778882</a> for details
+ * <p>See base class for test info.
+ */
+/*
+@test
+@bug 6778882
+@summary Viewport overlapping test for each AWT component
+@author sergey.grinev@oracle.com: area=awt.mixing
+@run main ViewportOverlapping
+ */
+public class ViewportOverlapping extends OverlappingTestBase {
+
+    private volatile int frameClicked;
+    private Point hLoc;
+    private Point vLoc;
+    private Point testLoc;
+    private Point resizeLoc;
+
+    private JFrame f;
+    private JPanel p;
+    private JButton b;
+    private JScrollPane scrollPane;
+
+    protected void prepareControls() {
+        p = new JPanel(new GridLayout(0, 1));
+        propagateAWTControls(p);
+        b = new JButton("Space extender");
+        p.add(b);
+        p.setPreferredSize(new Dimension(500, 500));
+        scrollPane = new JScrollPane(p);
+
+        f = new JFrame();
+        f.addMouseListener(new MouseAdapter() {
+
+            @Override
+            public void mouseClicked(MouseEvent e) {
+                frameClicked++;
+            }
+        });
+        f.getContentPane().add(scrollPane, BorderLayout.CENTER);
+        ((JComponent) f.getContentPane()).setBorder(
+                BorderFactory.createEmptyBorder(50, 50, 50, 50));
+        f.setSize(400, 400);
+        f.setLocationRelativeTo(null);
+        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        f.setVisible(true);
+    }
+
+    @Override
+    protected boolean performTest() {
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    // prepare test data
+                    frameClicked = 0;
+
+                    b.requestFocus();
+
+                    scrollPane.getHorizontalScrollBar().setUnitIncrement(40);
+                    scrollPane.getVerticalScrollBar().setUnitIncrement(40);
+
+                    hLoc = scrollPane.getHorizontalScrollBar().getLocationOnScreen();
+                    hLoc.translate(scrollPane.getHorizontalScrollBar().getWidth() - 3, 3);
+                    vLoc = scrollPane.getVerticalScrollBar().getLocationOnScreen();
+                    vLoc.translate(3, scrollPane.getVerticalScrollBar().getHeight() - 3);
+
+                    testLoc = p.getLocationOnScreen();
+                    testLoc.translate(-3, -3);
+
+                    resizeLoc = f.getLocationOnScreen();
+                    resizeLoc.translate(f.getWidth() - 1, f.getHeight() - 1);
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.exit(1);
+        }
+        // run robot
+        Robot robot = Util.createRobot();
+        robot.setAutoDelay(ROBOT_DELAY);
+
+        robot.mouseMove(hLoc.x, hLoc.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        Util.waitForIdle(robot);
+
+        robot.mouseMove(vLoc.x, vLoc.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        Util.waitForIdle(robot);
+
+        clickAndBlink(robot, testLoc, false);
+        robot.mouseMove(resizeLoc.x, resizeLoc.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(resizeLoc.x + 5, resizeLoc.y + 5);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        Util.waitForIdle(robot);
+
+        clickAndBlink(robot, testLoc, false);
+        return frameClicked == 2;
+    }
+
+    // this strange plumbing stuff is required due to "Standard Test Machinery" in base class
+    public static void main(String args[]) throws InterruptedException {
+        instance = new ViewportOverlapping();
+        OverlappingTestBase.doMain(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Robot/ModifierRobotKey/ModifierRobotKeyTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+import java.awt.*;
+import java.awt.event.*;
+
+import static jdk.testlibrary.Asserts.assertTrue;
+
+/*
+ * @test
+ * @summary Make sure that modifier key mask is set when robot press
+ * some key with one or more modifiers.
+ *
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main ModifierRobotKeyTest
+ */
+
+public class ModifierRobotKeyTest extends KeyAdapter {
+
+    private boolean focusGained = false;
+    private boolean startTest = false;
+    private ExtendedRobot robot;
+    private Frame frame;
+    private Canvas canvas;
+
+    private volatile boolean tempPress = false;
+
+    private int[] textKeys, modifierKeys, inputMasks;
+    private boolean[] modifierStatus, textStatus;
+
+    private final static int waitDelay = 5000;
+    private Object tempLock = new Object();
+    private Object keyLock = new Object();
+
+    public static void main(String[] args) throws Exception {
+        ModifierRobotKeyTest test = new ModifierRobotKeyTest();
+        test.doTest();
+    }
+
+    public ModifierRobotKeyTest() throws Exception {
+        modifierKeys =  new int[3];
+        modifierKeys[0] = KeyEvent.VK_SHIFT;
+        modifierKeys[1] = KeyEvent.VK_CONTROL;
+        modifierKeys[2] = KeyEvent.VK_ALT;
+
+        inputMasks = new int[3];
+        inputMasks[0] =  InputEvent.SHIFT_MASK;
+        inputMasks[1] =  InputEvent.CTRL_MASK;
+        inputMasks[2] =  InputEvent.ALT_MASK;
+
+        modifierStatus = new boolean[modifierKeys.length];
+
+        textKeys = new int[2];
+        textKeys[0] = KeyEvent.VK_A;
+
+        String os = System.getProperty("os.name").toLowerCase();
+
+        if (os.contains("solaris") || os.contains("sunos"))
+            textKeys[1] = KeyEvent.VK_S;
+        else if (os.contains("os x"))
+            textKeys[1] = KeyEvent.VK_K;
+        else
+            textKeys[1] = KeyEvent.VK_I;
+
+        textStatus = new boolean[textKeys.length];
+
+        EventQueue.invokeAndWait( () -> { initializeGUI(); });
+    }
+
+    public void keyPressed(KeyEvent event) {
+
+        tempPress = true;
+        synchronized (tempLock) { tempLock.notifyAll(); }
+
+        if (! startTest) {
+            return;
+        }
+        for (int x = 0; x < inputMasks.length; x++) {
+            if ((event.getModifiers() & inputMasks[x]) != 0) {
+                System.out.println("Modifier set: " + event.getKeyModifiersText(inputMasks[x]));
+                modifierStatus[x] = true;
+            }
+        }
+        for (int x = 0; x < textKeys.length; x++) {
+            if (event.getKeyCode() == textKeys[x]) {
+                System.out.println("Text set: " + event.getKeyText(textKeys[x]));
+                textStatus[x] = true;
+            }
+        }
+
+        synchronized (keyLock) { keyLock.notifyAll(); }
+    }
+
+    private void initializeGUI() {
+        frame = new Frame("Test frame");
+        canvas = new Canvas();
+        canvas.addFocusListener(new FocusAdapter() {
+            public void focusGained(FocusEvent event) { focusGained = true; }
+        });
+        canvas.addKeyListener(this);
+        frame.setLayout(new BorderLayout());
+        frame.add(canvas);
+        frame.setSize(200, 200);
+        frame.setVisible(true);
+    }
+
+    public void doTest() throws Exception {
+        robot = new ExtendedRobot();
+
+        robot.mouseMove((int) frame.getLocationOnScreen().getX() + frame.getSize().width / 2,
+                        (int) frame.getLocationOnScreen().getY() + frame.getSize().height / 2);
+        robot.click(MouseEvent.BUTTON1_MASK);
+        robot.waitForIdle();
+
+        assertTrue(focusGained, "FAIL: Canvas gained focus!");
+
+        for (int i = 0; i < modifierKeys.length; i++) {
+            for (int j = 0; j < textKeys.length; j++) {
+                tempPress = false;
+                robot.keyPress(modifierKeys[i]);
+                robot.waitForIdle();
+                if (! tempPress) {
+                    synchronized (tempLock) { tempLock.wait(waitDelay); }
+                }
+                assertTrue(tempPress, "FAIL: keyPressed triggered for i=" + i);
+
+                resetStatus();
+                startTest = true;
+                robot.keyPress(textKeys[j]);
+                robot.waitForIdle();
+                if (! modifierStatus[i] || ! textStatus[j]) {
+                    synchronized (keyLock) { keyLock.wait(waitDelay); }
+                }
+
+
+                assertTrue(modifierStatus[i] && textStatus[j],
+                        "FAIL: KeyEvent not proper!"+
+                        "Key checked: i=" + i + "; j=" + j+
+                        "ModifierStatus = " + modifierStatus[i]+
+                        "TextStatus = " + textStatus[j]);
+                startTest = false;
+                robot.keyRelease(textKeys[j]);
+                robot.waitForIdle();
+                robot.keyRelease(modifierKeys[i]);
+                robot.waitForIdle();
+            }
+        }
+
+        for (int i = 0; i < modifierKeys.length; i++) {
+            for (int j = i + 1; j < modifierKeys.length; j++) {
+                for (int k = 0; k < textKeys.length; k++) {
+                    tempPress = false;
+                    robot.keyPress(modifierKeys[i]);
+                    robot.waitForIdle();
+                    if (! tempPress) {
+                        synchronized (tempLock) { tempLock.wait(waitDelay); }
+                    }
+
+                    assertTrue(tempPress, "FAIL: MultiKeyTest: keyPressed triggered for i=" + i);
+
+                    tempPress = false;
+                    robot.keyPress(modifierKeys[j]);
+                    robot.waitForIdle();
+                    if (! tempPress) {
+                        synchronized (tempLock) { tempLock.wait(waitDelay); }
+                    }
+                    assertTrue(tempPress, "FAIL: MultiKeyTest keyPressed triggered for j=" + j);
+
+                    resetStatus();
+                    startTest = true;
+                    robot.keyPress(textKeys[k]);
+                    robot.waitForIdle();
+                    if (! modifierStatus[i] || ! modifierStatus[j] || ! textStatus[k]) {
+                        synchronized (keyLock) {
+                            keyLock.wait(waitDelay);
+                        }
+                    }
+                    assertTrue(modifierStatus[i] && modifierStatus[j] && textStatus[k],
+                            "FAIL: KeyEvent not proper!"+
+                            "Key checked: i=" + i + "; j=" + j + "; k=" + k+
+                            "Modifier1Status = " + modifierStatus[i]+
+                            "Modifier2Status = " + modifierStatus[j]+
+                            "TextStatus = " + textStatus[k]);
+
+                    startTest = false;
+                    robot.keyRelease(textKeys[k]);
+                    robot.waitForIdle();
+                    robot.keyRelease(modifierKeys[j]);
+                    robot.waitForIdle();
+                    robot.keyRelease(modifierKeys[i]);
+                    robot.waitForIdle();
+                }
+            }
+        }
+
+        frame.dispose();
+    }
+
+    private void resetStatus() {
+        for (int i = 0; i < modifierStatus.length; i++) {
+            modifierStatus[i] = false;
+        }
+        for (int i = 0; i < textStatus.length; i++) {
+            textStatus[i] = false;
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Toolkit/LockingKeyStateTest/LockingKeyStateTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+/*
+  @test
+  @summary verify LOCK buttons toogle
+  @author Yuri.Nesterenko, Dmitriy.Ermashov
+  @library ../../../../lib/testlibrary
+  @build ExtendedRobot
+  @run main LockingKeyStateTest
+*/
+
+public class LockingKeyStateTest {
+
+    Frame frame;
+    ExtendedRobot robot;
+
+    // Note that Kana lock you may actually toggle only if you have one.
+    static int[] lockingKeys = { KeyEvent.VK_CAPS_LOCK, KeyEvent.VK_NUM_LOCK,
+            KeyEvent.VK_SCROLL_LOCK, KeyEvent.VK_KANA_LOCK };
+    boolean[] getSupported = new boolean[lockingKeys.length];
+    boolean[] setSupported = new boolean[lockingKeys.length];
+    boolean[] state0 = new boolean[lockingKeys.length];
+
+    Toolkit toolkit = Toolkit.getDefaultToolkit();
+
+    LockingKeyStateTest() throws Exception {
+        robot = new ExtendedRobot();
+        EventQueue.invokeAndWait( this::createGui );
+    }
+
+    void toggleAllTrue(){toggleAll(true);}
+    void toggleAllFalse(){toggleAll(false);}
+    void toggleAll(boolean b) {
+        for(int i = 0; i < lockingKeys.length; i++) {
+            if(setSupported[i]) {
+                toolkit.setLockingKeyState(lockingKeys[i], b);
+            }
+        }
+    }
+
+    void checkAllTrue(){checkAll(true);}
+    void checkAllFalse(){checkAll(false);}
+    void checkAll(boolean b) {
+        for(int i = 0; i < lockingKeys.length; i++) {
+            if(getSupported[i]  && setSupported[i]) {
+                if (!(toolkit.getLockingKeyState(lockingKeys[i]) == b))
+                    throw new RuntimeException("State of "+KeyEvent.getKeyText(lockingKeys[i])+" is not "+b);
+                System.out.println("OK, state of "+KeyEvent.getKeyText(lockingKeys[i])+" is "+b);
+            }
+        }
+    }
+
+    void restoreAll() {
+        for(int i = 0; i < lockingKeys.length; i++) {
+            if(setSupported[i] && getSupported[i]) {
+                toolkit.setLockingKeyState(lockingKeys[i], state0[i]);
+            }
+        }
+    }
+
+    public void createGui() {
+        for(int i = 0; i < lockingKeys.length; i++) {
+            getSupported[i] = false;
+            setSupported[i] = false;
+            try {
+                state0[i] = toolkit.getLockingKeyState(lockingKeys[i]);
+                getSupported[i] = true;
+                toolkit.setLockingKeyState(lockingKeys[i], state0[i]);
+                setSupported[i] = true;
+            } catch (UnsupportedOperationException uoe) {
+            }
+            System.out.println(" State get/set of "+KeyEvent.getKeyText(lockingKeys[i])+" is supported? "+
+                    getSupported[i]+", "+setSupported[i]);
+        }
+        frame = new Frame("LockingKeyStateTest Title");
+        frame.setSize(200,200);
+        frame.setVisible(true);
+    }
+
+    void doTest() throws Exception{
+        robot.waitForIdle();
+        robot.mouseMove(frame.getLocationOnScreen().x + frame.getWidth() / 2,
+                frame.getLocationOnScreen().y + frame.getHeight() / 2);
+        robot.click();
+
+        EventQueue.invokeAndWait( this::toggleAllTrue );
+        robot.waitForIdle(2000);
+        EventQueue.invokeAndWait( this::checkAllTrue );
+        EventQueue.invokeAndWait( this::toggleAllFalse );
+        robot.waitForIdle(2000);
+        EventQueue.invokeAndWait( this::checkAllFalse );
+        EventQueue.invokeAndWait( this::restoreAll );
+        robot.waitForIdle();
+
+        frame.dispose();
+    }
+
+    public static void main(String argv[]) throws Exception {
+        LockingKeyStateTest af = new LockingKeyStateTest();
+        af.doTest();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/datatransfer/MappingGenerationTest/MappingGenerationTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.util.List;
+
+/*
+  @test
+  @bug 4512530 8027148
+  @summary tests that mappings for text flavors are generated properly
+  @author das@sparc.spb.su area=datatransfer
+*/
+
+public class MappingGenerationTest {
+
+    private static final SystemFlavorMap fm =
+        (SystemFlavorMap)SystemFlavorMap.getDefaultFlavorMap();
+
+    public static void main(String[] args)  {
+        test1();
+        test2();
+        test3();
+        test4();
+        test5();
+        test6();
+    }
+
+    /**
+     * Verifies that Lists returned from getNativesForFlavor() and
+     * getFlavorsForNative() are not modified with a subsequent call
+     * to addUnencodedNativeForFlavor() and addFlavorForUnencodedNative()
+     * respectively.
+     */
+    public static void test1() {
+        DataFlavor df = new DataFlavor("text/plain-test1", null);
+        String nat = "native1";
+
+        List<String> natives = fm.getNativesForFlavor(df);
+        fm.addUnencodedNativeForFlavor(df, nat);
+        List<String> nativesNew = fm.getNativesForFlavor(df);
+        if (natives.equals(nativesNew)) {
+            System.err.println("orig=" + natives);
+            System.err.println("new=" + nativesNew);
+            throw new RuntimeException("Test failed");
+        }
+
+        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
+        fm.addFlavorForUnencodedNative(nat, df);
+        List<DataFlavor> flavorsNew = fm.getFlavorsForNative(nat);
+        if (flavors.equals(flavorsNew)) {
+            System.err.println("orig=" + flavors);
+            System.err.println("new=" + flavorsNew);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that SystemFlavorMap is not affected by modification of
+     * the Lists returned from getNativesForFlavor() and
+     * getFlavorsForNative().
+     */
+    public static void test2() {
+        DataFlavor df = new DataFlavor("text/plain-test2", null);
+        String nat = "native2";
+        DataFlavor extraDf = new DataFlavor("text/test", null);
+
+        List<String> natives = fm.getNativesForFlavor(df);
+        natives.add("Should not be here");
+        java.util.List nativesNew = fm.getNativesForFlavor(df);
+        if (natives.equals(nativesNew)) {
+            System.err.println("orig=" + natives);
+            System.err.println("new=" + nativesNew);
+            throw new RuntimeException("Test failed");
+        }
+
+        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
+        flavors.add(extraDf);
+        java.util.List flavorsNew = fm.getFlavorsForNative(nat);
+        if (flavors.equals(flavorsNew)) {
+            System.err.println("orig=" + flavors);
+            System.err.println("new=" + flavorsNew);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that addUnencodedNativeForFlavor() for a particular text flavor
+     * doesn't affect mappings for other flavors.
+     */
+    public static void test3() {
+        DataFlavor df1 = new DataFlavor("text/plain-test3", null);
+        DataFlavor df2 = new DataFlavor("text/plain-test3; charset=Unicode; class=java.io.Reader", null);
+        String nat = "native3";
+        List<String> natives = fm.getNativesForFlavor(df2);
+        fm.addUnencodedNativeForFlavor(df1, nat);
+        List<String> nativesNew = fm.getNativesForFlavor(df2);
+        if (!natives.equals(nativesNew)) {
+            System.err.println("orig=" + natives);
+            System.err.println("new=" + nativesNew);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that addUnencodedNativeForFlavor() really adds the specified
+     * flavor-to-native mapping to the existing mappings.
+     */
+    public static void test4() {
+        DataFlavor df = new DataFlavor("text/plain-test4; charset=Unicode; class=java.io.Reader", null);
+        String nat = "native4";
+        List<String> natives = fm.getNativesForFlavor(df);
+        if (!natives.contains(nat)) {
+            fm.addUnencodedNativeForFlavor(df, nat);
+            List<String> nativesNew = fm.getNativesForFlavor(df);
+            natives.add(nat);
+            if (!natives.equals(nativesNew)) {
+                System.err.println("orig=" + natives);
+                System.err.println("new=" + nativesNew);
+                throw new RuntimeException("Test failed");
+            }
+        }
+    }
+
+    /**
+     * Verifies that a flavor doesn't have any flavor-to-native mappings after
+     * a call to setNativesForFlavor() with this flavor and an empty native
+     * array as arguments.
+     */
+    public static void test5() {
+        final DataFlavor flavor =
+            new DataFlavor("text/plain-TEST5; charset=Unicode", null);
+
+        fm.getNativesForFlavor(flavor);
+
+        fm.setNativesForFlavor(flavor, new String[0]);
+
+        List<String> natives = fm.getNativesForFlavor(flavor);
+
+        if (!natives.isEmpty()) {
+            System.err.println("natives=" + natives);
+            throw new RuntimeException("Test failed");
+        }
+    }
+
+    /**
+     * Verifies that a native doesn't have any native-to-flavor mappings after
+     * a call to setFlavorsForNative() with this native and an empty flavor
+     * array as arguments.
+     */
+    public static void test6() {
+        final String nat = "STRING";
+        fm.getFlavorsForNative(nat);
+        fm.setFlavorsForNative(nat, new DataFlavor[0]);
+
+        List<DataFlavor> flavors = fm.getFlavorsForNative(nat);
+
+        if (!flavors.isEmpty()) {
+            System.err.println("flavors=" + flavors);
+            throw new RuntimeException("Test failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.html	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,48 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 6887703
+  @summary Unsigned applet can retrieve the dragged information before drop action occurs
+  @author : area=dnd
+  @library ../../regtesthelpers
+  @library ../../regtesthelpers/process
+  @build Util
+  @build ProcessResults ProcessCommunicator 
+  @run applet/othervm DragInterceptorAppletTest.html
+
+-->
+<head>
+<title> Unsigned applet can retrieve the dragged information before drop action occurs </title>
+</head>
+<body>
+
+<h1>DragInterceptorAppletTest<br>Bug ID: 6887703</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="DragInterceptorAppletTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorAppletTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 6887703
+  @summary Unsigned applet can retrieve the dragged information before drop action occurs
+  @author : area=dnd
+  @run applet DragInterceptorAppletTest.html
+*/
+
+/**
+ * DragInterceptorAppletTest.java
+ *
+ * summary: Unsigned applet can retrieve the dragged information before drop action occurs
+ */
+
+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;
+
+public class DragInterceptorAppletTest extends Applet {
+
+    public void init() {
+        setLayout(new BorderLayout());
+    }//End  init()
+
+    public void start() {
+
+        SourceFrame sourceFrame = new SourceFrame();
+
+        Util.waitForIdle(null);
+
+        String [] args = new String [] {
+            String.valueOf(sourceFrame.getNextLocationX()),
+            String.valueOf(sourceFrame.getNextLocationY()),
+            String.valueOf(sourceFrame.getDragSourcePointX()),
+            String.valueOf(sourceFrame.getDragSourcePointY()),
+        };
+        String classpath = System.getProperty("java.class.path");
+        ProcessResults processResults =
+            ProcessCommunicator.executeChildProcess(this.getClass(),classpath,args);
+
+        verifyTestResults(processResults);
+
+    }// start()
+
+    private static void verifyTestResults(ProcessResults processResults) {
+
+    switch (processResults.getExitValue()) {
+        case InterprocessMessages.DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED:
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: Target applet can intercept data " +
+                    "without a clipboard permission and an exception handler was not triggered.");
+            //Unreachable...
+
+        case InterprocessMessages.DATA_WAS_INTERCEPTED:
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: Target applet can intercept data " +
+                    "without a clipboard permission");
+            //Unreachable...
+
+        case InterprocessMessages.EXCEPTION_HANDLER_WAS_NOT_TRIGGERED:
+            processResults.printProcessErrorOutput(System.err);
+            throw new RuntimeException("TEST IS FAILED: An exception handler was not triggered.");
+            //Unreachable...
+
+    }
+
+        //    The child process throws an exception. do not look at the stderr.
+        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 DragInterceptorAppletTest() {
+        super();
+    }
+
+    //We need in this constructor to pass frame position between JVMs
+    public DragInterceptorAppletTest(Point targetFrameLocation, Point dragSourcePoint)
+            throws InterruptedException
+    {
+        DragInterceptorFrame targetFrame = new DragInterceptorFrame(targetFrameLocation);
+
+        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);
+
+        sleep(2000);
+        ProcessCommunicator.destroyProcess();
+    }
+
+    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 DragInterceptorAppletTest(targetFrameLocation, dragSourcePoint);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }
+
+}// class DragInterceptorAppletTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/DragInterceptorFrame.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.dnd.*;
+import java.io.IOException;
+import java.security.Permission;
+import java.security.AccessControlException;
+
+class DragInterceptorFrame extends Frame implements DropTargetListener {
+
+    private static int exitMessage = InterprocessMessages.TEST_PASSED;
+    private static boolean dataIsAccessible = false;
+    private static boolean exceptionHasBeenThrown = false;
+
+    DragInterceptorFrame(Point location) {
+        System.setSecurityManager(new ClipboardDefender());
+        initGUI(location);
+        setDropTarget(new DropTarget(this, DnDConstants.ACTION_COPY,
+                this));
+    }
+
+    private void initGUI(Point location) {
+        this.setLocation(location);
+        this.addWindowListener(new WindowAdapter() {
+            public void windowClosing(WindowEvent e) {
+                DragInterceptorFrame.this.dispose();
+            }
+        });
+        setSize (200, 200);
+        this.setVisible(true);
+    }
+
+    public void dragEnter(DropTargetDragEvent dtde) {
+        // We want to set the exception handler on EDT
+        Thread.currentThread().setUncaughtExceptionHandler (
+            new Thread.UncaughtExceptionHandler() {
+                public void uncaughtException(Thread t, Throwable e) {
+                    exceptionHasBeenThrown = true;
+                }
+            }
+        );
+        examineTransferable(dtde);
+    }
+
+    public void dragOver(DropTargetDragEvent dtde) {
+        examineTransferable(dtde);
+    }
+
+    public void dropActionChanged(DropTargetDragEvent dtde) {
+        examineTransferable(dtde);
+    }
+
+    public void dragExit(DropTargetEvent dte) {}
+
+    public void drop(DropTargetDropEvent dtde) {
+
+        if (dataIsAccessible && !exceptionHasBeenThrown) {
+            exitMessage = InterprocessMessages.DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED;
+        } else if (dataIsAccessible) {
+            exitMessage = InterprocessMessages.DATA_WAS_INTERCEPTED;
+        } else if (!exceptionHasBeenThrown) {
+            exitMessage = InterprocessMessages.EXCEPTION_HANDLER_WAS_NOT_TRIGGERED;
+        }
+
+        // This returns the diagnostic code from the child VM
+        System.exit(exitMessage);
+    }
+
+    Point getDropTargetPoint() {
+        return new Point((int)getLocationOnScreen().getX()+(getWidth()/2),
+                (int)getLocationOnScreen().getY()+(getHeight()/2));
+    }
+
+    private void examineTransferable(DropTargetDragEvent dtde) {
+        if (dtde.getCurrentDataFlavorsAsList().contains(DataFlavor.stringFlavor)) {
+            dtde.acceptDrag(DnDConstants.ACTION_COPY);
+            try{
+                if (null != dtde.getTransferable().getTransferData(DataFlavor.stringFlavor)) {
+                    dataIsAccessible = true;
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+                exitMessage = InterprocessMessages.UNEXPECTED_IO_EXCEPTION;
+            } catch (UnsupportedFlavorException e) {
+                e.printStackTrace();
+                exitMessage = InterprocessMessages.UNEXPECTED_UNSUPPORTED_FLAVOR_EXCEPTION;
+            }
+        }
+    }
+
+    static class ClipboardDefender extends SecurityManager {
+        public void checkPermission(Permission p) {
+           if (p instanceof java.awt.AWTPermission &&
+                   p.getName().equals("accessClipboard")) {
+               throw new AccessControlException("access denied ");
+           }
+        }
+    }
+
+    public static void main(String[] args) {
+        new DragInterceptorFrame(new Point(200,200));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/InterprocessMessages.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+public interface InterprocessMessages {
+    final static int TEST_PASSED = 0;
+    final static int DATA_WAS_INTERCEPTED = 212;
+    final static int EXCEPTION_HANDLER_WAS_NOT_TRIGGERED = 213;
+    final static int DATA_WAS_INTERCEPTED_AND_EXCEPTION_HANDLER_WAS_NOT_TRIGGERED  = 214;
+
+    final static int UNEXPECTED_IO_EXCEPTION = 400;
+    final static int UNEXPECTED_UNSUPPORTED_FLAVOR_EXCEPTION = 401;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/DragInterceptorAppletTest/SourceFrame.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import test.java.awt.regtesthelpers.Util;
+
+import java.awt.*;
+import java.awt.datatransfer.StringSelection;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+
+class SourceFrame extends Frame implements DragGestureListener {
+
+    SourceFrame() {
+        super("Source File List Frame");
+        initGUI();
+        new DragSource().createDefaultDragGestureRecognizer(this,
+                DnDConstants.ACTION_COPY,this);
+    }
+
+    private void initGUI() {
+        this.addWindowListener(Util.getClosingWindowAdapter());
+        this.setLocation(300,250);
+        this.setSize(200,200);
+        this.setVisible(true);
+    }
+
+    int getNextLocationX() {
+        return getX()+getWidth();
+    }
+
+    int getNextLocationY() {
+        return getY();
+    }
+
+    int getDragSourcePointX() {
+        return (int)getLocationOnScreen().getX()+(getWidth()/2);
+    }
+
+   int getDragSourcePointY() {
+        return (int)getLocationOnScreen().getY()+ (getHeight()/2);
+    }
+
+    public void dragGestureRecognized(DragGestureEvent dge) {
+        dge.startDrag(null, new StringSelection("A TEXT"));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.html	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 4658741
+  @summary verifies that getDropSuccess() returns correct value for inter-JVM DnD
+  @author das@sparc.spb.su area=dnd
+  @run applet InterJVMGetDropSuccessTest.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>InterJVMGetDropSuccessTest<br>Bug ID: 4658741</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="InterJVMGetDropSuccessTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/InterJVMGetDropSuccessTest/InterJVMGetDropSuccessTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 4658741
+  @summary verifies that getDropSuccess() returns correct value for inter-JVM DnD
+  @author das@sparc.spb.su area=dnd
+  @run applet InterJVMGetDropSuccessTest.html
+*/
+
+// Note there is no @ in front of test above.  This is so that the
+//  harness will not mistake this file as a test file.  It should
+//  only see the html file as a test file. (the harness runs all
+//  valid test files, so it would run this test twice if this file
+//  were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag.  Here, you
+//  should put which functional area the test falls in.  See the
+//  AWT-core home page -> test areas and/or -> AWT team  for a list of
+//  areas.
+// Note also the 'InterJVMGetDropSuccessTest.html' in the run tag.  This should
+//  be changed to the name of the test.
+
+
+/**
+ * InterJVMGetDropSuccessTest.java
+ *
+ * summary: verifies that getDropSuccess() returns correct value for inter-JVM DnD
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.dnd.*;
+import java.awt.event.*;
+import java.io.*;
+import javax.swing.*;
+
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors.  (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems).  Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class InterJVMGetDropSuccessTest extends Applet {
+
+    private int returnCode = Util.CODE_NOT_RETURNED;
+    private boolean successCodes[] = { true, false };
+    private int dropCount = 0;
+
+    final Frame frame = new Frame("Target Frame");
+
+    final DropTargetListener dropTargetListener = new DropTargetAdapter() {
+            public void drop(DropTargetDropEvent dtde) {
+                dtde.acceptDrop(DnDConstants.ACTION_COPY);
+                dtde.dropComplete(successCodes[dropCount]);
+                dropCount++;
+            }
+        };
+    final DropTarget dropTarget = new DropTarget(frame, dropTargetListener);
+
+    public void init() {
+        //Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test",
+            "simply wait until it is done"
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        frame.setTitle("Test frame");
+        frame.setBounds(100, 100, 150, 150);
+    } // init()
+
+    public void start() {
+
+        frame.setVisible(true);
+
+        try {
+            Thread.sleep(Util.FRAME_ACTIVATION_TIMEOUT);
+
+            Point p = frame.getLocationOnScreen();
+            Dimension d = frame.getSize();
+
+            String javaPath = System.getProperty("java.home", "");
+            String command = javaPath + File.separator + "bin" +
+                File.separator + "java -cp " + System.getProperty("test.classes", ".") +
+                " Child " +
+                p.x + " " + p.y + " " + d.width + " " + d.height;
+
+            Process process = Runtime.getRuntime().exec(command);
+            returnCode = process.waitFor();
+
+            InputStream errorStream = process.getErrorStream();
+            int count = errorStream.available();
+            if (count > 0) {
+                byte[] b = new byte[count];
+                errorStream.read(b);
+                System.err.println("========= Child VM System.err ========");
+                System.err.print(new String(b));
+                System.err.println("======================================");
+            }
+
+            InputStream outputStream = process.getInputStream();
+            count = outputStream.available();
+            if (count > 0) {
+                byte[] b = new byte[count];
+                outputStream.read(b);
+                System.err.println("========= Child VM System.out ========");
+                System.err.print(new String(b));
+                System.err.println("======================================");
+            }
+        } catch (Throwable e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+        switch (returnCode) {
+        case Util.CODE_NOT_RETURNED:
+            throw new RuntimeException("Child VM: failed to start");
+        case Util.CODE_FAILURE:
+            throw new RuntimeException("Child VM: abnormal termination");
+        default:
+            if (dropCount == 2) {
+                int expectedRetCode = 0;
+                if (successCodes[0]) {
+                    expectedRetCode |= Util.CODE_FIRST_SUCCESS;
+                }
+                if (successCodes[1]) {
+                    expectedRetCode |= Util.CODE_SECOND_SUCCESS;
+                }
+                if (expectedRetCode != returnCode) {
+                    throw new RuntimeException("The test failed. Expected:" +
+                                               expectedRetCode + ". Returned:" +
+                                               returnCode);
+                }
+            }
+            break;
+        }
+    } // start()
+} // class InterJVMGetDropSuccessTest
+
+final class Util implements AWTEventListener {
+    public static final int CODE_NOT_RETURNED = -1;
+    public static final int CODE_FIRST_SUCCESS = 0x2;
+    public static final int CODE_SECOND_SUCCESS = 0x2;
+    public static final int CODE_FAILURE = 0x1;
+
+    public static final int FRAME_ACTIVATION_TIMEOUT = 3000;
+
+    static final Object SYNC_LOCK = new Object();
+    static final int MOUSE_RELEASE_TIMEOUT = 1000;
+
+    static final Util theInstance = new Util();
+
+    static {
+        Toolkit.getDefaultToolkit().addAWTEventListener(theInstance, AWTEvent.MOUSE_EVENT_MASK);
+    }
+
+    public static Point getCenterLocationOnScreen(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+        p.translate(d.width / 2, d.height / 2);
+        return p;
+    }
+
+    public static int sign(int n) {
+        return n < 0 ? -1 : n == 0 ? 0 : 1;
+    }
+
+    private Component clickedComponent = null;
+
+    private void reset() {
+        clickedComponent = null;
+    }
+
+    public void eventDispatched(AWTEvent e) {
+        if (e.getID() == MouseEvent.MOUSE_RELEASED) {
+            clickedComponent = (Component)e.getSource();
+            synchronized (SYNC_LOCK) {
+                SYNC_LOCK.notifyAll();
+            }
+        }
+    }
+
+    public static boolean pointInComponent(Robot robot, Point p, Component comp)
+      throws InterruptedException {
+        return theInstance.pointInComponentImpl(robot, p, comp);
+    }
+
+    private boolean pointInComponentImpl(Robot robot, Point p, Component comp)
+      throws InterruptedException {
+        robot.waitForIdle();
+        reset();
+        robot.mouseMove(p.x, p.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        synchronized (SYNC_LOCK) {
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT);
+        }
+
+        Component c = clickedComponent;
+
+        while (c != null && c != comp) {
+            c = c.getParent();
+        }
+
+        return c == comp;
+    }
+}
+
+class Child {
+    static class DragSourceDropListener extends DragSourceAdapter {
+        private boolean finished = false;
+        private boolean dropSuccess = false;
+
+        public void reset() {
+            finished = false;
+            dropSuccess = false;
+        }
+
+        public boolean isDropFinished() {
+            return finished;
+        }
+
+        public boolean getDropSuccess() {
+            return dropSuccess;
+        }
+
+        public void dragDropEnd(DragSourceDropEvent dsde) {
+            finished = true;
+            dropSuccess = dsde.getDropSuccess();
+            synchronized (Util.SYNC_LOCK) {
+                Util.SYNC_LOCK.notifyAll();
+            }
+        }
+    }
+
+    final Frame frame = new Frame("Source Frame");
+    final DragSource dragSource = DragSource.getDefaultDragSource();
+    final DragSourceDropListener dragSourceListener = new DragSourceDropListener();
+    final Transferable transferable = new StringSelection("TEXT");
+    final DragGestureListener dragGestureListener = new DragGestureListener() {
+            public void dragGestureRecognized(DragGestureEvent dge) {
+                dge.startDrag(null, transferable, dragSourceListener);
+            }
+        };
+    final DragGestureRecognizer dragGestureRecognizer =
+        dragSource.createDefaultDragGestureRecognizer(frame, DnDConstants.ACTION_COPY,
+                                                      dragGestureListener);
+
+    public static void main(String[] args) {
+        Child child = new Child();
+        child.run(args);
+    }
+
+    public void run(String[] args) {
+        try {
+            if (args.length != 4) {
+                throw new RuntimeException("Incorrect command line arguments.");
+            }
+
+            int x = Integer.parseInt(args[0]);
+            int y = Integer.parseInt(args[1]);
+            int w = Integer.parseInt(args[2]);
+            int h = Integer.parseInt(args[3]);
+
+            frame.setBounds(300, 200, 150, 150);
+            frame.setVisible(true);
+
+            Thread.sleep(Util.FRAME_ACTIVATION_TIMEOUT);
+
+            Point sourcePoint = Util.getCenterLocationOnScreen(frame);
+
+            Point targetPoint = new Point(x + w / 2, y + h / 2);
+
+            Robot robot = new Robot();
+            robot.mouseMove(sourcePoint.x, sourcePoint.y);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            for (Point p = new Point(sourcePoint); !p.equals(targetPoint);
+                 p.translate(Util.sign(targetPoint.x - p.x),
+                             Util.sign(targetPoint.y - p.y))) {
+                robot.mouseMove(p.x, p.y);
+                Thread.sleep(50);
+            }
+
+            synchronized (Util.SYNC_LOCK) {
+                robot.mouseRelease(InputEvent.BUTTON1_MASK);
+                Util.SYNC_LOCK.wait(Util.FRAME_ACTIVATION_TIMEOUT);
+            }
+
+            if (!dragSourceListener.isDropFinished()) {
+                throw new RuntimeException("Drop not finished");
+            }
+
+            boolean success1 = dragSourceListener.getDropSuccess();
+
+            dragSourceListener.reset();
+            robot.mouseMove(sourcePoint.x, sourcePoint.y);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            for (Point p = new Point(sourcePoint); !p.equals(targetPoint);
+                 p.translate(Util.sign(targetPoint.x - p.x),
+                             Util.sign(targetPoint.y - p.y))) {
+                robot.mouseMove(p.x, p.y);
+                Thread.sleep(50);
+            }
+
+            synchronized (Util.SYNC_LOCK) {
+                robot.mouseRelease(InputEvent.BUTTON1_MASK);
+                Util.SYNC_LOCK.wait(Util.FRAME_ACTIVATION_TIMEOUT);
+            }
+
+            if (!dragSourceListener.isDropFinished()) {
+                throw new RuntimeException("Drop not finished");
+            }
+
+            boolean success2 = dragSourceListener.getDropSuccess();
+            int retCode = 0;
+
+            if (success1) {
+                retCode |= Util.CODE_FIRST_SUCCESS;
+            }
+            if (success2) {
+                retCode |= Util.CODE_SECOND_SUCCESS;
+            }
+            // This returns the diagnostic code from the child VM
+            System.exit(retCode);
+        } catch (Throwable e) {
+            e.printStackTrace();
+            // This returns the diagnostic code from the child VM
+            System.exit(Util.CODE_FAILURE);
+        }
+    } // run()
+} // class child
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+ {
+   private static TestDialog dialog;
+
+   public static void createDialogWithInstructions( String[] instructions )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      dialog.printInstructions( instructions );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+   public static void createDialog( )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      String[] defInstr = { "Instructions will appear here. ", "" } ;
+      dialog.printInstructions( defInstr );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+
+   public static void printInstructions( String[] instructions )
+    {
+      dialog.printInstructions( instructions );
+    }
+
+
+   public static void println( String messageIn )
+    {
+      dialog.displayMessage( messageIn );
+    }
+
+ }// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+ {
+
+   TextArea instructionsText;
+   TextArea messageText;
+   int maxStringLength = 80;
+
+   //DO NOT call this directly, go through Sysout
+   public TestDialog( Frame frame, String name )
+    {
+      super( frame, name );
+      int scrollBoth = TextArea.SCROLLBARS_BOTH;
+      instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+      add( "North", instructionsText );
+
+      messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+      add("South", messageText);
+
+      pack();
+
+      show();
+    }// TestDialog()
+
+   //DO NOT call this directly, go through Sysout
+   public void printInstructions( String[] instructions )
+    {
+      //Clear out any current instructions
+      instructionsText.setText( "" );
+
+      //Go down array of instruction strings
+
+      String printStr, remainingStr;
+      for( int i=0; i < instructions.length; i++ )
+       {
+         //chop up each into pieces maxSringLength long
+         remainingStr = instructions[ i ];
+         while( remainingStr.length() > 0 )
+          {
+            //if longer than max then chop off first max chars to print
+            if( remainingStr.length() >= maxStringLength )
+             {
+               //Try to chop on a word boundary
+               int posOfSpace = remainingStr.
+                  lastIndexOf( ' ', maxStringLength - 1 );
+
+               if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+               printStr = remainingStr.substring( 0, posOfSpace + 1 );
+               remainingStr = remainingStr.substring( posOfSpace + 1 );
+             }
+            //else just print
+            else
+             {
+               printStr = remainingStr;
+               remainingStr = "";
+             }
+
+            instructionsText.append( printStr + "\n" );
+
+          }// while
+
+       }// for
+
+    }//printInstructions()
+
+   //DO NOT call this directly, go through Sysout
+   public void displayMessage( String messageIn )
+    {
+      messageText.append( messageIn + "\n" );
+    }
+
+ }// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.html	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,45 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug 4870762
+  @summary tests that a drop target JVM doesn't crash if the source doesn't export 
+           data in native formats.
+  @author das@sparc.spb.su area=dnd
+  @run applet NoFormatsCrashTest.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>NoFormatsCrashTest<br>Bug ID: 4870762</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="NoFormatsCrashTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/dnd/NoFormatsCrashTest/NoFormatsCrashTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,488 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 4870762
+  @summary tests that a drop target JVM doesn't crash if the source doesn't export
+           data in native formats.
+  @author das@sparc.spb.su area=dnd
+  @compile NoFormatsCrashTest.java
+  @run applet NoFormatsCrashTest.html
+*/
+
+// Note there is no @ in front of test above.  This is so that the
+//  harness will not mistake this file as a test file.  It should
+//  only see the html file as a test file. (the harness runs all
+//  valid test files, so it would run this test twice if this file
+//  were valid as well as the html file.)
+// Also, note the area= after Your Name in the author tag.  Here, you
+//  should put which functional area the test falls in.  See the
+//  AWT-core home page -> test areas and/or -> AWT team  for a list of
+//  areas.
+// Note also the 'NoFormatsCrashTest.html' in the run tag.  This should
+//  be changed to the name of the test.
+
+
+/**
+ * NoFormatsCrashTest.java
+ *
+ * summary: tests that a drop target JVM doesn't crash if the source doesn't export
+ *          data in native formats.
+ */
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.datatransfer.*;
+import java.awt.dnd.*;
+import java.awt.event.*;
+import java.io.*;
+
+
+//Automated tests should run as applet tests if possible because they
+// get their environments cleaned up, including AWT threads, any
+// test created threads, and any system resources used by the test
+// such as file descriptors.  (This is normally not a problem as
+// main tests usually run in a separate VM, however on some platforms
+// such as the Mac, separate VMs are not possible and non-applet
+// tests will cause problems).  Also, you don't have to worry about
+// synchronisation stuff in Applet tests they way you do in main
+// tests...
+
+
+public class NoFormatsCrashTest extends Applet {
+
+    final Frame frame = new Frame();
+    private volatile Process process;
+
+    static final int FRAME_ACTIVATION_TIMEOUT = 2000;
+
+    public static void main(String[] args) {
+        NoFormatsCrashTest test = new NoFormatsCrashTest();
+        test.run(args);
+    }
+
+    public void run(String[] args) {
+        try {
+            if (args.length != 4) {
+                throw new RuntimeException("Incorrect command line arguments.");
+            }
+
+            int x = Integer.parseInt(args[0]);
+            int y = Integer.parseInt(args[1]);
+            int w = Integer.parseInt(args[2]);
+            int h = Integer.parseInt(args[3]);
+
+            Panel panel = new DragSourcePanel();
+
+            frame.setTitle("Drag source frame");
+            frame.setLocation(500, 200);
+            frame.add(panel);
+            frame.pack();
+            frame.setVisible(true);
+
+            Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
+
+            Point sourcePoint = panel.getLocationOnScreen();
+            Dimension d = panel.getSize();
+            sourcePoint.translate(d.width / 2, d.height / 2);
+
+            Point targetPoint = new Point(x + w / 2, y + h / 2);
+
+            Robot robot = new Robot();
+            robot.mouseMove(sourcePoint.x, sourcePoint.y);
+            robot.keyPress(KeyEvent.VK_CONTROL);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            for (; !sourcePoint.equals(targetPoint);
+                 sourcePoint.translate(sign(targetPoint.x - sourcePoint.x),
+                                       sign(targetPoint.y - sourcePoint.y))) {
+                robot.mouseMove(sourcePoint.x, sourcePoint.y);
+                Thread.sleep(50);
+            }
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+            robot.keyRelease(KeyEvent.VK_CONTROL);
+
+            Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
+
+            if (process.isAlive()) {
+                process.destroy();
+            }
+        } catch (Throwable e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    } // run()
+
+    public void init() {
+        //Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test",
+            "simply wait until it is done"
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        frame.setTitle("Drop target frame");
+        frame.setLocation(200, 200);
+
+    } // init()
+
+    public void start() {
+        DropTargetPanel panel = new DropTargetPanel();
+        frame.add(panel);
+        frame.pack();
+        frame.setVisible(true);
+
+        try {
+            Thread.sleep(FRAME_ACTIVATION_TIMEOUT);
+
+            Point p = frame.getLocationOnScreen();
+            Dimension d = frame.getSize();
+
+            String javaPath = System.getProperty("java.home", "");
+            String command = javaPath + File.separator + "bin" +
+                File.separator + "java -cp " + System.getProperty("test.classes", ".") +
+                " NoFormatsCrashTest " +
+                p.x + " " + p.y + " " + d.width + " " + d.height;
+
+            process = Runtime.getRuntime().exec(command);
+            ProcessResults pres = ProcessResults.doWaitFor(process);
+            System.err.println("Child VM return code: " + pres.exitValue);
+
+            if (pres.stderr != null && pres.stderr.length() > 0) {
+                System.err.println("========= Child VM System.err ========");
+                System.err.print(pres.stderr);
+                System.err.println("======================================");
+            }
+
+            if (pres.stdout != null && pres.stdout.length() > 0) {
+                System.err.println("========= Child VM System.out ========");
+                System.err.print(pres.stdout);
+                System.err.println("======================================");
+            }
+
+        } catch (Throwable e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+
+        if (panel.isTestFailed()) {
+            throw new RuntimeException();
+        }
+    } // start()
+
+    public static int sign(int n) {
+        return n < 0 ? -1 : n > 0 ? 1 : 0;
+    }
+} // class NoFormatsCrashTest
+
+class TestTransferable implements Transferable {
+
+    public static DataFlavor dataFlavor = null;
+    static final Object data = new Object();
+
+    static {
+        DataFlavor df = null;
+        try {
+            df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType +
+                                "; class=java.lang.Object");
+        } catch (ClassNotFoundException e) {
+            throw new ExceptionInInitializerError(e);
+        }
+        dataFlavor = df;
+    }
+
+    public DataFlavor[] getTransferDataFlavors() {
+        return new DataFlavor[] { dataFlavor };
+    }
+
+    public boolean isDataFlavorSupported(DataFlavor df) {
+        return dataFlavor.equals(df);
+    }
+
+    public Object getTransferData(DataFlavor df)
+      throws UnsupportedFlavorException, IOException {
+        if (!isDataFlavorSupported(df)) {
+            throw new UnsupportedFlavorException(df);
+        }
+        return data;
+    }
+}
+
+class DragSourcePanel extends Panel {
+    public DragSourcePanel() {
+        final Transferable t = new TestTransferable();
+        final DragSourceListener dsl = new DragSourceAdapter() {
+                public void dragDropEnd(DragSourceDropEvent dtde) {
+                    try {
+                        Thread.sleep(100);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                    // This finishes child VM
+                    System.exit(0);
+                }
+            };
+        final DragGestureListener dgl = new DragGestureListener() {
+                public void dragGestureRecognized(DragGestureEvent dge) {
+                    dge.startDrag(null, t, dsl);
+                }
+            };
+        final DragSource ds = DragSource.getDefaultDragSource();
+        final DragGestureRecognizer dgr =
+            ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY,
+                                                  dgl);
+    }
+
+    public Dimension getPreferredSize() {
+        return new Dimension(100, 100);
+    }
+}
+
+class DropTargetPanel extends Panel {
+    private boolean testFailed = false;
+    public DropTargetPanel() {
+        final DropTargetListener dtl = new DropTargetAdapter() {
+                public void dragOver(DropTargetDragEvent dtde) {
+                    try {
+                        dtde.getCurrentDataFlavorsAsList();
+                    } catch (Exception e) {
+                        testFailed = true;
+                        e.printStackTrace();
+                    }
+                }
+                public void drop(DropTargetDropEvent dtde) {
+                    dtde.rejectDrop();
+                }
+            };
+        final DropTarget dt = new DropTarget(this, dtl);
+    }
+
+    public boolean isTestFailed() {
+        return testFailed;
+    }
+
+    public Dimension getPreferredSize() {
+        return new Dimension(100, 100);
+    }
+}
+
+class ProcessResults {
+    public int exitValue;
+    public String stdout;
+    public String stderr;
+
+    public ProcessResults() {
+        exitValue = -1;
+        stdout = "";
+        stderr = "";
+    }
+
+    /**
+     * Method to perform a "wait" for a process and return its exit value.
+     * This is a workaround for <code>Process.waitFor()</code> never returning.
+     */
+    public static ProcessResults doWaitFor(Process p) {
+        ProcessResults pres = new ProcessResults();
+
+        InputStream in = null;
+        InputStream err = null;
+
+        try {
+            in = p.getInputStream();
+            err = p.getErrorStream();
+
+            boolean finished = false;
+
+            while (!finished) {
+                try {
+                    while (in.available() > 0) {
+                        pres.stdout += (char)in.read();
+                    }
+                    while (err.available() > 0) {
+                        pres.stderr += (char)err.read();
+                    }
+                    // Ask the process for its exitValue. If the process
+                    // is not finished, an IllegalThreadStateException
+                    // is thrown. If it is finished, we fall through and
+                    // the variable finished is set to true.
+                    pres.exitValue = p.exitValue();
+                    finished  = true;
+                }
+                catch (IllegalThreadStateException e) {
+                    // Process is not finished yet;
+                    // Sleep a little to save on CPU cycles
+                    Thread.currentThread().sleep(500);
+                }
+            }
+            if (in != null) in.close();
+            if (err != null) err.close();
+        }
+        catch (Throwable e) {
+            System.err.println("doWaitFor(): unexpected exception");
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+        return pres;
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+ {
+   private static TestDialog dialog;
+
+   public static void createDialogWithInstructions( String[] instructions )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      dialog.printInstructions( instructions );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+   public static void createDialog( )
+    {
+      dialog = new TestDialog( new Frame(), "Instructions" );
+      String[] defInstr = { "Instructions will appear here. ", "" } ;
+      dialog.printInstructions( defInstr );
+      dialog.show();
+      println( "Any messages for the tester will display here." );
+    }
+
+
+   public static void printInstructions( String[] instructions )
+    {
+      dialog.printInstructions( instructions );
+    }
+
+
+   public static void println( String messageIn )
+    {
+      dialog.displayMessage( messageIn );
+    }
+
+ }// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+ {
+
+   TextArea instructionsText;
+   TextArea messageText;
+   int maxStringLength = 80;
+
+   //DO NOT call this directly, go through Sysout
+   public TestDialog( Frame frame, String name )
+    {
+      super( frame, name );
+      int scrollBoth = TextArea.SCROLLBARS_BOTH;
+      instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+      add( "North", instructionsText );
+
+      messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+      add("South", messageText);
+
+      pack();
+
+      show();
+    }// TestDialog()
+
+   //DO NOT call this directly, go through Sysout
+   public void printInstructions( String[] instructions )
+    {
+      //Clear out any current instructions
+      instructionsText.setText( "" );
+
+      //Go down array of instruction strings
+
+      String printStr, remainingStr;
+      for( int i=0; i < instructions.length; i++ )
+       {
+         //chop up each into pieces maxSringLength long
+         remainingStr = instructions[ i ];
+         while( remainingStr.length() > 0 )
+          {
+            //if longer than max then chop off first max chars to print
+            if( remainingStr.length() >= maxStringLength )
+             {
+               //Try to chop on a word boundary
+               int posOfSpace = remainingStr.
+                  lastIndexOf( ' ', maxStringLength - 1 );
+
+               if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+               printStr = remainingStr.substring( 0, posOfSpace + 1 );
+               remainingStr = remainingStr.substring( posOfSpace + 1 );
+             }
+            //else just print
+            else
+             {
+               printStr = remainingStr;
+               remainingStr = "";
+             }
+
+            instructionsText.append( printStr + "\n" );
+
+          }// while
+
+       }// for
+
+    }//printInstructions()
+
+   //DO NOT call this directly, go through Sysout
+   public void displayMessage( String messageIn )
+    {
+      messageText.append( messageIn + "\n" );
+    }
+
+ }// TestDialog  class
--- a/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/java/awt/regtesthelpers/process/ProcessCommunicator.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,22 @@
 
 import java.io.*;
 
-/** This class is created to solve interprocess communication problems.
+/**
+ *  This class is created to solve interprocess communication problems.
  *  When you need to write a regression test which should verify inter jvm
  *  behavior such as DnD data transfer, Clipboard data transfer, focus
  *  transfer etc., you could use the next scenario:
  *
  *  1. Write an implementation for the parent JVM, using applet test.
- *  2. Write an implimentation for the child JVM or native application, using
+ *  2. Write an implementation for the child JVM or native application, using
  *     main() function.
  *  3. Execute child process using  ProcessCommunicator.executeChildProcess()
  *     method.
- *  4. You can decide whetherthe test is passed on the basis of
+ *  4. You can decide whether the test is passed on the basis of
  *     ProcessResults class data.
  *
- *  Note: The class is not thread safe. You should access its methods only from the same
- *        thread.
+ *  Note: The class is not thread safe. You should access its methods only from
+ *        the same thread.
  */
 
 public class ProcessCommunicator {
@@ -48,31 +49,34 @@
     private static final String javaPath = javaHome + File.separator + "bin" +
             File.separator + "java ";
     private static String command = "";
+    private static volatile Process process;
 
     private ProcessCommunicator() {}
 
-    /** The same as {#link #executeChildProcess(Class,String)} except
-     *  the {@code classPathArgument} parameter. The class path
-     *  parameter is for the debug purposes
+    /**
+     * The same as {#link #executeChildProcess(Class,String)} except
+     * the {@code classPathArgument} parameter. The class path
+     * parameter is for the debug purposes
      *
-     *  @param classToExecute is passed to the child JVM
-     *  @param classPathArguments class path for the child JVM
-     *  @param args arguments that will be passed to the executed class
-     *  @return results of the executed {@code Process}
+     * @param classToExecute is passed to the child JVM
+     * @param classPathArguments class path for the child JVM
+     * @param args arguments that will be passed to the executed class
+     * @return results of the executed {@code Process}
      */
     public static ProcessResults executeChildProcess(final Class classToExecute,
                            final String classPathArguments, final String [] args)
     {
         try {
             String command = buildCommand(classToExecute, classPathArguments, args);
-            Process process = Runtime.getRuntime().exec(command);
+            process = Runtime.getRuntime().exec(command);
             return doWaitFor(process);
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
     }
 
-    /** Executes child {code Process}
+    /**
+     * Executes child {code Process}
      *
      * @param classToExecute class to be executed as a child java process
      * @param args args to be passed in to the child process
@@ -86,11 +90,11 @@
 
     /**
      * Waits for a process and return its results.
-     * This is a workaround for <code>Process.waitFor()</code> never returning.
+     * This is a workaround for {@code Process.waitFor()} never returning.
      *
      * @return results of the executed {@code Process}
      */
-    private static ProcessResults doWaitFor(final Process p) {
+    public static ProcessResults doWaitFor(final Process p) {
         ProcessResults pres = new ProcessResults();
 
         final InputStream in;
@@ -133,13 +137,14 @@
         return pres;
     }
 
-    /** Builds command on the basis of the passed class name,
-     *  class path and arguments.
+    /**
+     * Builds command on the basis of the passed class name,
+     * class path and arguments.
      *
      * @param classToExecute with class will be executed in the new JVM
      * @param classPathArguments java class path (only for test purposes)
      * @param args arguments for the new application. This could be used
-     *             to pass some information from the parnent to child JVM.
+     *             to pass some information from the parent to child JVM.
      * @return command to execute the {@code Process}
      */
     private static String buildCommand(final Class classToExecute,
@@ -162,11 +167,24 @@
         return command;
     }
 
-    /** Could be used for the debug purposes.
+    /**
+     * Could be used for the debug purposes.
      *
-      * @return command that was build to execute the child process
+     * @return command that was build to execute the child process
      */
     public static String getExecutionCommand () {
         return command;
     }
+
+    /**
+     * Terminates the process created by {@code executeChildProcess} methods.
+     */
+    public static void destroyProcess() {
+        if (process != null) {
+            if (process.isAlive()) {
+                process.destroy();
+            }
+            process = null;
+        }
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 8041490
+  @summary tests that the WarningWindow's surface is invalidated on dispose
+  @author Petr Pchelko
+  @run main/othervm WarningWindowDisposeCrashTest
+*/
+
+
+import sun.applet.AppletSecurity;
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+
+public class WarningWindowDisposeCrashTest {
+    public static void main(String[] args) throws Exception {
+        System.setSecurityManager(new AppletSecurity() {
+            @Override
+            public void checkPackageAccess (String s){
+            }
+        });
+
+        Frame f = new Frame();
+        f.setVisible(true);
+        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Thread.sleep(1000);
+        f.dispose();
+        // If the bug is present VM could crash after this call
+        for (int i = 0; i < 1000; i++) Toolkit.getDefaultToolkit().sync();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test8040656.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.beans.Introspector;
+import java.beans.MethodDescriptor;
+
+/*
+ * @test
+ * @bug 8040656
+ * @summary Tests that a normal method is preferred to a synthetic one
+ * @author Sergey Malenkov
+ */
+
+public class Test8040656 {
+    public static void main(String[] args) throws Exception {
+        test(String.class, C.class);
+        test(String.class, C1.class);
+        test(String.class, C2.class);
+        test(String.class, C3.class);
+        test(String.class, C4.class);
+        test(String.class, C5.class);
+        test(String.class, C6.class);
+        test(String.class, C7.class);
+        test(String.class, C8.class);
+        test(String.class, C9.class);
+    }
+
+    private static void test(Class<?> type, Class<?> bean) throws Exception {
+        for (MethodDescriptor md : Introspector.getBeanInfo(bean).getMethodDescriptors()) {
+            if (md.getName().equals("getFoo")) {
+                if (type != md.getMethod().getReturnType()) {
+                    throw new Error("unexpected type");
+                }
+            }
+        }
+    }
+
+    public interface A {
+        public Object getFoo();
+    }
+
+    public class C implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+    }
+
+    public class C1 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+    }
+
+    public class C2 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+    }
+
+    public class C3 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+    }
+
+    public class C4 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+    }
+
+    public class C5 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+    }
+
+    public class C6 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+    }
+
+    public class C7 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+
+        public String getFoo7() {
+            return null;
+        }
+    }
+
+    public class C8 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+
+        public String getFoo7() {
+            return null;
+        }
+
+        public String getFoo8() {
+            return null;
+        }
+    }
+
+    public class C9 implements A {
+        @Override
+        public String getFoo() {
+            return null;
+        }
+
+        public String getFoo1() {
+            return null;
+        }
+
+        public String getFoo2() {
+            return null;
+        }
+
+        public String getFoo3() {
+            return null;
+        }
+
+        public String getFoo4() {
+            return null;
+        }
+
+        public String getFoo5() {
+            return null;
+        }
+
+        public String getFoo6() {
+            return null;
+        }
+
+        public String getFoo7() {
+            return null;
+        }
+
+        public String getFoo8() {
+            return null;
+        }
+
+        public String getFoo9() {
+            return null;
+        }
+    }
+}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,7 @@
  * @bug 4199068 4738465 4937983 4930681 4926230 4931433 4932663 4986689
  *      5026830 5023243 5070673 4052517 4811767 6192449 6397034 6413313
  *      6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
- *      4947220 7018606 7034570 4244896 5049299
+ *      4947220 7018606 7034570 4244896 5049299 8003488
  * @summary Basic tests for Process and Environment Variable code
  * @run main/othervm/timeout=300 Basic
  * @run main/othervm/timeout=300 -Djdk.lang.Process.launchMechanism=fork Basic
@@ -1136,6 +1136,53 @@
         }
     }
 
+    static void checkProcessPid() {
+        long actualPid = 0;
+        long expectedPid = -1;
+        if (Windows.is()) {
+            String[] argsTasklist = {"tasklist.exe",  "/NH", "/FI",  "\"IMAGENAME eq tasklist.exe\""};
+            ProcessBuilder pb = new ProcessBuilder(argsTasklist);
+            try {
+                Process proc = pb.start();
+                expectedPid = proc.getPid();
+
+                String output = commandOutput(proc);
+                String[] splits = output.split("\\s+");
+                actualPid = Integer.valueOf(splits[2]);
+            } catch (Throwable t) {
+                unexpected(t);
+            }
+        } else if (Unix.is() || MacOSX.is()) {
+            String[]  shArgs = {"sh", "-c", "echo $$"};
+            ProcessBuilder pb = new ProcessBuilder(shArgs);
+            try {
+                Process proc = pb.start();
+                expectedPid = proc.getPid();
+
+                String output = commandOutput(proc);
+                String[] splits = output.split("\\s+");
+                actualPid = Integer.valueOf(splits[0]);
+            } catch (Throwable t) {
+                unexpected(t);
+            }
+        } else {
+            fail("No test for checkProcessPid on platform: " + System.getProperty("os.name"));
+            return;
+        }
+
+        equal(actualPid, expectedPid);
+
+        // Test the default implementation of Process.getPid
+        try {
+            DelegatingProcess p = new DelegatingProcess(null);
+            p.getPid();
+            fail("non-overridden Process.getPid method should throw UOE");
+        } catch (UnsupportedOperationException uoe) {
+            // correct
+        }
+
+    }
+
     private static void realMain(String[] args) throws Throwable {
         if (Windows.is())
             System.out.println("This appears to be a Windows system.");
@@ -1148,6 +1195,11 @@
         catch (Throwable t) { unexpected(t); }
 
         //----------------------------------------------------------------
+        // Basic tests for getPid()
+        //----------------------------------------------------------------
+        checkProcessPid();
+
+        //----------------------------------------------------------------
         // Basic tests for setting, replacing and deleting envvars
         //----------------------------------------------------------------
         try {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/TypeVariableBounds.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8038994
+ * @summary Test that getAnnotatedBounds().getType() match getBounds()
+ * @run testng TypeVariableBounds
+ */
+
+import java.io.Serializable;
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+import java.util.concurrent.Callable;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.*;
+
+public class TypeVariableBounds {
+    @Test(dataProvider = "classData")
+    public void testClass(Class<?> c) throws Exception {
+        assertNotEquals(c.getTypeParameters().length, 0);
+
+        TypeVariable[] tv = c.getTypeParameters();
+
+        for(TypeVariable t : tv)
+            testTv(t);
+
+    }
+
+    @Test(dataProvider = "methodData")
+    public void testMethod(Class<?>c) throws Exception {
+        Method m = c.getMethod("aMethod");
+        TypeVariable[] tv = m.getTypeParameters();
+
+        for(TypeVariable t : tv)
+            testTv(t);
+
+    }
+
+    public void testTv(TypeVariable<?> tv) {
+        Type[] t = tv.getBounds();
+        AnnotatedType[] at = tv.getAnnotatedBounds();
+
+        assertEquals(t.length, at.length, Arrays.asList(t) + " and " + Arrays.asList(at) + " should be the same length");
+
+        for (int i = 0; i < t.length; i++)
+            assertSame(at[i].getType(), t[i], "T: " + t[i] + ", AT: " + at[i] + ", AT.getType(): " + at[i].getType() + "\n");
+    }
+
+    @DataProvider
+    public Object[][] classData() { return CLASS_TESTS; }
+
+    @DataProvider
+    public Object[][] methodData() { return METHOD_TESTS; }
+
+    public static final Object[][] CLASS_TESTS = {
+        { Case1.class, },
+        { Case2.class, },
+        { Case5.class, },
+        { Case6.class, },
+    };
+
+    public static final Object[][] METHOD_TESTS = {
+        { Case3.class, },
+        { Case4.class, },
+        { Case5.class, },
+        { Case6.class, },
+    };
+
+    // Class type var
+    public static class Case1<C1T1, C1T2 extends AnnotatedElement, C1T3 extends AnnotatedElement & Type & Serializable> {}
+    public static class Case2<C2T0, @TA C2T1 extends Type, C2T2 extends @TB AnnotatedElement, C2T3 extends AnnotatedElement & @TB Type & Serializable> {}
+
+    // Method type var
+    public static class Case3 { public <C3T1, C3T2 extends AnnotatedElement, C3T3 extends AnnotatedElement & Type & Serializable> void aMethod() {}}
+    public static class Case4 { public <C4T0, @TA C4T1 extends List, C4T2 extends @TB Set, C4T3 extends Set & @TB Callable & Serializable> void aMethod() {}}
+
+    // Both
+    public static class Case5 <C5CT1, C5CT2 extends Runnable> {
+        public <C5MT1,
+               C5MT2 extends AnnotatedElement,
+               C5MT3 extends AnnotatedElement & Type & Serializable,
+               C5MT4 extends C5CT2>
+                   void aMethod() {}}
+
+    public static class Case6 <@TA C6CT1, C6CT2 extends @TB Runnable> {
+        public <@TA C6MT1,
+               C6MT2 extends @TB AnnotatedElement,
+               C6MT3 extends @TB AnnotatedElement & @TB2 Type & Serializable,
+               C6MT4 extends @TB2 C6CT2>
+                   void aMethod() {}}
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE_PARAMETER)
+    public @interface TA {}
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE_USE)
+    public @interface TB {}
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.TYPE_USE)
+    public @interface TB2 {}
+}
--- a/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThread.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThread.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,7 +26,7 @@
  * @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
  * @library /lib/testlibrary
  *
- * @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
+ * @build jdk.testlibrary.* DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
  * @run shell ../MakeJAR3.sh DummyAgent
  * @run main TestDaemonThreadLauncher /timeout=240
  *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/invoke/LambdaFormTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @summary unit tests for java.lang.invoke.LambdaForm
+ * @run junit/othervm test.java.lang.invoke.LambdaFormTest
+ */
+package test.java.lang.invoke;
+
+import org.junit.Test;
+import java.lang.reflect.Method;
+import static org.junit.Assert.*;
+
+public class LambdaFormTest {
+    static final Method M_shortenSignature;
+    static {
+        try {
+            Class<?> impl = Class.forName("java.lang.invoke.LambdaForm", false, null);
+            Method m = impl.getDeclaredMethod("shortenSignature", String.class);
+            m.setAccessible(true);
+            M_shortenSignature = m;
+        } catch(Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    public static String shortenSignature(String signature) throws ReflectiveOperationException {
+        return (String)M_shortenSignature.invoke(null, signature);
+    }
+
+    @Test
+    public void testShortenSignature() throws ReflectiveOperationException {
+        for (String s : new String[] {
+                // invariant strings:
+                "L", "LL", "ILL", "LIL", "LLI", "IILL", "ILIL", "ILLI",
+                // a few mappings:
+                "LLL=L3", "LLLL=L4", "LLLLLLLLLL=L10",
+                "IIIDDD=I3D3", "IDDD=ID3", "IIDDD=IID3", "IIID=I3D", "IIIDD=I3DD"
+            }) {
+            String s2 = s.substring(s.indexOf('=')+1);
+            String s1 = s.equals(s2) ? s : s.substring(0, s.length() - s2.length() - 1);
+            // mix the above cases with before and after reps of Z*
+            for (int k = -3; k <= 3; k++) {
+                String beg = (k < 0 ? "ZZZZ".substring(-k) : "");
+                String end = (k > 0 ? "ZZZZ".substring(+k) : "");
+                String ks1 = beg+s1+end;
+                String ks2 = shortenSignature(beg)+s2+shortenSignature(end);
+                String ks3 = shortenSignature(ks1);
+                assertEquals(ks2, ks3);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws ReflectiveOperationException {
+        LambdaFormTest test = new LambdaFormTest();
+        test.testShortenSignature();
+    }
+}
--- a/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Wed Jul 05 19:42:29 2017 +0200
@@ -33,7 +33,7 @@
  * @author  Mandy Chung
  *
  * @library /lib/testlibrary/
- * @build ResetPeakMemoryUsage MemoryUtil RunUtil
+ * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
  * @run main ResetPeakMemoryUsage
  */
 
--- a/jdk/test/java/sql/util/BaseTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/java/sql/util/BaseTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -61,29 +61,31 @@
     public void tearDownMethod() throws Exception {
     }
 
-    /**
+    /*
      * Take some form of SQLException, serialize and deserialize it
-     *
-     * @param <T> SQLException
-     * @param ex SQLException
-     * @return deserialized SQLException
-     * @throws IOException
-     * @throws ClassNotFoundException
      */
     @SuppressWarnings("unchecked")
     protected <T extends SQLException> T
             createSerializedException(T ex)
             throws IOException, ClassNotFoundException {
-        T ex1;
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try (ObjectOutputStream oos = new ObjectOutputStream(baos) ) {
-            oos.writeObject(ex);
-        }
-        try (ObjectInputStream ois =
-                new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
-            ex1 = (T) ois.readObject();
-        }
-        return ex1;
+        return (T) serializeDeserializeObject(ex);
     }
 
+    /*
+     * Utility method to serialize and deserialize an object
+     */
+    @SuppressWarnings("unchecked")
+    protected <T> T serializeDeserializeObject(T o)
+            throws IOException, ClassNotFoundException {
+        T o1;
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+            oos.writeObject(o);
+        }
+        try (ObjectInputStream ois
+                = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+            o1 = (T) ois.readObject();
+        }
+        return o1;
+    }
 }
--- a/jdk/test/java/util/BitSet/BSMethods.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/java/util/BitSet/BSMethods.java	Wed Jul 05 19:42:29 2017 +0200
@@ -26,6 +26,7 @@
  *      4979017 4979028 4979031 5030267 6222207 8040806
  * @summary Test the operation of the methods of BitSet class
  * @author Mike McCloskey, Martin Buchholz
+ * @run main/othervm BSMethods
  */
 
 import java.util.*;
@@ -897,15 +898,20 @@
     private static void testToString() {
         check(new BitSet().toString().equals("{}"));
         check(makeSet(2,3,42,43,234).toString().equals("{2, 3, 42, 43, 234}"));
-        try {
-            check(makeSet(Integer.MAX_VALUE-1).toString().equals(
-                    "{" + (Integer.MAX_VALUE-1) + "}"));
-            check(makeSet(Integer.MAX_VALUE).toString().equals(
-                    "{" + Integer.MAX_VALUE + "}"));
-            check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals(
-                    "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}"));
-        } catch (IndexOutOfBoundsException exc) {
-            fail("toString() with indices near MAX_VALUE");
+
+        final long MB = 1024*1024;
+        if (Runtime.getRuntime().maxMemory() >= 512*MB) {
+            // only run it if we have enough memory
+            try {
+                check(makeSet(Integer.MAX_VALUE-1).toString().equals(
+                        "{" + (Integer.MAX_VALUE-1) + "}"));
+                check(makeSet(Integer.MAX_VALUE).toString().equals(
+                        "{" + Integer.MAX_VALUE + "}"));
+                check(makeSet(0, 1, Integer.MAX_VALUE-1, Integer.MAX_VALUE).toString().equals(
+                        "{0, 1, " + (Integer.MAX_VALUE-1) + ", " + Integer.MAX_VALUE + "}"));
+            } catch (IndexOutOfBoundsException exc) {
+                fail("toString() with indices near MAX_VALUE");
+            }
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/png/ReadMalformedPngTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     6945174
+ * @summary Test verifies that PNG image readr throw correct exception
+ *          if image contains a chunk with incorrect length.
+ * @run     main ReadMalformedPngTest
+ */
+
+import java.awt.Color;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import javax.imageio.IIOException;
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageTypeSpecifier;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.ImageWriter;
+import javax.imageio.metadata.IIOMetadata;
+import javax.imageio.metadata.IIOMetadataNode;
+import javax.imageio.stream.ImageOutputStream;
+import org.w3c.dom.Node;
+
+public class ReadMalformedPngTest {
+
+    public static void main(String[] args) throws IOException {
+        ByteArrayInputStream bais = new ByteArrayInputStream(createTestPng());
+
+        IIOException expected = null;
+        try {
+            ImageIO.read(bais);
+        } catch (IIOException e) {
+            expected = e;
+        } catch (Throwable e) {
+            throw new RuntimeException("Test failed!", e);
+        }
+
+        if (expected == null) {
+            throw new RuntimeException("Test failed.");
+        }
+
+        System.out.println("Test passed.");
+    }
+
+    private static byte[] createTestPng() throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+        BufferedImage img = createTestImage();
+
+        try {
+            ImageOutputStream ios = ImageIO.createImageOutputStream(baos);
+
+            ImageWriter w = ImageIO.getImageWritersByFormatName("PNG").next();
+
+            w.setOutput(ios);
+
+            ImageWriteParam p = w.getDefaultWriteParam();
+
+            ImageTypeSpecifier t = ImageTypeSpecifier.createFromRenderedImage(img);
+
+            IIOMetadata m = w.getDefaultImageMetadata(t, p);
+
+            String nativeMetadataFormat = m.getNativeMetadataFormatName();
+
+            Node root = m.getAsTree(nativeMetadataFormat);
+
+            IIOMetadataNode textEntry = new IIOMetadataNode("tEXtEntry");
+            textEntry.setAttribute("keyword", "comment");
+            textEntry.setAttribute("value", "This is a test image for JDK-6945174");
+
+            IIOMetadataNode text = new IIOMetadataNode("tEXt");
+            text.appendChild(textEntry);
+
+            root.appendChild(text);
+
+            m.mergeTree(nativeMetadataFormat, root);
+
+            IIOImage iio_img = new IIOImage(img, null, m);
+
+            w.write(iio_img);
+
+            w.dispose();
+            ios.flush();
+            ios.close();
+        } catch (IOException e) {
+            throw new RuntimeException("Test failed.", e);
+        }
+
+        baos.flush();
+
+        byte[] data = baos.toByteArray();
+
+        adjustCommentLength(Integer.MAX_VALUE + 0x1000, data);
+
+        return data;
+    }
+
+    private static void adjustCommentLength(int v, byte[] data) {
+        final int pos = getCommentPos(data);
+        data[pos + 3] = (byte) (v & 0xFF);
+        v = v >> 8;
+        data[pos + 2] = (byte) (v & 0xFF);
+        v = v >> 8;
+        data[pos + 1] = (byte) (v & 0xFF);
+        v = v >> 8;
+        data[pos + 0] = (byte) (v & 0xFF);
+    }
+
+    private static int getCommentPos(byte[] d) {
+        int p = 8;
+        while (p + 8 < d.length) {
+            if (d[p + 4] == (byte) 0x74 && d[p + 5] == (byte) 0x45 &&
+                d[p + 6] == (byte) 0x58 && d[p + 7] == (byte) 0x74)
+            {
+                return p;
+            }
+            p++;
+        }
+        throw new RuntimeException("Test chunk was not found!");
+    }
+
+    private static BufferedImage createTestImage() {
+        final int w = 128;
+        final int h = 128;
+
+        BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR);
+        Graphics2D g = img.createGraphics();
+        g.setPaint(new GradientPaint(0, 0, Color.blue,
+                w, h, Color.red));
+        g.fillRect(0, 0, w, h);
+        g.dispose();
+        return img;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/TEST.properties	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,2 @@
+# JDBC unit tests uses TestNG
+TestNG.dirs= .
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialArrayTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.sql.Array;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.rowset.serial.SerialArray;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubArray;
+
+public class SerialArrayTests extends BaseTest {
+
+    private Object[] coffees;
+    private final String sqlType = "VARCHAR";
+    private Array a;
+    private Map<String, Class<?>> map;
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+        coffees = new Object[]{"Espresso", "Colombian", "French Roast",
+            "Cappuccino"};
+        a = new StubArray(sqlType, coffees);
+        map = new HashMap<>();
+    }
+
+    /*
+     * Validate a SerialArray can be created from an Array
+     */
+    @Test
+    public void test01() throws Exception {
+        SerialArray sa = new SerialArray(a);
+    }
+
+    /*
+     * Validate a SQLException is thrown if the map is null
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test02() throws Exception {
+        SerialArray sa = new SerialArray(a, null);
+    }
+
+    /*
+     * Validate a SerialException is thrown when getResultSet() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test03() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.getResultSet();
+    }
+
+    /*
+     * Validate a SerialException is thrown when getResultSet() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test04() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.getResultSet(null);
+    }
+
+    /*
+     * Validate a SerialException is thrown when getResultSet() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test05() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.getResultSet(1, 1);
+    }
+
+    /*
+     * Validate a SerialException is thrown when getResultSet() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test06() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.getResultSet(1, 1, null);
+    }
+
+    /*
+     * Validate a SerialException is thrown when  getArray() is invoked after
+     * free() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test07() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.free();
+        sa.getArray();
+    }
+
+    /*
+     * Validate a SerialException is thrown when  getArray() is invoked after
+     * free() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test08() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.free();
+        sa.getArray(map);
+    }
+
+    /*
+     * Validate a SerialException is thrown when  getArray() is invoked after
+     * free() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test09() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.free();
+        sa.getArray(1, 1, map);
+    }
+
+    /*
+     * Validate a SerialException is thrown when  getArray() is invoked after
+     * free() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test10() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.free();
+        sa.getArray(1, 1);
+    }
+
+    /*
+     * Validate a SerialException is thrown when  getBaseType() is invoked after
+     * free() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test11() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.free();
+        sa.getBaseType();
+    }
+
+    /*
+     * Validate a SerialException is thrown when  getBaseTypeName() is invoked after
+     * free() is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test12() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        sa.free();
+        sa.getBaseTypeName();
+    }
+
+    /*
+     * Validate getArray() returns the same Object[] used to create the
+     * SerialArray
+     */
+    @Test
+    public void test13() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        Object[] o = (Object[]) sa.getArray();
+        assertTrue(Arrays.equals(o, coffees));
+    }
+
+    /*
+     * Validate getArray() returns the same Object[] used to create the
+     * SerialArray
+     */
+    @Test
+    public void test14() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        Object[] o = (Object[]) sa.getArray(map);
+        assertTrue(Arrays.equals(o, coffees));
+    }
+
+    /*
+     * Validate getArray() returns the same Object[] used to create the
+     * SerialArray
+     */
+    @Test
+    public void test15() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        Object[] o = (Object[]) sa.getArray(1, 2);
+        assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3)));
+    }
+
+    /*
+     * Validate getArray() returns the same Object[] used to create the
+     * SerialArray
+     */
+    @Test
+    public void test16() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        Object[] o = (Object[]) sa.getArray(1, 2, map);
+        assertTrue(Arrays.equals(o, Arrays.copyOfRange(coffees, 1, 3)));
+    }
+
+    /*
+     * clone() a SerialArray and check that it is equal to the
+     * object it was cloned from
+     */
+    @Test
+    public void test17() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        SerialArray sa1 = (SerialArray) sa.clone();
+        assertTrue(sa.equals(sa1));
+    }
+
+    /*
+     * Validate that a SerialArray that is serialized & deserialized is equal to
+     * itself
+     */
+    @Test
+    public void test18() throws Exception {
+        SerialArray sa = new SerialArray(a);
+        SerialArray sa1 = serializeDeserializeObject(sa);;
+        assertTrue(sa.equals(sa1));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialBlobTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,399 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import javax.sql.rowset.serial.SerialBlob;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubBlob;
+
+public class SerialBlobTests extends BaseTest {
+
+    // byte[] used to populate SerialBlob
+    private byte[] bytes = new byte[]{1, 2, 3, 4, 5};
+
+    /*
+     * Validate calling free() does not throw an Exception
+     */
+    @Test
+    public void test() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+    }
+
+    /*
+     * Validate calling getBinaryStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test01() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.getBinaryStream();
+    }
+
+    /*
+     * Validate calling getBinaryStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test02() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.getBinaryStream(1, 5);
+    }
+
+    /*
+     * Validate calling getBytes() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test03() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.getBytes(1, 1);
+    }
+
+    /*
+     * Validate calling getLength() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test04() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.length();
+    }
+
+    /*
+     * Validate calling position() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test05() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.position(new byte[5], 1);
+    }
+
+    /*
+     * Validate calling position() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test06() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.position(new StubBlob(), 1);
+    }
+
+    /*
+     * Validate calling free() after calling setBinaryStream() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test07() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.setBinaryStream(5);
+    }
+
+    /*
+     * Validate calling free() after calling setBytes() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test08() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.setBytes(1, new byte[5]);
+    }
+
+    /*
+     * Validate calling setBytes() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test09() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.setBytes(1, new byte[10], 0, 5);
+    }
+
+    /*
+     * Validate calling truncate() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test10() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        sb.free();
+        sb.truncate(1);
+    }
+
+    /*
+     * Validate getBinaryStream returns the correct bytes
+     */
+    @Test
+    public void test11() throws Exception {
+        byte[] expected = new byte[]{1, 2, 3};
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream(1, 3);
+        for (byte b : expected) {
+            byte val = (byte) is.read();
+            assertTrue(b == val, val + " does not match " + b);
+        }
+    }
+
+    /*
+     * Validate a SerialException is thrown if pos < 0 for getBinaryStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test12() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream(-1, 3);
+    }
+
+    /*
+     * Validate a SerialException is thrown if pos = 0 for getBinaryStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test13() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream(0, 3);
+    }
+
+    /*
+     * Validate a SerialException is thrown if len > the length of the stream
+     * for getBinaryStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test14() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream(0, 3);
+    }
+
+    /*
+     * Validate a SerialException is thrown if length < 1
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test15() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream(1, 0);
+    }
+
+    /*
+     * Validate a SerialException is thrown if length > byte array length
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test16() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream(1, 6);
+    }
+
+    /*
+     * Validate a SerialException is thrown if pos > byte array length
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test17() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream(bytes.length + 2, 6);
+    }
+
+    /*
+     * Validate that a cloned SerializedBlob bytes match the original
+     */
+    @Test
+    public void test18() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        SerialBlob sb2 = (SerialBlob) sb.clone();
+        assertTrue(
+                Arrays.equals(sb.getBytes(1, (int) sb.length()),
+                        sb2.getBytes(1, (int) sb2.length())),
+                "arrays do not match ");
+    }
+
+    /*
+     * Test clone after free has been called that the clone is not accessible
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test19() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        sb.free();
+        SerialBlob sb2 = (SerialBlob) sb.clone();
+        InputStream is = sb2.getBinaryStream(1, 3);
+    }
+
+    /*
+     * Validate that a SerialBlob that is serialized & deserialized is equal to
+     * itself
+     */
+    @Test
+    public void test20() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        SerialBlob sb2 = serializeDeserializeObject(sb);
+        assertTrue(sb.equals(sb2), "SerialBlob not equal");
+    }
+
+    /*
+     * Validate a SerialException is thrown if byte[] is used to
+     * create the SeriablBlob and setBinaryStream is called
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test21() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        sb.setBinaryStream(3);
+    }
+
+    /*
+     * Validate that setBytes will properly write a set of bytes to the
+     * specified location in the SerialBlob and the correct count is returned
+     * for bytes written
+     */
+    @Test
+    public void test22() throws Exception {
+        byte[] diff = new byte[]{7, 8, 9};
+        byte[] expected = new byte[]{1, 7, 8, 9, 5};
+        SerialBlob sb = new SerialBlob(bytes);
+        int written = sb.setBytes(2, diff);
+        assertEquals(written, diff.length);
+        assertTrue(
+                Arrays.equals(sb.getBytes(1, (int) sb.length()),
+                        expected),
+                "arrays do not match ");
+    }
+
+    /*
+     * Validate that setBytes will properly write a set of bytes to the
+     * specified location in the SerialBlob and the correct count is returned
+     * for bytes written
+     */
+    @Test
+    public void test23() throws Exception {
+        int bytesToWrite = 3;
+        byte[] diff = new byte[]{7, 8, 9, 0};
+        byte[] expected = new byte[]{1, 8, 9, 0, 5};
+        SerialBlob sb = new SerialBlob(bytes);
+        int written = sb.setBytes(2, diff, 1, bytesToWrite);
+        assertEquals(written, bytesToWrite);
+        assertTrue(
+                Arrays.equals(sb.getBytes(1, (int) sb.length()),
+                        expected),
+                "arrays do not match ");
+    }
+
+    /*
+     * Validate that truncate reduces the length of the SerlizedBlob to the
+     * specified value
+     */
+    @Test
+    public void test24() throws Exception {
+        SerialBlob sb = new SerialBlob(bytes);
+        sb.truncate(0);
+        assertTrue(sb.length() == 0);
+        sb = new SerialBlob(bytes);
+        sb.truncate(3);
+        assertTrue(sb.length() == 3);
+    }
+
+    /*
+     * Validate getBinaryStream returns the correct bytes
+     */
+    @Test
+    public void test25() throws Exception {
+        byte[] expected = bytes;
+        SerialBlob sb = new SerialBlob(bytes);
+        InputStream is = sb.getBinaryStream();
+        for (byte b : expected) {
+            byte val = (byte) is.read();
+            assertTrue(b == val, val + " does not match " + b);
+        }
+    }
+
+    /*
+     * Validate setBinaryStream returns an OutputStream when passed a Blob
+     */
+    @Test
+    public void test26() throws Exception {
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        OutputStream os = sb.setBinaryStream(0);
+        assertTrue(os != null);
+    }
+
+    /*
+     * Validate that position returns the correct starting location for a
+     * pattern in the SerialBlob
+     */
+    @Test
+    public void test27() throws Exception {
+        long expectedPos = 3; // starting offset is 1 vs 0
+        byte[] pattern = new byte[]{3, 4};
+        SerialBlob sb = new SerialBlob(bytes);
+        long pos = sb.position(pattern, 1);
+        assertEquals(pos, expectedPos);
+    }
+
+    /*
+     * Validate that position returns the correct starting location for a
+     * pattern in the SerialBlob
+     */
+    @Test
+    public void test28() throws Exception {
+        long expectedPos = 3; // starting offset is 1 vs 0
+        byte[] pattern = new byte[]{3, 4, 5};
+        SerialBlob sb = new SerialBlob(bytes);
+        long pos = sb.position(pattern, 2);
+        assertEquals(pos, expectedPos);
+    }
+
+    /*
+     * Validate that position returns the correct starting location for a
+     * pattern in the SerialBlob
+     */
+    @Test
+    public void test29() throws Exception {
+        long expectedPos = 2; // starting offset is 1 vs 0
+        byte[] pattern = new byte[]{4, 6};
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        long pos = sb.position(pattern, 1);
+        assertEquals(pos, expectedPos);
+    }
+
+    /*
+     * Validate that position returns the correct starting location for a
+     * pattern in the SerialBlob
+     */
+    @Test
+    public void test30() throws Exception {
+        long expectedPos = 3; // starting offset is 1 vs 0
+        byte[] pattern = new byte[]{6, 8};
+        SerialBlob sb = new SerialBlob(new StubBlob());
+        long pos = sb.position(pattern, 2);
+        assertEquals(pos, expectedPos);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialClobTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,499 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import javax.sql.rowset.serial.SerialClob;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubClob;
+
+public class SerialClobTests extends BaseTest {
+
+    // char[] used to populate SerialClob
+    private final char[] chars;
+
+    public SerialClobTests() {
+        this.chars = new char[]{'h', 'e', 'l', 'l', 'o', ' ', 'w',
+            'o', 'r', 'l', 'd'};
+    }
+
+    /*
+     * Validate calling free() does not throw an Exception
+     */
+    @Test
+    public void test() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+    }
+
+    /*
+     * Validate calling getCharacterStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test01() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.getCharacterStream();
+    }
+
+    /*
+     * Validate calling getCharacterStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test02() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        sc.free();
+        sc.getCharacterStream();
+    }
+
+    /*
+     * Validate calling getCharacterStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test03() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.getCharacterStream(1, 5);
+    }
+
+    /*
+     * Validate calling getSubString() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test04() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.getSubString(1, 1);
+    }
+
+    /*
+     * Validate calling truncate() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test05() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.truncate(1);
+    }
+
+    /*
+     * Validate calling getAsciiStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test06() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.getAsciiStream();
+    }
+
+    /*
+     * Validate calling length() after calling free() throws an SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test07() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.length();
+    }
+
+    /*
+     * Validate calling position() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test08() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.position("hello", 1);
+    }
+
+    /*
+     * Validate calling position() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test09() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.position(new StubClob(), 1);
+    }
+
+    /*
+     * Validate calling setAsciiStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test10() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.setAsciiStream(5);
+    }
+
+    /*
+     * Validate calling setCharacterStream() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test11() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.setCharacterStream(5);
+    }
+
+    /*
+     * Validate calling setString() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test12() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.setString(1, "hello");
+    }
+
+    /*
+     * Validate calling setString() after calling free() throws an
+     * SerialException
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test13() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.free();
+        sc.setString(1, "hello", 0, 5);
+    }
+
+    /*
+     * Test that SerialException is thrown if pos < 0 on a call to
+     * getCharacterStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test14() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        sc.getCharacterStream(-1, 5);
+    }
+
+    /*
+     * Test that SerialException is thrown if pos = 0 on a call to
+     * getCharacterStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test15() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        sc.getCharacterStream(0, 5);
+    }
+
+    /*
+     * Test that SerialException is thrown if pos = 0 on a call to
+     * getCharacterStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test16() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        sc.getCharacterStream(1, 100);
+    }
+
+    /*
+     * Test that SerialException is thrown if length = 0 on a call to
+     * getCharacterStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test17() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        sc.getCharacterStream(1, 0);
+    }
+
+    /*
+     * Test that SerialException is thrown if pos > length on a call to
+     * getCharacterStream
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test18() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        sc.getCharacterStream(100, 5);
+    }
+
+    /*
+     * Clone a SerialClob and check that it is equal to itself
+     */
+    @Test
+    public void test19() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        SerialClob sc1 = (SerialClob) sc.clone();
+        assertTrue(sc.equals(sc1), "SerialClobs not equal");
+    }
+
+    /*
+     * Validate that a getAsciiStream() returns an InputStream when a Clob is
+     * used to create the SerialClob
+     */
+    @Test
+    public void test20() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        InputStream is = sc.getAsciiStream();
+        assertTrue(is != null);
+    }
+
+    /*
+     * Validate that a getCharacterStream() returns an Reader when a Clob is
+     * used to create the SerialClob
+     */
+    @Test
+    public void test21() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        Reader is = sc.getCharacterStream();
+        assertTrue(is != null);
+    }
+
+    /*
+     * Validate that a getCharacterStream() returns an Reader when a char[] is
+     * used to create the SerialClob
+     */
+    @Test
+    public void test22() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        Reader is = sc.getCharacterStream();
+        assertTrue(is != null);
+    }
+
+    /*
+     * Validate that a getSubString() returns the correct value when a char[] is
+     * used to create the SerialClob
+     */
+    @Test
+    public void test23() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        String expected = "world";
+        assertEquals(expected, sc.getSubString(7, 5));
+    }
+
+    /*
+     * Validate that a getSubString() returns the correct value when a Clob is
+     * used to create the SerialClob
+     */
+    @Test
+    public void test24() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        String expected = "test string";
+        assertEquals(expected, sc.getSubString(5, 11));
+    }
+
+    /*
+     * Validate that position() returns the correct value when a Clob is used to
+     * create the SerialClob
+     */
+    @Test
+    public void test25() throws Exception {
+        long expectedPos = 5;
+        SerialClob sc = new SerialClob(new StubClob());
+        String expected = "test string";
+        long pos = sc.position(expected, 1);
+        assertEquals(expectedPos, pos);
+    }
+
+    /*
+     * Validate that position returned is -1 when an the search string is not
+     * part of the SerialClob
+     */
+    @Test
+    public void test26() throws Exception {
+        long expectedPos = -1;
+        SerialClob sc = new SerialClob(chars);
+        String expected = "test string";
+        long pos = sc.position(expected, 1);
+        assertEquals(expectedPos, pos);
+    }
+
+    /*
+     * Validate that position() returned is -1 when an the search string is not
+     * part of the SerialClob
+     */
+    @Test
+    public void test27() throws Exception {
+        long expectedPos = -1;
+        SerialClob sc = new SerialClob(new StubClob());
+        String expected = "I am Batman";
+        long pos = sc.position(expected, 2);
+        assertEquals(expectedPos, pos);
+    }
+
+    /*
+     * Validate that position() returns the correct value when a char[] is used
+     * to create the SerialClob
+     */
+    @Test
+    public void test28() throws Exception {
+        long expectedPos = 2;
+        SerialClob sc = new SerialClob(chars);
+        String expected = "ello";
+        long pos = sc.position(expected, 1);
+        assertEquals(expectedPos, pos);
+    }
+
+    /*
+     * Validate that position() returns the correct value when a SerialClob is
+     * used for the search argument
+     */
+    @Test
+    public void test29() throws Exception {
+        long expectedPos = 21;
+        String expected = "Batman";
+        String buf = "I am Joker, not the Batman, hahaha";
+        SerialClob sc = new SerialClob(expected.toCharArray());
+        SerialClob sc1 = new SerialClob(buf.toCharArray());
+        long pos = sc1.position(sc, 1);
+        assertEquals(expectedPos, pos);
+    }
+
+    /*
+     * Validate that position() returns the correct value when a SerialClob is
+     * used for the search argument
+     */
+    @Test
+    public void test30() throws Exception {
+        long expectedPos = 17;
+        String expected = "012";
+        SerialClob sc = new SerialClob(expected.toCharArray());
+        SerialClob sc1 = new SerialClob(new StubClob());
+        long pos = sc1.position(sc, 1);
+        assertEquals(expectedPos, pos);
+    }
+
+    /*
+     * Check that setString() updates the appropriate characters in the
+     * SerialClob
+     */
+    @Test
+    public void test31() throws Exception {
+        String val = "Hello, I am Bruce Wayne";
+        String val1 = "the Batman!";
+        String expected = "Hello, I am the Batman!";
+        SerialClob sc = new SerialClob(val.toCharArray());
+        int written = sc.setString(13, val1);
+        assertEquals(val1.length(), written);
+        assertTrue(expected.equals(sc.getSubString(1, (int) sc.length())));
+    }
+
+    /*
+     * Check that setString() updates the appropriate characters in the
+     * SerialClob
+     */
+    @Test(enabled = false)
+    public void test32() throws Exception {
+        int expectedWritten = 9;
+        String val = "Hi, I am Catwoman!!!!!!";
+        String val1 = "Hahaha the Joker, who are you?!";
+        String expected = "Hi, I am the Joker!";
+        SerialClob sc = new SerialClob(val.toCharArray());
+        int written = sc.setString(10, val1, 8, expectedWritten+1);
+        assertEquals(written, expectedWritten);
+
+    }
+
+    /*
+     * Check that setCharacterStream() returns a non-null Writer for an
+     * SerialClob created from a Clob
+     */
+    @Test
+    public void test33() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        Writer w = sc.setCharacterStream(1);
+        assertTrue(w != null);
+    }
+
+    /*
+     * Check that setAsciiStream() returns a non-null OutputStream for an SerialClob
+     * created from a Clob
+     */
+    @Test
+    public void test34() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        OutputStream os = sc.setAsciiStream(1);
+        assertTrue(os != null);
+    }
+
+    /*
+     * Check that truncate() truncates the length of the SerialClob to the
+     * specified size
+     */
+    @Test
+    public void test35() throws Exception {
+        SerialClob sc = new SerialClob(new StubClob());
+        sc.truncate(0);
+        assertTrue(sc.length() == 0);
+        sc = new SerialClob(chars);
+        sc.truncate(5);
+        assertTrue(sc.length() == 5);
+    }
+
+    /*
+     * Check that getCharacterStream() returns a Reader and that the char[] that
+     * was specified to create the SerialClob can be returned via the Reader
+     */
+    @Test
+    public void test36() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        Reader r = sc.getCharacterStream();
+        for (char c : chars) {
+            char val = (char) r.read();
+            assertTrue(c == val, val + " does not match " + c);
+        }
+    }
+
+    /*
+     * Check that getCharacterStream() returns a Reader and that the char[] that
+     * was specified to create the SerialClob can be returned via the Reader
+     */
+    @Test(enabled = false)
+    public void test37() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        String expected = "ello w";
+        Reader r = sc.getCharacterStream(2, 6);
+        for (char c : expected.toCharArray()) {
+            char val = (char) r.read();
+            assertTrue(c == val, val + " does not match " + c);
+        }
+    }
+
+    /*
+     * Validate that a SerialClob that is serialized & deserialized is equal to
+     * itself
+     */
+    @Test
+    public void test38() throws Exception {
+        SerialClob sc = new SerialClob(chars);
+        SerialClob sc2 = serializeDeserializeObject(sc);
+        assertTrue(sc.equals(sc2), "SerialClobs not equal");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialDataLinkTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.net.URL;
+import javax.sql.rowset.serial.SerialDatalink;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SerialDataLinkTests extends BaseTest {
+
+    private URL u;
+    private URL u1;
+    private SerialDatalink dl;
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+        u = new URL("http://www.oracle.com/");
+        u1 = new URL("http://www.usatoday.com/");
+        dl = new SerialDatalink(u);
+    }
+
+    /*
+     * Validate that a SerialException is thrown if the URL is null
+     */
+    @Test(expectedExceptions = SerialException.class)
+    public void test() throws Exception {
+        SerialDatalink dl1 = new SerialDatalink(null);
+    }
+
+    /*
+     * Validate that getDatalink() returns the same URL used to create the
+     * SerialDatalink object
+     */
+    @Test
+    public void test01() throws Exception {
+        URL u2 = dl.getDatalink();
+        assertTrue(u2.equals(u));
+        assertTrue(u2.sameFile(u));
+    }
+
+    /*
+     * Validate that URL returned from getDatalink() differs from a URL that was
+     * not used to create the SerialDatalink
+     */
+    @Test
+    public void test02() throws Exception {
+        URL u2 = dl.getDatalink();
+        assertFalse(u2.equals(u1));
+        assertFalse(u2.sameFile(u1));
+    }
+
+    /*
+     * Create a clone of a SerialDatalink and validate that it is equal to the
+     * SerialDatalink it was cloned from
+     */
+    @Test
+    public void test03() throws Exception {
+        SerialDatalink dl2 = (SerialDatalink) dl.clone();
+        assertTrue(dl.equals(dl2));
+        SerialDatalink dl3 = new SerialDatalink(u1);
+        assertFalse(dl2.equals(dl3));
+    }
+
+    /*
+     * Validate that a SerialDatalink that is serialized & deserialized is
+     * equal to itself
+     */
+    @Test
+    public void test04() throws Exception {
+        SerialDatalink dl2 = serializeDeserializeObject(dl);
+        SerialDatalink dl3 = new SerialDatalink(u);
+        assertTrue(dl.equals(dl2));
+        assertTrue(dl3.equals(dl2));
+    }
+
+    /**
+     * Validate that a SerialDatalink that is serialized & deserialized is not equal
+     * to to a SerialDatalink created using a different URL
+     */
+    @Test
+    public void test05() throws Exception {
+        SerialDatalink dl2 = serializeDeserializeObject(dl);
+        SerialDatalink d3 = new SerialDatalink(u1);
+        assertFalse(d3.equals(dl2));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialExceptionTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.sql.SQLException;
+import javax.sql.rowset.serial.SerialException;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SerialExceptionTests extends BaseTest {
+
+    /*
+     * Create SerialException with no-arg constructor
+     */
+    @Test
+    public void test01() {
+        SerialException ex = new SerialException();
+        assertTrue(ex.getMessage() == null
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /*
+     * Create SerialException with message
+     */
+    @Test
+    public void test02() {
+        SerialException ex = new SerialException(reason);
+        assertTrue(ex.getMessage().equals(reason)
+                && ex.getSQLState() == null
+                && ex.getCause() == null
+                && ex.getErrorCode() == 0);
+    }
+
+    /*
+     * Validate that the ordering of the returned Exceptions is correct using
+     * for-each loop
+     */
+    @Test
+    public void test03() {
+        SerialException ex = new SerialException("Exception 1");
+        ex.initCause(t1);
+        SerialException ex1 = new SerialException("Exception 2");
+        SerialException ex2 = new SerialException("Exception 3");
+        ex2.initCause(t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        for (Throwable e : ex) {
+            assertTrue(msgs[num++].equals(e.getMessage()));
+        }
+    }
+
+    /*
+     * Validate that the ordering of the returned Exceptions is correct using
+     * traditional while loop
+     */
+    @Test
+    public void test04() {
+        SQLException ex = new SerialException("Exception 1");
+        ex.initCause(t1);
+        SerialException ex1 = new SerialException("Exception 2");
+        SerialException ex2 = new SerialException("Exception 3");
+        ex2.initCause(t2);
+        ex.setNextException(ex1);
+        ex.setNextException(ex2);
+        int num = 0;
+        while (ex != null) {
+            assertTrue(msgs[num++].equals(ex.getMessage()));
+            Throwable c = ex.getCause();
+            while (c != null) {
+                assertTrue(msgs[num++].equals(c.getMessage()));
+                c = c.getCause();
+            }
+            ex = ex.getNextException();
+        }
+    }
+
+    /*
+     * Serialize a SerialException and make sure you can read it back properly
+     */
+    @Test
+    public void test05() throws Exception {
+        SerialException e = new SerialException(reason);
+        SerialException ex1 = createSerializedException(e);
+        assertTrue(ex1.getMessage().equals(reason)
+                && ex1.getSQLState() == null
+                && ex1.getCause() == null
+                && ex1.getErrorCode() == 0);;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialJavaObjectTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import javax.sql.rowset.RowSetMetaDataImpl;
+import javax.sql.rowset.serial.SerialException;
+import javax.sql.rowset.serial.SerialJavaObject;
+import static org.testng.Assert.*;
+import org.testng.annotations.Test;
+import util.BaseTest;
+
+public class SerialJavaObjectTests extends BaseTest {
+
+    /*
+     * Validate that an NPE is thrown when null is specified to create
+     * the SerialJavaObject
+     */
+    @Test(expectedExceptions = NullPointerException.class)
+    public void test() throws Exception {
+        SerialJavaObject sjo = new SerialJavaObject(null);
+    }
+
+    /*
+     * Validate that an SerialExcepion is thrown when the object specified
+     * contains public static fields
+     */
+    @Test(expectedExceptions = SerialException.class, enabled = false)
+    public void test01() throws Exception {
+        SerialJavaObject sjo = new SerialJavaObject(new RowSetMetaDataImpl());
+    }
+
+    /*
+     * Validate that an getFields()s returns the same Field[] for the object
+     * used to create the SerialJavaObject
+     */
+    @Test
+    public void test02() throws Exception {
+        SerialException e = new SerialException();
+        SerialJavaObject sjo = new SerialJavaObject(e);
+        Field[] f = e.getClass().getFields();
+        assertTrue(Arrays.equals(f, sjo.getFields()));
+        assertFalse(Arrays.equals("hello".getClass().getFields(),
+                sjo.getFields()));
+    }
+
+    /*
+     * clone() a SerialJavaObject and check that it is equal to the
+     * object it was cloned from
+     */
+    @Test
+    public void test03() throws Exception {
+        SerialJavaObject sjo = new SerialJavaObject("Hello");
+        SerialJavaObject sjo2 = (SerialJavaObject) sjo.clone();
+        assertTrue(sjo.equals(sjo2));
+    }
+
+    /**
+     * Validate that a SerialJavaObject that is serialized & deserialized is
+     * equal to itself
+     */
+    @Test
+    public void test04() throws Exception {
+        SerialJavaObject sjo = new SerialJavaObject("Hello");
+        SerialJavaObject sjo2 = serializeDeserializeObject(sjo);
+        assertTrue(sjo.equals(sjo2));
+    }
+
+    /*
+     * Validate that a getObject() returns an object used to create the
+     * SerialJavaObject
+     */
+    @Test
+    public void test05() throws Exception {
+        String s = "Hello world";
+        SerialJavaObject sjo = new SerialJavaObject(s);
+        assertTrue(s.equals(sjo.getObject()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialRefTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.sql.Ref;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.rowset.serial.SerialRef;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubRef;
+import util.SuperHero;
+
+public class SerialRefTests extends BaseTest {
+
+    private static Map<String, Class<?>> map = new HashMap<>();
+    private Ref ref;
+    private final String sqlType = "SUPERHERO";
+    private SuperHero hero;
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+        map.put(sqlType, Class.forName("util.SuperHero"));
+        hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
+        ref = new StubRef(sqlType, hero);
+    }
+
+    /*
+     * Validate that a SQLException() is thrown if the Ref is null
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test01() throws Exception {
+        SerialRef sr = new SerialRef(null);
+    }
+
+    /*
+     * Validate that a SQLException() is thrown if the typeName is null in the
+     * Ref used to create the SerialRef
+     */
+    @Test(expectedExceptions = SQLException.class)
+    public void test02() throws Exception {
+        SerialRef sr = new SerialRef(new StubRef(null, hero));
+    }
+
+    /*
+     * Validate that getBaseTypeName() returns the same SQLType specified
+     * to create the Ref
+     */
+    @Test
+    public void test03() throws Exception {
+        SerialRef sr = new SerialRef(ref);
+        assertEquals(sr.getBaseTypeName(), sqlType);
+    }
+
+    /*
+     * Validate that getObject() returns the same object used to create the Ref
+     */
+    @Test
+    public void test04() throws Exception {
+        SerialRef sr = new SerialRef(ref);
+        assertTrue(hero.equals(sr.getObject()));
+    }
+
+    /*
+     * Validate that getObject() returns the same object used to create the Ref
+     */
+    @Test(enabled = false)
+    public void test05() throws Exception {
+        SerialRef sr = new SerialRef(ref);
+        assertTrue(hero.equals(sr.getObject(map)));
+    }
+
+    /*
+     * Validate that setObject() can be used to change the value of the object
+     * pointed to by the SerialRef
+     */
+    @Test
+    public void test06() throws Exception {
+        SerialRef sr = new SerialRef(ref);
+        assertTrue(hero.equals(sr.getObject()));
+        SuperHero h = new SuperHero(sqlType, "Dick", "Grayson", 1940, "Robin");
+        sr.setObject(h);
+        assertFalse(hero.equals(sr.getObject()));
+    }
+
+    /*
+     * clone() a SerialRef and check that it is equal to the
+     * object it was cloned from
+     */
+    @Test
+    public void test09() throws Exception {
+        SerialRef sr = new SerialRef(ref);
+        SerialRef sr1 = (SerialRef) sr.clone();
+        assertTrue(sr.equals(sr1));
+    }
+
+    /**
+     * Validate that a SerialRef that is serialized & deserialized is equal to
+     * itself for the Object & baseTypeName
+     */
+    @Test
+    public void test10() throws Exception {
+        SerialRef sr = new SerialRef(ref);
+        SerialRef sr1 = serializeDeserializeObject(sr);
+        assertTrue(sr1.getObject().equals(sr.getObject())
+                && sr1.getBaseTypeName().equals(sr.getBaseTypeName()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/test/rowset/serial/SerialStructTests.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package test.rowset.serial;
+
+import java.sql.Struct;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import javax.sql.rowset.serial.SerialStruct;
+import static org.testng.Assert.*;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import util.BaseTest;
+import util.StubStruct;
+import util.SuperHero;
+
+public class SerialStructTests extends BaseTest {
+
+    private static Map<String, Class<?>> map = new HashMap<>();
+    private Object[] attributes;
+    private Struct struct;
+    private final String sqlType = "SUPERHERO";
+    private SuperHero hero;
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+        attributes = new Object[]{"Bruce", "Wayne", 1939,
+            "Batman"};
+        map.put(sqlType, Class.forName("util.SuperHero"));
+        struct = new StubStruct(sqlType, attributes);
+        hero = new SuperHero(sqlType, "Bruce", "Wayne", 1939, "Batman");
+    }
+
+    /*
+     * Validate that getSQLTypeName() returns the same SQLType specified by
+     * the Struct used to create the object
+     */
+    @Test
+    public void test01() throws Exception {
+        SerialStruct ss = new SerialStruct(struct, map);
+        assertEquals(ss.getSQLTypeName(), sqlType);
+    }
+
+    /*
+     * Validate that getSQLTypeName() returns the same SQLType specified by
+     * the Struct used to create the object
+     */
+    @Test
+    public void test02() throws Exception {
+        SerialStruct ss = new SerialStruct(hero, map);
+        assertEquals(ss.getSQLTypeName(), sqlType);
+    }
+
+    /*
+     * Validate that getAttributes() returns the same attributes specified by
+     * the Struct used to create the object
+     */
+    @Test
+    public void test03() throws Exception {
+        SerialStruct ss = new SerialStruct(struct, map);
+        assertTrue(Arrays.equals(attributes,
+                ss.getAttributes()));
+    }
+
+    /*
+     * Validate that getAttributes() returns the same attributes specified by
+     * the Struct used to create the object
+     */
+    @Test
+    public void test04() throws Exception {
+        SerialStruct ss = new SerialStruct(hero, map);
+        assertTrue(Arrays.equals(attributes,
+                ss.getAttributes()));
+    }
+
+    /*
+     * Validate that getAttributes() returns the
+     same attributes specified by
+     * the Struct used to create the object
+     */
+    @Test
+    public void test05() throws Exception {
+        SerialStruct ss = new SerialStruct(struct, map);
+        assertTrue(Arrays.equals(attributes,
+                ss.getAttributes(map)));
+    }
+
+    /*
+     * Validate that getAttributes() returns the same attributes specified by
+     * the Struct used to create the object
+     */
+    @Test
+    public void test06() throws Exception {
+        SerialStruct ss = new SerialStruct(hero, map);
+        assertTrue(Arrays.equals(attributes,
+                ss.getAttributes(map)));
+    }
+
+    /*
+     * clone() a SerialStruct and check that it is equal to the
+     * object it was cloned from
+     */
+    @Test
+    public void test07() throws Exception {
+        SerialStruct ss = new SerialStruct(struct, map);
+        SerialStruct ss1 = (SerialStruct) ss.clone();
+        assertTrue(ss.equals(ss1));
+    }
+
+    /**
+     * Validate that a SerialStruct that is serialized & deserialized is equal
+     * to itself
+     */
+    @Test
+    public void test08() throws Exception {
+        SerialStruct ss = new SerialStruct(struct, map);
+        SerialStruct ss1 = serializeDeserializeObject(ss);;
+        assertTrue(ss.equals(ss1));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/BaseTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package util;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.sql.SQLException;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+
+public class BaseTest {
+
+    protected final String reason = "reason";
+    protected final String state = "SQLState";
+    protected final String cause = "java.lang.Throwable: cause";
+    protected final Throwable t = new Throwable("cause");
+    protected final Throwable t1 = new Throwable("cause 1");
+    protected final Throwable t2 = new Throwable("cause 2");
+    protected final int errorCode = 21;
+    protected final String[] msgs = {"Exception 1", "cause 1", "Exception 2",
+        "Exception 3", "cause 2"};
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @BeforeMethod
+    public void setUpMethod() throws Exception {
+    }
+
+    @AfterMethod
+    public void tearDownMethod() throws Exception {
+    }
+
+    /*
+     * Take some form of SQLException, serialize and deserialize it
+     */
+    @SuppressWarnings("unchecked")
+    protected <T extends SQLException> T
+            createSerializedException(T ex)
+            throws IOException, ClassNotFoundException {
+        return (T) serializeDeserializeObject(ex);
+    }
+
+    /*
+     * Utility method to serialize and deserialize an object
+     */
+    @SuppressWarnings("unchecked")
+    protected <T> T serializeDeserializeObject(T o)
+            throws IOException, ClassNotFoundException {
+        T o1;
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+            oos.writeObject(o);
+        }
+        try (ObjectInputStream ois
+                = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()))) {
+            o1 = (T) ois.readObject();
+        }
+        return o1;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubArray.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package util;
+
+import java.sql.Array;
+import java.sql.JDBCType;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Map;
+
+public class StubArray implements Array {
+
+    private String typeName;
+    Object[] elements;
+
+    public StubArray(String name, Object[] values) {
+        typeName = name;
+        elements = Arrays.copyOf(values, values.length);
+
+    }
+
+    @Override
+    public String getBaseTypeName() throws SQLException {
+        return typeName;
+    }
+
+    @Override
+    public int getBaseType() throws SQLException {
+        return JDBCType.valueOf(typeName).getVendorTypeNumber();
+    }
+
+    @Override
+    public Object getArray() throws SQLException {
+        return Arrays.copyOf(elements, elements.length);
+    }
+
+    @Override
+    public Object getArray(Map<String, Class<?>> map) throws SQLException {
+        return getArray();
+    }
+
+    @Override
+    public Object getArray(long index, int count) throws SQLException {
+        return getArray();
+    }
+
+    @Override
+    public Object getArray(long index, int count, Map<String, Class<?>> map) throws SQLException {
+        return getArray();
+    }
+
+    @Override
+    public ResultSet getResultSet() throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ResultSet getResultSet(Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ResultSet getResultSet(long index, int count) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public ResultSet getResultSet(long index, int count, Map<String, Class<?>> map) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void free() throws SQLException {
+        elements = null;
+        typeName = null;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubBlob.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.sql.Blob;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class StubBlob implements Blob {
+
+    private byte[] bytes;
+
+    public StubBlob() {
+        bytes = new byte[]{2, 4, 6, 8};
+    }
+
+    public long length() throws SQLException {
+        return bytes.length;
+    }
+
+    public byte[] getBytes(long pos, int length)
+            throws SQLException {
+        return Arrays.copyOfRange(bytes, (int) pos - 1, length);
+    }
+
+    public InputStream getBinaryStream()
+            throws SQLException {
+        return null;
+    }
+
+    public long position(byte[] pattern, long start)
+            throws SQLException {
+        return 0;
+    }
+
+    public long position(Blob pattern, long start)
+            throws SQLException {
+        return 0;
+    }
+
+    public int setBytes(long pos, byte[] bytes)
+            throws SQLException {
+        return 0;
+    }
+
+    public int setBytes(long pos, byte[] bytes, int offset, int len)
+            throws SQLException {
+        return 0;
+    }
+
+    public OutputStream setBinaryStream(long pos)
+            throws SQLException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = null;
+        try {
+            oos = new ObjectOutputStream(baos);
+        } catch (IOException ex) {
+            Logger.getLogger(StubBlob.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        return oos;
+    }
+
+    public void truncate(long len)
+            throws SQLException {
+    }
+
+    public void free() throws SQLException {
+    }
+
+    public InputStream getBinaryStream(long pos, long length) throws SQLException {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubClob.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.sql.Clob;
+import java.sql.SQLException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class StubClob implements Clob {
+
+    public String buf = "The test string 0123456789";
+
+    @Override
+    public String getSubString(long pos, int length) throws SQLException {
+        return buf;
+    }
+
+    @Override
+    public long length() throws SQLException {
+        return buf.length();
+    }
+
+    @Override
+    public Reader getCharacterStream() throws SQLException {
+        return new StringReader(buf);
+    }
+
+    @Override
+    public InputStream getAsciiStream() throws SQLException {
+        return new java.io.StringBufferInputStream(buf);
+    }
+
+    @Override
+    public int setString(long pos, String str) throws SQLException {
+        return str.length();
+    }
+
+    @Override
+    public int setString(long pos, String str, int offset, int len) throws SQLException {
+        return len;
+    }
+
+    @Override
+    public long position(String searchstr, long start) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public long position(Clob searchstr, long start) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public OutputStream setAsciiStream(long pos) throws SQLException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = null;
+        try {
+            oos = new ObjectOutputStream(baos);
+        } catch (IOException ex) {
+            Logger.getLogger(StubBlob.class.getName()).log(Level.SEVERE, null, ex);
+        }
+        return oos;
+    }
+
+    @Override
+    public Writer setCharacterStream(long pos) throws SQLException {
+        return new StringWriter();
+    }
+
+    @Override
+    public void truncate(long len) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void free() throws SQLException {
+    }
+
+    @Override
+    public Reader getCharacterStream(long pos, long length) throws SQLException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubRef.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package util;
+
+import java.io.Serializable;
+import java.sql.Ref;
+import java.sql.SQLException;
+import java.util.Map;
+
+public class StubRef implements Ref, Serializable {
+
+    private final String baseTypeName;
+    private Object obj;
+
+    public StubRef(String type, Object o) {
+        baseTypeName = type;
+        obj = o;
+    }
+
+    @Override
+    public String getBaseTypeName() throws SQLException {
+        return baseTypeName;
+    }
+
+    @Override
+    public Object getObject(Map<String, Class<?>> map) throws SQLException {
+        return obj;
+    }
+
+    @Override
+    public Object getObject() throws SQLException {
+        return getObject(null);
+    }
+
+    @Override
+    public void setObject(Object value) throws SQLException {
+        obj = value;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/StubStruct.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package util;
+
+import java.sql.SQLException;
+import java.sql.Struct;
+import java.util.Arrays;
+import java.util.Map;
+
+public class StubStruct implements Struct {
+
+    private final String type;
+    private final Object[] attribs;
+
+    public StubStruct(String type, Object[] o) {
+        this.type = type;
+        this.attribs = Arrays.copyOf(o, o.length);
+    }
+
+    @Override
+    public String getSQLTypeName() throws SQLException {
+        return type;
+    }
+
+    @Override
+    public Object[] getAttributes() throws SQLException {
+        return attribs;
+    }
+
+    @Override
+    public Object[] getAttributes(Map<String, Class<?>> map) throws SQLException {
+        return attribs;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/sql/testng/util/SuperHero.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package util;
+
+import java.io.Serializable;
+import java.sql.SQLData;
+import java.sql.SQLException;
+import java.sql.SQLInput;
+import java.sql.SQLOutput;
+
+public class SuperHero implements SQLData, Serializable {
+
+    private String first;
+    private String last;
+    private final String type;
+    private Integer firstYear;
+    private String secretIdentity;
+
+    public SuperHero(String sqlType, String fname, String lname, Integer year,
+            String identity) {
+        first = fname;
+        last = lname;
+        type = sqlType;
+        firstYear = year;
+        secretIdentity = identity;
+    }
+
+    @Override
+    public String getSQLTypeName() throws SQLException {
+        return type;
+    }
+
+    @Override
+    public void readSQL(SQLInput stream, String typeName) throws SQLException {
+        first = stream.readString();
+        last = stream.readString();
+        firstYear = stream.readInt();
+        secretIdentity = stream.readString();
+    }
+
+    @Override
+    public void writeSQL(SQLOutput stream) throws SQLException {
+        stream.writeString(first);
+        stream.writeString(last);
+        stream.writeInt(firstYear);
+        stream.writeString(secretIdentity);
+    }
+
+    @Override
+    public String toString() {
+        return "[ name =" + first + " " + last + " "
+                + firstYear + " " + secretIdentity + " ]";
+    }
+
+    public void setIdentity(String identity) {
+        secretIdentity = identity;
+    }
+
+    public String getIdentity() {
+        return secretIdentity;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof SuperHero) {
+            SuperHero ss = (SuperHero) obj;
+            return first.equals(ss.first) && last.equals(ss.last)
+                    && firstYear.equals(ss.firstYear)
+                    && type.equals(ss.type)
+                    && secretIdentity.equals(ss.secretIdentity);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return ((31 + first.hashCode()) * 31) * 31
+                + ((31 + last.hashCode()) * 31) * 31
+                + ((31 + firstYear.hashCode()) * 31) * 31
+                + ((31 + type.hashCode()) * 31) * 31
+                + secretIdentity.hashCode();
+    }
+}
--- a/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,7 +28,7 @@
 import javax.swing.SwingUtilities;
 
 /* @test
- * @bug 8031573
+ * @bug 8031573 8040279
  * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
  *           in high resolution on Retina
  * @author Alexander Scherbatiy
--- a/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/javax/swing/JOptionPane/8024926/bug8024926.java	Wed Jul 05 19:42:29 2017 +0200
@@ -31,7 +31,7 @@
 
 /**
  * @test
- * @bug 8024926
+ * @bug 8024926 8040279
  * @summary [macosx] AquaIcon HiDPI support
  * @author Alexander Scherbatiy
  * @run applet/manual=yesno bug8024926.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.html	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,32 @@
+<!--
+ Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<body>
+Choose the variable applet size and try to resize the applet.
+The test passes the thumb is painted correctly.
+
+<applet width="400" height="200" code="Test8039464">
+</applet>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JScrollBar/8039464/Test8039464.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+
+import javax.swing.JApplet;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JScrollBar;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+/*
+ * @test
+ * @bug 8039464
+ * @summary Tests enabling/disabling of titled border's caption
+ * @author Sergey Malenkov
+ * @run applet/manual=yesno Test8039464.html
+ */
+
+public class Test8039464 extends JApplet {
+    static {
+        try {
+            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        } catch (Exception exception) {
+            throw new Error("unexpected", exception);
+        }
+    }
+
+    @Override
+    public void init() {
+        init(this);
+    }
+
+    private static void init(Container container) {
+        container.setLayout(new GridBagLayout());
+        GridBagConstraints gbc = new GridBagConstraints();
+        gbc.fill = GridBagConstraints.BOTH;
+        gbc.gridx = 0;
+        gbc.gridy = 1;
+        JLabel label = new JLabel();
+        Dimension size = new Dimension(111, 0);
+        label.setPreferredSize(size);
+        label.setMinimumSize(size);
+        container.add(label, gbc);
+        gbc.gridx = 1;
+        gbc.weightx = 1;
+        container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
+        gbc.gridx = 2;
+        gbc.gridy = 0;
+        gbc.weightx = 0;
+        gbc.weighty = 1;
+        container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                JFrame frame = new JFrame("8039464");
+                init(frame);
+                frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+                frame.pack();
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTextField/8036819/bug8036819.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @library ../../regtesthelpers
+ * @build Util
+ * @bug 8036819
+ * @summary JAB: mnemonics not read for textboxes
+ * @author Vivi An
+ * @run main bug8036819
+ */
+
+import javax.swing.*;
+import javax.swing.event.*;
+import java.awt.event.*;
+import java.awt.*;
+import sun.awt.SunToolkit;
+import javax.accessibility.*;
+
+public class bug8036819 {
+
+    public static volatile Boolean passed = false;
+
+    public static void main(String args[]) throws Throwable {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createAndShowGUI();
+            }
+        });
+
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        Robot robo = new Robot();
+        robo.setAutoDelay(300);
+
+        // Using mnemonic key to focus on the textfield
+        Util.hitMnemonics(robo, KeyEvent.VK_P);
+        toolkit.realSync();
+
+        if (!passed){
+            throw new RuntimeException("Test failed.");
+        }
+    }
+
+    private static void createAndShowGUI() {
+        JFrame mainFrame = new JFrame("bug 8036819");
+
+        JLabel usernameLabel = new JLabel("Username: ");
+        JTextField usernameField = new JTextField(20);
+        usernameLabel.setDisplayedMnemonic(KeyEvent.VK_U);
+        usernameLabel.setLabelFor(usernameField);
+
+        JLabel pwdLabel = new JLabel("Password: ");
+        JTextField pwdField = new JTextField(20);
+        pwdLabel.setDisplayedMnemonic(KeyEvent.VK_P);
+        pwdLabel.setLabelFor(pwdField);
+
+        pwdField.addKeyListener(
+            new KeyListener(){
+                @Override
+                public void keyPressed(KeyEvent keyEvent) {
+                }
+
+                @Override
+                public void keyTyped(KeyEvent keyEvent) {
+                }
+
+                @Override
+                public void keyReleased(KeyEvent keyEvent){
+                    JComponent comp = (JComponent) pwdField;
+                    AccessibleContext ac = comp.getAccessibleContext();
+                    AccessibleExtendedComponent aec = (AccessibleExtendedComponent)ac.getAccessibleComponent();
+                    AccessibleKeyBinding akb = aec.getAccessibleKeyBinding();
+                    if (akb != null){
+                         int count = akb.getAccessibleKeyBindingCount();
+                        if (count != 1){
+                            passed = false;
+                            return;
+                        }
+
+                        // there is 1 accessible key for the text field
+                        System.out.println("Retrieved AccessibleKeyBinding for textfield " + count);
+
+                        // the key code is KeyEvent.VK_P
+                        Object o = akb.getAccessibleKeyBinding(0);
+                        if (o instanceof KeyStroke){
+                            javax.swing.KeyStroke key = (javax.swing.KeyStroke)o;
+                            System.out.println("keystroke is " + key.getKeyCode());
+                            if (key.getKeyCode() == KeyEvent.VK_P)
+                                passed = true;
+                        }
+                    }
+                }
+            }
+        );
+
+        mainFrame.getContentPane().add(usernameLabel);
+        mainFrame.getContentPane().add(usernameField);
+        mainFrame.getContentPane().add(pwdLabel);
+        mainFrame.getContentPane().add(pwdField);
+
+        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        mainFrame.setLayout(new FlowLayout(FlowLayout.LEFT));
+
+        mainFrame.setSize(200, 200);
+        mainFrame.setLocation(200, 200);
+        mainFrame.setVisible(true);
+        mainFrame.toFront();
+    }
+ }
--- a/jdk/test/javax/swing/border/Test4252164.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/javax/swing/border/Test4252164.java	Wed Jul 05 19:42:29 2017 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4252164
+ * @bug 4252164 8041917
  * @summary Tests rounded LineBorder for components
  * @author Sergey Malenkov
  * @run applet/manual=yesno Test4252164.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/nimbus/8041725/bug8041725.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 8041725
+   @summary JList selection colors are not UIResource instances in Nimbus L&F
+   @author Anton Litvinov
+*/
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.plaf.*;
+import javax.swing.plaf.nimbus.*;
+
+public class bug8041725 {
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new NimbusLookAndFeel());
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                JFrame frame = new JFrame("bug8041725");
+                frame.setSize(200, 200);
+                JList list = new JList(new String[]{"Item1", "Item2", "Item3"});
+                frame.getContentPane().add(list);
+                frame.pack();
+                frame.setVisible(true);
+
+                System.err.println("Test #1: No items are selected, list is enabled.");
+                testSelectionColors(list);
+
+                System.err.println("Test #2: No items are selected, list is disabled.");
+                list.setEnabled(false);
+                testSelectionColors(list);
+
+                System.err.println("Test #3: One item is selected, list is disabled.");
+                list.setSelectedIndex(0);
+                testSelectionColors(list);
+
+                System.err.println("Test #4: One item is selected, list is enabled.");
+                list.setEnabled(true);
+                testSelectionColors(list);
+
+                frame.dispose();
+            }
+        });
+    }
+
+    private static void testSelectionColors(JList list) {
+        Color selBackColor = list.getSelectionBackground();
+        if (!(selBackColor instanceof UIResource)) {
+            throw new RuntimeException(String.format(
+                "JList.getSelectionBackground() returned instance of '%s' instead of UIResource.",
+                selBackColor.getClass()));
+        }
+        Color selForeColor = list.getSelectionForeground();
+        if (!(selForeColor instanceof UIResource)) {
+            throw new RuntimeException(String.format(
+                "JList.getSelectionForeground() returned instance of '%s' instead of UIResource.",
+                selForeColor.getClass()));
+        }
+    }
+}
--- a/jdk/test/javax/swing/text/StyledEditorKit/8016833/bug8016833.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/javax/swing/text/StyledEditorKit/8016833/bug8016833.java	Wed Jul 05 19:42:29 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -190,9 +190,9 @@
         // not too wide
         assertTrue(out3.getWidth() * 0.8 < out2.getWidth());
         // not too low
-        assertTrue(out3.getY() - (out1.getY() + out2.getHeight()) < 3);
+        assertTrue(out3.getY() - (out1.getY() + out2.getHeight() - 1) < 4);
         // not too high
-        assertTrue(out3.getY() - (out1.getY() + out2.getHeight()) > 0);
+        assertTrue(out3.getY() - (out1.getY() + out2.getHeight() - 1) > 0);
     }
 
     void testStrikthrough() {
@@ -217,7 +217,7 @@
         // not too wide
         assertTrue(out3.getWidth() * 0.8 < out2.getWidth());
         // not too low
-        assertTrue(out3.getY() - (out1.getY() + out2.getHeight()) < 0);
+        assertTrue(out3.getY() - (out1.getY() + out2.getHeight() - 1) < 0);
         // not too high
         assertTrue(out3.getY() - out1.getY() > 1);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/ws/8043129/MailTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8043129
+ * @summary JAF initialisation in SAAJ clashing with the one in javax.mail
+ * @author mkos
+ * @library javax.mail.jar
+ * @build MailTest
+ * @run main MailTest
+ */
+
+import javax.activation.CommandMap;
+import javax.activation.MailcapCommandMap;
+import javax.mail.BodyPart;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.Multipart;
+import javax.mail.Session;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeMultipart;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+public class MailTest {
+
+    String host = null;
+    String user = "";
+    String password = null;
+    String from = null;
+    String to = null;
+
+    public static void main(String[] args) {
+        MailTest t = new MailTest();
+
+        t.user = "somebody@somewhere.com";
+        t.from = "somebody@somewhere.com";
+        t.to = "somebody@somewhere.com";
+
+        t.user = "somebody@somewhere.com";
+        t.password = "somepassword";
+        t.host = "somehost";
+
+        t.sendMail();    //this works
+
+        t.addSoapAttachement();
+        t.sendMail();    //after addAttachmentPart to soapmessage it do not work
+
+        // workaroundJAFSetup();
+        // t.sendMail();    //after workaround works again
+    }
+
+    void addSoapAttachement() {
+        try {
+            MessageFactory messageFactory = MessageFactory.newInstance();
+            SOAPMessage message = messageFactory.createMessage();
+            AttachmentPart a = message.createAttachmentPart();
+            a.setContentType("binary/octet-stream");
+            message.addAttachmentPart(a);
+        } catch (SOAPException e) {
+            e.printStackTrace();
+        }
+    }
+
+    void sendMail() {
+
+        try {
+            Properties props = new Properties();
+            props.put("mail.smtp.host", host);
+            props.put("mail.smtp.auth", "true");
+
+            Session session = Session.getInstance(props);
+            session.setDebug(true);
+
+            // Define message
+            MimeMessage message = new MimeMessage(session);
+            message.setFrom(new InternetAddress(from));
+            message.addRecipients(Message.RecipientType.TO, to);
+            message.setSubject("this is a multipart test");
+
+            Multipart multipart = new MimeMultipart();
+
+            BodyPart messageBodyPart1 = new MimeBodyPart();
+            messageBodyPart1.setText("please send also this Content\n ciao!");
+            multipart.addBodyPart(messageBodyPart1);
+
+            BodyPart messageBodyPart2 = new MimeBodyPart();
+            messageBodyPart2.setContent("<b>please</b> send also this Content <br>ciao!", "text/html; charset=UTF-8");
+            multipart.addBodyPart(messageBodyPart2);
+
+            message.setContent(multipart);
+
+            /*
+                Transport tr = session.getTransport("smtp");
+                tr.connect(host,user, password);
+                tr.sendMessage(message,InternetAddress.parse(to));
+                tr.close();
+            */
+
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            message.writeTo(baos);
+            String output = baos.toString();
+            System.out.println("output = " + output);
+            if (output.contains("also this Content")) {
+                System.out.println("Test PASSED.");
+            } else {
+                System.out.println("Test FAILED, missing content.");
+                throw new IllegalStateException("Test FAILED, missing content.");
+            }
+        } catch (MessagingException ignored) {
+        } catch (IOException ignored) {
+        }
+    }
+
+    // this is how the error can be worked around ...
+    static void workaroundJAFSetup() {
+        MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
+        mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
+    }
+}
Binary file jdk/test/javax/xml/ws/8043129/javax.mail.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/awt/dnd/8024061/bug8024061.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 8024061
+ * @summary Checks that no exception is thrown if dragGestureRecognized
+ *          takes a while to complete.
+ */
+import sun.awt.OSInfo;
+import sun.awt.OSInfo.OSType;
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.datatransfer.UnsupportedFlavorException;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureEvent;
+import java.awt.dnd.DragGestureListener;
+import java.awt.dnd.DragSource;
+import java.awt.dnd.DragSourceDragEvent;
+import java.awt.dnd.DragSourceDropEvent;
+import java.awt.dnd.DragSourceEvent;
+import java.awt.dnd.DragSourceListener;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.event.InputEvent;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.swing.*;
+
+/**
+ * If dragGestureRecognized() takes a while to complete and if user performs a drag quickly,
+ * an exception is thrown from DropTargetListener.dragEnter when it calls
+ * DropTargetDragEvent.getTransferable().
+ * <p>
+ * This class introduces a delay in dragGestureRecognized() to cause the exception.
+ */
+public class bug8024061 {
+    private static final DataFlavor DropObjectFlavor;
+    private static final int DELAY = 1000;
+
+    private final DnDPanel panel1 = new DnDPanel(Color.yellow);
+    private final DnDPanel panel2 = new DnDPanel(Color.pink);
+    private final JFrame frame;
+
+    private static final CountDownLatch lock = new CountDownLatch(1);
+    private static volatile Exception dragEnterException = null;
+
+    static {
+        DataFlavor flavor = null;
+        try {
+            flavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+        DropObjectFlavor = flavor;
+    }
+
+    bug8024061() {
+        frame = new JFrame("DnDWithRobot");
+        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
+
+        Dimension d = new Dimension(100, 100);
+
+        panel1.setPreferredSize(d);
+        panel2.setPreferredSize(d);
+
+        Container content = frame.getContentPane();
+        content.setLayout(new GridLayout(1, 2, 5, 5));
+        content.add(panel1);
+        content.add(panel2);
+
+        frame.pack();
+
+        DropObject drop = new DropObject();
+        drop.place(panel1, new Point(10, 10));
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws AWTException, InvocationTargetException, InterruptedException {
+        OSType type = OSInfo.getOSType();
+        if (type != OSType.LINUX && type != OSType.SOLARIS) {
+            System.out.println("This test is for Linux and Solaris only... " +
+                               "skipping!");
+            return;
+        }
+
+        final bug8024061[] dnd = {null};
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                dnd[0] = new bug8024061();
+            }
+        });
+        final Robot robot = new Robot();
+        robot.setAutoDelay(10);
+        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        toolkit.realSync();
+
+        JFrame frame = dnd[0].frame;
+        Point point = frame.getLocationOnScreen();
+        Point here = new Point(point.x + 35, point.y + 45);
+        Point there = new Point(point.x + 120, point.y + 45);
+        here.x += 25;
+        robot.mouseMove(here.x, here.y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        while (here.x < there.x) {
+            here.x += 20;
+            robot.mouseMove(here.x, here.y);
+            System.out.println("x = " + here.x);
+        }
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        toolkit.realSync();
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        System.out.println("finished");
+
+        try {
+            if (lock.await(5, TimeUnit.SECONDS)) {
+                if (dragEnterException == null) {
+                    System.out.println("Test passed.");
+                } else {
+                    System.out.println("Test failed.");
+                    dragEnterException.printStackTrace();
+                    throw new RuntimeException(dragEnterException);
+                }
+            } else {
+                System.out.println("Test failed. Timeout reached");
+                throw new RuntimeException("Timed out waiting for dragEnter()");
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    class DropObject implements Transferable {
+        DnDPanel panel;
+        Color color = Color.CYAN;
+        int width = 50;
+        int height = 50;
+        int x;
+        int y;
+
+        void draw(Graphics2D g) {
+            Color savedColor = g.getColor();
+            g.setColor(color);
+            g.fillRect(x, y, width, height);
+            g.setColor(Color.lightGray);
+            g.drawRect(x, y, width, height);
+            g.setColor(savedColor);
+        }
+
+        boolean contains(int x, int y) {
+            return (x > this.x && x < this.x + width)
+                    && (y > this.y && y < this.y + height);
+        }
+
+        @Override
+        public DataFlavor[] getTransferDataFlavors() {
+            return new DataFlavor[]{DropObjectFlavor};
+        }
+
+        void place(DnDPanel panel, Point location) {
+            if (panel != this.panel) {
+                x = location.x;
+                y = location.y;
+                if (this.panel != null) {
+                    this.panel.setDropObject(null);
+                    this.panel.repaint();
+                }
+                this.panel = panel;
+                this.panel.setDropObject(this);
+                this.panel.repaint();
+            }
+        }
+
+        @Override
+        public boolean isDataFlavorSupported(DataFlavor flavor) {
+            return DropObjectFlavor.equals(flavor);
+        }
+
+        @Override
+        public Object getTransferData(DataFlavor flavor)
+                throws UnsupportedFlavorException, IOException {
+            if (isDataFlavorSupported(flavor)) {
+                return this;
+            } else {
+                throw new UnsupportedFlavorException(flavor);
+            }
+        }
+    }
+
+    class DnDPanel extends JPanel {
+        DropObject dropObject;
+        final DragSource dragSource;
+        final DropTarget dropTarget;
+        final Color color;
+        final DragGestureListener dgListener;
+        final DragSourceListener dsListener;
+        final DropTargetListener dtListener;
+
+        DnDPanel(Color color) {
+            this.color = color;
+            this.dragSource = DragSource.getDefaultDragSource();
+            dgListener = new DragGestureListener() {
+                @Override
+                public void dragGestureRecognized(DragGestureEvent dge) {
+                    Point location = dge.getDragOrigin();
+                    if (dropObject != null && dropObject.contains(location.x, location.y)) {
+                        dragSource.startDrag(dge, DragSource.DefaultCopyNoDrop, dropObject, dsListener);
+                        try {
+                            Thread.sleep(DELAY);
+                        } catch (InterruptedException e) {
+                        }
+                    }
+                }
+            };
+
+            dsListener = new DragSourceListener() {
+                @Override
+                public void dragEnter(DragSourceDragEvent dsde) {
+                }
+
+                @Override
+                public void dragOver(DragSourceDragEvent dsde) {
+                }
+
+                @Override
+                public void dropActionChanged(DragSourceDragEvent dsde) {
+                }
+
+                @Override
+                public void dragExit(DragSourceEvent dse) {
+                }
+
+                @Override
+                public void dragDropEnd(DragSourceDropEvent dsde) {
+                }
+            };
+
+            dtListener = new DropTargetListener() {
+                @Override
+                public void dragEnter(DropTargetDragEvent dtde) {
+                    if (dropObject != null) {
+                        dtde.rejectDrag();
+                        return;
+                    }
+                    dtde.acceptDrag(DnDConstants.ACTION_MOVE);
+                    try {
+                        Transferable t = dtde.getTransferable();
+                        Object data = t.getTransferData(DropObjectFlavor);
+                        if (data != null) {
+                            throw new Exception("getTransferData returned non-null");
+                        }
+                    } catch (Exception e) {
+                        dragEnterException = e;
+                        e.printStackTrace();
+                    } finally {
+                        lock.countDown();
+                    }
+                }
+
+                @Override
+                public void dragOver(DropTargetDragEvent dtde) {
+                    if (dropObject != null) {
+                        dtde.rejectDrag();
+                        return;
+                    }
+                    dtde.acceptDrag(DnDConstants.ACTION_MOVE);
+                }
+
+                @Override
+                public void dropActionChanged(DropTargetDragEvent dtde) {
+                }
+
+                @Override
+                public void dragExit(DropTargetEvent dte) {
+                }
+
+                @Override
+                public void drop(DropTargetDropEvent dtde) {
+                    if (dropObject != null) {
+                        dtde.rejectDrop();
+                        return;
+                    }
+                    try {
+                        dtde.acceptDrop(DnDConstants.ACTION_MOVE);
+                        Transferable t = dtde.getTransferable();
+                        DropObject dropObject = (DropObject) t.getTransferData(DropObjectFlavor);
+                        Point location = dtde.getLocation();
+                        dropObject.place(DnDPanel.this, location);
+                        dtde.dropComplete(true);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+
+                }
+            };
+
+            dragSource.createDefaultDragGestureRecognizer(this,
+                    DnDConstants.ACTION_MOVE, dgListener);
+
+            dropTarget = new DropTarget(this, DnDConstants.ACTION_MOVE, dtListener, true);
+
+        }
+
+        public void paintComponent(Graphics g) {
+            super.paintComponent(g);
+            Color savedColor = g.getColor();
+            g.setColor(color);
+            g.fillRect(0, 0, getWidth(), getHeight());
+            g.setColor(savedColor);
+            if (dropObject != null) {
+                dropObject.draw((Graphics2D) g);
+            }
+        }
+
+        void setDropObject(DropObject dropObject) {
+            this.dropObject = dropObject;
+        }
+
+        DropObject findDropObject(int x, int y) {
+            if (dropObject != null && dropObject.contains(x, y)) {
+                return dropObject;
+            }
+            return null;
+        }
+    }
+}
--- a/jdk/test/sun/management/jdp/JdpDefaultsTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jdp/JdpDefaultsTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,7 +28,7 @@
  * @test JdpDefaultsTest
  * @summary Assert that we can read JDP packets from a multicast socket connection, on default IP and port.
  * @library /lib/testlibrary
- * @build ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
+ * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
  * @run main JdpDefaultsTest
  */
 
--- a/jdk/test/sun/management/jdp/JdpOffTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jdp/JdpOffTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -29,7 +29,7 @@
  * @test JdpOffTest.java
  * @summary Assert that no JDP packets are sent to the default address and port.
  * @library /lib/testlibrary
- * @build ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
+ * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOffTestCase DynamicLauncher
  * @run main JdpOffTest
  */
 
--- a/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jdp/JdpSpecificAddressTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,7 +28,7 @@
  * @test JdpSpecificAddressTest
  * @summary Assert that we can read JDP packets from a multicast socket connection, on specific IP and port.
  * @library /lib/testlibrary
- * @build ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
+ * @build jdk.testlibrary.* ClientConnection JdpTestUtil JdpTestCase JdpOnTestCase DynamicLauncher
  * @run main JdpSpecificAddressTest
  */
 
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -42,9 +42,7 @@
  *          without connection or username/password details.
  *          TestManager will attempt a connection to the address obtained from
  *          both agent properties and jvmstat buffer.
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.Utils
- * @build TestManager TestApplication
+ * @build jdk.testlibrary.* TestManager TestApplication
  * @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest
  */
 
--- a/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jmxremote/bootstrap/PasswordFilePermissionTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,11 +28,7 @@
  * @library /lib/testlibrary
  * @bug 6557093
  * @summary Check SSL config file permission for out-of-the-box management
- * @build jdk.testlibrary.Utils
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.OutputAnalyzer
- * @build AbstractFilePermissionTest
- * @build Dummy
+ * @build jdk.testlibrary.* AbstractFilePermissionTest Dummy
  * @run main/timeout=300 PasswordFilePermissionTest
  *
  * @author Taras Ledkov
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh	Wed Jul 05 19:42:29 2017 +0200
@@ -27,11 +27,7 @@
 # @summary Test RMI Bootstrap
 #
 # @library /lib/testlibrary
-# @library /lib/testlibrary
-# @build jdk.testlibrary.Utils
-# @build TestLogger
-# @build Utils
-# @build RmiBootstrapTest
+# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
 # @run shell/timeout=300  RmiBootstrapTest.sh
 
 # Define the Java class test name
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -42,10 +42,7 @@
  * @library /lib/testlibrary
  * @bug 6228231
  * @summary Test that RMI registry uses SSL.
- * @build jdk.testlibrary.Utils
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.OutputAnalyzer
- * @build RmiRegistrySslTestApp
+ * @build jdk.testlibrary.* RmiRegistrySslTestApp
  * @run main/timeout=300 RmiRegistrySslTest
  * @author Luis-Miguel Alventosa, Taras Ledkov
  */
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	Wed Jul 05 19:42:29 2017 +0200
@@ -27,10 +27,7 @@
 # @summary Test RMI Bootstrap with SSL
 #
 # @library /lib/testlibrary
-# @build jdk.testlibrary.Utils
-# @build TestLogger
-# @build Utils
-# @build RmiBootstrapTest
+# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
 # @run shell/timeout=300  RmiSslBootstrapTest.sh
 
 # Define the Java class test name
--- a/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -27,12 +27,7 @@
  * @test
  * @library /lib/testlibrary
  * @bug 6557093
- * @bug 6557093
- * @build jdk.testlibrary.Utils
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.OutputAnalyzer
- * @build Dummy
- * @build AbstractFilePermissionTest
+ * @build jdk.testlibrary.* Dummy AbstractFilePermissionTest
  * @summary Check SSL config file permission for out-of-the-box management
  * @run main/timeout=300 SSLConfigFilePermissionTest
  *
--- a/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/management/jmxremote/startstop/JMXStartStopTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -54,10 +54,7 @@
  * @test
  * @bug 7110104
  * @library /lib/testlibrary
- * @build jdk.testlibrary.ProcessTools
- * @build jdk.testlibrary.JDKToolLauncher
- * @build jdk.testlibrary.Utils
- * @build JMXStartStopTest JMXStartStopDoSomething
+ * @build jdk.testlibrary.* JMXStartStopTest JMXStartStopDoSomething
  * @run main/othervm JMXStartStopTest
  * @summary Makes sure that enabling/disabling the management agent through
  *          JCMD achieves the desired results
--- a/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/security/krb5/auto/ReplayCacheTestProc.java	Wed Jul 05 19:42:29 2017 +0200
@@ -40,7 +40,6 @@
 import java.security.MessageDigest;
 import java.util.*;
 
-import com.sun.security.auth.module.UnixSystem;
 import sun.security.jgss.GSSUtil;
 import sun.security.krb5.internal.APReq;
 import sun.security.krb5.internal.rcache.AuthTime;
@@ -79,13 +78,7 @@
                 mode = -1;
             }
 
-            try {
-                UnixSystem us = new com.sun.security.auth.module.UnixSystem();
-                uid = us.getUid();
-            } catch (Throwable e) {
-                // Cannot be only Exception, might be UnsatisfiedLinkError
-                uid = -1;
-            }
+            uid = sun.misc.VM.geteuid();
 
             KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true);
             for (int i=0; i<nu; i++) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/text/resources/Format/Bug8037343.java	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8037343
+ * @summary updating dateformat for es_DO
+ */
+
+import java.text.DateFormat;
+import java.util.Calendar;
+import java.util.Locale;
+
+public class Bug8037343
+{
+
+    public static void main(String[] arg)
+    {
+        final Locale esDO = new Locale("es", "DO");
+        final String expectedShort = "31/03/12";
+        final String expectedMedium = "31/03/2012";
+
+        int errors = 0;
+        DateFormat format;
+        String result;
+
+        Calendar cal = Calendar.getInstance(esDO);
+        cal.set(Calendar.DAY_OF_MONTH, 31);
+        cal.set(Calendar.MONTH, Calendar.MARCH);
+        cal.set(Calendar.YEAR, 2012);
+
+        format = DateFormat.getDateInstance(DateFormat.SHORT, esDO);
+        result = format.format(cal.getTime());
+        if (!expectedShort.equals(result)) {
+            System.out.println(String.format("Short Date format for es_DO is not as expected. Expected: [%s] Actual: [%s]", expectedShort, result));
+            errors++;
+        }
+
+        format = DateFormat.getDateInstance(DateFormat.MEDIUM, esDO);
+        result = format.format(cal.getTime());
+        if (!expectedMedium.equals(result)) {
+            System.out.println(String.format("Medium Date format for es_DO is not as expected. Expected: [%s] Actual: [%s]", expectedMedium, result));
+            errors++;
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException();
+        }
+    }
+
+}
--- a/jdk/test/sun/text/resources/LocaleData	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/text/resources/LocaleData	Wed Jul 05 19:42:29 2017 +0200
@@ -483,8 +483,8 @@
 FormatData/es_DO/TimePatterns/3=hh:mm a
 FormatData/es_DO/DatePatterns/0=EEEE d' de 'MMMM' de 'yyyy
 FormatData/es_DO/DatePatterns/1=d' de 'MMMM' de 'yyyy
-FormatData/es_DO/DatePatterns/2=MM/dd/yyyy
-FormatData/es_DO/DatePatterns/3=MM/dd/yy
+# FormatData/es_DO/DatePatterns/2=MM/dd/yyyy # Changed: see bug 8037343
+# FormatData/es_DO/DatePatterns/3=MM/dd/yy # Changed: see bug 8037343
 FormatData/es_DO/DateTimePatterns/0={1} {0}
 FormatData/es_DO/NumberElements/0=.
 FormatData/es_DO/NumberElements/1=,
@@ -7692,3 +7692,7 @@
 FormatData/es_EC/TimePatterns/1=H:mm:ss z
 FormatData/es_EC/TimePatterns/2=H:mm:ss
 FormatData/es_EC/TimePatterns/3=H:mm
+
+# bug 8037343
+FormatData/es_DO/DatePatterns/2=dd/MM/yyyy
+FormatData/es_DO/DatePatterns/3=dd/MM/yy
--- a/jdk/test/sun/text/resources/LocaleDataTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -36,6 +36,7 @@
  *      6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
  *      7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
  *      7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 8017142
+ *      8037343
  * @summary Verify locale data
  *
  */
--- a/jdk/test/sun/tools/jcmd/TestJcmdSanity.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jcmd/TestJcmdSanity.java	Wed Jul 05 19:42:29 2017 +0200
@@ -41,7 +41,7 @@
  * @bug 7104647 7154822
  * @library /lib/testlibrary
  * @build jdk.testlibrary.*
- * @run main TestJcmdSanity
+ * @run main/othervm -XX:+UsePerfData TestJcmdSanity
  */
 public class TestJcmdSanity {
 
--- a/jdk/test/sun/tools/jstat/JStatInterval.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jstat/JStatInterval.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,8 +28,7 @@
  * @summary Test checks case when target application finishes execution and jstat didn't complete work.
             jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes
             after 500ms. This shouldn't cause crash or hang in target application or in jstat.
- * @build jdk.testlibrary.ProcessTools jdk.testlibrary.JDKToolLauncher
- * @build JStatInterval
+ * @build jdk.testlibrary.* JStatInterval
  * @run main JStatInterval
  */
 
--- a/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jstatd/TestJstatdDefaults.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
  * @test
  * @bug 4990825
  * @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdDefaults
  */
 public class TestJstatdDefaults {
--- a/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jstatd/TestJstatdExternalRegistry.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
  * @test
  * @bug 4990825 7092186
  * @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdExternalRegistry
  */
 public class TestJstatdExternalRegistry {
--- a/jdk/test/sun/tools/jstatd/TestJstatdPort.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPort.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
  * @test
  * @bug 4990825
  * @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdPort
  */
 public class TestJstatdPort {
--- a/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jstatd/TestJstatdPortAndServer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
  * @test
  * @bug 4990825
  * @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdPortAndServer
  */
 public class TestJstatdPortAndServer {
--- a/jdk/test/sun/tools/jstatd/TestJstatdServer.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jstatd/TestJstatdServer.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,7 +25,7 @@
  * @test
  * @bug 4990825
  * @library /lib/testlibrary
- * @build JstatdTest JstatGCUtilParser
+ * @build jdk.testlibrary.* JstatdTest JstatGCUtilParser
  * @run main/timeout=60 TestJstatdServer
  */
 public class TestJstatdServer {
--- a/jdk/test/sun/tools/jstatd/TestJstatdUsage.java	Tue May 27 16:39:05 2014 -0600
+++ b/jdk/test/sun/tools/jstatd/TestJstatdUsage.java	Wed Jul 05 19:42:29 2017 +0200
@@ -28,7 +28,7 @@
  * @test
  * @bug 4990825
  * @library /lib/testlibrary
- * @build jdk.testlibrary.JDKToolLauncher jdk.testlibrary.OutputAnalyzer
+ * @build jdk.testlibrary.*
  * @run main TestJstatdUsage
  */
 public class TestJstatdUsage {
--- a/make/Jprt.gmk	Tue May 27 16:39:05 2014 -0600
+++ b/make/Jprt.gmk	Wed Jul 05 19:42:29 2017 +0200
@@ -23,8 +23,22 @@
 # questions.
 #
 
-# This file is contains targets utilities needed by JPRT.
+# This file contains targets and utilities needed by JPRT.
 
+# Cygpath is only defined when running on Cygwin
+ifneq ($(CYGPATH), )
+  # If we get JPRT_ARCHIVE_*BUNDLE externally, make sure they have /cygdrive
+  # style paths
+  ifdef JPRT_ARCHIVE_BUNDLE
+    override JPRT_ARCHIVE_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_BUNDLE))
+  endif
+  ifdef JPRT_ARCHIVE_INSTALL_BUNDLE
+    override JPRT_ARCHIVE_INSTALL_BUNDLE := $(shell $(CYGPATH) -u $(JPRT_ARCHIVE_INSTALL_BUNDLE))
+  endif
+endif
+
+# When running in JPRT these will be provided. Need defaults so that this makefile
+# is valid anyway.
 ifndef JPRT_ARCHIVE_BUNDLE
   JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
 endif
--- a/nashorn/.hgtags	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/.hgtags	Wed Jul 05 19:42:29 2017 +0200
@@ -247,3 +247,4 @@
 4d60c3292e14aac90dc3b8232496ba4af4254cc3 jdk9-b11
 282e9a675e079cc84dbfaa4c10050f08397faab0 jdk9-b12
 be4580ae56e2ef0ce521d3f840753eaa83cacf33 jdk9-b13
+806df06b6ac58d3e9c9c6a680dbdd7a6c94ca700 jdk9-b14
--- a/nashorn/make/build.xml	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/make/build.xml	Wed Jul 05 19:42:29 2017 +0200
@@ -360,6 +360,10 @@
       <include name="**/framework/*Test.class"/>
     </fileset>
 
+    <fileset id="test.nosecurity.classes" dir="${build.test.classes.dir}">
+      <include name="**/framework/ScriptTest.class"/>
+    </fileset>
+
     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
       <jvmarg line="${ext.class.path}"/>
@@ -376,6 +380,21 @@
           <pathelement path="${run.test.classpath}"/>
       </classpath>
     </testng>
+    <testng outputdir="${build.nosecurity.test.results.dir}" classfilesetref="test.nosecurity.classes"
+       verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
+      <jvmarg line="${ext.class.path}"/>
+      <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
+      <propertyset>
+        <propertyref prefix="nashorn."/>
+      </propertyset>
+      <propertyset>
+        <propertyref prefix="test-sys-prop-no-security."/>
+        <mapper from="test-sys-prop-no-security.*" to="*" type="glob"/>
+      </propertyset>
+      <classpath>
+          <pathelement path="${run.test.classpath}"/>
+      </classpath>
+    </testng>
   </target>
 
   <target name="test-basicparallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file">
--- a/nashorn/make/project.properties	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/make/project.properties	Wed Jul 05 19:42:29 2017 +0200
@@ -59,6 +59,7 @@
 
 # test results directory
 build.test.results.dir=${build.dir}/test/reports
+build.nosecurity.test.results.dir=${build.dir}/test/nosecurity/reports
 
 # This directory is removed when the project is cleaned:
 dist.dir=dist
@@ -113,6 +114,7 @@
 
 # test scripts to run
 test.dir=test
+test.nosecurity.dir=test/script/nosecurity
 test.script.dir=test/script
 test.basic.dir=test/script/basic
 test.maptests.dir=test/script/maptests
@@ -131,8 +133,12 @@
 test-sys-prop.es5conform.testcases.dir=${test.external.dir}/ES5Conform/TestCases
 test-sys-prop.test.basic.dir=${test.basic.dir}
 
+test-sys-prop-no-security.test.dir=${test.dir}
+test-sys-prop-no-security.test.js.roots=${test.nosecurity.dir}
+
 # framework root for our script tests
 test-sys-prop.test.js.framework=${test.script.dir}/assert.js
+test-sys-prop-no-security.test.js.framework=${test.script.dir}/assert.js
 
 # Control the verbosity of ParserTest
 test-sys-prop.parsertest.verbose=false
@@ -259,7 +265,7 @@
 test.src.dir=test/src
 
 # -Xmx is used for all tests, -Xms only for octane benchmark
-run.test.xmx=3G
+run.test.xmx=2G
 run.test.xms=2G
 
 run.test.user.language=tr
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Wed Jul 05 19:42:29 2017 +0200
@@ -61,9 +61,17 @@
     private static final DynamicLinker dynamicLinker;
     static {
         final DynamicLinkerFactory factory = new DynamicLinkerFactory();
-        factory.setPrioritizedLinkers(new NashornLinker(), new NashornPrimitiveLinker(), new NashornStaticClassLinker(),
-                new BoundDynamicMethodLinker(), new JavaSuperAdapterLinker(), new JSObjectLinker(), new ReflectionCheckLinker());
-        factory.setFallbackLinkers(new NashornBeansLinker(), new NashornBottomLinker());
+        final NashornBeansLinker nashornBeansLinker = new NashornBeansLinker();
+        final JSObjectLinker jsObjectLinker = new JSObjectLinker(nashornBeansLinker);
+        factory.setPrioritizedLinkers(
+            new NashornLinker(),
+            new NashornPrimitiveLinker(),
+            new NashornStaticClassLinker(),
+            new BoundDynamicMethodLinker(),
+            new JavaSuperAdapterLinker(),
+            jsObjectLinker,
+            new ReflectionCheckLinker());
+        factory.setFallbackLinkers(nashornBeansLinker, new NashornBottomLinker());
         factory.setSyncOnRelink(true);
         final int relinkThreshold = Options.getIntProperty("nashorn.unstable.relink.threshold", -1);
         if (relinkThreshold > -1) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Wed Jul 05 19:42:29 2017 +0200
@@ -30,6 +30,7 @@
 import java.lang.invoke.MethodType;
 import java.util.HashMap;
 import java.util.Map;
+import javax.script.Bindings;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.GuardedTypeConversion;
@@ -48,14 +49,23 @@
  * as ScriptObjects from other Nashorn contexts.
  */
 final class JSObjectLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory {
+    private final NashornBeansLinker nashornBeansLinker;
+
+    JSObjectLinker(final NashornBeansLinker nashornBeansLinker) {
+        this.nashornBeansLinker = nashornBeansLinker;
+    }
+
     @Override
     public boolean canLinkType(final Class<?> type) {
         return canLinkTypeStatic(type);
     }
 
     static boolean canLinkTypeStatic(final Class<?> type) {
-        // can link JSObject
-        return JSObject.class.isAssignableFrom(type);
+        // can link JSObject also handles Map, Bindings to make
+        // sure those are not JSObjects.
+        return Map.class.isAssignableFrom(type) ||
+               Bindings.class.isAssignableFrom(type) ||
+               JSObject.class.isAssignableFrom(type);
     }
 
     @Override
@@ -72,6 +82,11 @@
         final GuardedInvocation inv;
         if (self instanceof JSObject) {
             inv = lookup(desc);
+        } else if (self instanceof Map || self instanceof Bindings) {
+            // guard to make sure the Map or Bindings does not turn into JSObject later!
+            final GuardedInvocation beanInv = nashornBeansLinker.getGuardedInvocation(request, linkerServices);
+            inv = new GuardedInvocation(beanInv.getInvocation(),
+                NashornGuards.combineGuards(beanInv.getGuard(), NashornGuards.getNotJSObjectGuard()));
         } else {
             throw new AssertionError(); // Should never reach here.
         }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornGuards.java	Wed Jul 05 19:42:29 2017 +0200
@@ -31,6 +31,7 @@
 import java.lang.invoke.MethodHandles;
 import java.lang.ref.WeakReference;
 import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Property;
@@ -43,6 +44,7 @@
  */
 public final class NashornGuards {
     private static final MethodHandle IS_SCRIPTOBJECT   = findOwnMH("isScriptObject", boolean.class, Object.class);
+    private static final MethodHandle IS_NOT_JSOBJECT   = findOwnMH("isNotJSObject", boolean.class, Object.class);
     private static final MethodHandle IS_SCRIPTFUNCTION = findOwnMH("isScriptFunction", boolean.class, Object.class);
     private static final MethodHandle IS_MAP            = findOwnMH("isMap", boolean.class, Object.class, PropertyMap.class);
     private static final MethodHandle SAME_OBJECT       = findOwnMH("sameObject", boolean.class, Object.class, WeakReference.class);
@@ -61,6 +63,14 @@
     }
 
     /**
+     * Get the guard that checks if an item is not a {@code JSObject}
+     * @return method handle for guard
+     */
+    public static MethodHandle getNotJSObjectGuard() {
+        return IS_NOT_JSOBJECT;
+    }
+
+    /**
      * Get the guard that checks if an item is a {@code ScriptFunction}
      * @return method handle for guard
      */
@@ -157,6 +167,11 @@
     }
 
     @SuppressWarnings("unused")
+    private static boolean isNotJSObject(final Object self) {
+        return !(self instanceof JSObject);
+    }
+
+    @SuppressWarnings("unused")
     private static boolean isScriptFunction(final Object self) {
         return self instanceof ScriptFunction;
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java	Wed Jul 05 19:42:29 2017 +0200
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
+import java.lang.reflect.Modifier;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.beans.BeansLinker;
 import jdk.internal.dynalink.beans.StaticClass;
@@ -65,10 +66,15 @@
             return null;
         }
         final Class<?> receiverClass = ((StaticClass) self).getRepresentedClass();
+
         Bootstrap.checkReflectionAccess(receiverClass, true);
         final CallSiteDescriptor desc = request.getCallSiteDescriptor();
         // We intercept "new" on StaticClass instances to provide additional capabilities
         if ("new".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) {
+            if (! Modifier.isPublic(receiverClass.getModifiers())) {
+                throw ECMAErrors.typeError("new.on.nonpublic.javatype", receiverClass.getName());
+            }
+
             // make sure new is on accessible Class
             Context.checkPackageAccess(receiverClass);
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java	Wed Jul 05 19:42:29 2017 +0200
@@ -771,7 +771,7 @@
 
         while (value < end) {
             int ovalue = value;
-            buf = Character.toLowerCase(chars[value++]);
+            buf = EncodingHelper.toLowerCase(chars[value++]);
 
             if (chars[ovalue] != buf) {
 
@@ -779,7 +779,7 @@
                 System.arraycopy(chars, sn.p, sbuf, 0, ovalue - sn.p);
                 value = ovalue;
                 while (value < end) {
-                    buf = Character.toLowerCase(chars[value++]);
+                    buf = EncodingHelper.toLowerCase(chars[value++]);
                     if (sp >= sbuf.length) {
                         char[]tmp = new char[sbuf.length << 1];
                         System.arraycopy(sbuf, 0, tmp, 0, sbuf.length);
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java	Wed Jul 05 19:42:29 2017 +0200
@@ -20,70 +20,42 @@
 package jdk.nashorn.internal.runtime.regexp.joni;
 
 import jdk.nashorn.internal.runtime.regexp.joni.ast.CClassNode;
-import jdk.nashorn.internal.runtime.regexp.joni.ast.ConsAltNode;
-import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode;
 
 final class ApplyCaseFold {
 
     // i_apply_case_fold
-    public void apply(int from, int[]to, int length, Object o) {
+    public void apply(int from, int to, Object o) {
         ApplyCaseFoldArg arg = (ApplyCaseFoldArg)o;
 
         ScanEnvironment env = arg.env;
         CClassNode cc = arg.cc;
         BitSet bs = cc.bs;
 
-        if (length == 1) {
-            boolean inCC = cc.isCodeInCC(from);
+        boolean inCC = cc.isCodeInCC(from);
 
-            if (Config.CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS) {
-                if ((inCC && !cc.isNot()) || (!inCC && cc.isNot())) {
-                    if (to[0] >= BitSet.SINGLE_BYTE_SIZE) {
-                        cc.addCodeRange(env, to[0], to[0]);
-                    } else {
-                        /* /(?i:[^A-C])/.match("a") ==> fail. */
-                        bs.set(to[0]);
-                    }
+        if (Config.CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS) {
+            if ((inCC && !cc.isNot()) || (!inCC && cc.isNot())) {
+                if (to >= BitSet.SINGLE_BYTE_SIZE) {
+                    cc.addCodeRange(env, to, to);
+                } else {
+                    /* /(?i:[^A-C])/.match("a") ==> fail. */
+                    bs.set(to);
                 }
-            } else {
-                if (inCC) {
-                    if (to[0] >= BitSet.SINGLE_BYTE_SIZE) {
-                        if (cc.isNot()) cc.clearNotFlag();
-                        cc.addCodeRange(env, to[0], to[0]);
+            }
+        } else {
+            if (inCC) {
+                if (to >= BitSet.SINGLE_BYTE_SIZE) {
+                    if (cc.isNot()) cc.clearNotFlag();
+                    cc.addCodeRange(env, to, to);
+                } else {
+                    if (cc.isNot()) {
+                        bs.clear(to);
                     } else {
-                        if (cc.isNot()) {
-                            bs.clear(to[0]);
-                        } else {
-                            bs.set(to[0]);
-                        }
+                        bs.set(to);
                     }
                 }
-            } // CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS
-
-        } else {
-            if (cc.isCodeInCC(from) && (!Config.CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS || !cc.isNot())) {
-                StringNode node = null;
-                for (int i=0; i<length; i++) {
-                    if (i == 0) {
-                        node = new StringNode();
-                        /* char-class expanded multi-char only
-                        compare with string folded at match time. */
-                        node.setAmbig();
-                    }
-                    node.catCode(to[i]);
-                }
-
-                ConsAltNode alt = ConsAltNode.newAltNode(node, null);
-
-                if (arg.tail == null) {
-                    arg.altRoot = alt;
-                } else {
-                    arg.tail.setCdr(alt);
-                }
-                arg.tail = alt;
             }
-
-        }
+        } // CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS
 
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Wed Jul 05 19:42:29 2017 +0200
@@ -58,8 +58,8 @@
         int end1 = s1 + mbLen;
 
         while (s1 < end1) {
-            char c1 = Character.toLowerCase(chars[s1++]);
-            char c2 = Character.toLowerCase(chars[s2++]);
+            char c1 = EncodingHelper.toLowerCase(chars[s1++]);
+            char c2 = EncodingHelper.toLowerCase(chars[s2++]);
 
             if (c1 != c2) {
                 return false;
@@ -367,7 +367,7 @@
     }
 
     private void opExact1IC() {
-        if (s >= range || code[ip] != Character.toLowerCase(chars[s++])) {opFail(); return;}
+        if (s >= range || code[ip] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;}
         ip++;
         sprev = sbegin; // break;
     }
@@ -380,10 +380,10 @@
             char[] bs = regex.templates[code[ip++]];
             int ps = code[ip++];
 
-            while (tlen-- > 0) if (bs[ps++] != Character.toLowerCase(chars[s++])) {opFail(); return;}
+            while (tlen-- > 0) if (bs[ps++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;}
         } else {
 
-            while (tlen-- > 0) if (code[ip++] != Character.toLowerCase(chars[s++])) {opFail(); return;}
+            while (tlen-- > 0) if (code[ip++] != EncodingHelper.toLowerCase(chars[s++])) {opFail(); return;}
         }
         sprev = s - 1;
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java	Wed Jul 05 19:42:29 2017 +0200
@@ -93,43 +93,80 @@
        return s;
     }
 
-    public static int mbcToCode(byte[] bytes, int p, int end) {
-        int code = 0;
-        for (int i = p; i < end; i++) {
-            code = (code << 8) | (bytes[i] & 0xff);
-        }
-        return code;
-    }
-
     public static int mbcodeStartPosition() {
         return 0x80;
     }
 
     public static char[] caseFoldCodesByString(int flag, char c) {
-        if (Character.isUpperCase(c)) {
-            return new char[] {Character.toLowerCase(c)};
-        } else if (Character.isLowerCase(c)) {
-            return new char[] {Character.toUpperCase(c)};
-        } else {
-            return EMPTYCHARS;
+        char[] codes = EMPTYCHARS;
+        final char upper = toUpperCase(c);
+
+        if (upper != toLowerCase(upper)) {
+            int count = 0;
+            char ch = 0;
+
+            do {
+                final char u = toUpperCase(ch);
+                if (u == upper && ch != c) {
+                    // Almost all characters will return array of length 1, very few 2 or 3, so growing by one is fine.
+                    codes = count == 0 ? new char[1] : Arrays.copyOf(codes, count + 1);
+                    codes[count++] = ch;
+                }
+            } while (ch++ < 0xffff);
         }
+        return codes;
     }
 
     public static void applyAllCaseFold(int flag, ApplyCaseFold fun, Object arg) {
-        int[] code = new int[1];
-
         for (int c = 0; c < 0xffff; c++) {
-            if (Character.getType(c) == Character.LOWERCASE_LETTER) {
+            if (Character.isLowerCase(c)) {
+                final int upper = toUpperCase(c);
 
-                int upper = code[0] = Character.toUpperCase(c);
-                fun.apply(c, code, 1, arg);
+                if (upper != c) {
+                    fun.apply(c, upper, arg);
+                }
+            }
+        }
 
-                code[0] = c;
-                fun.apply(upper, code, 1, arg);
+        // Some characters have multiple lower case variants, hence we need to do a second run
+        for (int c = 0; c < 0xffff; c++) {
+            if (Character.isLowerCase(c)) {
+                final int upper = toUpperCase(c);
+
+                if (upper != c) {
+                    fun.apply(upper, c, arg);
+                }
             }
         }
     }
 
+    public static char toLowerCase(char c) {
+        return (char)toLowerCase((int)c);
+    }
+
+    public static int toLowerCase(int c) {
+        if (c < 128) {
+            return ('A' <= c && c <= 'Z') ? (c + ('a' - 'A')) : c;
+        }
+        // Do not convert non-ASCII upper case character to ASCII lower case.
+        int lower = Character.toLowerCase(c);
+        return (lower < 128) ? c : lower;
+
+    }
+
+    public static char toUpperCase(char c) {
+        return (char)toUpperCase((int)c);
+    }
+
+    public static int toUpperCase(int c) {
+        if (c < 128) {
+            return ('a' <= c && c <= 'z') ? c + ('A' - 'a') : c;
+        }
+        // Do not convert non-ASCII lower case character to ASCII upper case.
+        int upper = Character.toUpperCase(c);
+        return (upper < 128) ? c : upper;
+    }
+
     public static int[] ctypeCodeRange(int ctype, IntHolder sbOut) {
         sbOut.value = 0x100; // use bitset for codes smaller than 256
         int[] range = null;
--- a/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java	Wed Jul 05 19:42:29 2017 +0200
@@ -168,7 +168,7 @@
                                        char[] chars, int p, int end) {
 
             while (tP < tEnd) {
-                if (t[tP++] != Character.toLowerCase(chars[p++])) return false;
+                if (t[tP++] != EncodingHelper.toLowerCase(chars[p++])) return false;
             }
             return true;
         }
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Wed Jul 05 19:42:29 2017 +0200
@@ -138,6 +138,7 @@
 type.error.method.not.constructor=Java method {0} can't be used as a constructor.
 type.error.env.not.object=$ENV must be an Object.
 type.error.unsupported.java.to.type=Unsupported Java.to target type {0}.
+type.error.new.on.nonpublic.javatype=new cannot be used with non-public java type {0}.
 
 range.error.dataview.constructor.offset=Wrong offset or length in DataView constructor
 range.error.dataview.offset=Offset is outside the bounds of the DataView
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8030202.js	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8030202: Nashorn: Multiple RegExp#ignoreCase issues
+ *
+ * @test
+ * @run
+ */
+
+print(/\u2160/i.test("\u2170"));
+print(/[\u2160]/i.test("\u2170"));
+print(/\u2170/i.test("\u2160"));
+print(/[\u2170]/i.test("\u2160"));
+
+print(/\u0130/i.test("\u0069"));
+print(/[\u0130]/i.test("\u0069"));
+print(/\u0069/i.test("\u0130"));
+print(/[\u0069]/i.test("\u0130"));
+
+print(/\u1e9e/i.test("\u00df"));
+print(/[\u1e9e]/i.test("\u00df"));
+print(/\u00df/i.test("\u1e9e"));
+print(/[\u00df]/i.test("\u1e9e"));
+
+print(/[^\u1e9e]/i.test("\u00df"));
+print(/[^\u00df]/i.test("\u1e9e"));
+
+print(/\u0345{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
+print(/\u0399{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
+print(/\u03b9{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
+print(/\u1fbe{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
+
+print(/[\u0345]{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
+print(/[\u0399]{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
+print(/[\u03b9]{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
+print(/[\u1fbe]{4}/i.test("\u0345\u0399\u03b9\u1fbe"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8030202.js.EXPECTED	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,22 @@
+true
+true
+true
+true
+false
+false
+false
+false
+false
+false
+false
+false
+true
+true
+true
+true
+true
+true
+true
+true
+true
+true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8043930.js	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8043930: TypeError when attemping to create an instance of non-public class could be better 
+ *
+ * @test
+ * @run
+ */
+
+var NonPublicClass = Java.type("jdk.nashorn.test.models.NonPublicClass");
+try {
+    var obj = new NonPublicClass();
+    fail("Expected TypeError to be thrown!");
+} catch (e) {
+    print(e);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8043930.js.EXPECTED	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,1 @@
+TypeError: new cannot be used with non-public java type jdk.nashorn.test.models.NonPublicClass.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/nosecurity/nosecurity.js	Wed Jul 05 19:42:29 2017 +0200
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * 8043443: Test framework changes to run script tests without security manager 
+ * @test
+ * @run
+ */
+
+var System = Java.type("java.lang.System");
+
+if (System.securityManager != null) {
+    fail("SecurityManager is set!");
+}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Tue May 27 16:39:05 2014 -0600
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Wed Jul 05 19:42:29 2017 +0200
@@ -29,6 +29,8 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import javax.script.Bindings;
+import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
 import javax.script.ScriptException;
@@ -276,4 +278,31 @@
             "({ toString: function() { return 'foo' } })");
         assertEquals("foo", obj.to(String.class));
     }
+
+    // @bug 8044000: Access to undefined property yields "null" instead of "undefined"
+    @Test
+    public void mapScriptObjectMirrorCallsiteTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine = m.getEngineByName("nashorn");
+        final String TEST_SCRIPT = "typeof obj.foo";
+
+        final Bindings global = engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
+        engine.eval("var obj = java.util.Collections.emptyMap()");
+        // this will drive callsite "obj.foo" of TEST_SCRIPT
+        // to use "obj instanceof Map" as it's guard
+        engine.eval(TEST_SCRIPT, global);
+        // redefine 'obj' to be a script object
+        engine.eval("obj = {}");
+
+        final Bindings newGlobal = engine.createBindings();
+        // transfer 'obj' from default global to new global
+        // new global will get a ScriptObjectMirror wrapping 'obj'
+        newGlobal.put("obj", global.get("obj"));
+
+        // Every ScriptObjectMirror is a Map! If callsite "obj.foo"
+        // does not see the new 'obj' is a ScriptObjectMirror, it'll
+        // continue to use Map's get("obj.foo") instead of ScriptObjectMirror's
+        // getMember("obj.foo") - thereby getting null instead of undefined
+        assertEquals("undefined", engine.eval(TEST_SCRIPT, newGlobal));
+    }
 }
--- a/test/Makefile	Tue May 27 16:39:05 2014 -0600
+++ b/test/Makefile	Wed Jul 05 19:42:29 2017 +0200
@@ -33,6 +33,7 @@
 # This makefile depends on the availability of sibling directories.
 LANGTOOLS_DIR=$(TOPDIR)/langtools
 JDK_DIR=$(TOPDIR)/jdk
+HOTSPOT_DIR=$(TOPDIR)/hotspot
 
 # Macro to run a test target in a subdir
 define SUBDIR_TEST # subdirectory target
@@ -62,6 +63,9 @@
 jdk_% core_%s svc_%:
 	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@)
 
+hotspot_%:
+	@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
+
 ################################################################
 
 # Phony targets (e.g. these are not filenames)